Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • lurpi/ogsPW
  • steffenbeese/ogs
  • HBShaoUFZ/ogs
  • vehling/ogs
  • kuateric/ogs
  • heinzej/ogs
  • MostafaMollaali/dynamic
  • GuanglinDu/ogs
  • katakurgyis/ogs
  • felikskiszkurno/ogs
  • aachaudhry/ogs
  • friederl/ogs
  • fparisio/ogs
  • Scinopode/ogs
  • MaxDoe/ogs
  • nagelt/ogs
  • zhangning737/ogs
  • ogs/ogs
  • bilke/ogs
  • montoyav/ogs
  • TomFischer/ogs
  • wenqing/ogs
  • renchao-lu/ogs
  • ChaofanChen/ogs
  • rinkk/ogs
  • WanlongCai/ogs
  • dominik-kern/ogs
  • Yonghui56/ogs
  • endJunction/ogs
  • VinayGK/ogs
  • AlirezaBGE/ogs
  • SebasTouristTrophyF/ogs
  • tengfeideng/ogs
  • joergbuchwald/ogs
  • KeitaYoshioka/ogs
  • hhutyou/debug-petsc-large
  • ThieJan/ogs
  • ArashPartow/ogs
  • skai95/ogs
  • yezhigangzju/ogs
  • PhilippSelzer/ogs
  • MartinBinder/ogs
  • MehranGhasabeh/ogs-mg
  • MManicaM/ogs
  • TobiasMeisel/ogs
  • norihiro-w/ogs
  • garibay-j/ogs
  • Christopher-McDermott/ogs
  • loewenzahm/ogs
  • aheinri5/ogs
  • RichardScottOZ/ogs
  • lagraviereScience/ogs
  • tcajuhi/ogs
  • jrandow/ogs
  • cbsilver/ogs
  • reza-taherdangkoo/ogs
  • joboog/ogs
  • basakz/ogs
  • ropaoleon/ogs
  • ShuangChen88/ogs
  • cguevaramorel/ogs
  • boyanmeng/ogs
  • XRuiWang/ogs
  • grubbymoon/ogs
  • yUHaOLiu-tj/ogs
  • FZill/ogs
  • michaelpitz/ogs
  • hhutyou/ogs
  • Lifan97/ogs
  • mattschy/ogs
  • Mojtaba-abdolkhani/ogs
  • kristofkessler/ogs
  • ozgurozansen/ogs
  • eike-radeisen/ogs-gitlab
  • DStafford/ogs
  • Max_Jaeschke/ogs
  • fwitte/ogs
  • LionAhrendt/ogs
  • emadnrz/ogs
  • laubry/ogs
  • HailongS/ogs
  • noorhasan/ogs
  • WenjieXuZJU/ogs
  • suresh199824/ogs
84 results
Show changes
Commits on Source (4691)
Showing
with 659 additions and 357 deletions
--- ---
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-pro-type-member-init, *explicit-conversions*, google-explicit-constructor, google-readability-braces-around-statements, modernize-loop-convert, modernize-use-default-member-init, modernize-use-emplace, modernize-use-using, readability-braces-around-statements, readability-else-after-return, readability-named-parameter, *readability-namespace-comments, *readability-inconsistent-*, readability-redundant-member-init, readability-simplify-boolean-expr, readability-string-compare' Checks: >
-*
,clang-diagnostic-*,
clang-analyzer-*,
cppcoreguidelines-pro-type-member-init,
*explicit-conversions*,
google-explicit-constructor,
google-readability-braces-around-statements,
modernize-loop-convert,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-using,
readability-braces-around-statements,
readability-else-after-return,
readability-named-parameter,
*readability-namespace-comments,
*readability-inconsistent-*,
readability-redundant-member-init,
readability-simplify-boolean-expr,
readability-string-compare
WarningsAsErrors: '' WarningsAsErrors: ""
HeaderFilterRegex: '.*' HeaderFilterRegex: ".*"
AnalyzeTemporaryDtors: false AnalyzeTemporaryDtors: false
FormatStyle: file FormatStyle: file
CheckOptions: CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines - key: google-readability-braces-around-statements.ShortStatementLines
value: '1' value: "1"
- key: hicpp-braces-around-statements.ShortStatementLines - key: hicpp-braces-around-statements.ShortStatementLines
value: '1' value: "1"
- key: readability-braces-around-statements.ShortStatementLines - key: readability-braces-around-statements.ShortStatementLines
value: '1' value: "1"
...@@ -57,28 +57,6 @@ parse: ...@@ -57,28 +57,6 @@ parse:
RUNTIME: 1 RUNTIME: 1
WRAPPER: + WRAPPER: +
meshtest:
pargs:
nargs: "*"
flags:
- NONE
spelling: MeshTest
kwargs:
EXECUTABLE: 1
PATH: 1
NAME: 1
WRAPPER: 1
RUNTIME: 1
WORKING_DIRECTORY: 1
EXECUTABLE_ARGS: +
DATA: +
DIFF_DATA:
pargs:
tags:
- cmdline
WRAPPER_ARGS: +
REQUIREMENTS: +
cpmaddpackage: cpmaddpackage:
pargs: pargs:
nargs: "*" nargs: "*"
...@@ -109,6 +87,7 @@ parse: ...@@ -109,6 +87,7 @@ parse:
HTTP_PASSWORD: 1 HTTP_PASSWORD: 1
EXCLUDE_FROM_ALL: 1 EXCLUDE_FROM_ALL: 1
OPTIONS: + OPTIONS: +
PATCH_COMMAND: +
cpmfindpackage: cpmfindpackage:
pargs: pargs:
nargs: "*" nargs: "*"
......
version: "2" version: "2"
exclude_patterns: exclude_patterns:
- "ThirdParty/"
- "Tests/" - "Tests/"
plugins: plugins:
duplication: duplication:
......
...@@ -11,3 +11,4 @@ Malcom, M.A.M.(2018).Analysis of underground excavations in argillaceous hard ...@@ -11,3 +11,4 @@ Malcom, M.A.M.(2018).Analysis of underground excavations in argillaceous hard
Stoffverhaltens von Salzgestein in Abh{\"a}ngigkeit von der Zeit und der Stoffverhaltens von Salzgestein in Abh{\"a}ngigkeit von der Zeit und der
Temperatur auf der Grundlage von Laborversuchen mit begleitenden kontinuumsmechanischen Temperatur auf der Grundlage von Laborversuchen mit begleitenden kontinuumsmechanischen
Berechnungen nach der Methode der finiten Elemente}' Berechnungen nach der Methode der finiten Elemente}'
- _Dupuit J. Mouvement de l’eau a travers le terrains permeables. C. R. Hebd. Seances Acad. Sci., 45:92–96, 1857._
[codespell] [codespell]
skip = ./.git,./Tests/Data,./ThirdParty,*.yml,*.bib,./web/content/imprint.md,./GeoLib/IO/XmlIO/OpenGeoSysSTN.xsd skip = *.bib,*.css,*.pdf,*.yaml,*.yml,*.vtu,*/.vale,./.git,./GeoLib/IO/XmlIO/OpenGeoSysSTN.xsd,./Tests/Data,./web/content/imprint.md,./web/node_modules,./web/public/imprint/index.html,./web/resources,CITATION.cff,
ignore-words-list = ket,nd,strat,theis,ba,sur ignore-words-list = ba,bu,ket,nd,pris,strat,sur,theis,ot,Jupyter,testrunner
exclude-file = .codespellexclude exclude-file = .codespellexclude
uri-ignore-words-list = *
{ {
"name": "ogs-gcc-dev", "name": "ogs-gcc-dev",
"image": "registry.opengeosys.org/ogs/ogs/vscode:latest", "image": "mcr.microsoft.com/devcontainers/cpp",
"postStartCommand": "nohup bash -c 'cd web; yarn; yarn build; hugo server &'", "mounts": [
"forwardPorts": [ "source=devcontainer-cpm-cache,target=/opt/cpm,type=volume",
1313 "source=devcontainer-ccache-cache,target=/opt/ccache,type=volume",
], "source=${localWorkspaceFolder}/../build,target=${containerWorkspaceFolder}/../build,type=bind"
"mounts": [ ],
"source=devcontainer-cpm-cache,target=/opt/cpm,type=volume", "features": {
"source=devcontainer-ccache-cache,target=/opt/ccache,type=volume", "common": {},
"source=${localWorkspaceFolder}/../build,target=${containerWorkspaceFolder}/../build,type=bind" "ghcr.io/devcontainers/features/python:1": {},
], "ghcr.io/devcontainers/features/common-utils:2": {
"customizations": { "configureZshAsDefaultShell": true
"vscode": { }
"extensions": [ }
"ms-vscode.cmake-tools",
"ms-vscode.cpptools"
]
}
},
"remoteUser": "vscode",
"features": {
"common": {}
}
} }
# .git # .git
Tests/Data Tests/Data
_out/images _out/images
ThirdParty/container-maker
...@@ -15,7 +15,7 @@ jobs: ...@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Configure CMake - name: Configure CMake
run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DOGS_BUILD_PROCESS_TH2M=OFF -DOGS_USE_PYTHON=OFF -DOGS_USE_UNITY_BUILDS=OFF -DOGS_BUILD_TESTING=OFF -DOGS_ENABLE_ELEMENT_PRISM=OFF -DOGS_ENABLE_ELEMENT_PYRAMID=OFF -DOGS_MAX_ELEMENT_DIM=2 run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DOGS_USE_UNITY_BUILDS=OFF -DOGS_BUILD_TESTING=OFF -DOGS_ENABLE_ELEMENT_PRISM=OFF -DOGS_ENABLE_ELEMENT_PYRAMID=OFF -DOGS_MAX_ELEMENT_DIM=2
# Build is not required unless generated source files are used # Build is not required unless generated source files are used
# - name: Build CMake # - name: Build CMake
......
...@@ -12,11 +12,6 @@ tags ...@@ -12,11 +12,6 @@ tags
# Visual Studio Code project files # Visual Studio Code project files
.vscode .vscode
# Conan package manager
conanbuildinfo.cmake
conaninfo.txt
CMakeLists.txt.user*
*.pyc *.pyc
.venv .venv
...@@ -26,6 +21,7 @@ Tests/Data/_out ...@@ -26,6 +21,7 @@ Tests/Data/_out
web/.netlify web/.netlify
CMakeUserPresets.json CMakeUserPresets.json
scripts/cmake/vtk-*.patch
.snakemake .snakemake
......
stages: stages:
- preparation - preparation
- build - build
- test
- check - check
- release - release
- package - package
...@@ -10,57 +11,73 @@ variables: ...@@ -10,57 +11,73 @@ variables:
BUILD_TYPE: Release BUILD_TYPE: Release
BUILD_TESTS: "true" BUILD_TESTS: "true"
BUILD_CTEST: "true" BUILD_CTEST: "true"
CTEST_INCLUDE_REGEX: "" # Regex is given via ctest -R [regex] CTEST_ARGS: "" # If not empty supply arguments to select tests
CTEST_TIMEOUT: "" # in minutes
CPU_TARGET: ivybridge # envinf1 has oldest cpu CPU_TARGET: ivybridge # envinf1 has oldest cpu
ARTIFACTS_PAGES_URL: https://$CI_PROJECT_ROOT_NAMESPACE.$CI_PAGES_DOMAIN/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts ARTIFACTS_PAGES_URL: https://$CI_PROJECT_ROOT_NAMESPACE.$CI_PAGES_DOMAIN/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts
PIPELINE_NAME: "Default pipeline name"
# by default skip performance tests, they can be enabled on isolated test machines
OGS_PERFORMANCE_TESTS_ALLOWED_TO_FAIL: true
workflow: workflow:
name: "$PIPELINE_NAME"
rules: rules:
# Disable CI for non-MR user-scoped pipelines # Disable CI for non-MR user-scoped pipelines
- if: '$CI_MERGE_REQUEST_IID == null && $CI_PROJECT_PATH != "ogs/ogs"' - if: '$CI_MERGE_REQUEST_IID == null && $CI_PROJECT_PATH != "ogs/ogs"'
when: never when: never
- if: "$CI_MERGE_REQUEST_LABELS =~ /.*(workflow::paused|ci skip).*/" - if: "$CI_MERGE_REQUEST_LABELS =~ /.*(workflow::paused|ci::skip).*/"
when: never when: never
- if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::web only.*/
variables:
PIPELINE_NAME: "web only MR pipeline: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
BUILD_TESTS: "false"
CTEST_INCLUDE_REGEX: "nb-"
- if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::linux only.*/
variables:
PIPELINE_NAME: "linux only MR pipeline: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::mac only.*/
variables:
PIPELINE_NAME: "mac only MR pipeline: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::win only.*/
variables:
PIPELINE_NAME: "win only MR pipeline: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::guix only.*/
variables:
PIPELINE_NAME: "guix only MR pipeline: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- if: $CI_MERGE_REQUEST_IID # merge requests - if: $CI_MERGE_REQUEST_IID # merge requests
variables:
PIPELINE_NAME: "MR pipeline: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- if: $CI_COMMIT_TAG # tags, ogs/ogs repo only - if: $CI_COMMIT_TAG # tags, ogs/ogs repo only
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "ogs/ogs"' # master, ogs/ogs repo only - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_PATH == "ogs/ogs"' # master, ogs/ogs repo only
- if: '$CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/ && $CI_PROJECT_PATH == "ogs/ogs"' # release branches, e.g. v6.x.x variables:
PIPELINE_NAME: "master pipeline"
include: include:
- local: "scripts/ci/extends/*.yml" - local: "scripts/ci/extends/*.yml"
- local: "/scripts/ci/jobs/meta.yml" - local: "/scripts/ci/pipelines/regular.yml"
- local: "/scripts/ci/jobs/ci_images.yml" rules:
# jobs, can be indiviually disabled for testing - if: $CI_PIPELINE_SOURCE != "schedule" && $CI_MERGE_REQUEST_LABELS !~ /.*ci::\w* only.*/
- local: "/scripts/ci/jobs/pre-commit.yml" - local: "/scripts/ci/pipelines/web.yml"
- local: "/scripts/ci/jobs/build-linux.yml" rules:
- local: "/scripts/ci/jobs/build-linux-petsc.yml" - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::web only?($|,)/
- local: "/scripts/ci/jobs/build-linux-frontend.yml" - local: "/scripts/ci/pipelines/web-fast.yml"
- local: "/scripts/ci/jobs/build-docs.yml" rules:
- local: "/scripts/ci/jobs/build-win.yml" - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::web only \(fast.*/
- local: "/scripts/ci/jobs/build-mac.yml" - local: "/scripts/ci/pipelines/scheduled.yml"
- local: "/scripts/ci/jobs/build-container.yml" rules:
- local: "/scripts/ci/jobs/jupyter.yml" - if: '$CI_PIPELINE_SOURCE == "schedule"'
- local: "/scripts/ci/jobs/code-quality.yml" - local: "/scripts/ci/pipelines/linux.yml"
- local: "/scripts/ci/jobs/code-coverage.yml" rules:
- local: "/scripts/ci/jobs/build-gui-linux.yml" - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::linux only.*/
- local: "/scripts/ci/jobs/build-gui-win.yml" - local: "/scripts/ci/pipelines/mac.yml"
- local: "/scripts/ci/jobs/build-gui-mac.yml" rules:
- local: "/scripts/ci/jobs/check-header.yml" - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::mac only.*/
- local: "/scripts/ci/jobs/clang-sanitizer.yml" - local: "/scripts/ci/pipelines/win.yml"
- local: "/scripts/ci/jobs/clang-tidy.yml" rules:
- local: "/scripts/ci/jobs/web.yml" - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::win only.*/
- local: "/scripts/ci/jobs/container.yml" - local: "/scripts/ci/pipelines/guix.yml"
- local: "/scripts/ci/jobs/release.yml" rules:
- local: "/scripts/ci/jobs/package.yml" - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::guix only.*/
- local: "/scripts/ci/jobs/trigger.yml" - local: "/scripts/ci/jobs/build-wheels.yml"
rules:
# child pipelines - if: $CI_MERGE_REQUEST_LABELS =~ /.*ci::wheels only.*/
wheels:
stage: build
needs: []
trigger:
include: /scripts/ci/jobs/build-wheels.yml
rules:
- if: $CI_COMMIT_TAG
- when: manual
allow_failure: true
^[CMake]
*.cmake @bilke
CMakeLists.txt @bilke
[Documentation] @ogs/docs-team
Documentation
web/content
[submodule "ThirdParty/container-maker"]
path = ThirdParty/container-maker
url = https://gitlab.opengeosys.org/ogs/container-maker.git
[submodule "ThirdParty/ogs6py"]
path = ThirdParty/ogs6py
url = https://github.com/joergbuchwald/ogs6py.git
...@@ -2,11 +2,14 @@ Alireza Hassanzadegan <a.hassanzadegan@gmail.com> AlirezaBGE <a.hassanzadegan@gm ...@@ -2,11 +2,14 @@ Alireza Hassanzadegan <a.hassanzadegan@gmail.com> AlirezaBGE <a.hassanzadegan@gm
Aqeel Chaudhry <Aqeel.Chaudhry@ifgt.tu-freiberg.de> aachaudhry <aqeel318@gmail.com> Aqeel Chaudhry <Aqeel.Chaudhry@ifgt.tu-freiberg.de> aachaudhry <aqeel318@gmail.com>
Carolin Helbig <carolin.helbig@ufz.de> Carolin Helbig <carolin.helbig@ufz.de>
Chaofan Chen <chaofan.chen@ufz.de> Chaofan Chen <chaofan.chen@ufz.de>
Chaofan Chen <chaofan.chen@ufz.de> <cchaofan1311@gmail.com>
Christian Silbermann <christian.silbermann@ifgt.tu-freiberg.de> cbsilver <christian.silbermann@ifgt.tu-freiberg.de> Christian Silbermann <christian.silbermann@ifgt.tu-freiberg.de> cbsilver <christian.silbermann@ifgt.tu-freiberg.de>
Christoph Lehmann <christoph.lehmann@ufz.de> <chleh@users.noreply.github.com> Christoph Lehmann <christoph.lehmann@ufz.de> <chleh@users.noreply.github.com>
Dmitri Naumov <dmitri.naumov@ufz.de> <github@naumov.de> Dmitri Naumov <dmitri-jurievic.naumov@ifgt.tu-freiberg.de> <github@naumov.de>
Dmitri Naumov <dmitri.naumov@ufz.de> Dmitrij Naumov <dmitrij@naumov.de> Dmitri Naumov <dmitri-jurievic.naumov@ifgt.tu-freiberg.de> Dmitrij Naumov <dmitrij@naumov.de>
Dmitri Naumov <dmitri.naumov@ufz.de> Dmitry Yu. Naumov <dmitri.naumov@ufz.de> Dmitri Naumov <dmitri-jurievic.naumov@ifgt.tu-freiberg.de> Dmitry Yu. Naumov <dmitri.naumov@ufz.de>
Dmitri Naumov <dmitri-jurievic.naumov@ifgt.tu-freiberg.de> <dmitri.naumov@ufz.de>
Dmitri Naumov <dmitri-jurievic.naumov@ifgt.tu-freiberg.de> <Dmitri-Jurievic.Naumov@ifgt.tu-freiberg.de>
Dominik Kern <dominik.kern1@ifgt.tu-freiberg.de> <dominik.kern.ifgt@gmail.com> Dominik Kern <dominik.kern1@ifgt.tu-freiberg.de> <dominik.kern.ifgt@gmail.com>
Eric Simo <eric.simo@bge.de> ericsimo <kuateric> Eric Simo <eric.simo@bge.de> ericsimo <kuateric>
Florian Zill <florian.zill@ufz.de> Florian Krupsack <florian.krupsack@ufz.de> Florian Zill <florian.zill@ufz.de> Florian Krupsack <florian.krupsack@ufz.de>
...@@ -27,21 +30,25 @@ Jörg Buchwald <joerg.buchwald@ufz.de> joerg <joerg@debian> ...@@ -27,21 +30,25 @@ Jörg Buchwald <joerg.buchwald@ufz.de> joerg <joerg@debian>
Jörg Buchwald <joerg.buchwald@ufz.de> joergbuchwald <44933043+joergbuchwald@users.noreply.github.com> Jörg Buchwald <joerg.buchwald@ufz.de> joergbuchwald <44933043+joergbuchwald@users.noreply.github.com>
Jörg Buchwald <joerg.buchwald@ufz.de> joergbuchwald <joerg.buchwald@ufz.de> Jörg Buchwald <joerg.buchwald@ufz.de> joergbuchwald <joerg.buchwald@ufz.de>
Karsten Rink <karsten.rink@ufz.de> Karsten Rink <karsten.rink@ufz.de>
Keita Yoshioka <keita.yoshioka@ufz.de> KeitaYoshioka <32516139+KeitaYoshioka@users.noreply.github.com> Keita Yoshioka <keita.yoshioka@ufz.de>
Keita Yoshioka <keita.yoshioka@ufz.de> <32516139+KeitaYoshioka@users.noreply.github.com>
Lars Bilke <lars.bilke@ufz.de> <bilke@users.noreply.github.com> <lars@bilke.info> Lars Bilke <lars.bilke@ufz.de> <bilke@users.noreply.github.com> <lars@bilke.info>
Lars Bilke <lars.bilke@ufz.de> Lars Bilke <lars@bilke.info> Lars Bilke <lars.bilke@ufz.de> Lars Bilke <lars@bilke.info>
Lars Bilke <lars.bilke@ufz.de> Lars Bilke <larsbilke83@googlemail.com> Lars Bilke <lars.bilke@ufz.de> Lars Bilke <larsbilke83@googlemail.com>
Marc Walther <marc.walther@ufz.de> Marc Walther <marc.walther@ufz.de>
Mostafa Mollaali <mostafa.mollaali@ufz.de> MostafaMollaali <m.molaali@gmail.com> Mostafa Mollaali <mostafa.mollaali@ufz.de> MostafaMollaali <m.molaali@gmail.com>
Myles English <mylesenglish@gmail.com> Myles English <mylesenglish@gmail.com>
Norbert Grunwald <norbert.grunwald@ufz.de> <n.g.boettcher@gmail.com> <Norbert.Grunwald@ufz.de> Norbert Grunwald <norbert.grunwald@ufz.de> <n.g.boettcher@gmail.com>
Norihiro Watanabe <norihiro.watanabe@aist.go.jp> <norihiro.w@gmail.com> <norihiro.watanabe@ufz.de> Norbert Grunwald <norbert.grunwald@ufz.de> <Norbert.Grunwald@ufz.de>
Norihiro Watanabe <norihiro.watanabe@ufz.de> <norihiro.watanabe@aist.go.jp>
Norihiro Watanabe <norihiro.watanabe@ufz.de> <norihiro.w@gmail.com>
OGS Bot[bot] <no-email> git@dev2 <lars.bilke@ufz.de> OGS Bot[bot] <no-email> git@dev2 <lars.bilke@ufz.de>
OGS Bot[bot] <no-email> GitLab Runner <ci@opengeosys.org> OGS Bot[bot] <no-email> GitLab Runner <ci@opengeosys.org>
OGS Bot[bot] <no-email> OGS Bot <larsbilke@web.de> OGS Bot[bot] <no-email> OGS Bot <larsbilke@web.de>
OGS Bot[bot] <no-email> OGS Bot <larsbilke@web.de> OGS Bot[bot] <no-email> OGS Bot <larsbilke@web.de>
OGS Bot[bot] <no-email> ogsbot <larsbilke@web.de> OGS Bot[bot] <no-email> ogsbot <larsbilke@web.de>
Renchao Lu <renchao.lu@ufz.de> <renchao.lu@gmail.com> <lur@modmon128.intranet.ufz.de> Renchao Lu <renchao.lu@ufz.de> <renchao.lu@gmail.com>
Renchao Lu <renchao.lu@ufz.de> <lur@modmon128.intranet.ufz.de>
Renchao Lu <renchao.lu@ufz.de> renchao.lu <renchao.lu@ufz.de> Renchao Lu <renchao.lu@ufz.de> renchao.lu <renchao.lu@ufz.de>
Reza Taher Dang Koo <reza.taherdangkoo@ifgt.tu-freiberg.de> rezataherdangkoo <reza.taherdangkoo@gmail.com> Reza Taher Dang Koo <reza.taherdangkoo@ifgt.tu-freiberg.de> rezataherdangkoo <reza.taherdangkoo@gmail.com>
Shuang Chen <shuang.chen@bgr.de> <gechenshuang88@gmail.com> Shuang Chen <shuang.chen@bgr.de> <gechenshuang88@gmail.com>
...@@ -49,13 +56,15 @@ Shuang Chen <shuang.chen@bgr.de> Shuang Chen <shuang.chen@ufz.de> ...@@ -49,13 +56,15 @@ Shuang Chen <shuang.chen@bgr.de> Shuang Chen <shuang.chen@ufz.de>
Tengfei Deng <Tengfei.Deng@doktorand.tu-freiberg.de> tengfeideng <54792615+tengfeideng@users.noreply.github.com> Tengfei Deng <Tengfei.Deng@doktorand.tu-freiberg.de> tengfeideng <54792615+tengfeideng@users.noreply.github.com>
Tengfei Deng <Tengfei.Deng@doktorand.tu-freiberg.de> tengfeideng <dengtengfei2016@hotmail.com> Tengfei Deng <Tengfei.Deng@doktorand.tu-freiberg.de> tengfeideng <dengtengfei2016@hotmail.com>
Thomas Fischer <thomas.fischer@ufz.de> <123_tom_dabei@web.de> <Thomas.Fischer@ufz.de> Thomas Fischer <thomas.fischer@ufz.de> <123_tom_dabei@web.de> <Thomas.Fischer@ufz.de>
Thomas Fischer <thomas.fischer@ufz.de> Tom Fischer <Thomas.Fischer@ufz.de> Thomas Fischer <thomas.fischer@ufz.de> <Thomas.Fischer@ufz.de>
Thomas Kalbacher <thomas.kalbacher@ufz.de> Thomas-TK <thomas.kalbacher@ufz.de> Thomas Kalbacher <thomas.kalbacher@ufz.de> Thomas-TK <thomas.kalbacher@ufz.de>
Thomas Nagel <thomas.nagel@ufz.de> <nagelt@tcd.ie> Thomas Nagel <thomas.nagel@ufz.de> <nagelt@tcd.ie>
Thomas Nagel <thomas.nagel@ufz.de> nagelt <thomas.nagel@ufz.de> Thomas Nagel <thomas.nagel@ufz.de> nagelt <thomas.nagel@ufz.de>
Thomas Nagel <thomas.nagel@ufz.de> tnagel <thomas.nagel@ufz.de> Thomas Nagel <thomas.nagel@ufz.de> tnagel <thomas.nagel@ufz.de>
Thomas Nagel <thomas.nagel@ufz.de> <thomas.nagel@ifgt.tu-freiberg.de>
Tianyuan Zheng <ichbinzty@gmail.com> Tianyuan Zheng <ichbinzty@gmail.com>
Tobias Meisel <tobias.meisel@ufz.de> <tobias.meisel@web.de> Tobias Meisel <tobias.meisel@ufz.de> <tobias.meisel@web.de>
Tobias Meisel <tobias.meisel@ufz.de>
Tuanny Cajuhi <Tuanny.Cajuhi@bgr.de> tcajuhi <trmcajuhi@gmail.com> Tuanny Cajuhi <Tuanny.Cajuhi@bgr.de> tcajuhi <trmcajuhi@gmail.com>
Vanessa Montoya <vanessa.montoya@ufz.de> montoyag <vanemonto@hotmail.com> Vanessa Montoya <vanessa.montoya@ufz.de> montoyag <vanemonto@hotmail.com>
Vanessa Montoya <vanessa.montoya@ufz.de> montoyav <vanessa.montoya@ufz.de> Vanessa Montoya <vanessa.montoya@ufz.de> montoyav <vanessa.montoya@ufz.de>
...@@ -78,3 +87,15 @@ Sophia Einspänner <sophia.einspaenner@student.tu-freiberg.de> Sophia Einspänne ...@@ -78,3 +87,15 @@ Sophia Einspänner <sophia.einspaenner@student.tu-freiberg.de> Sophia Einspänne
Jakob Randow <jakob.randow@web.de> jrandow <jakob.randow@htwk-leipzig.de> Jakob Randow <jakob.randow@web.de> jrandow <jakob.randow@htwk-leipzig.de>
Jakob Randow <jakob.randow@web.de> jrandow <jakob.randow@web.de> Jakob Randow <jakob.randow@web.de> jrandow <jakob.randow@web.de>
Olaf Kolditz <olaf.kolditz@ufz.de> Olaf Kolditz <olaf.kolditz@ufz.de>
Falko Vehling <falko.vehling@ufz.de>
Julian Heinze <julian.heinze@ufz.de>
Tao You <hhutyou@126.com>
Matthes Kantzenbach <m.kantzenbach@outlook.de>
Feliks K. Kiszkurno <feliks-kuba.kiszkurno@ufz.de>
Philipp Selzer <philipp.selzer@ufz.de>
Philipp Selzer <philipp.selzer@ufz.de> <Philipp.Selzer@gmx.net>
Joy Brato Shil <joybroto6@gmail.com>
Frieder Loer <frieder.loer@ufz.de>
Eike Radeisen <eike.radeisen@bgr.de>
Maximilian Dörnbrack <maximilian.doernbrack@ufz.de> <maximlian.doernbrack@ufz.de>
Kristof Kessler <kristof.kessler@bgr.de> <mail@kristofkessler.com>
\ No newline at end of file
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0 rev: v4.4.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
args: [--markdown-linebreak-ext=md, --markdown-linebreak-ext=pandoc] args: [--markdown-linebreak-ext=md, --markdown-linebreak-ext=pandoc]
exclude: "^ThirdParty/.*|^Tests/Data/.*|^web/static/images/xsd|^Documentation/.vale/.*" # Tests/Python/res/test_docu_scripts/ contain improper white spaces on
# purpose: such whitespace errors should be tested, there.
exclude: "^Tests/Data/.*|^Tests/Python/res/test_docu_scripts/|^web/static|^Documentation/.vale/.*|.*\\.patch"
- id: check-added-large-files - id: check-added-large-files
args: [--maxkb 1024] args: [--maxkb 1024]
- id: check-merge-conflict - id: check-merge-conflict
- id: check-xml - id: check-xml
exclude: '^Tests/Data/.*\.xml'
- id: check-yaml - id: check-yaml
exclude: "^scripts/ci/.*|.cmake-format.yaml" exclude: "^scripts/ci/.*|.cmake-format.yaml"
- id: check-toml - id: check-toml
...@@ -18,53 +21,89 @@ repos: ...@@ -18,53 +21,89 @@ repos:
- id: fix-byte-order-marker - id: fix-byte-order-marker
exclude: "^Documentation/.vale/.*" exclude: "^Documentation/.vale/.*"
- id: mixed-line-ending - id: mixed-line-ending
exclude: ".*\\.vtu" exclude: ".*\\.vtu|.*@@"
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.3.0 rev: 23.1.0
hooks: hooks:
- id: black - id: black
exclude: "ThirdParty|LinearMFront/generate_ref.py" exclude: "LinearMFront/generate_ref.py"
# Run black on markdown notebooks
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-black
additional_dependencies: [jupytext, black==23.1.0]
- repo: https://github.com/codespell-project/codespell - repo: https://github.com/codespell-project/codespell
rev: v2.1.0 rev: v2.2.2
hooks: hooks:
- id: codespell - id: codespell
exclude: 'ThirdParty/.*|Tests/Data/.*|.*\.ya?ml|.*\.bib|^web/content/imprint.md|^GeoLib/IO/XmlIO/OpenGeoSysSTN.xsd|^Applications/FileIO/Legacy/OGSIOVer4.cpp|^scripts/cmake/CPM.cmake|Documentation/.vale/.*' exclude: 'Tests/Data/.*|.*\.ya?ml|.*\.bib|^web/content/imprint.md|^GeoLib/IO/XmlIO/OpenGeoSysSTN.xsd|^Applications/FileIO/Legacy/OGSIOVer4.cpp|^scripts/cmake/CPM.cmake|Documentation/.vale/.*|.*\.ipynb|.*\.svg|^GeoLib/predicates.c'
- repo: https://github.com/cheshirekow/cmake-format-precommit - repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13 rev: v0.6.13
hooks: hooks:
- id: cmake-format - id: cmake-format
additional_dependencies: ["cmakelang[YAML]"] additional_dependencies: ["cmakelang[YAML]"]
args: [--config=.cmake-format.yaml] args: [--config=.cmake-format.yaml]
exclude: "scripts/cmake/jedbrown/.*|PackagingMacros.cmake|conan.cmake|CPM.cmake|FindFilesystem.cmake|ConanSetup.cmake|Tests.cmake" exclude: "CPM.cmake|FindFilesystem.cmake|FindMKL.cmake|JSONParser.cmake|Tests.cmake|FindTFEL.cmake|FindMFrontGenericInterface.cmake"
- id: cmake-lint - id: cmake-lint
additional_dependencies: ["cmakelang[YAML]"] additional_dependencies: ["cmakelang[YAML]"]
exclude: "scripts/cmake/jedbrown/.*|PackagingMacros.cmake|conan.cmake|CPM.cmake|FindFilesystem.cmake|ConanSetup.cmake|BuildExternalProject.cmake" exclude: "CPM.cmake|FindFilesystem.cmake|FindMKL.cmake|JSONParser.cmake|BuildExternalProject.cmake|FindTFEL.cmake|FindMFrontGenericInterface.cmake"
- repo: https://github.com/igorshubovych/markdownlint-cli - repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.31.1 rev: v0.42.0
hooks: hooks:
- id: markdownlint - id: markdownlint
language_version: 22.11.0
- repo: local - repo: local
hooks: hooks:
- id: git-diff-check - id: git-diff-check
name: Run git diff --check name: Run git diff --check
entry: git diff --check --cached -- ':!*.md' ':!*.pandoc' ':!*.asc' ':!*.dat' ':!*.ts' entry: git diff --check --cached -- ':!*.md' ':!*.pandoc' ':!*.asc' ':!*.dat' ':!*.ts'
language: system language: system
exclude: "ThirdParty/*|Tests/Data/*|web/static/images/xsd" exclude: "Tests/Data/.*|web/static/images/xsd"
stages: [commit, manual] stages: [pre-commit, manual]
- id: file-extensions - id: file-extensions
name: Check file extensions name: Check file extensions
entry: scripts/hooks/pre-commit-file-extensions.sh entry: scripts/hooks/pre-commit-file-extensions.sh
language: system language: system
files: '.*\.cpp' files: '.*\.cpp'
stages: [commit, manual] stages: [pre-commit, manual]
- id: git-clang-format - id: git-clang-format
name: git-clang-format name: git-clang-format
entry: bash -c 'if command -v git-clang-format &> /dev/null; then git clang-format; else exit 0; fi' entry: bash -c 'if command -v git-clang-format &> /dev/null; then git clang-format; else exit 0; fi'
language: system language: system
pass_filenames: false pass_filenames: false
files: \.(h|cpp)$ files: \.(h|cpp)$
- repo: https://github.com/errata-ai/vale
rev: v2.24.4
hooks:
- id: vale - id: vale
name: Check spelling with vale name: vale sync
entry: bash -c 'if command -v vale &> /dev/null; then vale sync; VALE_MIN_ALERT_LEVEL=error scripts/ci/helper/run-vale; else exit 0; fi'
pass_filenames: false pass_filenames: false
language: system args: [sync]
- id: vale
args: [--output=line, --minAlertLevel=error]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.9"
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--output-format=full]
# A variant of the ruff hook above that automatically applies proposed fixes.
# Runs only manually.
# Run this hook (and all other manual hooks if any) with:
# pre-commit run --hook-stage manual
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.9"
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--output-format=full, --fix, --exit-non-zero-on-fix]
stages: [manual]
# Enable on demand, run with
# pre-commit run --all-files clang-format
#
# - repo: https://github.com/pocc/pre-commit-hooks
# rev: master
# hooks:
# - id: clang-format
# args: ["-i"]
...@@ -9,7 +9,7 @@ Packages = Hugo ...@@ -9,7 +9,7 @@ Packages = Hugo
[*.md] [*.md]
BasedOnStyles = Vale, write-good, ogs BasedOnStyles = Vale, write-good, ogs
Vale.Spelling = None Vale.Spelling = None
write-good.ThereIs = suggestion write-good.ThereIs = None
write-good.Passive = None write-good.Passive = None
write-good.TooWordy = None write-good.TooWordy = None
write-good.Weasel = None write-good.Weasel = None
...@@ -21,7 +21,10 @@ TokenIgnores = \ ...@@ -21,7 +21,10 @@ TokenIgnores = \
; (\\ref\s\S+(\s"\S*")?), \ ; (\\ref\s\S+(\s"\S*")?), \
; (\\subpage\s\S*), \ ; (\\subpage\s\S*), \
; (\\copydoc\s\S*), \ ; (\\copydoc\s\S*), \
(\$+[^\n$]+\$+), \
(\$[^\n$]+\$), \ (\$[^\n$]+\$), \
(\\\S*|\{\S*\}), \ (\\\S*|\{\S*\}), \
(\w*\set\sal) (\w*\set\sal), \
({{<\s?(rel)?ref (.*)>}})
# https://regex101.com/r/QWLhgT/1 helped me generating this one:
BlockIgnores = (?s) *(\$\$.*?\$\$)
...@@ -7,11 +7,19 @@ ogs_add_library(ApplicationsLib ${LIB_SOURCES}) ...@@ -7,11 +7,19 @@ ogs_add_library(ApplicationsLib ${LIB_SOURCES})
target_link_libraries( target_link_libraries(
ApplicationsLib ApplicationsLib
PUBLIC BaseLib GeoLib NumLib PUBLIC
$<$<TARGET_EXISTS:VTK::ParallelMPI>:VTK::ParallelMPI> BaseLib
PRIVATE CMakeInfoLib MathLib MeshLib MeshGeoToolsLib GeoLib
$<$<BOOL:${OGS_USE_PYTHON}>:pybind11::pybind11> NumLib
$<$<BOOL:${OGS_USE_PETSC}>:petsc> $<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::ParallelMPI>>:VTK::ParallelMPI>
$<$<AND:$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>,$<BOOL:${OGS_BUILD_CLI}>>:ogs_embedded_python>
PRIVATE CMakeInfoLib
MathLib
MeshLib
MeshGeoToolsLib
MeshToolsLib
$<$<BOOL:${OGS_USE_PETSC}>:PkgConfig::PETSC>
pybind11::module
) )
if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING) if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING)
...@@ -19,7 +27,9 @@ if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING) ...@@ -19,7 +27,9 @@ if(OGS_BUILD_CLI OR OGS_BUILD_UTILS OR OGS_BUILD_TESTING)
ApplicationsLib PUBLIC Processes PRIVATE ParameterLib ProcessLib ApplicationsLib PUBLIC Processes PRIVATE ParameterLib ProcessLib
) )
elseif(OGS_BUILD_GUI) elseif(OGS_BUILD_GUI)
target_link_libraries(ApplicationsLib PRIVATE nlohmann_json::nlohmann_json) target_link_libraries(
ApplicationsLib PRIVATE MeshToolsLib nlohmann_json::nlohmann_json
)
endif() endif()
if(OGS_USE_LIS) if(OGS_USE_LIS)
...@@ -28,10 +38,20 @@ endif() ...@@ -28,10 +38,20 @@ endif()
target_compile_definitions( target_compile_definitions(
ApplicationsLib PUBLIC $<$<BOOL:${USE_LIS}>:USE_LIS> ApplicationsLib PUBLIC $<$<BOOL:${USE_LIS}>:USE_LIS>
$<$<BOOL:${OGS_USE_PYTHON}>:OGS_USE_PYTHON>
PRIVATE $<$<BOOL:${OGS_USE_INSITU}>:OGS_USE_INSITU> PRIVATE $<$<BOOL:${OGS_USE_INSITU}>:OGS_USE_INSITU>
) )
# ~~~
# Prevent warning:
# warning: ‘ProjectData’ declared with greater visibility than the type of its field ‘ProjectData::_py_scoped_interpreter’
# see https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
# ~~~
if(NOT OGS_BUILD_WHEEL AND OGS_BUILD_CLI)
set_target_properties(
ApplicationsLib PROPERTIES CXX_VISIBILITY_PRESET hidden
)
endif()
# Set cpp definitions if the cmake option is enabled for the given process. # Set cpp definitions if the cmake option is enabled for the given process.
foreach(process ${_enabled_processes}) foreach(process ${_enabled_processes})
string(TOUPPER "OGS_BUILD_PROCESS_${process}" EnableProcess) string(TOUPPER "OGS_BUILD_PROCESS_${process}" EnableProcess)
...@@ -41,5 +61,7 @@ foreach(process ${_enabled_processes}) ...@@ -41,5 +61,7 @@ foreach(process ${_enabled_processes})
) )
endforeach() endforeach()
target_precompile_headers(ApplicationsLib PRIVATE [["BaseLib/Error.h"]] target_precompile_headers(
[["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]]) ApplicationsLib PRIVATE [["BaseLib/Error.h"]] [["BaseLib/ConfigTree.h"]]
[["BaseLib/Logging.h"]]
)
/** /**
* \file
* \copyright * \copyright
* Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) * Copyright (c) 2012-2025, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License. * Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or * See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
/// The default implementation is empty providing polymorphic behaviour when /// The default implementation is empty providing polymorphic behaviour when
/// using this class. /// using this class.
#include "BaseLib/MPI.h"
#include "NumLib/DOF/GlobalMatrixProviders.h" #include "NumLib/DOF/GlobalMatrixProviders.h"
#if defined(USE_PETSC) #if defined(USE_PETSC)
...@@ -27,9 +29,8 @@ namespace ApplicationsLib ...@@ -27,9 +29,8 @@ namespace ApplicationsLib
{ {
struct LinearSolverLibrarySetup final struct LinearSolverLibrarySetup final
{ {
LinearSolverLibrarySetup(int argc, char* argv[]) LinearSolverLibrarySetup(int argc, char* argv[]) : mpi_setup(argc, argv)
{ {
MPI_Init(&argc, &argv);
char help[] = "ogs6 with PETSc \n"; char help[] = "ogs6 with PETSc \n";
PetscInitialize(&argc, &argv, nullptr, help); PetscInitialize(&argc, &argv, nullptr, help);
MPI_Comm_set_errhandler(PETSC_COMM_WORLD, MPI_ERRORS_RETURN); MPI_Comm_set_errhandler(PETSC_COMM_WORLD, MPI_ERRORS_RETURN);
...@@ -39,8 +40,9 @@ struct LinearSolverLibrarySetup final ...@@ -39,8 +40,9 @@ struct LinearSolverLibrarySetup final
{ {
NumLib::cleanupGlobalMatrixProviders(); NumLib::cleanupGlobalMatrixProviders();
PetscFinalize(); PetscFinalize();
MPI_Finalize();
} }
BaseLib::MPI::Setup mpi_setup;
}; };
} // ApplicationsLib } // ApplicationsLib
#elif defined(USE_LIS) #elif defined(USE_LIS)
...@@ -66,7 +68,22 @@ namespace ApplicationsLib ...@@ -66,7 +68,22 @@ namespace ApplicationsLib
{ {
struct LinearSolverLibrarySetup final struct LinearSolverLibrarySetup final
{ {
LinearSolverLibrarySetup(int /*argc*/, char* /*argv*/[]) {} LinearSolverLibrarySetup(int /*argc*/, char* /*argv*/[])
{
#ifdef _OPENMP
const char* omp_num_threads_env = std::getenv("OMP_NUM_THREADS");
if (omp_num_threads_env)
{
INFO("OMP_NUM_THREADS is set to: {:s}", omp_num_threads_env);
}
else
{
WARN("OMP_NUM_THREADS is not set, falling back to: {:d}",
omp_get_max_threads());
}
#endif
INFO("Eigen use {:d} threads", Eigen::nbThreads());
}
~LinearSolverLibrarySetup() ~LinearSolverLibrarySetup()
{ {
NumLib::cleanupGlobalMatrixProviders(); NumLib::cleanupGlobalMatrixProviders();
......
/** /**
* \file
* \author Karsten Rink * \author Karsten Rink
* \date 2010-08-25 * \date 2010-08-25
* \brief Implementation of the project data class. * \brief Implementation of the project data class.
* *
* \copyright * \copyright
* Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) * Copyright (c) 2012-2025, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License. * Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or * See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
...@@ -13,23 +14,30 @@ ...@@ -13,23 +14,30 @@
#include "ProjectData.h" #include "ProjectData.h"
#include <pybind11/eval.h>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <cctype> #include <cctype>
#include <range/v3/action/sort.hpp>
#include <range/v3/action/unique.hpp>
#include <range/v3/algorithm/contains.hpp>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/adjacent_remove_if.hpp>
#include <set> #include <set>
#ifdef OGS_USE_PYTHON
#include <pybind11/eval.h>
#endif
#include "BaseLib/Algorithm.h" #include "BaseLib/Algorithm.h"
#include "BaseLib/ConfigTree.h" #include "BaseLib/ConfigTree.h"
#include "BaseLib/FileTools.h" #include "BaseLib/FileTools.h"
#include "BaseLib/Logging.h" #include "BaseLib/Logging.h"
#include "BaseLib/StringTools.h" #include "BaseLib/StringTools.h"
#include "GeoLib/GEOObjects.h" #include "GeoLib/GEOObjects.h"
#include "GeoLib/IO/AsciiRasterInterface.h"
#include "GeoLib/IO/NetCDFRasterReader.h"
#include "GeoLib/Raster.h"
#include "InfoLib/CMakeInfo.h" #include "InfoLib/CMakeInfo.h"
#include "MaterialLib/MPL/CreateMedium.h" #include "MaterialLib/MPL/CreateMedium.h"
#include "MaterialLib/Utils/MediaCreation.h"
#include "MathLib/Curve/CreatePiecewiseLinearCurve.h" #include "MathLib/Curve/CreatePiecewiseLinearCurve.h"
#if defined(USE_LIS) #if defined(USE_LIS)
#include "MathLib/LinAlg/EigenLis/LinearSolverOptionsParser.h" #include "MathLib/LinAlg/EigenLis/LinearSolverOptionsParser.h"
...@@ -43,6 +51,7 @@ ...@@ -43,6 +51,7 @@
#include "MeshGeoToolsLib/SearchLength.h" #include "MeshGeoToolsLib/SearchLength.h"
#include "MeshLib/Mesh.h" #include "MeshLib/Mesh.h"
#include "MeshLib/Utils/SetMeshSpaceDimension.h" #include "MeshLib/Utils/SetMeshSpaceDimension.h"
#include "MeshToolsLib/ZeroMeshFieldDataByMaterialIDs.h"
#include "NumLib/ODESolver/ConvergenceCriterion.h" #include "NumLib/ODESolver/ConvergenceCriterion.h"
#include "ProcessLib/CreateJacobianAssembler.h" #include "ProcessLib/CreateJacobianAssembler.h"
#include "ProcessLib/DeactivatedSubdomain.h" #include "ProcessLib/DeactivatedSubdomain.h"
...@@ -51,10 +60,15 @@ ...@@ -51,10 +60,15 @@
#include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h" #include "GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.h"
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "ParameterLib/ConstantParameter.h" #include "ParameterLib/ConstantParameter.h"
#include "ParameterLib/CreateCoordinateSystem.h"
#include "ParameterLib/Utils.h" #include "ParameterLib/Utils.h"
#include "ProcessLib/CreateTimeLoop.h" #include "ProcessLib/CreateTimeLoop.h"
#include "ProcessLib/TimeLoop.h" #include "ProcessLib/TimeLoop.h"
#ifdef OGS_EMBED_PYTHON_INTERPRETER
#include "Applications/CLI/ogs_embedded_python.h"
#endif
#ifdef OGS_BUILD_PROCESS_COMPONENTTRANSPORT #ifdef OGS_BUILD_PROCESS_COMPONENTTRANSPORT
#include "ChemistryLib/CreateChemicalSolverInterface.h" #include "ChemistryLib/CreateChemicalSolverInterface.h"
#include "ProcessLib/ComponentTransport/CreateComponentTransportProcess.h" #include "ProcessLib/ComponentTransport/CreateComponentTransportProcess.h"
...@@ -71,13 +85,21 @@ ...@@ -71,13 +85,21 @@
#ifdef OGS_BUILD_PROCESS_HEATTRANSPORTBHE #ifdef OGS_BUILD_PROCESS_HEATTRANSPORTBHE
#include "ProcessLib/HeatTransportBHE/CreateHeatTransportBHEProcess.h" #include "ProcessLib/HeatTransportBHE/CreateHeatTransportBHEProcess.h"
#endif #endif
#ifdef OGS_BUILD_PROCESS_WELLBORESIMULATOR
#include "ProcessLib/WellboreSimulator/CreateWellboreSimulatorProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_HYDROMECHANICS #ifdef OGS_BUILD_PROCESS_HYDROMECHANICS
#include "ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.h" #include "ProcessLib/HydroMechanics/CreateHydroMechanicsProcess.h"
#endif #endif
#ifdef OGS_BUILD_PROCESS_LIE #ifdef OGS_BUILD_PROCESS_LARGEDEFORMATION
#include "ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h" #include "ProcessLib/LargeDeformation/CreateLargeDeformationProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_LIE_M
#include "ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.h" #include "ProcessLib/LIE/SmallDeformation/CreateSmallDeformationProcess.h"
#endif #endif
#ifdef OGS_BUILD_PROCESS_LIE_HM
#include "ProcessLib/LIE/HydroMechanics/CreateHydroMechanicsProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_LIQUIDFLOW #ifdef OGS_BUILD_PROCESS_LIQUIDFLOW
#include "ProcessLib/LiquidFlow/CreateLiquidFlowProcess.h" #include "ProcessLib/LiquidFlow/CreateLiquidFlowProcess.h"
#endif #endif
...@@ -92,6 +114,9 @@ ...@@ -92,6 +114,9 @@
#ifdef OGS_BUILD_PROCESS_PHASEFIELD #ifdef OGS_BUILD_PROCESS_PHASEFIELD
#include "ProcessLib/PhaseField/CreatePhaseFieldProcess.h" #include "ProcessLib/PhaseField/CreatePhaseFieldProcess.h"
#endif #endif
#ifdef OGS_BUILD_PROCESS_HMPHASEFIELD
#include "ProcessLib/HMPhaseField/CreateHMPhaseFieldProcess.h"
#endif
#ifdef OGS_BUILD_PROCESS_RICHARDSCOMPONENTTRANSPORT #ifdef OGS_BUILD_PROCESS_RICHARDSCOMPONENTTRANSPORT
#include "ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.h" #include "ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.h"
#endif #endif
...@@ -137,27 +162,52 @@ ...@@ -137,27 +162,52 @@
namespace namespace
{ {
void readGeometry(std::string const& fname, GeoLib::GEOObjects& geo_objects) void readGeometry(std::string const& fname, GeoLib::GEOObjects& geo_objects,
std::string const& dir_first, std::string const& dir_second)
{ {
DBUG("Reading geometry file '{:s}'.", fname); DBUG("Reading geometry file '{:s}'.", fname);
GeoLib::IO::BoostXmlGmlInterface gml_reader(geo_objects); GeoLib::IO::BoostXmlGmlInterface gml_reader(geo_objects);
gml_reader.readFile(fname); std::string geometry_file = BaseLib::joinPaths(dir_first, fname);
if (!BaseLib::IsFileExisting(geometry_file))
{
// Fallback to reading gml from prj-file directory
geometry_file = BaseLib::joinPaths(dir_second, fname);
WARN("File {:s} not found in {:s}! Trying reading from {:s}.", fname,
dir_first, dir_second);
if (!BaseLib::IsFileExisting(geometry_file))
{
OGS_FATAL("Could not read geometry file {:s} in {:s}.", fname,
dir_second);
}
}
gml_reader.readFile(geometry_file);
} }
std::unique_ptr<MeshLib::Mesh> readSingleMesh( std::unique_ptr<MeshLib::Mesh> readSingleMesh(
BaseLib::ConfigTree const& mesh_config_parameter, BaseLib::ConfigTree const& mesh_config_parameter,
std::string const& directory) std::string const& directory)
{ {
std::string const mesh_file = BaseLib::copyPathToFileName( std::string const mesh_file = BaseLib::joinPaths(
mesh_config_parameter.getValue<std::string>(), directory); directory, mesh_config_parameter.getValue<std::string>());
DBUG("Reading mesh file '{:s}'.", mesh_file); DBUG("Reading mesh file '{:s}'.", mesh_file);
auto mesh = std::unique_ptr<MeshLib::Mesh>( auto mesh = std::unique_ptr<MeshLib::Mesh>(MeshLib::IO::readMeshFromFile(
MeshLib::IO::readMeshFromFile(mesh_file)); mesh_file, true /* compute_element_neighbors */));
if (!mesh) if (!mesh)
{ {
std::filesystem::path abspath{mesh_file};
try
{
abspath = std::filesystem::absolute(mesh_file);
}
catch (std::filesystem::filesystem_error const& e)
{
ERR("Determining the absolute path of '{}' failed: {}", mesh_file,
e.what());
}
OGS_FATAL("Could not read mesh from '{:s}' file. No mesh added.", OGS_FATAL("Could not read mesh from '{:s}' file. No mesh added.",
mesh_file); abspath.string());
} }
#ifdef DOXYGEN_DOCU_ONLY #ifdef DOXYGEN_DOCU_ONLY
...@@ -171,16 +221,23 @@ std::unique_ptr<MeshLib::Mesh> readSingleMesh( ...@@ -171,16 +221,23 @@ std::unique_ptr<MeshLib::Mesh> readSingleMesh(
"axially_symmetric")) "axially_symmetric"))
{ {
mesh->setAxiallySymmetric(*axially_symmetric); mesh->setAxiallySymmetric(*axially_symmetric);
if (mesh->getDimension() == 3 && mesh->isAxiallySymmetric())
{
OGS_FATAL("3D mesh cannot be axially symmetric.");
}
} }
return mesh; return mesh;
} }
std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes( std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes(
BaseLib::ConfigTree const& config, std::string const& directory) BaseLib::ConfigTree const& config, std::string const& directory,
std::string const& project_directory)
{ {
std::vector<std::unique_ptr<MeshLib::Mesh>> meshes; std::vector<std::unique_ptr<MeshLib::Mesh>> meshes;
GeoLib::GEOObjects geoObjects;
//! \ogs_file_param{prj__meshes} //! \ogs_file_param{prj__meshes}
auto optional_meshes = config.getConfigSubtreeOptional("meshes"); auto optional_meshes = config.getConfigSubtreeOptional("meshes");
if (optional_meshes) if (optional_meshes)
...@@ -192,25 +249,30 @@ std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes( ...@@ -192,25 +249,30 @@ std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes(
std::back_inserter(meshes), std::back_inserter(meshes),
[&directory](auto const& mesh_config) [&directory](auto const& mesh_config)
{ return readSingleMesh(mesh_config, directory); }); { return readSingleMesh(mesh_config, directory); });
if (auto const geometry_file_name =
//! \ogs_file_param{prj__geometry}
config.getConfigParameterOptional<std::string>("geometry"))
{
readGeometry(*geometry_file_name, geoObjects, directory,
project_directory);
}
} }
else else
{ // Read single mesh with geometry. { // Read single mesh with geometry.
WARN(
"Consider switching from mesh and geometry input to multiple "
"meshes input. See "
"https://www.opengeosys.org/docs/tools/meshing-submeshes/"
"constructmeshesfromgeometry/ tool for conversion.");
meshes.push_back( meshes.push_back(
//! \ogs_file_param{prj__mesh} //! \ogs_file_param{prj__mesh}
readSingleMesh(config.getConfigParameter("mesh"), directory)); readSingleMesh(config.getConfigParameter("mesh"), directory));
std::string const geometry_file = BaseLib::copyPathToFileName( auto const geometry_file_name =
//! \ogs_file_param{prj__geometry} //! \ogs_file_param{prj__geometry}
config.getConfigParameter<std::string>("geometry"), config.getConfigParameter<std::string>("geometry");
directory); readGeometry(geometry_file_name, geoObjects, directory,
GeoLib::GEOObjects geoObjects; project_directory);
readGeometry(geometry_file, geoObjects); }
if (!geoObjects.getPoints().empty() || !geoObjects.getPolylines().empty() ||
!geoObjects.getSurfaces().empty())
{ // generate meshes from geometries
std::unique_ptr<MeshGeoToolsLib::SearchLength> search_length_algorithm = std::unique_ptr<MeshGeoToolsLib::SearchLength> search_length_algorithm =
MeshGeoToolsLib::createSearchLengthAlgorithm(config, *meshes[0]); MeshGeoToolsLib::createSearchLengthAlgorithm(config, *meshes[0]);
bool const multiple_nodes_allowed = false; bool const multiple_nodes_allowed = false;
...@@ -223,67 +285,85 @@ std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes( ...@@ -223,67 +285,85 @@ std::vector<std::unique_ptr<MeshLib::Mesh>> readMeshes(
std::back_inserter(meshes)); std::back_inserter(meshes));
} }
auto mesh_names = MeshLib::views::names | ranges::to<std::vector>() |
ranges::actions::sort;
auto const sorted_names = meshes | mesh_names;
auto const unique_names = meshes | mesh_names | ranges::actions::unique;
if (unique_names.size() < sorted_names.size())
{
WARN(
"Mesh names aren't unique. From project file read mesh names are:");
for (auto const& name : meshes | MeshLib::views::names)
{
INFO("- {}", name);
}
}
auto const zero_mesh_field_data_by_material_ids =
//! \ogs_file_param{prj__zero_mesh_field_data_by_material_ids}
config.getConfigParameterOptional<std::vector<int>>(
"zero_mesh_field_data_by_material_ids");
if (zero_mesh_field_data_by_material_ids)
{
WARN(
"Tag 'zero_mesh_field_data_by_material_ids` is experimental. Its "
"name may be changed, or it may be removed due to its "
"corresponding feature becomes a single tool. Please use it with "
"care!");
MeshToolsLib::zeroMeshFieldDataByMaterialIDs(
*meshes[0], *zero_mesh_field_data_by_material_ids);
}
MeshLib::setMeshSpaceDimension(meshes); MeshLib::setMeshSpaceDimension(meshes);
return meshes; return meshes;
} }
std::optional<ParameterLib::CoordinateSystem> parseLocalCoordinateSystem( std::vector<GeoLib::NamedRaster> readRasters(
std::optional<BaseLib::ConfigTree> const& config, BaseLib::ConfigTree const& config, std::string const& raster_directory,
std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters) GeoLib::MinMaxPoints const& min_max_points)
{ {
if (!config) INFO("readRasters ...");
{ std::vector<GeoLib::NamedRaster> named_rasters;
return {};
}
DBUG("Reading coordinate system configuration."); //! \ogs_file_param{prj__rasters}
auto optional_rasters = config.getConfigSubtreeOptional("rasters");
// if (optional_rasters)
// Fetch the first basis vector; its length defines the dimension.
//
auto const& basis_vector_0 = ParameterLib::findParameter<double>(
*config,
//! \ogs_file_param_special{prj__local_coordinate_system__basis_vector_0}
"basis_vector_0", parameters, 0 /* any dimension */);
int const dimension = basis_vector_0.getNumberOfGlobalComponents();
// check dimension
if (dimension != 2 && dimension != 3)
{ {
OGS_FATAL( //! \ogs_file_param{prj__rasters__raster}
"Basis vector parameter '{:s}' must have two or three components, " auto const configs = optional_rasters->getConfigSubtreeList("raster");
"but it has {:d}.", std::transform(
basis_vector_0.name, dimension); configs.begin(), configs.end(), std::back_inserter(named_rasters),
[&raster_directory, &min_max_points](auto const& raster_config)
{
return GeoLib::IO::readRaster(raster_config, raster_directory,
min_max_points);
});
} }
INFO("readRasters done");
return named_rasters;
}
// // for debugging raster reading implementation
// Fetch the second basis vector, which must be of the same dimension as the // void writeRasters(std::vector<GeoLib::NamedRaster> const& named_rasters,
// first one. // std::string const& output_directory)
// //{
auto const& basis_vector_1 = ParameterLib::findParameter<double>( // for (auto const& named_raster : named_rasters)
*config, // {
//! \ogs_file_param_special{prj__local_coordinate_system__basis_vector_1} // #if defined(USE_PETSC)
"basis_vector_1", parameters, dimension); // int my_mpi_rank;
// MPI_Comm_rank(MPI_COMM_WORLD, &my_mpi_rank);
// // #endif
// For two dimensions, we are done; construct coordinate system; // FileIO::AsciiRasterInterface::writeRasterAsASC(
// // named_raster.raster, output_directory + "/" +
if (dimension == 2) // named_raster.raster_name +
{ // #if defined(USE_PETSC)
return ParameterLib::CoordinateSystem{basis_vector_0, basis_vector_1}; // "_" + std::to_string(my_mpi_rank) +
} // #endif
// ".asc");
// }
//}
//
// Parse the third vector, for three dimensions.
//
auto const& basis_vector_2 = ParameterLib::findParameter<double>(
*config,
//! \ogs_file_param_special{prj__local_coordinate_system__basis_vector_2}
"basis_vector_2", parameters, dimension);
return ParameterLib::CoordinateSystem{basis_vector_0, basis_vector_1,
basis_vector_2};
}
} // namespace } // namespace
ProjectData::ProjectData() = default; ProjectData::ProjectData() = default;
...@@ -293,24 +373,30 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, ...@@ -293,24 +373,30 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
std::string const& output_directory, std::string const& output_directory,
std::string const& mesh_directory, std::string const& mesh_directory,
[[maybe_unused]] std::string const& script_directory) [[maybe_unused]] std::string const& script_directory)
: _mesh_vec(readMeshes(project_config, mesh_directory)) : _mesh_vec(readMeshes(project_config, mesh_directory, project_directory)),
_named_rasters(readRasters(project_config, project_directory,
GeoLib::AABB(_mesh_vec[0]->getNodes().begin(),
_mesh_vec[0]->getNodes().end())
.getMinMaxPoints()))
{ {
// for debugging raster reading implementation
// writeRasters(_named_rasters, output_directory);
if (auto const python_script = if (auto const python_script =
//! \ogs_file_param{prj__python_script} //! \ogs_file_param{prj__python_script}
project_config.getConfigParameterOptional<std::string>("python_script")) project_config.getConfigParameterOptional<std::string>("python_script"))
{ {
#ifdef OGS_USE_PYTHON
namespace py = pybind11; namespace py = pybind11;
#ifdef OGS_EMBED_PYTHON_INTERPRETER
_py_scoped_interpreter.emplace(ApplicationsLib::setupEmbeddedPython());
#endif
// Append to python's module search path // Append to python's module search path
auto py_path = py::module::import("sys").attr("path"); auto py_path = py::module::import("sys").attr("path");
py_path.attr("append")(script_directory); // .prj or -s directory py_path.attr("append")(script_directory); // .prj or -s directory
// virtualenv
py_path.attr("append")(
CMakeInfoLib::CMakeInfo::python_virtualenv_sitepackages);
auto const script_path = auto const script_path =
BaseLib::copyPathToFileName(*python_script, script_directory); BaseLib::joinPaths(script_directory, *python_script);
// Evaluate in scope of main module // Evaluate in scope of main module
py::object scope = py::module::import("__main__").attr("__dict__"); py::object scope = py::module::import("__main__").attr("__dict__");
...@@ -319,10 +405,15 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, ...@@ -319,10 +405,15 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
globals["ogs_prj_directory"] = project_directory; globals["ogs_prj_directory"] = project_directory;
globals["ogs_mesh_directory"] = mesh_directory; globals["ogs_mesh_directory"] = mesh_directory;
globals["ogs_script_directory"] = script_directory; globals["ogs_script_directory"] = script_directory;
py::eval_file(script_path, scope); try
#else {
OGS_FATAL("OpenGeoSys has not been built with Python support."); py::eval_file(script_path, scope);
#endif // OGS_USE_PYTHON }
catch (py::error_already_set const& e)
{
OGS_FATAL("Error evaluating python script {}: {}", script_path,
e.what());
}
} }
//! \ogs_file_param{prj__curves} //! \ogs_file_param{prj__curves}
...@@ -332,7 +423,7 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config, ...@@ -332,7 +423,7 @@ ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
//! \ogs_file_param{prj__parameters} //! \ogs_file_param{prj__parameters}
parseParameters(project_config.getConfigSubtree("parameters")); parseParameters(project_config.getConfigSubtree("parameters"));
_local_coordinate_system = parseLocalCoordinateSystem( _local_coordinate_system = ParameterLib::createCoordinateSystem(
//! \ogs_file_param{prj__local_coordinate_system} //! \ogs_file_param{prj__local_coordinate_system}
project_config.getConfigSubtreeOptional("local_coordinate_system"), project_config.getConfigSubtreeOptional("local_coordinate_system"),
_parameters); _parameters);
...@@ -402,10 +493,7 @@ void ProjectData::parseProcessVariables( ...@@ -402,10 +493,7 @@ void ProjectData::parseProcessVariables(
var_config.getConfigParameter<std::string>("mesh", var_config.getConfigParameter<std::string>("mesh",
_mesh_vec[0]->getName()); _mesh_vec[0]->getName());
auto& mesh = *BaseLib::findElementOrError( auto& mesh = MeshLib::findMeshByName(_mesh_vec, mesh_name);
begin(_mesh_vec), end(_mesh_vec),
[&mesh_name](auto const& m) { return m->getName() == mesh_name; },
"Expected to find a mesh named " + mesh_name + ".");
auto pv = ProcessLib::ProcessVariable{var_config, mesh, _mesh_vec, auto pv = ProcessLib::ProcessVariable{var_config, mesh, _mesh_vec,
_parameters, _curves}; _parameters, _curves};
...@@ -432,8 +520,8 @@ std::vector<std::string> ProjectData::parseParameters( ...@@ -432,8 +520,8 @@ std::vector<std::string> ProjectData::parseParameters(
//! \ogs_file_param{prj__parameters__parameter} //! \ogs_file_param{prj__parameters__parameter}
parameters_config.getConfigSubtreeList("parameter")) parameters_config.getConfigSubtreeList("parameter"))
{ {
auto p = auto p = ParameterLib::createParameter(parameter_config, _mesh_vec,
ParameterLib::createParameter(parameter_config, _mesh_vec, _curves); _named_rasters, _curves);
if (!names.insert(p->name).second) if (!names.insert(p->name).second)
{ {
OGS_FATAL("A parameter with name `{:s}' already exists.", p->name); OGS_FATAL("A parameter with name `{:s}' already exists.", p->name);
...@@ -481,40 +569,27 @@ void ProjectData::parseMedia( ...@@ -481,40 +569,27 @@ void ProjectData::parseMedia(
//! \ogs_file_param{prj__media__medium} //! \ogs_file_param{prj__media__medium}
media_config->getConfigSubtreeList("medium")) media_config->getConfigSubtreeList("medium"))
{ {
auto material_id_string = auto create_medium = [dim = _mesh_vec[0]->getDimension(),
&medium_config, this](int const id)
{
return MaterialPropertyLib::createMedium(
id, _mesh_vec[0]->getDimension(), medium_config, _parameters,
_local_coordinate_system ? &*_local_coordinate_system : nullptr,
_curves);
};
auto const material_id_string =
//! \ogs_file_attr{prj__media__medium__id} //! \ogs_file_attr{prj__media__medium__id}
medium_config.getConfigAttribute<std::string>("id", "0"); medium_config.getConfigAttribute<std::string>("id", "0");
auto const material_ids_of_this_medium = std::vector<int> const material_ids_of_this_medium =
splitMaterialIdString(material_id_string); MaterialLib::parseMaterialIdString(material_id_string,
materialIDs(*_mesh_vec[0]));
for (auto const& id : material_ids_of_this_medium) for (auto const& id : material_ids_of_this_medium)
{ {
if (_media.find(id) != end(_media)) MaterialLib::createMediumForId(
{ id, _media, material_ids_of_this_medium, create_medium);
OGS_FATAL(
"Multiple media were specified for the same material id "
"'{:d}'. Keep in mind, that if no material id is "
"specified, it is assumed to be 0 by default.",
id);
}
if (id == material_ids_of_this_medium[0])
{
_media[id] = MaterialPropertyLib::createMedium(
id, _mesh_vec[0]->getDimension(), medium_config,
_parameters,
_local_coordinate_system ? &*_local_coordinate_system
: nullptr,
_curves);
}
else
{
// This medium has multiple material IDs assigned and this is
// not the first material ID. Therefore we can reuse the medium
// we created before.
_media[id] = _media[material_ids_of_this_medium[0]];
}
} }
} }
...@@ -613,7 +688,7 @@ void ProjectData::parseProcesses( ...@@ -613,7 +688,7 @@ void ProjectData::parseProcesses(
//! \ogs_file_param{prj__processes__process__name} //! \ogs_file_param{prj__processes__process__name}
process_config.getConfigParameter<std::string>("name"); process_config.getConfigParameter<std::string>("name");
auto const integration_order = [[maybe_unused]] auto const integration_order =
//! \ogs_file_param{prj__processes__process__integration_order} //! \ogs_file_param{prj__processes__process__integration_order}
process_config.getConfigParameter<int>("integration_order"); process_config.getConfigParameter<int>("integration_order");
...@@ -652,6 +727,9 @@ void ProjectData::parseProcesses( ...@@ -652,6 +727,9 @@ void ProjectData::parseProcesses(
#ifdef OGS_BUILD_PROCESS_STOKESFLOW #ifdef OGS_BUILD_PROCESS_STOKESFLOW
if (type == "StokesFlow") if (type == "StokesFlow")
{ {
WARN(
"The StokesFlow process is deprecated and will be removed in "
"OGS-6.5.5.");
switch (_mesh_vec[0]->getDimension()) switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
...@@ -673,6 +751,9 @@ void ProjectData::parseProcesses( ...@@ -673,6 +751,9 @@ void ProjectData::parseProcesses(
#ifdef OGS_BUILD_PROCESS_TES #ifdef OGS_BUILD_PROCESS_TES
if (type == "TES") if (type == "TES")
{ {
WARN(
"The TES process is deprecated and will be removed in "
"OGS-6.5.5.");
process = ProcessLib::TES::createTESProcess( process = ProcessLib::TES::createTESProcess(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, integration_order, _process_variables, _parameters, integration_order,
...@@ -733,11 +814,37 @@ void ProjectData::parseProcesses( ...@@ -733,11 +814,37 @@ void ProjectData::parseProcesses(
} }
else else
#endif #endif
#ifdef OGS_BUILD_PROCESS_WELLBORESIMULATOR
if (type == "WELLBORE_SIMULATOR")
{
if (_mesh_vec[0]->getDimension() != 1)
{
OGS_FATAL(
"WELLBORE_SIMULATOR can only work with a 1-dimensional "
"mesh!");
}
process =
ProcessLib::WellboreSimulator::createWellboreSimulatorProcess(
name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, integration_order,
process_config, _media);
}
else
#endif
#ifdef OGS_BUILD_PROCESS_HYDROMECHANICS #ifdef OGS_BUILD_PROCESS_HYDROMECHANICS
if (type == "HYDRO_MECHANICS") if (type == "HYDRO_MECHANICS")
{ {
//! \ogs_file_param{prj__processes__process__HYDRO_MECHANICS__dimension} if ( //! \ogs_file_param{prj__processes__process__HYDRO_MECHANICS__dimension}
switch (process_config.getConfigParameter<int>("dimension")) process_config.getConfigParameterOptional<int>("dimension"))
{
OGS_FATAL(
"The 'dimension' tag has been removed in the merge-request "
"!4766. The dimension is now taken from the main mesh and "
"the tag must be removed. There is a python script in the "
"merge-request description for automatic conversion.");
}
switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
process = process =
...@@ -765,11 +872,51 @@ void ProjectData::parseProcesses( ...@@ -765,11 +872,51 @@ void ProjectData::parseProcesses(
} }
else else
#endif #endif
#ifdef OGS_BUILD_PROCESS_LIE #ifdef OGS_BUILD_PROCESS_LARGEDEFORMATION
if (type == "LARGE_DEFORMATION")
{
switch (_mesh_vec[0]->getDimension())
{
case 2:
process = ProcessLib::LargeDeformation::
createLargeDeformationProcess<2>(
name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters,
_local_coordinate_system, integration_order,
process_config, _media);
break;
case 3:
process = ProcessLib::LargeDeformation::
createLargeDeformationProcess<3>(
name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters,
_local_coordinate_system, integration_order,
process_config, _media);
break;
default:
OGS_FATAL(
"LARGE_DEFORMATION process does not support given "
"dimension");
}
}
else
#endif
#ifdef OGS_BUILD_PROCESS_LIE_HM
if (type == "HYDRO_MECHANICS_WITH_LIE") if (type == "HYDRO_MECHANICS_WITH_LIE")
{ {
//! \ogs_file_param{prj__processes__process__HYDRO_MECHANICS_WITH_LIE__dimension} if ( //! \ogs_file_param{prj__processes__process__HYDRO_MECHANICS_WITH_LIE__dimension}
switch (process_config.getConfigParameter<int>("dimension")) process_config.getConfigParameterOptional<int>("dimension"))
{
OGS_FATAL(
"The 'dimension' tag has been removed in the merge-request "
"!4766."
"The dimension is now taken from the main mesh and the tag "
"must be"
"removed. There is a python script in the merge-request "
"description"
"for automatic conversion.");
}
switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
process = ProcessLib::LIE::HydroMechanics:: process = ProcessLib::LIE::HydroMechanics::
...@@ -777,7 +924,7 @@ void ProjectData::parseProcesses( ...@@ -777,7 +924,7 @@ void ProjectData::parseProcesses(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, _process_variables, _parameters,
_local_coordinate_system, integration_order, _local_coordinate_system, integration_order,
process_config); process_config, _media);
break; break;
case 3: case 3:
process = ProcessLib::LIE::HydroMechanics:: process = ProcessLib::LIE::HydroMechanics::
...@@ -785,7 +932,7 @@ void ProjectData::parseProcesses( ...@@ -785,7 +932,7 @@ void ProjectData::parseProcesses(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, _process_variables, _parameters,
_local_coordinate_system, integration_order, _local_coordinate_system, integration_order,
process_config); process_config, _media);
break; break;
default: default:
OGS_FATAL( OGS_FATAL(
...@@ -842,6 +989,31 @@ void ProjectData::parseProcesses( ...@@ -842,6 +989,31 @@ void ProjectData::parseProcesses(
} }
else else
#endif #endif
#ifdef OGS_BUILD_PROCESS_HMPHASEFIELD
if (type == "HM_PHASE_FIELD")
{
switch (_mesh_vec[0]->getDimension())
{
case 2:
process =
ProcessLib::HMPhaseField::createHMPhaseFieldProcess<2>(
name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters,
_local_coordinate_system, integration_order,
process_config, _media);
break;
case 3:
process =
ProcessLib::HMPhaseField::createHMPhaseFieldProcess<3>(
name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters,
_local_coordinate_system, integration_order,
process_config, _media);
break;
}
}
else
#endif
#ifdef OGS_BUILD_PROCESS_RICHARDSCOMPONENTTRANSPORT #ifdef OGS_BUILD_PROCESS_RICHARDSCOMPONENTTRANSPORT
if (type == "RichardsComponentTransport") if (type == "RichardsComponentTransport")
{ {
...@@ -864,7 +1036,7 @@ void ProjectData::parseProcesses( ...@@ -864,7 +1036,7 @@ void ProjectData::parseProcesses(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, _process_variables, _parameters,
_local_coordinate_system, integration_order, _local_coordinate_system, integration_order,
process_config); process_config, _media);
break; break;
case 3: case 3:
process = ProcessLib::SmallDeformation:: process = ProcessLib::SmallDeformation::
...@@ -872,7 +1044,7 @@ void ProjectData::parseProcesses( ...@@ -872,7 +1044,7 @@ void ProjectData::parseProcesses(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, _process_variables, _parameters,
_local_coordinate_system, integration_order, _local_coordinate_system, integration_order,
process_config); process_config, _media);
break; break;
default: default:
OGS_FATAL( OGS_FATAL(
...@@ -885,6 +1057,9 @@ void ProjectData::parseProcesses( ...@@ -885,6 +1057,9 @@ void ProjectData::parseProcesses(
#ifdef OGS_BUILD_PROCESS_SMALLDEFORMATIONNONLOCAL #ifdef OGS_BUILD_PROCESS_SMALLDEFORMATIONNONLOCAL
if (type == "SMALL_DEFORMATION_NONLOCAL") if (type == "SMALL_DEFORMATION_NONLOCAL")
{ {
WARN(
"The SMALL_DEFORMATION_NONLOCAL process is deprecated and will "
"be removed in OGS-6.5.5.");
switch (_mesh_vec[0]->getDimension()) switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
...@@ -912,11 +1087,22 @@ void ProjectData::parseProcesses( ...@@ -912,11 +1087,22 @@ void ProjectData::parseProcesses(
} }
else else
#endif #endif
#ifdef OGS_BUILD_PROCESS_LIE #ifdef OGS_BUILD_PROCESS_LIE_M
if (type == "SMALL_DEFORMATION_WITH_LIE") if (type == "SMALL_DEFORMATION_WITH_LIE")
{ {
//! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__dimension} if ( //! \ogs_file_param{prj__processes__process__SMALL_DEFORMATION_WITH_LIE__dimension}
switch (process_config.getConfigParameter<int>("dimension")) process_config.getConfigParameterOptional<int>("dimension"))
{
OGS_FATAL(
"The 'dimension' tag has been removed in the merge-request "
"!4766."
"The dimension is now taken from the main mesh and the tag "
"must be"
"removed. There is a python script in the merge-request "
"description"
"for automatic conversion.");
}
switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
process = ProcessLib::LIE::SmallDeformation:: process = ProcessLib::LIE::SmallDeformation::
...@@ -945,8 +1131,19 @@ void ProjectData::parseProcesses( ...@@ -945,8 +1131,19 @@ void ProjectData::parseProcesses(
#ifdef OGS_BUILD_PROCESS_THERMOHYDROMECHANICS #ifdef OGS_BUILD_PROCESS_THERMOHYDROMECHANICS
if (type == "THERMO_HYDRO_MECHANICS") if (type == "THERMO_HYDRO_MECHANICS")
{ {
//! \ogs_file_param{prj__processes__process__THERMO_HYDRO_MECHANICS__dimension} if ( //! \ogs_file_param{prj__processes__process__THERMO_HYDRO_MECHANICS__dimension}
switch (process_config.getConfigParameter<int>("dimension")) process_config.getConfigParameterOptional<int>("dimension"))
{
OGS_FATAL(
"The 'dimension' tag has been removed in the merge-request "
"!4766."
"The dimension is now taken from the main mesh and the tag "
"must be"
"removed. There is a python script in the merge-request "
"description"
"for automatic conversion.");
}
switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
process = ProcessLib::ThermoHydroMechanics:: process = ProcessLib::ThermoHydroMechanics::
...@@ -975,6 +1172,9 @@ void ProjectData::parseProcesses( ...@@ -975,6 +1172,9 @@ void ProjectData::parseProcesses(
#ifdef OGS_BUILD_PROCESS_THERMOMECHANICALPHASEFIELD #ifdef OGS_BUILD_PROCESS_THERMOMECHANICALPHASEFIELD
if (type == "THERMO_MECHANICAL_PHASE_FIELD") if (type == "THERMO_MECHANICAL_PHASE_FIELD")
{ {
WARN(
"The THERMO_MECHANICAL_PHASE_FIELD process is deprecated and "
"will be removed in OGS-6.5.5.");
switch (_mesh_vec[0]->getDimension()) switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
...@@ -1028,15 +1228,26 @@ void ProjectData::parseProcesses( ...@@ -1028,15 +1228,26 @@ void ProjectData::parseProcesses(
process = ProcessLib::RichardsFlow::createRichardsFlowProcess( process = ProcessLib::RichardsFlow::createRichardsFlowProcess(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, integration_order, _process_variables, _parameters, integration_order,
process_config, _curves, _media); process_config, _media);
} }
else else
#endif #endif
#ifdef OGS_BUILD_PROCESS_RICHARDSMECHANICS #ifdef OGS_BUILD_PROCESS_RICHARDSMECHANICS
if (type == "RICHARDS_MECHANICS") if (type == "RICHARDS_MECHANICS")
{ {
//! \ogs_file_param{prj__processes__process__RICHARDS_MECHANICS__dimension} if ( //! \ogs_file_param{prj__processes__process__RICHARDS_MECHANICS__dimension}
switch (process_config.getConfigParameter<int>("dimension")) process_config.getConfigParameterOptional<int>("dimension"))
{
OGS_FATAL(
"The 'dimension' tag has been removed in the merge-request "
"!4766."
"The dimension is now taken from the main mesh and the tag "
"must be"
"removed. There is a python script in the merge-request "
"description"
"for automatic conversion.");
}
switch (_mesh_vec[0]->getDimension())
{ {
case 2: case 2:
process = ProcessLib::RichardsMechanics:: process = ProcessLib::RichardsMechanics::
...@@ -1102,18 +1313,21 @@ void ProjectData::parseProcesses( ...@@ -1102,18 +1313,21 @@ void ProjectData::parseProcesses(
ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess( ProcessLib::TwoPhaseFlowWithPP::createTwoPhaseFlowWithPPProcess(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, integration_order, _process_variables, _parameters, integration_order,
process_config, _curves, _media); process_config, _media);
} }
else else
#endif #endif
#ifdef OGS_BUILD_PROCESS_TWOPHASEFLOWWITHPRHO #ifdef OGS_BUILD_PROCESS_TWOPHASEFLOWWITHPRHO
if (type == "TWOPHASE_FLOW_PRHO") if (type == "TWOPHASE_FLOW_PRHO")
{ {
WARN(
"The TWOPHASE_FLOW_PRHO process is deprecated and will be "
"removed in OGS-6.5.5.");
process = ProcessLib::TwoPhaseFlowWithPrho:: process = ProcessLib::TwoPhaseFlowWithPrho::
createTwoPhaseFlowWithPrhoProcess( createTwoPhaseFlowWithPrhoProcess(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, integration_order, _process_variables, _parameters, integration_order,
process_config, _curves); process_config, _media);
} }
else else
#endif #endif
...@@ -1124,7 +1338,7 @@ void ProjectData::parseProcesses( ...@@ -1124,7 +1338,7 @@ void ProjectData::parseProcesses(
createThermalTwoPhaseFlowWithPPProcess( createThermalTwoPhaseFlowWithPPProcess(
name, *_mesh_vec[0], std::move(jacobian_assembler), name, *_mesh_vec[0], std::move(jacobian_assembler),
_process_variables, _parameters, integration_order, _process_variables, _parameters, integration_order,
process_config, _curves, _media); process_config, _media);
} }
else else
#endif #endif
...@@ -1132,10 +1346,9 @@ void ProjectData::parseProcesses( ...@@ -1132,10 +1346,9 @@ void ProjectData::parseProcesses(
OGS_FATAL("Unknown process type: {:s}", type); OGS_FATAL("Unknown process type: {:s}", type);
} }
if (BaseLib::containsIf( if (ranges::contains(_processes, name,
_processes, [](std::unique_ptr<ProcessLib::Process> const& p)
[&name](std::unique_ptr<ProcessLib::Process> const& p) { return p->name; }))
{ return p->name == name; }))
{ {
OGS_FATAL("The process name '{:s}' is not unique.", name); OGS_FATAL("The process name '{:s}' is not unique.", name);
} }
...@@ -1197,7 +1410,7 @@ void ProjectData::parseNonlinearSolvers(BaseLib::ConfigTree const& config) ...@@ -1197,7 +1410,7 @@ void ProjectData::parseNonlinearSolvers(BaseLib::ConfigTree const& config)
auto const ls_name = auto const ls_name =
//! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__linear_solver} //! \ogs_file_param{prj__nonlinear_solvers__nonlinear_solver__linear_solver}
conf.getConfigParameter<std::string>("linear_solver"); conf.getConfigParameter<std::string>("linear_solver");
auto& linear_solver = BaseLib::getOrError( auto const& linear_solver = BaseLib::getOrError(
_linear_solvers, ls_name, _linear_solvers, ls_name,
"A linear solver with the given name does not exist."); "A linear solver with the given name does not exist.");
...@@ -1234,53 +1447,7 @@ void ProjectData::parseCurves(std::optional<BaseLib::ConfigTree> const& config) ...@@ -1234,53 +1447,7 @@ void ProjectData::parseCurves(std::optional<BaseLib::ConfigTree> const& config)
} }
} }
std::vector<int> splitMaterialIdString(std::string const& material_id_string) MeshLib::Mesh& ProjectData::getMesh(std::string const& mesh_name) const
{ {
auto const material_ids_strings = return MeshLib::findMeshByName(_mesh_vec, mesh_name);
BaseLib::splitString(material_id_string, ',');
std::vector<int> material_ids;
for (auto& mid_str : material_ids_strings)
{
std::size_t num_chars_processed = 0;
int material_id;
try
{
material_id = std::stoi(mid_str, &num_chars_processed);
}
catch (std::invalid_argument&)
{
OGS_FATAL(
"Could not parse material ID from '{}' to a valid "
"integer.",
mid_str);
}
catch (std::out_of_range&)
{
OGS_FATAL(
"Could not parse material ID from '{}'. The integer value "
"of the given string exceeds the permitted range.",
mid_str);
}
if (num_chars_processed != mid_str.size())
{
// Not the whole string has been parsed. Check the rest.
if (auto const it = std::find_if_not(
begin(mid_str) + num_chars_processed, end(mid_str),
[](unsigned char const c) { return std::isspace(c); });
it != end(mid_str))
{
OGS_FATAL(
"Could not parse material ID from '{}'. Please "
"separate multiple material IDs by comma only. "
"Invalid character: '{}' at position {}.",
mid_str, *it, distance(begin(mid_str), it));
}
}
material_ids.push_back(material_id);
};
return material_ids;
} }
/** /**
* \file
* \author Karsten Rink * \author Karsten Rink
* \date 2010-08-25 * \date 2010-08-25
* *
* \copyright * \copyright
* Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) * Copyright (c) 2012-2025, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License. * Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or * See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include <string> #include <string>
#include "BaseLib/ConfigTree-fwd.h" #include "BaseLib/ConfigTree-fwd.h"
#include "BaseLib/ExportSymbol.h"
#include "ChemistryLib/ChemicalSolverInterface.h" #include "ChemistryLib/ChemicalSolverInterface.h"
#include "MaterialLib/MPL/Medium.h" #include "MaterialLib/MPL/Medium.h"
#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" #include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h"
...@@ -26,6 +28,15 @@ ...@@ -26,6 +28,15 @@
#include "ProcessLib/Process.h" #include "ProcessLib/Process.h"
#include "ProcessLib/ProcessVariable.h" #include "ProcessLib/ProcessVariable.h"
#ifdef OGS_EMBED_PYTHON_INTERPRETER
#include <pybind11/embed.h>
#endif
namespace GeoLib
{
struct NamedRaster;
}
namespace MeshLib namespace MeshLib
{ {
class Mesh; class Mesh;
...@@ -83,6 +94,14 @@ public: ...@@ -83,6 +94,14 @@ public:
ProcessLib::TimeLoop& getTimeLoop() { return *_time_loop; } ProcessLib::TimeLoop& getTimeLoop() { return *_time_loop; }
MeshLib::Mesh& getMesh(std::string const& mesh_name) const;
std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const&
getMedia() const
{
return _media;
}
private: private:
/// Parses the process variables configuration and creates new variables for /// Parses the process variables configuration and creates new variables for
/// each variable entry passing the corresponding subtree to the process /// each variable entry passing the corresponding subtree to the process
...@@ -124,6 +143,7 @@ private: ...@@ -124,6 +143,7 @@ private:
const std::string& output_directory); const std::string& output_directory);
std::vector<std::unique_ptr<MeshLib::Mesh>> _mesh_vec; std::vector<std::unique_ptr<MeshLib::Mesh>> _mesh_vec;
std::vector<GeoLib::NamedRaster> _named_rasters;
std::vector<std::unique_ptr<ProcessLib::Process>> _processes; std::vector<std::unique_ptr<ProcessLib::Process>> _processes;
std::vector<ProcessLib::ProcessVariable> _process_variables; std::vector<ProcessLib::ProcessVariable> _process_variables;
...@@ -144,9 +164,8 @@ private: ...@@ -144,9 +164,8 @@ private:
std::map<std::string, std::map<std::string,
std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
_curves; _curves;
};
/// Parses a comma separated list of integers. #ifdef OGS_EMBED_PYTHON_INTERPRETER
/// Such lists occur in the medium definition in the OGS prj file. std::optional<pybind11::scoped_interpreter> _py_scoped_interpreter;
/// Error messages in this function refer to this specific purpose. #endif
std::vector<int> splitMaterialIdString(std::string const& material_id_string); };
/** /**
* \brief Implementation of class Simulation
* \file * \file
* \brief Implementation of class Simulation
* *
* \copyright * \copyright
* Copyright (c) 2012-2022, OpenGeoSys Community (http://www.opengeosys.org) * Copyright (c) 2012-2025, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License. * Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or * See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license * http://www.opengeosys.org/project/license
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "BaseLib/ConfigTreeUtil.h" #include "BaseLib/ConfigTreeUtil.h"
#include "BaseLib/FileTools.h" #include "BaseLib/FileTools.h"
#include "BaseLib/PrjProcessing.h" #include "BaseLib/PrjProcessing.h"
#include "MeshLib/Mesh.h"
#include "NumLib/NumericsConfig.h" #include "NumLib/NumericsConfig.h"
#include "ProcessLib/TimeLoop.h" #include "ProcessLib/TimeLoop.h"
...@@ -100,7 +101,7 @@ void Simulation::initializeDataStructures( ...@@ -100,7 +101,7 @@ void Simulation::initializeDataStructures(
INFO("Initialize processes."); INFO("Initialize processes.");
for (auto& p : project_data->getProcesses()) for (auto& p : project_data->getProcesses())
{ {
p->initialize(); p->initialize(project_data->getMedia());
} }
// Check intermediately that config parsing went fine. // Check intermediately that config parsing went fine.
...@@ -114,13 +115,13 @@ void Simulation::initializeDataStructures( ...@@ -114,13 +115,13 @@ void Simulation::initializeDataStructures(
double Simulation::currentTime() const double Simulation::currentTime() const
{ {
auto const& time_loop = project_data->getTimeLoop(); auto const& time_loop = project_data->getTimeLoop();
return time_loop.currentTime(); return time_loop.currentTime()();
} }
double Simulation::endTime() const double Simulation::endTime() const
{ {
auto const& time_loop = project_data->getTimeLoop(); auto const& time_loop = project_data->getTimeLoop();
return time_loop.endTime(); return time_loop.endTime()();
} }
bool Simulation::executeTimeStep() bool Simulation::executeTimeStep()
...@@ -128,11 +129,21 @@ bool Simulation::executeTimeStep() ...@@ -128,11 +129,21 @@ bool Simulation::executeTimeStep()
auto& time_loop = project_data->getTimeLoop(); auto& time_loop = project_data->getTimeLoop();
if (time_loop.currentTime() < time_loop.endTime()) if (time_loop.currentTime() < time_loop.endTime())
{ {
return time_loop.executeTimeStep(); auto const result = time_loop.executeTimeStep();
if (time_loop.calculateNextTimeStep())
{
time_loop.outputLastTimeStep();
}
return result;
} }
return false; return false;
} }
MeshLib::Mesh& Simulation::getMesh(std::string const& name)
{
return project_data->getMesh(name);
}
bool Simulation::executeSimulation() bool Simulation::executeSimulation()
{ {
INFO("Solve processes."); INFO("Solve processes.");
......