diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7729845a464..dda45adc958 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "GEOS_TPL_TAG": "256-147" + "GEOS_TPL_TAG": "263-252" } }, "runArgs": [ diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 7267acb2d1d..5a7ad497636 100755 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -4,3 +4,5 @@ git submodule init git submodule deinit integratedTests git submodule update +# Load the pretty printer for LvArray +echo "source /workspaces/GEOS/src/coreComponents/LvArray/scripts/gdb-printers-shallow.py" > ~/.gdbinit diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..7e248436149 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + # open a single pull-request for all GitHub actions updates + github-actions: + patterns: + - '*' \ No newline at end of file diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 2da2c18ea9b..b0fb147a734 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -54,6 +54,15 @@ jobs: build_test_deploy: runs-on: ${{ inputs.RUNS_ON }} steps: + - name: 'Cleanup build folder' + run: | + pwd + echo "cleaning ${GITHUB_WORKSPACE}" + ls -la ./ + rm -rf ./* ./.*|| true + echo "expecting ${GITHUB_WORKSPACE} to be empty" + ls -la ./ + - name: Checkout Repository uses: actions/checkout@v4.1.1 with: @@ -103,9 +112,9 @@ jobs: script_args+=(--data-basename ${DATA_BASENAME}) - DATA_EXCHANGE_DIR=/mnt/geos-exchange # Exchange folder outside of the container + DATA_EXCHANGE_DIR=${GITHUB_WORKSPACE}/geos-exchange # Exchange folder outside of the container if [ ! -d "${DATA_EXCHANGE_DIR}" ]; then - sudo mkdir -p ${DATA_EXCHANGE_DIR} + mkdir -p ${DATA_EXCHANGE_DIR} fi DATA_EXCHANGE_MOUNT_POINT=/tmp/exchange # Exchange folder inside of the container docker_args+=(--volume=${DATA_EXCHANGE_DIR}:${DATA_EXCHANGE_MOUNT_POINT}) @@ -119,7 +128,7 @@ jobs: script_args+=(--sccache-credentials $(basename ${GOOGLE_GHA_CREDS_PATH})) fi - if [ ${{ inputs.RUNS_ON }} == 'self-hosted' ]; then + if [ ${{ inputs.RUNS_ON }} == 'streak' ] || [ ${{ inputs.RUNS_ON }} == 'streak2' ]; then RUNNER_CERTIFICATES_DIR=/etc/pki/ca-trust/source/anchors/ mkdir -p ${GITHUB_WORKSPACE}/certificates cp ${RUNNER_CERTIFICATES_DIR}/*.crt* ${GITHUB_WORKSPACE}/certificates @@ -169,7 +178,7 @@ jobs: -h=`hostname` \ ${{ inputs.DOCKER_REPOSITORY }}:${{ inputs.DOCKER_IMAGE_TAG }} \ ${GITHUB_WORKSPACE_MOUNT_POINT}/scripts/ci_build_and_test_in_container.sh \ - ${script_args[@]} + ${script_args[@]} EXIT_STATUS=$? echo "Received exit status ${EXIT_STATUS} from the build process." set -e @@ -181,11 +190,11 @@ jobs: echo "Download the bundle at https://storage.googleapis.com/${{ inputs.GCP_BUCKET }}/${DATA_BASENAME}" fi fi - - # Remove the container and the workspace to avoid any conflict with the next run. - echo github.workspace = ${{ github.workspace }} - #rm -rf ${{ github.workspace }}/* - #docker rm -f ${CONTAINER_NAME} + + # manually remove the workspace to avoid issues with the next job when using self-hosted runners + if [ -d "${GITHUB_WORKSPACE}/integratedTests" ]; then + rm -rf ${GITHUB_WORKSPACE}/integratedTests + fi exit ${EXIT_STATUS} @@ -196,4 +205,13 @@ jobs: files: geos_coverage.info.cleaned fail_ci_if_error: true env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: 'Cleanup build folder' + run: | + pwd + echo "cleaning ${GITHUB_WORKSPACE}" + ls -la ./ + rm -rf ./* ./.*|| true + echo "expecting ${GITHUB_WORKSPACE} to be empty" + ls -la ./ diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 46b45151698..7bd8128679c 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -124,19 +124,19 @@ jobs: fail-fast : false matrix: include: - - name: Ubuntu (20.04, gcc 9.3.0, open-mpi 4.0.3) + - name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9 - - name: Ubuntu debug (20.04, gcc 10.3.0, open-mpi 4.0.3) - github codespaces + - name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces CMAKE_BUILD_TYPE: Debug DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - - name: Ubuntu (20.04, gcc 10.3.0, open-mpi 4.0.3) - github codespaces + - name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10 - - name: Ubuntu (22.04, gcc 11.2.0, open-mpi 4.1.2) + - name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11 ENABLE_HYPRE: ON @@ -149,6 +149,12 @@ jobs: ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF + - name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2) + CMAKE_BUILD_TYPE: Release + DOCKER_REPOSITORY: geosx/ubuntu22.04-clang15 + ENABLE_HYPRE: ON + ENABLE_TRILINOS: OFF + - name: Pecan CPU (centos 7.7, gcc 8.2.0, open-mpi 4.0.1, mkl 2019.5) CMAKE_BUILD_TYPE: Release DOCKER_REPOSITORY: geosx/pecan-cpu-gcc8.2.0-openmpi4.0.1-mkl2019.5 @@ -200,7 +206,8 @@ jobs: ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF GCP_BUCKET: geosx/integratedTests - RUNS_ON: ubuntu-22.04 + RUNS_ON: streak2 + DOCKER_RUN_ARGS: "--cpus=32 --memory=384g" code_coverage: needs: @@ -246,9 +253,8 @@ jobs: ENABLE_HYPRE_DEVICE: CUDA ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF - RUNS_ON: self-hosted - DOCKER_RUN_ARGS: "--cpus=8 --memory=128g --runtime=nvidia --gpus all" - + RUNS_ON: streak + DOCKER_RUN_ARGS: "--cpus=8 --memory=256g --runtime=nvidia --gpus all" - name: Centos (7.7, gcc 8.3.1, open-mpi 1.10.7, cuda 11.8.89) BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" diff --git a/host-configs/apple/macOS_Matteo.cmake b/host-configs/apple/macOS_Matteo.cmake deleted file mode 100644 index 6edb525f1aa..00000000000 --- a/host-configs/apple/macOS_Matteo.cmake +++ /dev/null @@ -1,4 +0,0 @@ -set( HOMEBREW_DIR "/Users/cusini1/local" ) -set( CONFIG_NAME "macOS_Matteo" ) - -include(${CMAKE_CURRENT_LIST_DIR}/macOS_base.cmake) diff --git a/host-configs/apple/macOS_customized.cmake b/host-configs/apple/macOS_customized.cmake new file mode 100644 index 00000000000..c1707a0b945 --- /dev/null +++ b/host-configs/apple/macOS_customized.cmake @@ -0,0 +1,7 @@ +set( HOMEBREW_DIR $ENV{HOMEBREW_DIR} ) +set( CONFIG_NAME $ENV{GEOS_CONFIG_NAME} ) + +set(Python3_ROOT_DIR $ENV{GEOS_PYTHON_DIR} CACHE PATH "") +set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/bin/python3 CACHE PATH "") + +include(${CMAKE_CURRENT_LIST_DIR}/macOS_base.cmake) diff --git a/host-configs/tpls.cmake b/host-configs/tpls.cmake index 08e605d79bf..e0a7b0f1146 100644 --- a/host-configs/tpls.cmake +++ b/host-configs/tpls.cmake @@ -3,6 +3,14 @@ # message("in tpls.cmake GEOSX_TPL_DIR=${GEOSX_TPL_DIR}") +# +# General TPL Folder verifications +# +if(NOT EXISTS ${GEOSX_TPL_DIR}) + message(WARNING "'GEOSX_TPL_DIR' does not exist.\n") +endif() + + if(EXISTS ${GEOSX_TPL_DIR}/raja) set(RAJA_DIR ${GEOSX_TPL_DIR}/raja CACHE PATH "" FORCE) endif() diff --git a/inputFiles/compositionalMultiphaseFlow/4comp_2ph_cap_1d_upwind.xml b/inputFiles/compositionalMultiphaseFlow/4comp_2ph_cap_1d_upwind.xml new file mode 100644 index 00000000000..5d043375c8f --- /dev/null +++ b/inputFiles/compositionalMultiphaseFlow/4comp_2ph_cap_1d_upwind.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_direct.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_direct.xml index 921966dad20..25668102c78 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_direct.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_direct.xml @@ -47,7 +47,7 @@ target="/Solvers/compflow"/> diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_iterative.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_iterative.xml index dea8dc17e22..a70fd719ee6 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_iterative.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_base_iterative.xml @@ -2,7 +2,7 @@ - + diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_benchmark.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_benchmark.xml index cd134e9e2f1..3edd2f02657 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_benchmark.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_benchmark.xml @@ -18,21 +18,15 @@ nx="{ 50, 1, 20, 1, 40 }" ny="{ 50, 1, 50 }" nz="{ 20, 30, 10 }" - cellBlockNames="{ aquiferBottom00, aquitard00, aquiferTop00, - aquiferBottom01, aquitard01, aquiferTop01, - aquiferBottom02, aquitard02, aquiferTop02, - aquiferBottom10, aquitard10, aquiferTop10, - aquiferBottom11, aquitard11, aquiferTop11, - aquiferBottom12, aquitard12, aquiferTop12, - aquiferBottom20, aquitard20, aquiferTop20, - aquiferBottom21, aquitard21, aquiferTop21, - aquiferBottom22, aquitard22, aquiferTop22, - aquiferBottom30, aquitard30, aquiferTop30, - aquiferBottom31, aquitard31, aquiferTop31, - aquiferBottom32, aquitard32, aquiferTop32, - aquiferBottom40, aquitard40, aquiferTop40, - aquiferBottom41, aquitard41, aquiferTop41, - aquiferBottom42, aquitard42, aquiferTop42 }"/> + cellBlockNames="{ aquiferBottom00, aquiferBottom10, aquiferBottom20, aquiferBottom30, aquiferBottom40, + aquiferBottom01, aquiferBottom11, aquiferBottom21, aquiferBottom31, aquiferBottom41, + aquiferBottom02, aquiferBottom12, aquiferBottom22, aquiferBottom32, aquiferBottom42, + aquitard00, aquitard10, aquitard20, aquitard30, aquitard40, + aquitard01, aquitard11, aquitard21, aquitard31, aquitard41, + aquitard02, aquitard12, aquitard22, aquitard32, aquitard42, + aquiferTop00, aquiferTop10, aquiferTop20, aquiferTop30, aquiferTop40, + aquiferTop01, aquiferTop11, aquiferTop21, aquiferTop31, aquiferTop41, + aquiferTop02, aquiferTop12, aquiferTop22, aquiferTop32, aquiferTop42 }"/> diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_smoke_3d.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_smoke_3d.xml index 775890d368f..69362de80c4 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_smoke_3d.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/isothermalLeakyWell/isothermalLeakyWell_smoke_3d.xml @@ -18,21 +18,15 @@ nx="{ 5, 1, 2, 1, 4 }" ny="{ 5, 1, 5 }" nz="{ 5, 30, 5 }" - cellBlockNames="{ aquiferBottom00, aquitard00, aquiferTop00, - aquiferBottom01, aquitard01, aquiferTop01, - aquiferBottom02, aquitard02, aquiferTop02, - aquiferBottom10, aquitard10, aquiferTop10, - aquiferBottom11, aquitard11, aquiferTop11, - aquiferBottom12, aquitard12, aquiferTop12, - aquiferBottom20, aquitard20, aquiferTop20, - aquiferBottom21, aquitard21, aquiferTop21, - aquiferBottom22, aquitard22, aquiferTop22, - aquiferBottom30, aquitard30, aquiferTop30, - aquiferBottom31, aquitard31, aquiferTop31, - aquiferBottom32, aquitard32, aquiferTop32, - aquiferBottom40, aquitard40, aquiferTop40, - aquiferBottom41, aquitard41, aquiferTop41, - aquiferBottom42, aquitard42, aquiferTop42 }"/> + cellBlockNames="{ aquiferBottom00, aquiferBottom10, aquiferBottom20, aquiferBottom30, aquiferBottom40, + aquiferBottom01, aquiferBottom11, aquiferBottom21, aquiferBottom31, aquiferBottom41, + aquiferBottom02, aquiferBottom12, aquiferBottom22, aquiferBottom32, aquiferBottom42, + aquitard00, aquitard10, aquitard20, aquitard30, aquitard40, + aquitard01, aquitard11, aquitard21, aquitard31, aquitard41, + aquitard02, aquitard12, aquitard22, aquitard32, aquitard42, + aquiferTop00, aquiferTop10, aquiferTop20, aquiferTop30, aquiferTop40, + aquiferTop01, aquiferTop11, aquiferTop21, aquiferTop31, aquiferTop41, + aquiferTop02, aquiferTop12, aquiferTop22, aquiferTop32, aquiferTop42 }"/> diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_direct.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_direct.xml index 9680e6ef85f..961d7c6d00d 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_direct.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_direct.xml @@ -73,19 +73,15 @@ diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_iterative.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_iterative.xml index 91ec5e502d4..985cec900ae 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_iterative.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_base_iterative.xml @@ -61,19 +61,15 @@ diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_benchmark.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_benchmark.xml index 7cd5d9467cd..45e0669af83 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_benchmark.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_benchmark.xml @@ -18,21 +18,15 @@ nx="{ 50, 1, 20, 1, 40 }" ny="{ 50, 1, 50 }" nz="{ 20, 30, 10 }" - cellBlockNames="{ aquiferBottom00, aquitard00, aquiferTop00, - aquiferBottom01, aquitard01, aquiferTop01, - aquiferBottom02, aquitard02, aquiferTop02, - aquiferBottom10, aquitard10, aquiferTop10, - aquiferBottom11, aquitard11, aquiferTop11, - aquiferBottom12, aquitard12, aquiferTop12, - aquiferBottom20, aquitard20, aquiferTop20, - aquiferBottom21, aquitard21, aquiferTop21, - aquiferBottom22, aquitard22, aquiferTop22, - aquiferBottom30, aquitard30, aquiferTop30, - aquiferBottom31, aquitard31, aquiferTop31, - aquiferBottom32, aquitard32, aquiferTop32, - aquiferBottom40, aquitard40, aquiferTop40, - aquiferBottom41, aquitard41, aquiferTop41, - aquiferBottom42, aquitard42, aquiferTop42 }"/> + cellBlockNames="{ aquiferBottom00, aquiferBottom10, aquiferBottom20, aquiferBottom30, aquiferBottom40, + aquiferBottom01, aquiferBottom11, aquiferBottom21, aquiferBottom31, aquiferBottom41, + aquiferBottom02, aquiferBottom12, aquiferBottom22, aquiferBottom32, aquiferBottom42, + aquitard00, aquitard10, aquitard20, aquitard30, aquitard40, + aquitard01, aquitard11, aquitard21, aquitard31, aquitard41, + aquitard02, aquitard12, aquitard22, aquitard32, aquitard42, + aquiferTop00, aquiferTop10, aquiferTop20, aquiferTop30, aquiferTop40, + aquiferTop01, aquiferTop11, aquiferTop21, aquiferTop31, aquiferTop41, + aquiferTop02, aquiferTop12, aquiferTop22, aquiferTop32, aquiferTop42 }"/> diff --git a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_smoke_3d.xml b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_smoke_3d.xml index ac2e8ae02d5..3aabd020d74 100644 --- a/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_smoke_3d.xml +++ b/inputFiles/compositionalMultiphaseFlow/benchmarks/thermalLeakyWell/thermalLeakyWell_smoke_3d.xml @@ -18,21 +18,15 @@ nx="{ 5, 1, 2, 1, 4 }" ny="{ 5, 1, 5 }" nz="{ 5, 30, 5 }" - cellBlockNames="{ aquiferBottom00, aquitard00, aquiferTop00, - aquiferBottom01, aquitard01, aquiferTop01, - aquiferBottom02, aquitard02, aquiferTop02, - aquiferBottom10, aquitard10, aquiferTop10, - aquiferBottom11, aquitard11, aquiferTop11, - aquiferBottom12, aquitard12, aquiferTop12, - aquiferBottom20, aquitard20, aquiferTop20, - aquiferBottom21, aquitard21, aquiferTop21, - aquiferBottom22, aquitard22, aquiferTop22, - aquiferBottom30, aquitard30, aquiferTop30, - aquiferBottom31, aquitard31, aquiferTop31, - aquiferBottom32, aquitard32, aquiferTop32, - aquiferBottom40, aquitard40, aquiferTop40, - aquiferBottom41, aquitard41, aquiferTop41, - aquiferBottom42, aquitard42, aquiferTop42 }"/> + cellBlockNames="{ aquiferBottom00, aquiferBottom10, aquiferBottom20, aquiferBottom30, aquiferBottom40, + aquiferBottom01, aquiferBottom11, aquiferBottom21, aquiferBottom31, aquiferBottom41, + aquiferBottom02, aquiferBottom12, aquiferBottom22, aquiferBottom32, aquiferBottom42, + aquitard00, aquitard10, aquitard20, aquitard30, aquitard40, + aquitard01, aquitard11, aquitard21, aquitard31, aquitard41, + aquitard02, aquitard12, aquitard22, aquitard32, aquitard42, + aquiferTop00, aquiferTop10, aquiferTop20, aquiferTop30, aquiferTop40, + aquiferTop01, aquiferTop11, aquiferTop21, aquiferTop31, aquiferTop41, + aquiferTop02, aquiferTop12, aquiferTop22, aquiferTop32, aquiferTop42 }"/> diff --git a/inputFiles/compositionalMultiphaseFlow/c1-ppu/grav_seg_c1ppu_base.xml b/inputFiles/compositionalMultiphaseFlow/c1-ppu/grav_seg_c1ppu_base.xml index d59b2b2c590..89e2c9149b6 100644 --- a/inputFiles/compositionalMultiphaseFlow/c1-ppu/grav_seg_c1ppu_base.xml +++ b/inputFiles/compositionalMultiphaseFlow/c1-ppu/grav_seg_c1ppu_base.xml @@ -64,7 +64,7 @@ name="rockPorosity" defaultReferencePorosity="0.2" referencePressure="1e7" - compressibility="1.0e-15"/> + compressibility="1.0e-10"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"/> @@ -71,12 +74,12 @@ diff --git a/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml b/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml index 2b90105cff6..fc452b3d6d1 100644 --- a/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml +++ b/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_3d.xml @@ -31,7 +31,10 @@ nx="{ 5, 5 }" ny="{ 5, 5 }" nz="{ 3, 3, 3, 3 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"/> @@ -92,12 +95,12 @@ diff --git a/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_hybrid_3d.xml b/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_hybrid_3d.xml index e4daec34867..4fe769a93b1 100644 --- a/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_hybrid_3d.xml +++ b/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_hybrid_3d.xml @@ -29,7 +29,10 @@ nx="{ 5, 5 }" ny="{ 5, 5 }" nz="{ 3, 3, 3, 3 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"/> @@ -81,12 +84,12 @@ diff --git a/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_obl_3d.xml b/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_obl_3d.xml index 2be6da038ed..f9722261b2b 100644 --- a/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_obl_3d.xml +++ b/inputFiles/compositionalMultiphaseFlow/deadoil_3ph_staircase_obl_3d.xml @@ -34,7 +34,10 @@ nx="{ 5, 5 }" ny="{ 5, 5 }" nz="{ 3, 3, 3, 3 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"/> @@ -91,12 +94,12 @@ diff --git a/inputFiles/compositionalMultiphaseFlow/pvdg_m.txt b/inputFiles/compositionalMultiphaseFlow/pvdg_m.txt new file mode 100644 index 00000000000..f2ff16c2d2f --- /dev/null +++ b/inputFiles/compositionalMultiphaseFlow/pvdg_m.txt @@ -0,0 +1,8 @@ +# Pg(Pa) Bg(m3/sm3) Visc(Pa.s) +3000000 0.04234 1 +12000000 0.00977 1 +21000000 0.005541 1 +24000000 0.004919 1 +29500000 0.004194 1 +33000000 0.00391 1 +53000000 0.003868 1 diff --git a/inputFiles/compositionalMultiphaseFlow/pvdo_m.txt b/inputFiles/compositionalMultiphaseFlow/pvdo_m.txt new file mode 100644 index 00000000000..7c073714556 --- /dev/null +++ b/inputFiles/compositionalMultiphaseFlow/pvdo_m.txt @@ -0,0 +1,8 @@ +# P[Pa] Bo[m3/sm3] Visc(Pa.s) +2000000 1.02 1 +5000000 1.03 1 +10000000 1.04 1 +20000000 1.05 1 +30000000 1.07 1 +40000000 1.08 1 +50000000.7 1.09 1 diff --git a/inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEggVTK_benchmark.xml b/inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEggVTK_benchmark.xml new file mode 100644 index 00000000000..675d20853a3 --- /dev/null +++ b/inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEggVTK_benchmark.xml @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/compositionalMultiphaseWell/co2flash.txt b/inputFiles/compositionalMultiphaseWell/co2flash.txt index 033d013cc31..767338389fb 100644 --- a/inputFiles/compositionalMultiphaseWell/co2flash.txt +++ b/inputFiles/compositionalMultiphaseWell/co2flash.txt @@ -1 +1 @@ -FlashModel CO2Solubility 1e6 7.5e7 5e4 367.15 369.15 1 0 +FlashModel CO2Solubility 1.0e5 7.5e7 1e5 285.15 395.15 5 0 diff --git a/inputFiles/compositionalMultiphaseWell/pvtgas.txt b/inputFiles/compositionalMultiphaseWell/pvtgas.txt index 785e55ef684..30688e58cec 100644 --- a/inputFiles/compositionalMultiphaseWell/pvtgas.txt +++ b/inputFiles/compositionalMultiphaseWell/pvtgas.txt @@ -1,2 +1,2 @@ -DensityFun SpanWagnerCO2Density 1e6 7.5e7 5e4 367.15 369.15 1 -ViscosityFun FenghourCO2Viscosity 1e6 7.5e7 5e4 367.15 369.15 1 +DensityFun SpanWagnerCO2Density 1.0e5 7.5e7 1e5 285.15 395.15 5 +ViscosityFun FenghourCO2Viscosity 1.0e5 7.5e7 1e5 285.15 395.15 5 diff --git a/inputFiles/compositionalMultiphaseWell/pvtliquid.txt b/inputFiles/compositionalMultiphaseWell/pvtliquid.txt index cc514a9cae2..c2811b6c310 100644 --- a/inputFiles/compositionalMultiphaseWell/pvtliquid.txt +++ b/inputFiles/compositionalMultiphaseWell/pvtliquid.txt @@ -1,2 +1,2 @@ -DensityFun PhillipsBrineDensity 1e6 7.5e7 5e4 367.15 369.15 1 0 +DensityFun PhillipsBrineDensity 1.0e5 7.5e7 1e5 285.15 395.15 5 0 ViscosityFun PhillipsBrineViscosity 0 diff --git a/inputFiles/compositionalMultiphaseWell/staircase_co2_wells_3d.xml b/inputFiles/compositionalMultiphaseWell/staircase_co2_wells_3d.xml index 2c66c759f13..93f9b1469eb 100644 --- a/inputFiles/compositionalMultiphaseWell/staircase_co2_wells_3d.xml +++ b/inputFiles/compositionalMultiphaseWell/staircase_co2_wells_3d.xml @@ -65,7 +65,10 @@ nx="{ 5, 5 }" ny="{ 5, 5 }" nz="{ 3, 3, 3, 3 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"> + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/heterogeneousInSitu_base.xml b/inputFiles/hydraulicFracturing/heterogeneousInSitu_base.xml index 10bb684463f..bbf01a6a976 100644 --- a/inputFiles/hydraulicFracturing/heterogeneousInSitu_base.xml +++ b/inputFiles/hydraulicFracturing/heterogeneousInSitu_base.xml @@ -122,7 +122,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/heterogeneousInSitu_smoke.xml b/inputFiles/hydraulicFracturing/heterogeneousInSitu_smoke.xml index e9e75837ac4..b75048cd2c2 100644 --- a/inputFiles/hydraulicFracturing/heterogeneousInSitu_smoke.xml +++ b/inputFiles/hydraulicFracturing/heterogeneousInSitu_smoke.xml @@ -132,7 +132,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> @@ -275,7 +275,7 @@ name="bulk_modulus" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions" + objectPath="ElementRegions/Domain" fieldName="rock_bulkModulus" functionName="bulk_modulus" scale="1.0"/> @@ -284,7 +284,7 @@ name="shear_modulus" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions" + objectPath="ElementRegions/Domain" fieldName="rock_shearModulus" functionName="shear_modulus" scale="1.0"/> @@ -293,7 +293,7 @@ name="sigma_xx" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions" + objectPath="ElementRegions/Domain" fieldName="rock_stress" component="0" functionName="sigma_xx" @@ -303,7 +303,7 @@ name="sigma_yy" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions" + objectPath="ElementRegions/Domain" fieldName="rock_stress" component="1" functionName="sigma_yy" @@ -313,7 +313,7 @@ name="sigma_zz" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions" + objectPath="ElementRegions/Domain" fieldName="rock_stress" component="2" functionName="sigma_zz" diff --git a/inputFiles/hydraulicFracturing/hydrofractureSinglePhase2d.xml b/inputFiles/hydraulicFracturing/hydrofractureSinglePhase2d.xml index 4b935534255..5d1e865b642 100644 --- a/inputFiles/hydraulicFracturing/hydrofractureSinglePhase2d.xml +++ b/inputFiles/hydraulicFracturing/hydrofractureSinglePhase2d.xml @@ -121,7 +121,7 @@ diff --git a/inputFiles/hydraulicFracturing/kgdBase_C3D6_base.xml b/inputFiles/hydraulicFracturing/kgdBase_C3D6_base.xml index 26147bb56f6..19f102b76c5 100644 --- a/inputFiles/hydraulicFracturing/kgdBase_C3D6_base.xml +++ b/inputFiles/hydraulicFracturing/kgdBase_C3D6_base.xml @@ -24,7 +24,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/kgdToughnessDominated_base.xml b/inputFiles/hydraulicFracturing/kgdToughnessDominated_base.xml index 686921aa1f3..83f22994aee 100644 --- a/inputFiles/hydraulicFracturing/kgdToughnessDominated_base.xml +++ b/inputFiles/hydraulicFracturing/kgdToughnessDominated_base.xml @@ -72,7 +72,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/kgdToughnessDominated_poroelastic_base.xml b/inputFiles/hydraulicFracturing/kgdToughnessDominated_poroelastic_base.xml index 54480f05dd0..e7296af5629 100644 --- a/inputFiles/hydraulicFracturing/kgdToughnessDominated_poroelastic_base.xml +++ b/inputFiles/hydraulicFracturing/kgdToughnessDominated_poroelastic_base.xml @@ -64,7 +64,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/kgdValidation_base.xml b/inputFiles/hydraulicFracturing/kgdValidation_base.xml index c25bd30e8a0..59c48a60734 100644 --- a/inputFiles/hydraulicFracturing/kgdValidation_base.xml +++ b/inputFiles/hydraulicFracturing/kgdValidation_base.xml @@ -75,7 +75,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/kgdViscosityDominated_base.xml b/inputFiles/hydraulicFracturing/kgdViscosityDominated_base.xml index 1dbc79458d5..28cb49e72b3 100644 --- a/inputFiles/hydraulicFracturing/kgdViscosityDominated_base.xml +++ b/inputFiles/hydraulicFracturing/kgdViscosityDominated_base.xml @@ -73,7 +73,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/kgdViscosityDominated_poroelastic_base.xml b/inputFiles/hydraulicFracturing/kgdViscosityDominated_poroelastic_base.xml index 76c2d059736..c8f35cb12c4 100644 --- a/inputFiles/hydraulicFracturing/kgdViscosityDominated_poroelastic_base.xml +++ b/inputFiles/hydraulicFracturing/kgdViscosityDominated_poroelastic_base.xml @@ -65,7 +65,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_base.xml b/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_base.xml index f8643427fcc..bf1560af82a 100644 --- a/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_base.xml +++ b/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_base.xml @@ -11,7 +11,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_base.xml b/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_base.xml index ae43b66eaa5..5f02af9bc0c 100644 --- a/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_base.xml +++ b/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_base.xml @@ -11,7 +11,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_smoke.xml b/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_smoke.xml index bab9396dd71..9ca8ea93a77 100644 --- a/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_smoke.xml +++ b/inputFiles/hydraulicFracturing/pennyShapedToughnessDominated_poroelastic_smoke.xml @@ -15,6 +15,7 @@ surfaceGeneratorName="SurfaceGen" logLevel="1" targetRegions="{ Domain, Fracture }" + isMatrixPoroelastic="1" contactRelationName="fractureContact" maxNumResolves="5" initialDt="0.1"> diff --git a/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_base.xml b/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_base.xml index aa760f8649f..5ab4f148e39 100644 --- a/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_base.xml +++ b/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_base.xml @@ -11,7 +11,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_base.xml b/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_base.xml index f186a7eb2fb..77b57db57fa 100644 --- a/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_base.xml +++ b/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_base.xml @@ -11,7 +11,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_smoke.xml b/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_smoke.xml index f162d0da562..793c9fcaa3b 100644 --- a/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_smoke.xml +++ b/inputFiles/hydraulicFracturing/pennyShapedViscosityDominated_poroelastic_smoke.xml @@ -15,6 +15,7 @@ surfaceGeneratorName="SurfaceGen" logLevel="1" targetRegions="{ Domain, Fracture }" + isMatrixPoroelastic="1" contactRelationName="fractureContact" maxNumResolves="1" initialDt="0.1"> diff --git a/inputFiles/hydraulicFracturing/pknViscosityDominated_base.xml b/inputFiles/hydraulicFracturing/pknViscosityDominated_base.xml index add569e9aaa..2d3507534f4 100644 --- a/inputFiles/hydraulicFracturing/pknViscosityDominated_base.xml +++ b/inputFiles/hydraulicFracturing/pknViscosityDominated_base.xml @@ -11,7 +11,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_base.xml b/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_base.xml index af885a2839e..09e0f8d129a 100644 --- a/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_base.xml +++ b/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_base.xml @@ -11,7 +11,7 @@ + materialList="{ water, fractureFilling, fractureContact }"/> diff --git a/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_smoke.xml b/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_smoke.xml index 1d2262b7a46..a1de3e56f6b 100644 --- a/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_smoke.xml +++ b/inputFiles/hydraulicFracturing/pknViscosityDominated_poroelastic_smoke.xml @@ -15,6 +15,7 @@ surfaceGeneratorName="SurfaceGen" logLevel="1" targetRegions="{ Domain, Fracture }" + isMatrixPoroelastic="1" contactRelationName="fractureContact" maxNumResolves="5" initialDt="0.1"> diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml index e68f003b6e3..524da88f684 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_base.xml @@ -9,7 +9,7 @@ origin="{0.0, 0.0, 0.0}" lengthVector="{0.0, 1.0, 0.0}" widthVector="{0.0, 0.0, 1.0}" - dimensions="{ 100, 10 }"/> + dimensions="{ 100, 200 }"/> + dimensions="{ 100, 200 }"/> + dimensions="{ 50, 200 }"/> + dimensions="{ 50, 200 }"/> diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml index a4678fac840..83e9561f2c4 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_benchmark.xml @@ -46,9 +46,9 @@ elementTypes="{ C3D8 }" xCoords="{ -1000, -100, 100, 1000 }" yCoords="{ -1000, -100, 100, 1000 }" - zCoords="{ 0, 1 }" - nx="{ 50, 200, 50 }" - ny="{ 50, 200, 50 }" + zCoords="{ 0, 2 }" + nx="{ 150, 200, 150 }" + ny="{ 150, 200, 150 }" nz="{ 2 }" cellBlockNames="{ cb1 }"/> diff --git a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml index ef470599b58..b788e0ac183 100644 --- a/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml +++ b/inputFiles/lagrangianContactMechanics/ContactMechanics_TFrac_smoke.xml @@ -46,9 +46,9 @@ elementTypes="{ C3D8 }" xCoords="{ -1000, -100, 100, 1000 }" yCoords="{ -1000, -100, 100, 1000 }" - zCoords="{ 0, 1 }" - nx="{ 5, 52, 5 }" - ny="{ 5, 52, 5 }" + zCoords="{ 0, 100 }" + nx="{ 20, 20, 20 }" + ny="{ 20, 20, 20 }" nz="{ 2 }" cellBlockNames="{ cb1 }"/> diff --git a/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_base.xml b/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_base.xml index 53ca032ac5f..14f540a6a30 100755 --- a/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_base.xml +++ b/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_base.xml @@ -12,7 +12,10 @@ nx="{ 3, 3 }" ny="{ 3, 3 }" nz="{ 2, 2, 2, 2 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"> + targetRegions="{ channel }"/> @@ -90,32 +90,11 @@ target="/Outputs/vtkOutput"/> - - + target="/Tasks/multiphasePoroelasticityEquilibrationStep"/> - - - - - + + - - + name="multiphasePoroelasticityEquilibrationStep" + poromechanicsSolverName="multiphasePoroelasticity" + solidMechanicsStatisticsName="linearElasticityStatistics"/> diff --git a/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_sequential.xml b/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_sequential.xml index 2775e1326bf..e0f04762409 100755 --- a/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_sequential.xml +++ b/inputFiles/poromechanics/PoroElastic_staircase_co2_3d_sequential.xml @@ -13,7 +13,7 @@ solidSolverName="linearElasticity" reservoirAndWellsSolverName="reservoirAndWells" logLevel="1" - targetRegions="{ channel, barrier }"> + targetRegions="{ channel }"> + targetRegions="{ channel, wellRegion1, wellRegion2 }"> @@ -97,32 +97,11 @@ target="/Outputs/vtkOutput_seq"/> - - + target="/Tasks/multiphasePoroelasticityEquilibrationStep"/> - - - - - + + - - + name="multiphasePoroelasticityEquilibrationStep" + poromechanicsSolverName="reservoirSystem" + solidMechanicsStatisticsName="linearElasticityStatistics"/> diff --git a/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_base.xml b/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_base.xml index 5a69dfa2842..bea4a79c816 100755 --- a/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_base.xml +++ b/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_base.xml @@ -12,7 +12,10 @@ nx="{ 3, 3 }" ny="{ 3, 3 }" nz="{ 2, 2, 2, 2 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"> + target="/Tasks/singlePhasePoroelasticityEquilibrationStep"/> - - - - - - + name="singlePhasePoroelasticityEquilibrationStep" + poromechanicsSolverName="singlePhasePoroelasticity" + solidMechanicsStatisticsName="linearElasticityStatistics"/> diff --git a/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_sequential.xml b/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_sequential.xml index a95a1d1d185..58e14123fef 100755 --- a/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_sequential.xml +++ b/inputFiles/poromechanics/PoroElastic_staircase_singlephase_3d_sequential.xml @@ -86,23 +86,18 @@ name="outputs" timeFrequency="1e6" target="/Outputs/vtkOutput_seq"/> + + target="/Tasks/singlePhasePoroelasticityEquilibrationStep"/> - - - - - - + name="singlePhasePoroelasticityEquilibrationStep" + poromechanicsSolverName="reservoirPoromechanics" + solidMechanicsStatisticsName="linearElasticityStatistics"/> diff --git a/inputFiles/poromechanics/nonlinearAcceleration/validationCase/poroelasticCoupling_validation.ats b/inputFiles/poromechanics/nonlinearAcceleration/validationCase/poroelasticCoupling_validation.ats index ae39bd6c1d7..1ffd4767566 100644 --- a/inputFiles/poromechanics/nonlinearAcceleration/validationCase/poroelasticCoupling_validation.ats +++ b/inputFiles/poromechanics/nonlinearAcceleration/validationCase/poroelasticCoupling_validation.ats @@ -77,7 +77,7 @@ def _build_NonlinearAccelerationValidation_cases(): description = Description("Nonlinear acceleration validation problem ", "auto", "Sohail Waziri", True) restartcheck_params = {"atol": 1.0e-4, "rtol": 2.0e-6} - return _build_poro_elastic_coupling_case("validationCase.xml", (3, 6), + return _build_poro_elastic_coupling_case("validationCase.xml", (1, 2), ((1, 1, 1), ), description, restartcheck_params) diff --git a/inputFiles/poromechanics/nonlinearAcceleration/validationCase/validationCase.xml b/inputFiles/poromechanics/nonlinearAcceleration/validationCase/validationCase.xml index af9a6c20b5c..e307a69edcf 100755 --- a/inputFiles/poromechanics/nonlinearAcceleration/validationCase/validationCase.xml +++ b/inputFiles/poromechanics/nonlinearAcceleration/validationCase/validationCase.xml @@ -16,12 +16,6 @@ lineSearchAction="None" subcycling="1" nonlinearAccelerationType="Aitken"/> - @@ -36,10 +30,8 @@ newtonTol="1.0e-7" newtonMaxIter="40"/> + solverType="direct" + directParallel="0"/> @@ -54,10 +46,8 @@ newtonTol="1.0e-7" newtonMaxIter="40"/> + solverType="direct" + directParallel="0"/> @@ -89,15 +79,13 @@ nx="{ 5, 11, 5 }" ny="{ 5, 11, 5 }" nz="{ 2, 5, 1, 1, 1, 1, 1 }" - cellBlockNames="{ b00,b01,b02,b03,b04,b05,b06, - b07,b08,b09,b10,b11,b12,b13, - b14,b15,b16,b17,b18,b19,b20, - b21,b22,b23,b24,b25,b26,b27, - b28,b29,b30,b31,b32,b33,b34, - b35,b36,b37,b38,b39,b40,b41, - b42,b43,b44,b45,b46,b47,b48, - b49,b50,b51,b52,b53,b54,b55, - b56,b57,b58,b59,b60,b61,b62 }"> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-2_0_0, cb-0_1_0, cb-1_1_0, cb-2_1_0, cb-0_2_0, cb-1_2_0, cb-2_2_0, + cb-0_0_1, cb-1_0_1, cb-2_0_1, cb-0_1_1, cb-1_1_1, cb-2_1_1, cb-0_2_1, cb-1_2_1, cb-2_2_1, + cb-0_0_2, cb-1_0_2, cb-2_0_2, cb-0_1_2, cb-1_1_2, cb-2_1_2, cb-0_2_2, cb-1_2_2, cb-2_2_2, + cb-0_0_3, cb-1_0_3, cb-2_0_3, cb-0_1_3, cb-1_1_3, cb-2_1_3, cb-0_2_3, cb-1_2_3, cb-2_2_3, + cb-0_0_4, cb-1_0_4, cb-2_0_4, cb-0_1_4, cb-1_1_4, cb-2_1_4, cb-0_2_4, cb-1_2_4, cb-2_2_4, + cb-0_0_5, cb-1_0_5, cb-2_0_5, cb-0_1_5, cb-1_1_5, cb-2_1_5, cb-0_2_5, cb-1_2_5, cb-2_2_5, + cb-0_0_6, cb-1_0_6, cb-2_0_6, cb-0_1_6, cb-1_1_6, cb-2_1_6, cb-0_2_6, cb-1_2_6, cb-2_2_6 }"> @@ -167,18 +155,16 @@ @@ -195,7 +181,7 @@ + maxTime="3456000"> @@ -391,7 +377,7 @@ name="sigma_xx_Res" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions/reservoir/b29" + objectPath="ElementRegions/reservoir/cb-1_1_1" fieldName="skeletonRes_stress" component="0" scale="0.0"/> @@ -407,7 +393,7 @@ name="sigma_yy_Res" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions/reservoir/b29" + objectPath="ElementRegions/reservoir/cb-1_1_1" fieldName="skeletonRes_stress" component="1" scale="0.0"/> @@ -423,7 +409,7 @@ name="sigma_zz_Res" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions/reservoir/b29" + objectPath="ElementRegions/reservoir/cb-1_1_1" fieldName="skeletonRes_stress" component="2" scale="0.0"/> @@ -463,7 +449,7 @@ @@ -481,7 +467,7 @@ diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_base.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_base.xml index a1f1bfdf98a..b811af3ef4a 100644 --- a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_base.xml +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_base.xml @@ -1,54 +1,6 @@ - - - - - - - - - - - - - - - - + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_benchmark.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_benchmark.xml new file mode 100755 index 00000000000..d9312aade45 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_benchmark.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_smoke.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_smoke.xml new file mode 100755 index 00000000000..99098cfeb82 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_smoke.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_solvers.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_solvers.xml new file mode 100755 index 00000000000..845f3151232 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_sequential_solvers.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_smoke.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_smoke.xml index 42cee5e69c0..6da3d3746bd 100644 --- a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_smoke.xml +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_smoke.xml @@ -1,6 +1,10 @@ + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_solvers.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_solvers.xml new file mode 100755 index 00000000000..2c8d9f8936b --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_faultSlip_solvers.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_base.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_base.xml index 259cf4e34d8..6fab669691b 100644 --- a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_base.xml +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_base.xml @@ -1,54 +1,6 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_horizontal_smoke.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_horizontal_smoke.xml index 3e9282ccb5d..993b40bfaae 100644 --- a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_horizontal_smoke.xml +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_horizontal_smoke.xml @@ -1,6 +1,10 @@ + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_sequential_solvers.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_sequential_solvers.xml new file mode 100755 index 00000000000..4112be144f1 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_sequential_solvers.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_solvers.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_solvers.xml new file mode 100755 index 00000000000..cc365b429c6 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_solvers.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_benchmark.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_benchmark.xml index 897967aefa3..20c65d99a94 100644 --- a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_benchmark.xml +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_benchmark.xml @@ -1,6 +1,10 @@ + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_benchmark.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_benchmark.xml new file mode 100755 index 00000000000..a7b5775a538 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_benchmark.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_smoke.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_smoke.xml new file mode 100755 index 00000000000..3feed452401 --- /dev/null +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_smoke.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_smoke.xml b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_smoke.xml index 88891999ccb..3feed452401 100644 --- a/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_smoke.xml +++ b/inputFiles/poromechanicsFractures/PoroElastic_conformingFracture_2d_openingFrac_vertical_smoke.xml @@ -1,6 +1,10 @@ + + + diff --git a/inputFiles/poromechanicsFractures/poromechanicsFractures.ats b/inputFiles/poromechanicsFractures/poromechanicsFractures.ats index 02dfc957812..5cbe443b5a9 100644 --- a/inputFiles/poromechanicsFractures/poromechanicsFractures.ats +++ b/inputFiles/poromechanicsFractures/poromechanicsFractures.ats @@ -26,6 +26,13 @@ decks = [ restart_step=0, check_step=10, restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="PoroElastic_conformingFracture_2d_openingFrac_horizontal_sequential_smoke", + description='PoroElastic conformingFracture 2d case (sequential)', + partitions=((1, 1, 1), (2, 2, 1)), + restart_step=0, + check_step=10, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), TestDeck( name="PoroElastic_conformingFracture_2d_openingFrac_vertical_smoke", description='PoroElastic conformingFracture 2d case', @@ -33,6 +40,13 @@ decks = [ restart_step=0, check_step=10, restartcheck_params=RestartcheckParameters(**restartcheck_params)), + TestDeck( + name="PoroElastic_conformingFracture_2d_openingFrac_vertical_sequential_smoke", + description='PoroElastic conformingFracture 2d case (sequential)', + partitions=((1, 1, 1), (2, 2, 1)), + restart_step=0, + check_step=10, + restartcheck_params=RestartcheckParameters(**restartcheck_params)), TestDeck( name="PoroElastic_efem-edfm_pressurizedFrac_smoke", description='poromechanics efem-edfm pressurized vertical frac', diff --git a/inputFiles/singlePhaseFlow/compressible_1d_2solids.xml b/inputFiles/singlePhaseFlow/compressible_1d_2solids.xml index 1f28c8d3e13..b6c38999957 100644 --- a/inputFiles/singlePhaseFlow/compressible_1d_2solids.xml +++ b/inputFiles/singlePhaseFlow/compressible_1d_2solids.xml @@ -25,7 +25,7 @@ nx="{ 5, 5 }" ny="{ 1 }" nz="{ 1 }" - cellBlockNames="{ block1, block2 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0 }"/> @@ -69,12 +69,12 @@ diff --git a/inputFiles/singlePhaseFlow/compressible_2d_2fluids.xml b/inputFiles/singlePhaseFlow/compressible_2d_2fluids.xml index 96110f04bbf..17b28f92439 100644 --- a/inputFiles/singlePhaseFlow/compressible_2d_2fluids.xml +++ b/inputFiles/singlePhaseFlow/compressible_2d_2fluids.xml @@ -25,7 +25,7 @@ nx="{ 5, 5 }" ny="{ 3 }" nz="{ 1 }" - cellBlockNames="{ block1, block2 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0 }"/> @@ -85,12 +85,12 @@ diff --git a/inputFiles/singlePhaseFlow/compressible_2d_2fluids_hybrid.xml b/inputFiles/singlePhaseFlow/compressible_2d_2fluids_hybrid.xml index 2c934611c49..c7589636004 100644 --- a/inputFiles/singlePhaseFlow/compressible_2d_2fluids_hybrid.xml +++ b/inputFiles/singlePhaseFlow/compressible_2d_2fluids_hybrid.xml @@ -25,7 +25,7 @@ nx="{ 5, 5 }" ny="{ 3 }" nz="{ 1 }" - cellBlockNames="{ block1, block2 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0 }"/> @@ -85,12 +85,12 @@ @@ -137,7 +137,7 @@ name="Porosity" initialCondition="1" setNames="{ all }" - objectPath="ElementRegions/Region1/block1" + objectPath="ElementRegions/Region1/cb-0_0_0" fieldName="rockPorosity_referencePorosity" scale="0.05"/> diff --git a/inputFiles/singlePhaseFlow/staircase_3d.xml b/inputFiles/singlePhaseFlow/staircase_3d.xml index 95628bc339d..199f1a726ea 100644 --- a/inputFiles/singlePhaseFlow/staircase_3d.xml +++ b/inputFiles/singlePhaseFlow/staircase_3d.xml @@ -25,7 +25,10 @@ nx="{ 5, 5 }" ny="{ 5, 5 }" nz="{ 3, 3, 3, 3 }" - cellBlockNames="{ b00, b01, b02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"/> @@ -73,12 +76,12 @@ diff --git a/inputFiles/singlePhaseFlowFractures/fractureMatrixFlowWithGravity_edfm_verticalFrac_smoke.xml b/inputFiles/singlePhaseFlowFractures/fractureMatrixFlowWithGravity_edfm_verticalFrac_smoke.xml index 648b26903f6..c0429d938fb 100644 --- a/inputFiles/singlePhaseFlowFractures/fractureMatrixFlowWithGravity_edfm_verticalFrac_smoke.xml +++ b/inputFiles/singlePhaseFlowFractures/fractureMatrixFlowWithGravity_edfm_verticalFrac_smoke.xml @@ -133,7 +133,7 @@ name="rockPorosity" defaultReferencePorosity="0.05" referencePressure="0.0" - compressibility="0.0e-9"/> + compressibility="1.0e-9"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"> @@ -155,7 +156,7 @@ + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1 }"/> diff --git a/inputFiles/solidMechanics/viscoExtendedDruckerPrager_relaxation_smoke.xml b/inputFiles/solidMechanics/viscoExtendedDruckerPrager_relaxation_smoke.xml index 0d50bd21c23..172adadc4f4 100644 --- a/inputFiles/solidMechanics/viscoExtendedDruckerPrager_relaxation_smoke.xml +++ b/inputFiles/solidMechanics/viscoExtendedDruckerPrager_relaxation_smoke.xml @@ -15,7 +15,8 @@ nx="{ 1, 1 }" ny="{ 1, 1 }" nz="{ 1, 1 }" - cellBlockNames="{ cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1 }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3 }"/> @@ -73,23 +76,21 @@ target="/Outputs/vtkOutput"/> + target="/Tasks/multiphasePoroelasticityEquilibrationStep"/> + - - - - - - @@ -335,16 +325,9 @@ - - - + diff --git a/inputFiles/wavePropagation/acous3D_pml_smoke.xml b/inputFiles/wavePropagation/acous3D_pml_smoke.xml index 7e2b978d31d..3a1e3db0f47 100644 --- a/inputFiles/wavePropagation/acous3D_pml_smoke.xml +++ b/inputFiles/wavePropagation/acous3D_pml_smoke.xml @@ -31,15 +31,15 @@ nx="{ 1, 3, 1}" ny="{ 1, 3, 1}" nz="{ 1, 3, 1}" - cellBlockNames="{ pmlLeftFrontBottom, pmlLeftFrontMid, pmlLeftFrontTop, - pmlLeftMidBottom, pmlLeftMidMid, pmlLeftMidTop, - pmlLeftBackBottom, pmlLeftBackMid, pmlLeftBackTop, - pmlMidFrontBottom, pmlMidFrontMid, pmlMidFrontTop, - pmlMidMidBottom, interiorMidMidMid, pmlMidMidTop, - pmlMidBackBottom, pmlMidBackMid, pmlMidBackTop, - pmlRightFrontBottom, pmlRightFrontMid, pmlRightFrontTop, - pmlRightMidBottom, pmlRightMidMid, pmlRightMidTop, - pmlRightBackBottom, pmlRightBackMid, pmlRightBackTop }"/> + cellBlockNames="{ cb-0_0_0, cb-1_0_0, cb-2_0_0, + cb-0_1_0, cb-1_1_0, cb-2_1_0, + cb-0_2_0, cb-1_2_0, cb-2_2_0, + cb-0_0_1, cb-1_0_1, cb-2_0_1, + cb-0_1_1, cb-1_1_1, cb-2_1_1, + cb-0_2_1, cb-1_2_1, cb-2_2_1, + cb-0_0_2, cb-1_0_2, cb-2_0_2, + cb-0_1_2, cb-1_1_2, cb-2_1_2, + cb-0_2_2, cb-1_2_2, cb-2_2_2 }"/> @@ -115,20 +115,20 @@ diff --git a/inputFiles/wavePropagation/benchmarks/acouselas3D.xml b/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_base.xml similarity index 67% rename from inputFiles/wavePropagation/benchmarks/acouselas3D.xml rename to inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_base.xml index 7ee7cc3e86e..80fe7332730 100644 --- a/inputFiles/wavePropagation/benchmarks/acouselas3D.xml +++ b/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_base.xml @@ -13,21 +13,13 @@ 6400x1600x4800m domain NOTES: nx="{ 320 }" - ny="{ 240 }" - nz="{ 120, 120 } - => local threshold for local builds 3D Q1 Δt=1e-4 (18e6 elems, 10Gb per 1 GPU) - -> Q4 180 procs / GPU 16h - -> Q1 180 procs / GPU 1h40min - -> Q3 gar6more results - nx="{ 160 }" ny="{ 120 }" - nz="{ 60, 60 } - => local threshold for local builds 3D Q2 Δt=1e-4 (2e6 elems, 4Gb per 1 GPU) - -> Q3 swaps - nx="{ 80 }" - ny="{ 60 }" - nz="{ 30, 30 } - => coarse 10 min frontal run 3D Q5 Δt=1e-3 (288e3 elems, 8Gb per 6 GPU) + nz="{ 120, 120 }" + => Q3 24 procs / GPUs -> 10min run on P3 (validation run) + nx="{ 320 }" + ny="{ 80 }" + nz="{ 120, 120 }" + => Q2 18 procs / GPUs -> 5min run on P3 (debug run) # Validation againt [gar6more3d](https://gitlab.inria.fr/jdiaz/gar6more3d) @@ -37,7 +29,7 @@ 0 first layer : acoustic (0) elastodynamic (1), poroelastic (2) 4 Source derivative (Hermite functions derivative, i.e. 2 for a ricker source) 10. Central frequency of the source - 1020. Amplitude of the source (× ρᶠ ?) + 2.295e9 Amplitude of the source (≡ λᶠ) 0.115 Delay of the source 500. Height of the source 533.3333 Height of the line of receivers (relative to interface) @@ -47,10 +39,10 @@ 0. Ordinate of the last receiver 1 Numbers of receivers 0. Start time - 3. Stop time + 1.85 Stop time 1e-3 Time step (of the seismo samples) - 1000 Number of intervals for the numerical computation of the convolution - 1000 Number of intervals for the numerical computation of the space integration + 100 Number of intervals for the numerical computation of the convolution + 100 Number of intervals for the numerical computation of the space integration 2.295e9 1020. λᶠ and ρᶠ 1 second layer : acoustic (0) elastodynamic (1), poroelastic (2) 9.6334225e9 9.633155e9 2500. μˢ, λˢ and ρˢ @@ -60,9 +52,9 @@ ``` 4 infinite medium (1), free surface (2), wall boundary (3) or bilayered medium(4) 0 first layer : acoustic (0) elastodynamic (1), poroelastic (2) - 4 Source derivative (Hermite functions derivative, i.e. 2 for a ricker source) + 3 Source derivative (Hermite functions derivative, i.e. 2 for a ricker source) 10. Central frequency of the source - 1020. Amplitude of the source (× ρᶠ ?) + 2.295e9 Amplitude of the source (≡ λᶠ) 0.115 Delay of the source 500. Height of the source -533.3333 Height of the line of receivers (relative to interface) @@ -72,10 +64,10 @@ 0. Ordinate of the last receiver 1 Numbers of receivers 0. Start time - 3. Stop time + 1.85 Stop time 1e-3 Time step (of the seismo samples) - 500 Number of intervals for the numerical computation of the convolution - 500 Number of intervals for the numerical computation of the space integration + 100 Number of intervals for the numerical computation of the convolution + 100 Number of intervals for the numerical computation of the space integration 2.295e9 1020. λᶠ and ρᶠ 1 second layer : acoustic (0) elastodynamic (1), poroelastic (2) 9.6334225e9 9.633155e9 2500. μˢ, λˢ and ρˢ @@ -83,37 +75,6 @@ --> - - - - - - - @@ -137,22 +98,21 @@ - + @@ -169,8 +129,7 @@ - + diff --git a/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_flu.xml b/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_flu.xml new file mode 100644 index 00000000000..a1367ef4128 --- /dev/null +++ b/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_flu.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + diff --git a/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_sol.xml b/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_sol.xml new file mode 100644 index 00000000000..5a4e3ff62ee --- /dev/null +++ b/inputFiles/wavePropagation/benchmarks/acouselas3D_komatitsch_sol.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_aea.xml b/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_aea.xml new file mode 100644 index 00000000000..141cf84d7a6 --- /dev/null +++ b/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_aea.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + diff --git a/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_base.xml b/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_base.xml new file mode 100644 index 00000000000..83922fb1c8c --- /dev/null +++ b/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_base.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_eae.xml b/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_eae.xml new file mode 100644 index 00000000000..e75b0cb0c93 --- /dev/null +++ b/inputFiles/wavePropagation/benchmarks/acouselas3D_layers_eae.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + diff --git a/inputFiles/wellbore/CasedElasticWellbore_ImperfectInterfaces_base.xml b/inputFiles/wellbore/CasedElasticWellbore_ImperfectInterfaces_base.xml index 04a17b7ea8b..06384dcce1c 100644 --- a/inputFiles/wellbore/CasedElasticWellbore_ImperfectInterfaces_base.xml +++ b/inputFiles/wellbore/CasedElasticWellbore_ImperfectInterfaces_base.xml @@ -12,8 +12,7 @@ + newtonMaxIter="10"/> diff --git a/inputFiles/wellbore/CasedThermoElasticWellbore_ImperfectInterfaces_base.xml b/inputFiles/wellbore/CasedThermoElasticWellbore_ImperfectInterfaces_base.xml index b2028906503..82aae72d5bb 100644 --- a/inputFiles/wellbore/CasedThermoElasticWellbore_ImperfectInterfaces_base.xml +++ b/inputFiles/wellbore/CasedThermoElasticWellbore_ImperfectInterfaces_base.xml @@ -24,15 +24,14 @@ + newtonMaxIter="10"/> @@ -67,8 +66,10 @@ - + diff --git a/integratedTests b/integratedTests index eb4b88b485b..1de49d91217 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit eb4b88b485bd35a6cb37dd37b141daef5a0a832a +Subproject commit 1de49d91217f6ddd2b254948636513a7e1bee108 diff --git a/scripts/SchemaToRSTDocumentation.py b/scripts/SchemaToRSTDocumentation.py index 0710515381c..e6492853736 100644 --- a/scripts/SchemaToRSTDocumentation.py +++ b/scripts/SchemaToRSTDocumentation.py @@ -191,6 +191,10 @@ def buildTableValues(type_map, link_string='XML', include_defaults=True): if k in type_map[att_name]: table_row[jj] = type_map[att_name][k] + # Fix type strings + if ('Type' in k): + table_row[jj] = table_row[jj].replace('_lt_', '<').replace('_gt_', '>').replace('_cm_', ',').replace('-', ' ') + # Format any registration entries as links if ('Registered' in k): table_row[jj] = ", ".join([':ref:`%s_%s`' % (link_string, x) for x in table_row[jj]]) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index c292755a605..405cb7a46c3 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -1,6 +1,8 @@ #!/bin/bash set -o pipefail +export PYTHONDONTWRITEBYTECODE=1 + printenv SCRIPT_NAME=$0 @@ -143,7 +145,7 @@ EOT # The path to the `sccache` executable is available through the SCCACHE environment variable. SCCACHE_CMAKE_ARGS="-DCMAKE_CXX_COMPILER_LAUNCHER=${SCCACHE} -DCMAKE_CUDA_COMPILER_LAUNCHER=${SCCACHE}" - if [[ ${HOSTNAME} == 'streak.llnl.gov' ]]; then + if [ ${HOSTNAME} == 'streak.llnl.gov' ] || [ ${HOSTNAME} == 'streak2.llnl.gov' ]; then DOCKER_CERTS_DIR=/usr/local/share/ca-certificates for file in "${GEOS_SRC_DIR}"/certificates/*.crt.pem; do if [ -f "$file" ]; then @@ -174,7 +176,8 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then or_die apt-get install -y virtualenv python3-dev python-is-python3 ATS_PYTHON_HOME=/tmp/run_integrated_tests_virtualenv or_die virtualenv ${ATS_PYTHON_HOME} - ATS_CMAKE_ARGS="-DATS_ARGUMENTS=\"--machine openmpi --ats openmpi_mpirun=/usr/bin/mpirun --ats openmpi_args=--allow-run-as-root --ats openmpi_procspernode=2 --ats openmpi_maxprocs=2\" -DPython3_ROOT_DIR=${ATS_PYTHON_HOME}" + export ATS_FILTER="np<=32" + ATS_CMAKE_ARGS="-DATS_ARGUMENTS=\"--machine openmpi --ats openmpi_mpirun=/usr/bin/mpirun --ats openmpi_args=--allow-run-as-root --ats openmpi_procspernode=32 --ats openmpi_maxprocs=32\" -DPython3_ROOT_DIR=${ATS_PYTHON_HOME}" fi @@ -252,7 +255,7 @@ fi # Run the unit tests (excluding previously ran checks). if [[ "${RUN_UNIT_TESTS}" = true ]]; then - if [[ ${HOSTNAME} == 'streak.llnl.gov' ]]; then + if [ ${HOSTNAME} == 'streak.llnl.gov' ] || [ ${HOSTNAME} == 'streak2.llnl.gov' ]; then or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck|testLifoStorage|testExternalSolvers" else or_die ctest --output-on-failure -E "testUncrustifyCheck|testDoxygenCheck" @@ -288,6 +291,12 @@ fi # Cleaning the build directory. or_die ninja clean + +# Clean the repository +or_die cd ${GEOS_SRC_DIR}/inputFiles +find . -name *.pyc | xargs rm -f + + # If we're here, either everything went OK or we have to deal with the integrated tests manually. if [[ ! -z "${INTEGRATED_TEST_EXIT_STATUS+x}" ]]; then echo "Exiting the build process with exit status ${INTEGRATED_TEST_EXIT_STATUS} from the integrated tests." diff --git a/src/cmake/thirdparty/SetupGeosxThirdParty.cmake b/src/cmake/thirdparty/SetupGeosxThirdParty.cmake index e6ce967a316..7706da01a5b 100644 --- a/src/cmake/thirdparty/SetupGeosxThirdParty.cmake +++ b/src/cmake/thirdparty/SetupGeosxThirdParty.cmake @@ -1,7 +1,16 @@ #################################### +# # 3rd Party Dependencies +# +# Setup all GEOS TPL +# #################################### + +################################ +# Helper macros & functions +################################ + macro(find_and_import) set(singleValueArgs NAME HEADER) set(multiValueArgs INCLUDE_DIRECTORIES @@ -101,8 +110,22 @@ macro(extract_version_from_header) endmacro( extract_version_from_header) + +macro(mandatory_tpl_doesnt_exist + CURRENT_TPL_NAME + CURRENT_TPL_DIR_VAR) + + message(FATAL_ERROR + "GEOSX requires ${CURRENT_TPL_NAME}, either :\n" + " - Verify that you provided a valid TPL installation directory (GEOSX_TPL_DIR = \"${GEOSX_TPL_DIR}\"),\n" + " - Or set ${CURRENT_TPL_DIR_VAR} to the ${CURRENT_TPL_NAME} installation directory (${CURRENT_TPL_DIR_VAR} = \"${${CURRENT_TPL_DIR_VAR}}\").\n") + +endmacro(mandatory_tpl_doesnt_exist) + + set(thirdPartyLibs "") + ################################ # BLAS/LAPACK ################################ @@ -184,7 +207,7 @@ if(DEFINED CONDUIT_DIR) set(thirdPartyLibs ${thirdPartyLibs} conduit::conduit) else() - message(FATAL_ERROR "GEOSX requires conduit, set CONDUIT_DIR to the conduit installation directory.") + mandatory_tpl_doesnt_exist("Conduit" CONDUIT_DIR) endif() ################################ @@ -215,7 +238,7 @@ if(DEFINED HDF5_DIR) set(ENABLE_HDF5 ON CACHE BOOL "") set(thirdPartyLibs ${thirdPartyLibs} hdf5) else() - message(FATAL_ERROR "GEOSX requires hdf5, set HDF5_DIR to the hdf5 installation directory.") + mandatory_tpl_doesnt_exist("hdf5" HDF5_DIR) endif() ################################ @@ -259,7 +282,7 @@ if(DEFINED PUGIXML_DIR) set(thirdPartyLibs ${thirdPartyLibs} pugixml) endif() else() - message(FATAL_ERROR "GEOSX requires pugixml, set PUGIXML_DIR to the pugixml installation directory.") + mandatory_tpl_doesnt_exist("pugixml" PUGIXML_DIR) endif() ################################ @@ -291,7 +314,7 @@ if(DEFINED RAJA_DIR) set(ENABLE_RAJA ON CACHE BOOL "") set(thirdPartyLibs ${thirdPartyLibs} RAJA ) else() - message(FATAL_ERROR "GEOSX requires RAJA, set RAJA_DIR to the RAJA installation directory.") + mandatory_tpl_doesnt_exist("RAJA" RAJA_DIR) endif() ################################ @@ -322,7 +345,7 @@ if(DEFINED UMPIRE_DIR) set(ENABLE_UMPIRE ON CACHE BOOL "") set(thirdPartyLibs ${thirdPartyLibs} umpire) else() - message(FATAL_ERROR "GEOSX requires Umpire, set UMPIRE_DIR to the Umpire installation directory.") + mandatory_tpl_doesnt_exist("Umpire" UMPIRE_DIR) endif() @@ -345,7 +368,7 @@ if(DEFINED CHAI_DIR) set(ENABLE_CHAI ON CACHE BOOL "") set(thirdPartyLibs ${thirdPartyLibs} chai) else() - message(FATAL_ERROR "GEOSX requires CHAI, set CHAI_DIR to the CHAI installation directory.") + mandatory_tpl_doesnt_exist("CHAI" CHAI_DIR) endif() ################################ @@ -613,7 +636,7 @@ if(DEFINED HYPRE_DIR AND ENABLE_HYPRE) set( HYPRE_DEPENDS ${HYPRE_DEPENDS} superlu_dist ) endif() if( ${ENABLE_HYPRE_DEVICE} STREQUAL "CUDA" ) - set( EXTRA_LIBS ${CUDA_cusparse_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_curand_LIBRARY} ) + set( EXTRA_LIBS ${CUDA_cusparse_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_curand_LIBRARY} ${CUDA_cusolver_LIBRARY} ) elseif( ${ENABLE_HYPRE_DEVICE} STREQUAL "HIP" ) find_package( rocblas REQUIRED ) find_package( rocsolver REQUIRED ) @@ -800,7 +823,7 @@ if(DEFINED FMT_DIR) set(thirdPartyLibs ${thirdPartyLibs} fmt::fmt ) else() - message(FATAL_ERROR "GEOSX requires {fmt}, set FMT_DIR to the {fmt} installation directory.") + mandatory_tpl_doesnt_exist("{fmt}" FMT_DIR) endif() ################################ @@ -841,7 +864,7 @@ if( ${CMAKE_VERSION} VERSION_LESS "3.19" ) set( PYTHON_AND_VERSION Python3 ) set( PYTHON_OPTIONAL_COMPONENTS) else() - set( PYTHON_AND_VERSION Python3 3.7.0...3.11.2 ) + set( PYTHON_AND_VERSION Python3 3.6.0...3.12.2 ) set( PYTHON_OPTIONAL_COMPONENTS OPTIONAL_COMPONENTS Development NumPy) endif() if(ENABLE_PYGEOSX) diff --git a/src/coreComponents/LvArray b/src/coreComponents/LvArray index 1531241583e..fb5200d7436 160000 --- a/src/coreComponents/LvArray +++ b/src/coreComponents/LvArray @@ -1 +1 @@ -Subproject commit 1531241583eebe21cfcdc0facd16a80f1e03c939 +Subproject commit fb5200d743621126f2117eaef0dd855792fa0443 diff --git a/src/coreComponents/codingUtilities/Utilities.hpp b/src/coreComponents/codingUtilities/Utilities.hpp index b6e39ba6667..7555c6bbfbc 100644 --- a/src/coreComponents/codingUtilities/Utilities.hpp +++ b/src/coreComponents/codingUtilities/Utilities.hpp @@ -209,6 +209,31 @@ VAL findOption( mapBase< KEY, VAL, SORTED > const & map, return iter->second; } +namespace +{ + +/** + * @brief Apply functor @p transformer onto the map elements and store the results into a container of type @p C. + * @tparam MAP Type of the considered map. + * @tparam C Type of the container holding the keys. + * @tparam TRANSFORMER Type of the unary functor. + * @param[in] map The map from which keys will be extracted. + * @param transformer Which unary functor to apply to the @p map elements. + * @return The container with the results for the @p transformer application. + */ +template< template< typename ... > class C, typename MAP, typename TRANSFORMER > +auto mapTransformer( MAP const & map, + TRANSFORMER const & transformer ) +{ + using v = std::invoke_result_t< TRANSFORMER, typename MAP::const_reference >; + C< v > result; + auto inserter = std::inserter( result, result.end() ); + std::transform( map.begin(), map.end(), inserter, transformer ); + return result; +} + +} + /** * @brief Extract the keys from the given map. * @tparam MAP Type of the considered map. @@ -219,11 +244,24 @@ VAL findOption( mapBase< KEY, VAL, SORTED > const & map, template< template< typename ... > class C = std::vector, typename MAP > C< typename MAP::key_type > mapKeys( MAP const & map ) { - C< typename MAP::key_type > keys; - auto transformer = []( auto const & p ) { return p.first; }; - auto inserter = std::inserter( keys, keys.end() ); - std::transform( map.begin(), map.end(), inserter, transformer ); - return keys; + auto transformer = []( auto const & p ) -> typename MAP::key_type + { return p.first; }; + return mapTransformer< C >( map, transformer ); +} + +/** + * @brief Extract the values from the given map. + * @tparam MAP Type of the considered map. + * @tparam C Type of the container holding the values. + * @param[in] map The map from which values will be extracted. + * @return The container with the values. + */ +template< template< typename ... > class C = std::vector, typename MAP > +C< typename MAP::mapped_type > mapValues( MAP const & map ) +{ + auto transformer = []( typename MAP::const_reference p ) -> typename MAP::mapped_type + { return p.second; }; + return mapTransformer< C >( map, transformer ); } namespace internal diff --git a/src/coreComponents/codingUtilities/tests/CMakeLists.txt b/src/coreComponents/codingUtilities/tests/CMakeLists.txt index f70776694a0..f6009a67062 100644 --- a/src/coreComponents/codingUtilities/tests/CMakeLists.txt +++ b/src/coreComponents/codingUtilities/tests/CMakeLists.txt @@ -2,7 +2,8 @@ set( testSources testGeosxTraits.cpp testStringUtilities.cpp - testParsing.cpp ) + testParsing.cpp + testUtilities.cpp ) set( dependencyList gtest codingUtilities ${parallelDeps} ) diff --git a/src/coreComponents/codingUtilities/tests/testUtilities.cpp b/src/coreComponents/codingUtilities/tests/testUtilities.cpp new file mode 100644 index 00000000000..94a3147a245 --- /dev/null +++ b/src/coreComponents/codingUtilities/tests/testUtilities.cpp @@ -0,0 +1,35 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +#include "codingUtilities/Utilities.hpp" + +#include + +#include + +using namespace geos; + +TEST( Utilities, MapExtraction ) +{ + std::map< string, int > const m{ + { "k0", 0 }, + { "k1", 1 }, + { "k2", 2 } + }; + + EXPECT_EQ( mapKeys( m ), std::vector< string >( { "k0", "k1", "k2" } ) ); + EXPECT_EQ( mapKeys< std::set >( m ), std::set< string >( { "k0", "k1", "k2" } ) ); + EXPECT_EQ( mapValues( m ), std::vector< int >( { 0, 1, 2 } ) ); + EXPECT_EQ( mapValues< std::set >( m ), std::set< int >( { 0, 1, 2 } ) ); +} diff --git a/src/coreComponents/common/MpiWrapper.hpp b/src/coreComponents/common/MpiWrapper.hpp index 10fb0dccde6..3c8c97a3dce 100644 --- a/src/coreComponents/common/MpiWrapper.hpp +++ b/src/coreComponents/common/MpiWrapper.hpp @@ -20,7 +20,6 @@ #include "common/DataTypes.hpp" #include "common/Span.hpp" -#include "mesh/ElementType.hpp" #if defined(GEOSX_USE_MPI) #include diff --git a/src/coreComponents/constitutive/CMakeLists.txt b/src/coreComponents/constitutive/CMakeLists.txt index 47e573b6f13..28ff5208229 100644 --- a/src/coreComponents/constitutive/CMakeLists.txt +++ b/src/coreComponents/constitutive/CMakeLists.txt @@ -43,21 +43,23 @@ set( constitutive_headers fluid/multifluid/blackOil/PVTOData.hpp fluid/multifluid/CO2Brine/CO2BrineFluid.hpp fluid/multifluid/CO2Brine/PhaseModel.hpp - fluid/multifluid/CO2Brine/functions/PhillipsBrineDensity.hpp - fluid/multifluid/CO2Brine/functions/PhillipsBrineViscosity.hpp + fluid/multifluid/CO2Brine/functions/BrineEnthalpy.hpp + fluid/multifluid/CO2Brine/functions/CO2Enthalpy.hpp + fluid/multifluid/CO2Brine/functions/CO2EOSSolver.hpp + fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp + fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.hpp + fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.hpp fluid/multifluid/CO2Brine/functions/EzrokhiBrineDensity.hpp fluid/multifluid/CO2Brine/functions/EzrokhiBrineViscosity.hpp - fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp fluid/multifluid/CO2Brine/functions/FenghourCO2Viscosity.hpp fluid/multifluid/CO2Brine/functions/FlashModelBase.hpp - fluid/multifluid/CO2Brine/functions/PVTFunctionBase.hpp fluid/multifluid/CO2Brine/functions/NoOpPVTFunction.hpp + fluid/multifluid/CO2Brine/functions/PhillipsBrineDensity.hpp + fluid/multifluid/CO2Brine/functions/PhillipsBrineViscosity.hpp + fluid/multifluid/CO2Brine/functions/PureWaterProperties.hpp + fluid/multifluid/CO2Brine/functions/PVTFunctionBase.hpp fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.hpp - fluid/multifluid/CO2Brine/functions/BrineEnthalpy.hpp - fluid/multifluid/CO2Brine/functions/CO2Enthalpy.hpp - fluid/multifluid/CO2Brine/functions/CO2EOSSolver.hpp - fluid/multifluid/CO2Brine/functions/PureWaterProperties.hpp fluid/multifluid/CO2Brine/functions/WaterDensity.hpp fluid/multifluid/compositional/functions/CompositionalProperties.hpp fluid/multifluid/compositional/functions/CubicEOSPhaseModel.hpp @@ -202,6 +204,8 @@ set( constitutive_sources fluid/multifluid/CO2Brine/functions/EzrokhiBrineDensity.cpp fluid/multifluid/CO2Brine/functions/EzrokhiBrineViscosity.cpp fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp + fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.cpp + fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.cpp fluid/multifluid/CO2Brine/functions/FenghourCO2Viscosity.cpp fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.cpp fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.cpp diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp index 0a02e19ad51..01e210d20a1 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp @@ -162,7 +162,8 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::checkTablesParameters( real64 const m_phase1->enthalpy.checkTablesParameters( pressure, temperatureInCelsius ); } catch( SimulationError const & ex ) { - string const errorMsg = GEOS_FMT( "{}: Table input error for phase no. 1.\n", getDataContext() ); + string const errorMsg = GEOS_FMT( "Table input error for {} phase (in table from \"{}\").\n", + m_phaseNames[m_p1Index], m_phasePVTParaFiles[m_p1Index] ); throw SimulationError( ex, errorMsg ); } @@ -173,7 +174,8 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::checkTablesParameters( real64 const m_phase2->enthalpy.checkTablesParameters( pressure, temperatureInCelsius ); } catch( SimulationError const & ex ) { - string const errorMsg = GEOS_FMT( "{}: Table input error for phase no. 2.\n", getDataContext() ); + string const errorMsg = GEOS_FMT( "Table input error for {} phase (in table from \"{}\").\n", + m_phaseNames[m_p2Index], m_phasePVTParaFiles[m_p2Index] ); throw SimulationError( ex, errorMsg ); } @@ -182,7 +184,8 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::checkTablesParameters( real64 const m_flash->checkTablesParameters( pressure, temperatureInCelsius ); } catch( SimulationError const & ex ) { - string const errorMsg = GEOS_FMT( "{}: Table input error for flash phase.\n", getDataContext() ); + string const errorMsg = GEOS_FMT( "Table input error for flash phase (in table from \"{}\").\n", + m_flashModelParaFile ); throw SimulationError( ex, errorMsg ); } } @@ -377,9 +380,10 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() // If 1 table is provided, it is the CO2 solubility table and water vapourisation is zero // If 2 tables are provided, they are the CO2 solubility and water vapourisation tables depending // on how phaseNames is arranged + string const solubilityModel = EnumStrings< CO2Solubility::SolubilityModel >::toString( CO2Solubility::SolubilityModel::Tables ); string_array strs; strs.emplace_back( "FlashModel" ); - strs.emplace_back( "Tables" ); // Marker to indicate that tables are provided + strs.emplace_back( solubilityModel ); // Marker to indicate that tables are provided strs.emplace_back( "" ); // 2 empty strings for the 2 phase tables gas first, then water strs.emplace_back( "" ); if( m_solubilityTables.size() == 2 ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp index b68851478f2..835a475fec1 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.hpp @@ -194,7 +194,6 @@ class CO2BrineFluid : public MultiFluidBase // Flash model std::unique_ptr< FLASH > m_flash; - }; // these aliases are useful in constitutive dispatch diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp index ce4041bce68..4f2a140f99d 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp @@ -17,9 +17,8 @@ */ #include "constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp" - -#include "constitutive/fluid/multifluid/CO2Brine/functions/CO2EOSSolver.hpp" -#include "constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp" +#include "constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.hpp" +#include "constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.hpp" #include "functions/FunctionManager.hpp" #include "common/Units.hpp" @@ -29,337 +28,193 @@ namespace geos using namespace stringutilities; -namespace constitutive -{ - -namespace PVTProps -{ - namespace { -constexpr real64 P_Pa_f = 1e+5; -constexpr real64 P_c = 73.773 * P_Pa_f; -constexpr real64 T_c = 304.1282; -constexpr real64 Rgas = constants::gasConstant; -constexpr real64 V_c = Rgas*T_c/P_c; - -// these coefficients are in Table (A1) of Duan and Sun (2003) -constexpr real64 acoef[] = -{ 8.99288497e-2, -4.94783127e-1, 4.77922245e-2, 1.03808883e-2, -2.82516861e-2, 9.49887563e-2, 5.20600880e-4, - -2.93540971e-4, -1.77265112e-3, -2.51101973e-5, 8.93353441e-5, 7.88998563e-5, -1.66727022e-2, 1.398, 2.96e-2 }; - -real64 co2EOS( real64 const & T, real64 const & P, real64 const & V_r ) -{ - // reduced pressure - real64 const P_r = P*P_Pa_f/P_c; - // reduced temperature - real64 const T_r = units::convertCToK( T )/T_c; - - // CO2 equation of state - // see equation (A1) in Duan and Sun (2003) - real64 const f_Z = 1.0 - + ( acoef[0] + acoef[1]/(T_r * T_r) + acoef[2]/(T_r * T_r * T_r) )/V_r - + ( acoef[3] + acoef[4]/(T_r * T_r) + acoef[5]/(T_r * T_r * T_r) )/(V_r*V_r) - + ( acoef[6] + acoef[7]/(T_r * T_r) + acoef[8]/(T_r * T_r * T_r) )/(V_r*V_r*V_r*V_r) - + ( acoef[9] + acoef[10]/(T_r * T_r) + acoef[11]/(T_r * T_r * T_r) )/(V_r*V_r*V_r*V_r*V_r) - + acoef[12]/(T_r * T_r * T_r)/(V_r * V_r) * (acoef[13] + acoef[14]/(V_r * V_r)) * exp( -acoef[14]/(V_r * V_r)) - P_r * V_r / T_r; - - return f_Z; -} - -real64 PWater( real64 const & T ) -{ - // these coefficients are defined in Table (B1) of Duan and Sun (2003) - constexpr real64 ccoef[] = { -38.640844, 5.8948420, 59.876516, 26.654627, 10.637097 }; - - // H2O critical pressure (bars) - real64 const P_c_w = 220.85; - // H2O critical temperature (K) - real64 const T_c_w = 647.29; - real64 const tt = ( units::convertCToK( T )-T_c_w )/T_c_w; - // Empirical model for water pressure of equation (B1) of Duan and Sun (2003) - real64 const x = ( P_c_w*units::convertCToK( T )/T_c_w ) - * (1 - + ccoef[0]*pow( -tt, 1.9 ) - + ccoef[1]*tt - + ccoef[2]*tt*tt - + ccoef[3]*tt*tt*tt - + ccoef[4]*tt*tt*tt*tt); - - return x; -} - -real64 logF( real64 const & T, real64 const & P, real64 const & V_r ) +TableFunction const * makeTable( string const & tableName, + constitutive::PVTProps::PTTableCoordinates const & tableCoords, + array1d< real64 > && values, + FunctionManager & functionManager ) { - // reduced pressure - real64 const P_r = P*P_Pa_f/P_c; - // reduced temperature - real64 const T_r = units::convertCToK( T ) / T_c; - real64 const Z = P_r * V_r/T_r; - - // fugacity coefficient of CO2, equation (A6) of Duan and Sun (2003) - real64 const log_f = Z - 1 - log( Z ) + - ( acoef[0] + acoef[1]/T_r/T_r + acoef[2]/T_r/T_r/T_r )/V_r - + ( acoef[3] + acoef[4]/T_r/T_r + acoef[5]/T_r/T_r/T_r )/2.0/V_r/V_r - + ( acoef[6] + acoef[7]/T_r/T_r + acoef[8]/T_r/T_r/T_r )/4.0/V_r/V_r/V_r/V_r - + ( acoef[9] + acoef[10]/T_r/T_r + acoef[11]/T_r/T_r/T_r )/5.0/V_r/V_r/V_r/V_r/V_r - + acoef[12]/2.0/T_r/T_r/T_r/acoef[14] * ( acoef[13] + 1.0 - (acoef[13] + 1.0 + acoef[14]/V_r/V_r) * exp( -acoef[14]/V_r/V_r ) ); - - return log_f; -} - -real64 Par( real64 const & T, real64 const & P, real64 const * cc ) -{ - // "equation for the parameters", see equation (7) of Duan and Sun (2003) - real64 x = cc[0] - + cc[1]*T - + cc[2]/T - + cc[3]*T*T - + cc[4]/(630.0-T) - + cc[5]*P - + cc[6]*P *log( T ) - + cc[7]*P/T - + cc[8]*P/(630.0-T) - + cc[9]*P*P/(630.0-T)/(630.0-T) - + cc[10]*T *log( P ); - - return x; -} - -real64 CO2SolubilityFunction( string const & name, - real64 const & tolerance, - real64 const & T, - real64 const & P, - real64 (* f)( real64 const & x1, real64 const & x2, real64 const & x3 ) ) -{ - // compute the initial guess for Newton's method - real64 const initialReducedVolume = 0.75*Rgas*units::convertCToK( T )/(P*P_Pa_f)*(1/V_c); - - // define the local solver parameters - // for now, this is hard-coded, but we may want to let the user access the parameters at some point - integer const maxNumNewtonIter = 500; - integer const maxNumBacktrackIter = 8; - real64 const maxAbsUpdate = 1e12; - real64 const minAbsDeriv = 0; - real64 const allowedMinValue = 0.05; // value chosen to match previous implementation - real64 const presMultiplierForReporting = 1e5; // this is because P is in hectopascal in this function - - // solve the CO2 equation of state for this pair of (pres, temp) - // return the reduced volume - return CO2EOSSolver::solve( name, - maxNumNewtonIter, - maxNumBacktrackIter, - tolerance, - minAbsDeriv, - maxAbsUpdate, - allowedMinValue, - initialReducedVolume, - T, - P, - presMultiplierForReporting, - f ); + TableFunction * tableFunction = nullptr; + if( functionManager.hasGroup< TableFunction >( tableName ) ) + { + tableFunction = functionManager.getGroupPointer< TableFunction >( tableName ); + } + else + { + tableFunction = dynamicCast< TableFunction * >( functionManager.createChild( "TableFunction", tableName ) ); + tableFunction->setTableCoordinates( tableCoords.getCoords(), { units::Pressure, units::TemperatureInC } ); + tableFunction->setTableValues( values, units::Solubility ); + tableFunction->setInterpolationMethod( TableFunction::InterpolationType::Linear ); + } + tableFunction->initializeFunction(); + return tableFunction; } -void calculateCO2Solubility( string const & functionName, - real64 const & tolerance, - PTTableCoordinates const & tableCoords, - real64 const & salinity, - array1d< real64 > const & values ) +std::pair< TableFunction const *, TableFunction const * > +makeSolubilityTables( string const & functionName, + string_array const & inputParams, + constitutive::PVTProps::CO2Solubility::SolubilityModel const & solubilityModel ) { - // Interaction parameters, see Table 2 of Duan and Sun (2003) - constexpr real64 mu[] = - { 28.9447706, -0.0354581768, -4770.67077, 1.02782768e-5, 33.8126098, 9.04037140e-3, - -1.14934031e-3, -0.307405726, -0.0907301486, 9.32713393e-4, 0 }; - constexpr real64 lambda[] = { -0.411370585, 6.07632013e-4, 97.5347708, 0, 0, 0, 0, -0.0237622469, 0.0170656236, 0, 1.41335834e-5 }; - constexpr real64 zeta[] = { 3.36389723e-4, -1.98298980e-5, 0, 0, 0, 0, 0, 2.12220830e-3, -5.24873303e-3, 0, 0 }; - - localIndex const nPressures = tableCoords.nPressures(); - localIndex const nTemperatures = tableCoords.nTemperatures(); + FunctionManager & functionManager = FunctionManager::getInstance(); + constitutive::PVTProps::PTTableCoordinates tableCoords; - for( localIndex i = 0; i < nPressures; ++i ) + // Check solubility model for explicit table input + if( solubilityModel == constitutive::PVTProps::CO2Solubility::SolubilityModel::Tables ) { - real64 const P = tableCoords.getPressure( i ) / P_Pa_f; - - for( localIndex j = 0; j < nTemperatures; ++j ) + // The default table is a table with all zeros unless the name is explicitly provided + // The pressure and temperature values below will be used only to create the zero table so they + // simply give a range large enough to cover most values. + tableCoords.appendPressure( 1.0e5 ).appendPressure( 1.0e8 ) + .appendTemperature( 0.0 ).appendTemperature( 800.0 ); + + TableFunction const * tables[2] = { nullptr, nullptr }; + for( integer tableIndex : { 0, 1 } ) { - real64 const T = tableCoords.getTemperature( j ); - - // compute reduced volume by solving the CO2 equation of state - real64 const V_r = CO2SolubilityFunction( functionName, tolerance, T, P, &co2EOS ); + array1d< real64 > values( 4 ); + values.zero(); - // compute equation (6) of Duan and Sun (2003) - real64 const logK = Par( units::convertCToK( T ), P, mu ) - - logF( T, P, V_r ) - + 2*Par( units::convertCToK( T ), P, lambda ) * salinity - + Par( units::convertCToK( T ), P, zeta ) * salinity * salinity; - real64 const expLogK = exp( logK ); - - // mole fraction of CO2 in vapor phase, equation (4) of Duan and Sun (2003) - real64 const Pw = PWater( T ); - real64 const y_CO2 = (P - Pw)/P; - values[j*nPressures+i] = y_CO2 * P / expLogK; - - GEOS_WARNING_IF( expLogK <= 1e-10, - GEOS_FMT( "CO2Solubility: exp(logK) = {} is too small (logK = {}, P = {}, T = {}, V_r = {}), resulting solubility value is {}", - expLogK, logK, P, T, V_r, values[j*nPressures+i] )); - - if( values[j*nPressures+i] < 0 ) + string inputTableName = inputParams[2 + tableIndex]; + if( inputTableName.empty() ) { - GEOS_LOG_RANK_0( GEOS_FMT( "CO2Solubility: negative solubility value = {}, y_CO2 = {}, P = {}, PWater(T) = {}; corrected to 0", - values[j * nPressures + i], y_CO2, P, Pw ) ); - values[j*nPressures+i] = 0.0; + inputTableName = GEOS_FMT( "{}_zeroDissolution_table", constitutive::PVTProps::CO2Solubility::catalogName() ); } + else + { + // If a name is explicitly given, then check that it exists + GEOS_THROW_IF( !functionManager.hasGroup< TableFunction >( inputTableName ), + GEOS_FMT( "{}: Could not find TableFunction with name {}", functionName, inputTableName ), + InputError ); + } + tables[tableIndex] = makeTable( inputTableName, tableCoords, std::move ( values ), functionManager ); } + return { tables[0], tables[1] }; } -} -TableFunction const * getSolubilityTable( string const & tableName, - FunctionManager & functionManager ) -{ - TableFunction * const table = functionManager.getGroupPointer< TableFunction >( tableName ); - table->initializeFunction(); - table->setDimUnits( { units::Pressure, units::TemperatureInC } ); - table->setValueUnits( units::Solubility ); - return table; -} - -TableFunction const * makeSolubilityTable( array1d< real64_array > const & coords, - array1d< real64 > const & values, - string const & tableName, - FunctionManager & functionManager ) -{ - TableFunction * const table = dynamicCast< TableFunction * >( functionManager.createChild( "TableFunction", tableName ) ); - table->setTableCoordinates( coords, { units::Pressure, units::TemperatureInC } ); - table->setTableValues( values, units::Solubility ); - table->setInterpolationMethod( TableFunction::InterpolationType::Linear ); - return table; -} + // If the tables have already been created, then simply retrieve them + string const co2TableName = functionName + "_co2Dissolution_table"; + string const h2oTableName = functionName + "_waterVaporization_table"; -TableFunction const * makeZeroTable( string const & tableName, - FunctionManager & functionManager ) -{ - if( functionManager.hasGroup< TableFunction >( tableName ) ) + if( functionManager.hasGroup< TableFunction >( co2TableName ) && functionManager.hasGroup< TableFunction >( h2oTableName )) { - return getSolubilityTable( tableName, functionManager ); + TableFunction const * co2SolubilityTable = functionManager.getGroupPointer< TableFunction >( co2TableName ); + TableFunction const * h2oSolubilityTable = functionManager.getGroupPointer< TableFunction >( h2oTableName ); + return {co2SolubilityTable, h2oSolubilityTable}; } - else - { - array1d< array1d< real64 > > coords( 2 ); - for( integer dim = 0; dim < 2; ++dim ) - { - coords[dim].emplace_back( -1.0e10 ); - coords[dim].emplace_back( 1.0e10 ); - } - array1d< real64 > values( 4 ); - values.zero(); - return makeSolubilityTable( coords, values, tableName, functionManager ); - } -} + // Initialize the (p,T) coordinates + constitutive::PVTProps::PVTFunctionHelpers::initializePropertyTable( inputParams, tableCoords ); -TableFunction const * makeSolubilityTable( string_array const & inputParams, - string const & functionName, - FunctionManager & functionManager ) -{ - // Check the second argument - if( inputParams[1] == "Tables" ) + // Initialize salinity and tolerance + GEOS_THROW_IF_LT_MSG( inputParams.size(), 9, + GEOS_FMT( "{}: insufficient number of model parameters", functionName ), + InputError ); + + real64 tolerance = 1e-9; + real64 salinity = 0.0; + try { - string const inputTableName = inputParams[2]; - if( inputTableName.empty()) + salinity = stod( inputParams[8] ); + if( inputParams.size() >= 10 ) { - return makeZeroTable( GEOS_FMT( "{}_zeroDissolution_table", CO2Solubility::catalogName() ), functionManager ); - } - else - { - GEOS_THROW_IF( !functionManager.hasGroup< TableFunction >( inputTableName ), - GEOS_FMT( "{}: Could not find TableFunction with name {}", functionName, inputTableName ), - InputError ); - return getSolubilityTable( inputTableName, functionManager ); + tolerance = stod( inputParams[9] ); } } + catch( const std::invalid_argument & e ) + { + GEOS_THROW( GEOS_FMT( "{}: invalid model parameter value: {}", functionName, e.what() ), InputError ); + } - string const tableName = functionName + "_co2Dissolution_table"; + integer const nPressures = tableCoords.nPressures(); + integer const nTemperatures = tableCoords.nTemperatures(); - if( functionManager.hasGroup< TableFunction >( tableName ) ) + array1d< real64 > co2Solubility( nPressures * nTemperatures ); + array1d< real64 > h2oSolubility( nPressures * nTemperatures ); + + if( solubilityModel == constitutive::PVTProps::CO2Solubility::SolubilityModel::DuanSun ) { - return getSolubilityTable( tableName, functionManager ); + constitutive::PVTProps::CO2SolubilityDuanSun::populateSolubilityTables( + functionName, + tableCoords, + salinity, + tolerance, + co2Solubility, + h2oSolubility ); } - else + else if( solubilityModel == constitutive::PVTProps::CO2Solubility::SolubilityModel::SpycherPruess ) { - // initialize the (p,T) coordinates - PTTableCoordinates tableCoords; - PVTFunctionHelpers::initializePropertyTable( inputParams, tableCoords ); - - // initialize salinity and tolerance - GEOS_THROW_IF_LT_MSG( inputParams.size(), 9, - GEOS_FMT( "{}: insufficient number of model parameters", functionName ), - InputError ); - - real64 tolerance = 1e-9; - real64 salinity = 0.0; - try + constitutive::PVTProps::CO2SolubilitySpycherPruess::populateSolubilityTables( + functionName, + tableCoords, + salinity, + tolerance, + co2Solubility, + h2oSolubility ); + } + + // Truncate negative solubility and warn + integer constexpr maxBad = 5; // Maximum number of bad values to report + stackArray2d< real64, maxBad *4 > badValues( maxBad, 4 ); + integer badCount = 0; + for( localIndex i = 0; i < nPressures; ++i ) + { + real64 const P = tableCoords.getPressure( i ); + for( localIndex j = 0; j < nTemperatures; ++j ) { - salinity = stod( inputParams[8] ); - if( inputParams.size() >= 10 ) + real64 const T = tableCoords.getTemperature( j ); + if( co2Solubility[j*nPressures+i] < 0.0 || h2oSolubility[j*nPressures+i] < 0.0 ) { - tolerance = stod( inputParams[9] ); + badValues( badCount % maxBad, 0 ) = P; + badValues( badCount % maxBad, 1 ) = T; + badValues( badCount % maxBad, 2 ) = co2Solubility[j*nPressures+i]; + badValues( badCount % maxBad, 3 ) = h2oSolubility[j*nPressures+i]; + ++badCount; + } + if( co2Solubility[j*nPressures+i] < 0.0 ) + { + co2Solubility[j*nPressures+i] = 0.0; + } + if( h2oSolubility[j*nPressures+i] < 0.0 ) + { + h2oSolubility[j*nPressures+i] = 0.0; } } - catch( const std::invalid_argument & e ) - { - GEOS_THROW( GEOS_FMT( "{}: invalid model parameter value: {}", functionName, e.what() ), InputError ); - } - - array1d< real64 > values( tableCoords.nPressures() * tableCoords.nTemperatures() ); - calculateCO2Solubility( functionName, tolerance, tableCoords, salinity, values ); - - return makeSolubilityTable( tableCoords.getCoords(), values, tableName, functionManager ); } -} -TableFunction const * makeVapourisationTable( string_array const & inputParams, - string const & functionName, - FunctionManager & functionManager ) -{ - if( inputParams[1] == "Tables" ) + if( 0 < badCount ) { - string const inputTableName = inputParams[3]; - if( inputTableName.empty()) - { - return makeZeroTable( GEOS_FMT( "{}_zeroDissolution_table", CO2Solubility::catalogName() ), functionManager ); - } - else + std::ostringstream badValueTable; + badValueTable + << std::setw( 15 ) << "Pressure (Pa)" << " " + << std::setw( 15 ) << "Temperature (C)" << " " + << std::setw( 23 ) << "CO2 solubility (mol/kg)" << " " + << std::setw( 23 ) << "H2O solubility (mol/kg)" << " "; + for( integer row = 0; row < LvArray::math::min( maxBad, badCount ); ++row ) { - GEOS_THROW_IF( !functionManager.hasGroup< TableFunction >( inputTableName ), - GEOS_FMT( "{}: Could not find TableFunction with name {}", functionName, inputTableName ), - InputError ); - return getSolubilityTable( inputTableName, functionManager ); + badValueTable + << "\n" + << std::setw( 15 ) << badValues( row, 0 ) << " " + << std::setw( 15 ) << badValues( row, 1 ) << " " + << std::setw( 23 ) << badValues( row, 2 ) << " " + << std::setw( 23 ) << badValues( row, 3 ) << " "; } + GEOS_LOG_RANK_0( GEOS_FMT( "CO2Solubility: {} negative solubility values encountered. These will be truncated to zero.\nCheck out report table with max {} values.\n{}", + badCount, maxBad, badValueTable.str() ) ); } - string const tableName = functionName + "_waterVaporization_table"; - - if( functionManager.hasGroup< TableFunction >( tableName ) ) - { - return getSolubilityTable( tableName, functionManager ); - } - else - { - // initialize the (p,T) coordinates - PTTableCoordinates tableCoords; - PVTFunctionHelpers::initializePropertyTable( inputParams, tableCoords ); - - // Currently initialise to all zeros - array1d< real64 > values( tableCoords.nPressures() * tableCoords.nTemperatures() ); - values.zero(); - - return makeSolubilityTable( tableCoords.getCoords(), values, tableName, functionManager ); - } + TableFunction const * co2SolubilityTable = makeTable( co2TableName, tableCoords, std::move( co2Solubility ), functionManager ); + TableFunction const * h2oSolubilityTable = makeTable( h2oTableName, tableCoords, std::move( h2oSolubility ), functionManager ); + return {co2SolubilityTable, h2oSolubilityTable}; } } // namespace +namespace constitutive +{ +namespace PVTProps +{ + CO2Solubility::CO2Solubility( string const & name, string_array const & inputParams, string_array const & phaseNames, @@ -389,8 +244,18 @@ CO2Solubility::CO2Solubility( string const & name, string const expectedWaterPhaseNames[] = { "Water", "water", "Liquid", "liquid" }; m_phaseLiquidIndex = PVTFunctionHelpers::findName( phaseNames, expectedWaterPhaseNames, "phaseNames" ); - m_CO2SolubilityTable = makeSolubilityTable( inputParams, m_modelName, FunctionManager::getInstance() ); - m_WaterVapourisationTable = makeVapourisationTable( inputParams, m_modelName, FunctionManager::getInstance() ); + SolubilityModel solubilityModel = SolubilityModel::DuanSun; // Default solubility model + if( inputParams[1] == EnumStrings< SolubilityModel >::toString( SolubilityModel::Tables ) ) + { + solubilityModel = SolubilityModel::Tables; + } + else if( 11 <= inputParams.size() ) + { + solubilityModel = EnumStrings< SolubilityModel >::fromString( inputParams[10] ); + } + + std::tie( m_CO2SolubilityTable, m_WaterVapourisationTable ) = makeSolubilityTables( m_modelName, inputParams, solubilityModel ); + if( printTable ) { m_CO2SolubilityTable->print( m_CO2SolubilityTable->getName() ); @@ -418,8 +283,6 @@ CO2Solubility::KernelWrapper CO2Solubility::createKernelWrapper() const m_phaseLiquidIndex ); } -REGISTER_CATALOG_ENTRY( FlashModelBase, CO2Solubility, string const &, string_array const &, string_array const &, string_array const &, array1d< real64 > const &, bool const ) - } // end namespace PVTProps } // namespace constitutive diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp index bc0492008fa..9221c48503b 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp @@ -103,7 +103,14 @@ class CO2SolubilityUpdate final : public FlashModelBaseUpdate class CO2Solubility : public FlashModelBase { public: + enum class SolubilityModel : integer + { + DuanSun, + SpycherPruess, + Tables + }; +public: CO2Solubility( string const & name, string_array const & inputParams, string_array const & phaseNames, @@ -130,7 +137,6 @@ class CO2Solubility : public FlashModelBase KernelWrapper createKernelWrapper() const; private: - /// Table to compute solubility as a function of pressure and temperature TableFunction const * m_CO2SolubilityTable; @@ -332,6 +338,11 @@ CO2SolubilityUpdate::compute( real64 const & pressure, } } +ENUM_STRINGS( CO2Solubility::SolubilityModel, + "DuanSun", + "SpycherPruess", + "Tables" ); + } // end namespace PVTProps } // end namespace constitutive diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.cpp new file mode 100644 index 00000000000..cc7b5f3bab2 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.cpp @@ -0,0 +1,222 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file CO2SolubilityDuanSun.cpp + */ + +#include "constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.hpp" +#include "constitutive/fluid/multifluid/CO2Brine/functions/CO2EOSSolver.hpp" + +#include "common/Units.hpp" + +namespace geos +{ +namespace constitutive +{ +namespace PVTProps +{ + +namespace +{ + +constexpr real64 P_Pa_f = 1e+5; +constexpr real64 P_c = 73.773 * P_Pa_f; +constexpr real64 T_c = 304.1282; +constexpr real64 Rgas = constants::gasConstant; +constexpr real64 V_c = Rgas*T_c/P_c; + +// these coefficients are in Table (A1) of Duan and Sun (2003) +constexpr real64 acoef[] = +{ 8.99288497e-2, -4.94783127e-1, 4.77922245e-2, 1.03808883e-2, -2.82516861e-2, 9.49887563e-2, 5.20600880e-4, + -2.93540971e-4, -1.77265112e-3, -2.51101973e-5, 8.93353441e-5, 7.88998563e-5, -1.66727022e-2, 1.398, 2.96e-2 }; + +real64 co2EOS( real64 const & T, real64 const & P, real64 const & V_r ) +{ + // reduced pressure + real64 const P_r = P*P_Pa_f/P_c; + // reduced temperature + real64 const T_r = units::convertCToK( T )/T_c; + + // CO2 equation of state + // see equation (A1) in Duan and Sun (2003) + real64 const f_Z = 1.0 + + ( acoef[0] + acoef[1]/(T_r * T_r) + acoef[2]/(T_r * T_r * T_r) )/V_r + + ( acoef[3] + acoef[4]/(T_r * T_r) + acoef[5]/(T_r * T_r * T_r) )/(V_r*V_r) + + ( acoef[6] + acoef[7]/(T_r * T_r) + acoef[8]/(T_r * T_r * T_r) )/(V_r*V_r*V_r*V_r) + + ( acoef[9] + acoef[10]/(T_r * T_r) + acoef[11]/(T_r * T_r * T_r) )/(V_r*V_r*V_r*V_r*V_r) + + acoef[12]/(T_r * T_r * T_r)/(V_r * V_r) * (acoef[13] + acoef[14]/(V_r * V_r)) * exp( -acoef[14]/(V_r * V_r)) - P_r * V_r / T_r; + + return f_Z; +} + +real64 PWater( real64 const & T ) +{ + // these coefficients are defined in Table (B1) of Duan and Sun (2003) + constexpr real64 ccoef[] = { -38.640844, 5.8948420, 59.876516, 26.654627, 10.637097 }; + + // H2O critical pressure (bars) + real64 const P_c_w = 220.85; + // H2O critical temperature (K) + real64 const T_c_w = 647.29; + real64 const tt = ( units::convertCToK( T )-T_c_w )/T_c_w; + // Empirical model for water pressure of equation (B1) of Duan and Sun (2003) + real64 const x = ( P_c_w*units::convertCToK( T )/T_c_w ) + * (1 + + ccoef[0]*pow( -tt, 1.9 ) + + ccoef[1]*tt + + ccoef[2]*tt*tt + + ccoef[3]*tt*tt*tt + + ccoef[4]*tt*tt*tt*tt); + + return x; +} + +real64 logF( real64 const & T, real64 const & P, real64 const & V_r ) +{ + // reduced pressure + real64 const P_r = P*P_Pa_f/P_c; + // reduced temperature + real64 const T_r = units::convertCToK( T ) / T_c; + real64 const Z = P_r * V_r/T_r; + + // fugacity coefficient of CO2, equation (A6) of Duan and Sun (2003) + real64 const log_f = Z - 1 - log( Z ) + + ( acoef[0] + acoef[1]/T_r/T_r + acoef[2]/T_r/T_r/T_r )/V_r + + ( acoef[3] + acoef[4]/T_r/T_r + acoef[5]/T_r/T_r/T_r )/2.0/V_r/V_r + + ( acoef[6] + acoef[7]/T_r/T_r + acoef[8]/T_r/T_r/T_r )/4.0/V_r/V_r/V_r/V_r + + ( acoef[9] + acoef[10]/T_r/T_r + acoef[11]/T_r/T_r/T_r )/5.0/V_r/V_r/V_r/V_r/V_r + + acoef[12]/2.0/T_r/T_r/T_r/acoef[14] * ( acoef[13] + 1.0 - (acoef[13] + 1.0 + acoef[14]/V_r/V_r) * exp( -acoef[14]/V_r/V_r ) ); + + return log_f; +} + +real64 Par( real64 const & T, real64 const & P, real64 const * cc ) +{ + // "equation for the parameters", see equation (7) of Duan and Sun (2003) + real64 x = cc[0] + + cc[1]*T + + cc[2]/T + + cc[3]*T*T + + cc[4]/(630.0-T) + + cc[5]*P + + cc[6]*P *log( T ) + + cc[7]*P/T + + cc[8]*P/(630.0-T) + + cc[9]*P*P/(630.0-T)/(630.0-T) + + cc[10]*T *log( P ); + + return x; +} + +real64 CO2SolubilityFunction( string const & name, + real64 const & tolerance, + real64 const & T, + real64 const & P, + real64 (* f)( real64 const & x1, real64 const & x2, real64 const & x3 ) ) +{ + // compute the initial guess for Newton's method + real64 const initialReducedVolume = 0.75*Rgas*units::convertCToK( T )/(P*P_Pa_f)*(1/V_c); + + // define the local solver parameters + // for now, this is hard-coded, but we may want to let the user access the parameters at some point + integer const maxNumNewtonIter = 500; + integer const maxNumBacktrackIter = 8; + real64 const maxAbsUpdate = 1e12; + real64 const minAbsDeriv = 0; + real64 const allowedMinValue = 0.05; // value chosen to match previous implementation + real64 const presMultiplierForReporting = 1e5; // this is because P is in hectopascal in this function + + // solve the CO2 equation of state for this pair of (pres, temp) + // return the reduced volume + return CO2EOSSolver::solve( name, + maxNumNewtonIter, + maxNumBacktrackIter, + tolerance, + minAbsDeriv, + maxAbsUpdate, + allowedMinValue, + initialReducedVolume, + T, + P, + presMultiplierForReporting, + f ); +} + +void calculateCO2Solubility( string const & functionName, + real64 const & tolerance, + PTTableCoordinates const & tableCoords, + real64 const & salinity, + array1d< real64 > const & values ) +{ + // Interaction parameters, see Table 2 of Duan and Sun (2003) + constexpr real64 mu[] = + { 28.9447706, -0.0354581768, -4770.67077, 1.02782768e-5, 33.8126098, 9.04037140e-3, + -1.14934031e-3, -0.307405726, -0.0907301486, 9.32713393e-4, 0 }; + constexpr real64 lambda[] = { -0.411370585, 6.07632013e-4, 97.5347708, 0, 0, 0, 0, -0.0237622469, 0.0170656236, 0, 1.41335834e-5 }; + constexpr real64 zeta[] = { 3.36389723e-4, -1.98298980e-5, 0, 0, 0, 0, 0, 2.12220830e-3, -5.24873303e-3, 0, 0 }; + + localIndex const nPressures = tableCoords.nPressures(); + localIndex const nTemperatures = tableCoords.nTemperatures(); + + for( localIndex i = 0; i < nPressures; ++i ) + { + real64 const P = tableCoords.getPressure( i ) / P_Pa_f; + + for( localIndex j = 0; j < nTemperatures; ++j ) + { + real64 const T = tableCoords.getTemperature( j ); + + // compute reduced volume by solving the CO2 equation of state + real64 const V_r = CO2SolubilityFunction( functionName, tolerance, T, P, &co2EOS ); + + // compute equation (6) of Duan and Sun (2003) + real64 const logK = Par( units::convertCToK( T ), P, mu ) + - logF( T, P, V_r ) + + 2*Par( units::convertCToK( T ), P, lambda ) * salinity + + Par( units::convertCToK( T ), P, zeta ) * salinity * salinity; + real64 const expLogK = exp( logK ); + + // mole fraction of CO2 in vapor phase, equation (4) of Duan and Sun (2003) + real64 const Pw = PWater( T ); + real64 const y_CO2 = (P - Pw)/P; + values[j*nPressures+i] = y_CO2 * P / expLogK; + + GEOS_WARNING_IF( expLogK <= 1e-10, + GEOS_FMT( "CO2Solubility: exp(logK) = {} is too small (logK = {}, P = {}, T = {}, V_r = {}), resulting solubility value is {}", + expLogK, logK, P, T, V_r, values[j*nPressures+i] )); + } + } +} + +} // end namespace + +void CO2SolubilityDuanSun::populateSolubilityTables( string const & functionName, + PTTableCoordinates const & tableCoords, + real64 const & salinity, + real64 const & tolerance, + array1d< real64 > const & co2SolubilityValues, + array1d< real64 > const & h2oSolubilityValues ) +{ + h2oSolubilityValues.zero(); + calculateCO2Solubility( functionName, + tolerance, + tableCoords, + salinity, + co2SolubilityValues ); +} + +} // end namespace PVTProps +} // namespace constitutive +} // end namespace geos diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.hpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.hpp new file mode 100644 index 00000000000..f0db58369b3 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilityDuanSun.hpp @@ -0,0 +1,57 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file CO2SolubilityDuanSun.hpp + */ + +#ifndef GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_CO2SOLUBILITYDUANSUN_HPP_ +#define GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_CO2SOLUBILITYDUANSUN_HPP_ + +#include "constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp" + +namespace geos +{ +namespace constitutive +{ +namespace PVTProps +{ + +struct CO2SolubilityDuanSun +{ +/** + * @brief Create CO2 and H2O solubility table based on Duan and Sun (2003) + * @details Each generated table is a 2D table with lookup properties pressure (in Pa) and + * temperature (in degC). The returned CO2 solubility is in mole of CO2 per kg of + * H2O and the returned water vapourisation is in moles of H2O per kg of CO2. + * @param[in] functionName The name of the model + * @param[in] tableCoords The values of pressure and temperature + * @param[in] salinity The salinity of the brine + * @param[in] tolerance Tolerance to be used in solving for the solubility + * @param[out] co2SolubilityValues The CO2 solubility values (mol/kg) at the given pressures and temperatures + * @param[out] h2oSolubilityValues The H2O solubility values (mol/kg) at the given pressures and temperatures + */ + static void populateSolubilityTables( string const & functionName, + PTTableCoordinates const & tableCoords, + real64 const & salinity, + real64 const & tolerance, + array1d< real64 > const & co2SolubilityValues, + array1d< real64 > const & h2oSolubilityValues ); +}; + +} // end namespace PVTProps +} // end namespace constitutive +} // end namespace geos + +#endif //GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_CO2SOLUBILITYDUANSUN_HPP_ diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.cpp new file mode 100644 index 00000000000..70c4425a9b3 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.cpp @@ -0,0 +1,202 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file CO2SolubilitySpycherPruess.cpp + */ + +#include "CO2SolubilitySpycherPruess.hpp" +#include "constitutive/fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.hpp" +#include "common/Units.hpp" + +namespace geos +{ + +namespace +{ +/** + * Physical constants + * These correlations are developed with units: pressure [bar], volume [cm3], temperature [K]. + * The equilibrium constant correlations (equilibriumConstantCO2 and equilibriumConstantH2O) have a temperature in C + */ +static constexpr real64 P_ref = 1.0; // Reference pressure is 1 bar +static constexpr real64 Pa_2_bar = 1.0e-5; // Conversion factor from Pa to Bar +static constexpr real64 R = 10.0*constants::gasConstant; // Universal gas constant in [bar.cm3/mol.K] +static constexpr real64 molarMassCO2 = 44.01e-3; // Molar mass of CO2 [kg/mol] +static constexpr real64 molarMassH2O = 18.01e-3; // Molar mass of H2O [kg/mol] +static constexpr real64 v_av_H2O = 18.1; // Average partial molar volume of H2O [cm3/mol] +static constexpr real64 v_av_CO2 = 32.6; // Average partial molar volume of CO2 [cm3/mol] + +/** + * @brief Calculate the CO2 equilibrium constant from Spycher et al. (2003) + * @details The correlation parameters are given in Table 2 of Spycher et al. (2003) + * @param[in] T Temperature [C] + */ +real64 equilibriumConstantCO2( real64 const T ) +{ + constexpr real64 c[] = {1.189, 1.304e-2, -5.446e-5}; + real64 const logk0_CO2 = c[0] + T * (c[1] + T * c[2]); + return pow( 10.0, logk0_CO2 ); +} + +/** + * @brief Calculate the H2O equilibrium constant from Spycher et al. (2003) + * @details The correlation parameters are given in Table 2 of Spycher et al. (2003) + * @param[in] T Temperature [C] + */ +real64 equilibriumConstantH2O( real64 const T ) +{ + constexpr real64 c[] = {-2.209, 3.097e-2, -1.098e-4, 2.048e-7}; + real64 const logk0_H2O = c[0] + T * (c[1] + T * (c[2] + T* c[3])); + return pow( 10.0, logk0_H2O ); +} + +/** + * @brief Calculate the fugacity coefficient of CO2 from the RK-EOS + * @param[in] P Pressure [bar] + * @param[in] T Temperature [K] + * @param[in] rhoCO2 Density of CO2 [kg/m3] + * @param[in] salinity Salinity of water + */ +real64 fugacityCoefficientCO2( real64 const P, real64 const T, real64 const rhoCO2, real64 const salinity ) +{ + GEOS_UNUSED_VAR( salinity ); + real64 const V = 1.0e6*molarMassCO2/rhoCO2; // Molar volume [cm3/mol] + + // Mixture parameters from the tuned Redlich-Kwong EOS + // These values are given in Table 1 of Spycher et al. (2003) + real64 const a_CO2 = (7.54e7 - 4.13e4*T); // [bar.cm3.K^(1/2)/mol^2] + real64 constexpr b_CO2 = 27.8; // [cm3/mol] + + real64 const lnPhiCO2 = log( V/(V - b_CO2)) + b_CO2/(V - b_CO2) + - 2*a_CO2/(R*pow( T, 1.5 )*b_CO2)*log((V + b_CO2)/V ) + + a_CO2*b_CO2/(R*pow( T, 1.5 )*b_CO2*b_CO2) * (log((V + b_CO2)/V ) - b_CO2/(V + b_CO2)) + - log( P*V/(R*T)); + return exp( lnPhiCO2 ); +} + +/** + * @brief Calculate the fugacity coefficient of CO2 from the RK-EOS + * @param[in] P Pressure [bar] + * @param[in] T Temperature [K] + * @param[in] rhoCO2 Density of CO2 [kg/m3] + * @param[in] salinity Salinity of water + */ +real64 fugacityCoefficientH2O( real64 const P, real64 const T, real64 const rhoCO2, real64 const salinity ) +{ + GEOS_UNUSED_VAR( salinity ); + real64 const V = 1.0e6*molarMassCO2/rhoCO2; // Molar volume [cm3/mol] + + // Mixture parameters from the tuned Redlich-Kwong EOS + // These values are given in Table 1 of Spycher et al. (2003) + real64 const a_CO2 = (7.54e7 - 4.13e4*T); // [bar.cm3.K^(1/2)/mol^2] + real64 constexpr a_CO2_H2O = 7.89e7; // [bar.cm3.K^(1/2)/mol^2] + real64 constexpr b_CO2 = 27.8; // [cm3/mol] + real64 constexpr b_H2O = 18.18; // [cm3/mol] + + real64 const lnPhiH2O = log( V/(V - b_CO2) ) + b_H2O/(V - b_CO2) + - 2.0 * a_CO2_H2O * log( (V + b_CO2)/V ) / ( R*pow( T, 1.5 )*b_CO2 ) + + a_CO2 * b_H2O / ( R*pow( T, 1.5 )*b_CO2*b_CO2 )*( log( (V + b_CO2)/V ) - b_CO2/(V + b_CO2) ) + - log( P*V/(R*T) ); + return exp( lnPhiH2O ); +} + +/** + * @brief Calculate the parameter A from Eq (11) of Spycher et al. (2003) + * @param[in] P Pressure [Pa] + * @param[in] T Temperature [C] + * @param[in] rhoCO2 CO2 density [kg/m3] + * @param[in] salinity Salinity of the water + */ +real64 computeA( real64 const P, real64 const T, real64 const rhoCO2, real64 const salinity ) +{ + real64 const P_in_bar = P * Pa_2_bar; + real64 const deltaP = P_in_bar - P_ref; + real64 const TinK = units::convertCToK( T ); + real64 const k0_H2O = equilibriumConstantH2O( T ); // K-value for H2O at 1 bar + real64 const phi_H2O = fugacityCoefficientH2O( P_in_bar, TinK, rhoCO2, salinity ); // Fugacity coefficient of H2O for the water-CO2 system + real64 const A = k0_H2O/(phi_H2O*P_in_bar) * exp( deltaP*v_av_H2O/(R*TinK)); + return A; +} + +/** + * @brief Calculate the parameter B from Eq (12) of Spycher et al. (2003) + * @param[in] P Pressure [Pa] + * @param[in] T Temperature [C] + * @param[in] rhoCO2 CO2 density [kg/m3] + * @param[in] salinity Salinity of the water + */ +real64 computeB( real64 const P, real64 const T, real64 const rhoCO2, real64 const salinity ) +{ + real64 const P_in_bar = P * Pa_2_bar; + real64 const deltaP = P_in_bar - P_ref; + real64 const TinK = units::convertCToK( T ); + real64 const k0_CO2 = equilibriumConstantCO2( T ); // K-value for CO2 at 1 bar + real64 const phi_CO2 = fugacityCoefficientCO2( P_in_bar, TinK, rhoCO2, salinity ); // Fugacity coefficient of CO2 for the water-CO2 system + real64 const B = phi_CO2*P_in_bar/(55.508*k0_CO2) * exp( -(deltaP*v_av_CO2)/(R*TinK) ); + return B; +} +} // end namespace + +namespace constitutive +{ +namespace PVTProps +{ +void CO2SolubilitySpycherPruess::populateSolubilityTables( string const & functionName, + PTTableCoordinates const & tableCoords, + real64 const & salinity, + real64 const & tolerance, + array1d< real64 > const & co2SolubilityValues, + array1d< real64 > const & h2oSolubilityValues ) +{ + localIndex const nPressures = tableCoords.nPressures(); + localIndex const nTemperatures = tableCoords.nTemperatures(); + + // Calculate the CO2 density + array1d< real64 > densities( nPressures*nTemperatures ); + SpanWagnerCO2Density::calculateCO2Density( GEOS_FMT( "{}_co2_density", functionName ), + tolerance, + tableCoords, + densities ); + + for( localIndex i = 0; i < nPressures; ++i ) + { + real64 const P = tableCoords.getPressure( i ); + + for( localIndex j = 0; j < nTemperatures; ++j ) + { + real64 const T = tableCoords.getTemperature( j ); + + // Get the CO2 density + real64 const rhoCO2 = densities[j*nPressures+i]; + + // Calculate A and B + real64 const A = computeA( P, T, rhoCO2, salinity ); + real64 const B = computeB( P, T, rhoCO2, salinity ); + + // Calculate the mole fractions + // Eqns (13) and (14) from Spycher et al. (2003) + real64 const y_H2O = (1.0 - B)/(1.0/A - B); + real64 const x_CO2 = B*(1.0 - y_H2O); + + // Calculate the solubility + co2SolubilityValues[j*nPressures+i] = x_CO2/((1.0 - x_CO2)*molarMassH2O); + h2oSolubilityValues[j*nPressures+i] = y_H2O/((1.0 - y_H2O)*molarMassCO2); + } + } +} + +} // end namespace PVTProps +} // namespace constitutive +} // end namespace geos diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.hpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.hpp new file mode 100644 index 00000000000..01c71019b86 --- /dev/null +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2SolubilitySpycherPruess.hpp @@ -0,0 +1,59 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file CO2SolubilitySpycherPruess.hpp + */ + +#ifndef GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_CO2SOLUBILITYSPYCHERPRUESS_HPP_ +#define GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_CO2SOLUBILITYSPYCHERPRUESS_HPP_ + +#include "constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp" + +namespace geos +{ +namespace constitutive +{ +namespace PVTProps +{ + +struct CO2SolubilitySpycherPruess +{ + +/** + * @brief Create CO2 and H2O solubility table based on Spycher, Pruess, Ennis-King (2003) + * @details Each generated table is a 2D table with lookup properties pressure (in Pa) and + * temperature (in degC). The returned CO2 solubility is in mole of CO2 per kg of + * H2O and the returned water vapourisation is in moles of H2O per kg of CO2. + * @param[in] functionName The name of the model + * @param[in] tableCoords The values of pressure and temperature + * @param[in] salinity The salinity of the brine + * @param[in] tolerance Tolerance to be used in solving for the solubility + * @param[out] co2SolubilityValues The CO2 solubility values (mol/kg) at the given pressures and temperatures + * @param[out] h2oSolubilityValues The H2O solubility values (mol/kg) at the given pressures and temperatures + */ + static void populateSolubilityTables( string const & functionName, + PTTableCoordinates const & tableCoords, + real64 const & salinity, + real64 const & tolerance, + array1d< real64 > const & co2SolubilityValues, + array1d< real64 > const & h2oSolubilityValues ); + +}; + +} // end namespace PVTProps +} // end namespace constitutive +} // end namespace geos + +#endif //GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_CO2SOLUBILITYSPYCHERPRUESS_HPP_ diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.cpp index 951fd1c22f6..f71c6ed46dd 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.cpp @@ -16,7 +16,6 @@ * @file PVTFunctionHelpers.cpp */ -#include "codingUtilities/StringUtilities.hpp" #include "constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp" #include "LvArray/src/sortedArrayManipulation.hpp" diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp index fd0cc5d2386..5f0e3f39276 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PVTFunctionHelpers.hpp @@ -19,6 +19,8 @@ #include "common/DataTypes.hpp" #include "common/Units.hpp" +#include "codingUtilities/StringUtilities.hpp" + #ifndef GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_PVTFUNCTIONHELPERS_HPP_ #define GEOS_CONSTITUTIVE_FLUID_MULTIFLUID_CO2BRINE_FUNCTIONS_PVTFUNCTIONHELPERS_HPP_ @@ -122,8 +124,8 @@ class PTTableCoordinates localIndex nPressures() const { return coords[coordType::PRES].size(); } localIndex nTemperatures() const { return coords[coordType::TEMP].size(); } - void appendPressure( const real64 & pres ) { coords[coordType::PRES].emplace_back( pres ); } - void appendTemperature( const real64 & temp ) { coords[coordType::TEMP].emplace_back( temp ); } + PTTableCoordinates & appendPressure( const real64 & pres ) { coords[coordType::PRES].emplace_back( pres ); return *this; } + PTTableCoordinates & appendTemperature( const real64 & temp ) { coords[coordType::TEMP].emplace_back( temp ); return *this; } real64 const & getPressure( localIndex i ) const { return coords[coordType::PRES][i]; } real64 const & getTemperature( localIndex i ) const { return coords[coordType::TEMP][i]; } diff --git a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp index f118a6a6819..93b463ccdd3 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp @@ -214,7 +214,8 @@ void ReactiveBrineFluid< PHASE >::checkTablesParameters( real64 const pressure, m_phase->enthalpy.checkTablesParameters( pressure, temperatureInCelsius ); } catch( SimulationError const & ex ) { - string const errorMsg = GEOS_FMT( "{}: Table input error.\n", getDataContext() ); + string const errorMsg = GEOS_FMT( "Table input error (in table from {}).\n", + stringutilities::join( m_phasePVTParaFiles ) ); throw SimulationError( ex, errorMsg ); } } diff --git a/src/coreComponents/constitutive/solid/CompressibleSolid.hpp b/src/coreComponents/constitutive/solid/CompressibleSolid.hpp index db93d4a14a8..b8c37b4c07a 100644 --- a/src/coreComponents/constitutive/solid/CompressibleSolid.hpp +++ b/src/coreComponents/constitutive/solid/CompressibleSolid.hpp @@ -54,15 +54,13 @@ class CompressibleSolidUpdates : public CoupledSolidUpdates< NullModel, PORO_TYP virtual void updateStateFromPressureAndTemperature( localIndex const k, localIndex const q, real64 const & pressure, - real64 const & pressure_n, - real64 const & pressure_k, + real64 const & GEOS_UNUSED_PARAM( pressure_k ), + real64 const & GEOS_UNUSED_PARAM( pressure_n ), real64 const & temperature, - real64 const & temperature_k, - real64 const & temperature_n ) const override final + real64 const & GEOS_UNUSED_PARAM( temperature_k ), + real64 const & GEOS_UNUSED_PARAM( temperature_n ) ) const override final { - m_porosityUpdate.updateFromPressureAndTemperature( k, q, - pressure, pressure_k, pressure_n, - temperature, temperature_k, temperature_n ); + m_porosityUpdate.updateFromPressureAndTemperature( k, q, pressure, temperature ); real64 const porosity = m_porosityUpdate.getPorosity( k, q ); m_permUpdate.updateFromPorosity( k, q, porosity ); } @@ -74,15 +72,9 @@ class CompressibleSolidUpdates : public CoupledSolidUpdates< NullModel, PORO_TYP real64 const & oldHydraulicAperture, real64 const & newHydraulicAperture ) const { - real64 const pressure_k = 0; - real64 const pressure_n = 0; real64 const temperature = 0; - real64 const temperature_k = 0; - real64 const temperature_n = 0; real64 const dHydraulicAperture_dNormalJump = 1.0; - m_porosityUpdate.updateFromPressureAndTemperature( k, q, - pressure, pressure_k, pressure_n, - temperature, temperature_k, temperature_n ); + m_porosityUpdate.updateFromPressureAndTemperature( k, q, pressure, temperature ); m_permUpdate.updateFromAperture( k, q, oldHydraulicAperture, newHydraulicAperture, dHydraulicAperture_dNormalJump ); } @@ -96,7 +88,7 @@ class CompressibleSolidUpdates : public CoupledSolidUpdates< NullModel, PORO_TYP real64 const ( &dispJump )[3], real64 const ( &traction )[3] ) const { - m_porosityUpdate.updateFromPressureAndTemperature( k, q, pressure, 0.0, 0.0, 0.0, 0.0, 0.0 ); + m_porosityUpdate.updateFromPressureAndTemperature( k, q, pressure, 0.0 ); m_permUpdate.updateFromApertureAndShearDisplacement( k, q, oldHydraulicAperture, newHydraulicAperture, dHydraulicAperture_dNormalJump, pressure, dispJump, traction ); } diff --git a/src/coreComponents/constitutive/solid/PorousSolid.hpp b/src/coreComponents/constitutive/solid/PorousSolid.hpp index 67a16bef411..078ca36ce7d 100644 --- a/src/coreComponents/constitutive/solid/PorousSolid.hpp +++ b/src/coreComponents/constitutive/solid/PorousSolid.hpp @@ -62,19 +62,19 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, real64 const & temperature_k, real64 const & temperature_n ) const override final { - updateBiotCoefficientAndAssignBulkModulus( k ); + updateBiotCoefficientAndAssignModuli( k ); - m_porosityUpdate.updateFromPressureAndTemperature( k, q, - pressure, pressure_k, pressure_n, - temperature, temperature_k, temperature_n ); + m_porosityUpdate.updateFixedStress( k, q, + pressure, pressure_k, pressure_n, + temperature, temperature_k, temperature_n ); } GEOS_HOST_DEVICE void smallStrainUpdatePoromechanics( localIndex const k, localIndex const q, - real64 const & pressure_n, - real64 const & pressure, real64 const & timeIncrement, + real64 const & pressure, + real64 const & pressure_n, real64 const & temperature, real64 const & deltaTemperatureFromLastStep, real64 const ( &strainIncrement )[6], @@ -82,6 +82,7 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, real64 ( & dTotalStress_dPressure )[6], real64 ( & dTotalStress_dTemperature )[6], DiscretizationOps & stiffness, + integer const performStressInitialization, real64 & porosity, real64 & porosity_n, real64 & dPorosity_dVolStrain, @@ -92,8 +93,8 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, // Compute total stress increment and its derivative computeTotalStress( k, q, - pressure, timeIncrement, + pressure, temperature, strainIncrement, totalStress, @@ -116,6 +117,15 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, dPorosity_dPressure, dPorosity_dTemperature ); + // skip porosity update when doing poromechanics initialization + if( performStressInitialization ) + { + porosity = porosityInit; + dPorosity_dVolStrain = 0.0; + dPorosity_dPressure = 0.0; + dPorosity_dTemperature = 0.0; + } + // Save the derivative of solid density wrt pressure for the computation of the body force dSolidDensity_dPressure = m_porosityUpdate.dGrainDensity_dPressure(); } @@ -123,11 +133,11 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, GEOS_HOST_DEVICE void smallStrainUpdatePoromechanicsFixedStress( localIndex const k, localIndex const q, - real64 const & pressure_n, - real64 const & pressure, real64 const & timeIncrement, - real64 const & temperature_n, + real64 const & pressure, + real64 const & pressure_n, real64 const & temperature, + real64 const & temperature_n, real64 const ( &strainIncrement )[6], real64 ( & totalStress )[6], DiscretizationOps & stiffness ) const @@ -138,8 +148,8 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, // Compute total stress increment and its derivative computeTotalStress( k, q, - pressure, timeIncrement, + pressure, temperature, strainIncrement, totalStress, @@ -148,7 +158,6 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, stiffness ); // Compute total stress increment for the porosity update - GEOS_UNUSED_VAR( pressure_n, temperature_n ); real64 const bulkModulus = m_solidUpdate.getBulkModulus( k ); real64 const meanEffectiveStressIncrement = bulkModulus * ( strainIncrement[0] + strainIncrement[1] + strainIncrement[2] ); real64 const biotCoefficient = m_porosityUpdate.getBiotCoefficient( k ); @@ -211,12 +220,13 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, GEOS_HOST_DEVICE inline - void updateBiotCoefficientAndAssignBulkModulus( localIndex const k ) const + void updateBiotCoefficientAndAssignModuli( localIndex const k ) const { // This call is not general like this. real64 const bulkModulus = m_solidUpdate.getBulkModulus( k ); + real64 const shearModulus = m_solidUpdate.getShearModulus( k ); - m_porosityUpdate.updateBiotCoefficientAndAssignBulkModulus( k, bulkModulus ); + m_porosityUpdate.updateBiotCoefficientAndAssignModuli( k, bulkModulus, shearModulus ); } GEOS_HOST_DEVICE @@ -258,8 +268,8 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, inline void computeTotalStress( localIndex const k, localIndex const q, - real64 const & pressure, real64 const & timeIncrement, + real64 const & pressure, real64 const & temperature, real64 const ( &strainIncrement )[6], real64 ( & totalStress )[6], @@ -267,6 +277,8 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, real64 ( & dTotalStress_dTemperature )[6], DiscretizationOps & stiffness ) const { + updateBiotCoefficientAndAssignModuli( k ); + // Compute total stress increment and its derivative w.r.t. pressure m_solidUpdate.smallStrainUpdate( k, q, @@ -275,8 +287,6 @@ class PorousSolidUpdates : public CoupledSolidUpdates< SOLID_TYPE, BiotPorosity, totalStress, // first effective stress increment accumulated stiffness ); - updateBiotCoefficientAndAssignBulkModulus( k ); - // Add the contributions of pressure and temperature to the total stress real64 const biotCoefficient = m_porosityUpdate.getBiotCoefficient( k ); real64 const thermalExpansionCoefficient = m_solidUpdate.getThermalExpansionCoefficient( k ); diff --git a/src/coreComponents/constitutive/solid/SolidBase.hpp b/src/coreComponents/constitutive/solid/SolidBase.hpp index 6e8f6264817..79292fd8bee 100644 --- a/src/coreComponents/constitutive/solid/SolidBase.hpp +++ b/src/coreComponents/constitutive/solid/SolidBase.hpp @@ -699,10 +699,6 @@ class SolidBase : public constitutive::ConstitutiveBase /// Flag to disable inelasticity (plasticity, damage, etc.) bool m_disableInelasticity = false; - - /// band-aid fix...going to have to remove this after we clean up - /// initialization for constitutive models. - bool m_postProcessed = false; }; } // namespace constitutive diff --git a/src/coreComponents/constitutive/solid/porosity/BiotPorosity.cpp b/src/coreComponents/constitutive/solid/porosity/BiotPorosity.cpp index 1494de982b9..861bfed8fe5 100644 --- a/src/coreComponents/constitutive/solid/porosity/BiotPorosity.cpp +++ b/src/coreComponents/constitutive/solid/porosity/BiotPorosity.cpp @@ -40,6 +40,11 @@ BiotPorosity::BiotPorosity( string const & name, Group * const parent ): setInputFlag( InputFlags::OPTIONAL ). setDescription( "Default thermal expansion coefficient" ); + registerWrapper( viewKeyStruct::useUniaxialFixedStressString(), &m_useUniaxialFixedStress ). + setApplyDefaultValue( 0 ). + setInputFlag( InputFlags::OPTIONAL ). + setDescription( "Flag enabling uniaxial approximation in fixed stress update" ); + registerField( fields::porosity::biotCoefficient{}, &m_biotCoefficient ). setApplyDefaultValue( 1.0 ); // this is useful for sequential simulations, for the first flow solve // ultimately, we want to be able to load the biotCoefficient from input directly, and this won't be necessary anymore @@ -53,6 +58,10 @@ BiotPorosity::BiotPorosity( string const & name, Group * const parent ): registerWrapper( viewKeyStruct::solidBulkModulusString(), &m_bulkModulus ). setApplyDefaultValue( 1e-6 ). setDescription( "Solid bulk modulus" ); + + registerWrapper( viewKeyStruct::solidShearModulusString(), &m_shearModulus ). + setApplyDefaultValue( 1e-6 ). + setDescription( "Solid shear modulus" ); } void BiotPorosity::allocateConstitutiveData( dataRepository::Group & parent, diff --git a/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp b/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp index 918efea6b67..4d64b0d9416 100644 --- a/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp +++ b/src/coreComponents/constitutive/solid/porosity/BiotPorosity.hpp @@ -55,18 +55,22 @@ class BiotPorosityUpdates : public PorosityBaseUpdates arrayView2d< real64 > const & meanTotalStressIncrement_k, arrayView1d< real64 > const & averageMeanTotalStressIncrement_k, arrayView1d< real64 > const & bulkModulus, - real64 const & grainBulkModulus ): PorosityBaseUpdates( newPorosity, - porosity_n, - dPorosity_dPressure, - dPorosity_dTemperature, - initialPorosity, - referencePorosity ), + arrayView1d< real64 > const & shearModulus, + real64 const & grainBulkModulus, + integer const useUniaxialFixedStress ): PorosityBaseUpdates( newPorosity, + porosity_n, + dPorosity_dPressure, + dPorosity_dTemperature, + initialPorosity, + referencePorosity ), m_grainBulkModulus( grainBulkModulus ), m_thermalExpansionCoefficient( thermalExpansionCoefficient ), m_biotCoefficient( biotCoefficient ), m_bulkModulus( bulkModulus ), + m_shearModulus( shearModulus ), m_meanTotalStressIncrement_k( meanTotalStressIncrement_k ), - m_averageMeanTotalStressIncrement_k( averageMeanTotalStressIncrement_k ) + m_averageMeanTotalStressIncrement_k( averageMeanTotalStressIncrement_k ), + m_useUniaxialFixedStress( useUniaxialFixedStress ) {} GEOS_HOST_DEVICE @@ -100,74 +104,86 @@ class BiotPorosityUpdates : public PorosityBaseUpdates dPorosity_dPressure = biotSkeletonModulusInverse; dPorosity_dTemperature = -porosityThermalExpansion; - savePorosity( k, q, porosity, biotSkeletonModulusInverse ); + savePorosity( k, q, porosity, dPorosity_dPressure, dPorosity_dTemperature ); } GEOS_HOST_DEVICE - void computePorosity( real64 const & deltaPressureFromBeginningOfTimeStep, - real64 const & deltaTemperatureFromBeginningOfTimeStep, - real64 const & porosity_n, - real64 const & referencePorosity, - real64 & porosity, - real64 & dPorosity_dPressure, - real64 & dPorosity_dTemperature, - real64 const & biotCoefficient, - real64 const & thermalExpansionCoefficient, - real64 const & averageMeanTotalStressIncrement_k, - real64 const & bulkModulus ) const + void computePorosityFixedStress( real64 const & pressure, + real64 const & pressure_k, + real64 const & pressure_n, + real64 const & temperature, + real64 const & temperature_k, + real64 const & temperature_n, + real64 const & porosity_n, + real64 const & referencePorosity, + real64 & porosity, + real64 & dPorosity_dPressure, + real64 & dPorosity_dTemperature, + real64 const & biotCoefficient, + real64 const & thermalExpansionCoefficient, + real64 const & averageMeanTotalStressIncrement_k, + real64 const & bulkModulus, + real64 const & fixedStressModulus ) const { real64 const biotSkeletonModulusInverse = (biotCoefficient - referencePorosity) / m_grainBulkModulus; real64 const porosityThermalExpansion = 3 * thermalExpansionCoefficient * ( biotCoefficient - referencePorosity ); - real64 const fixedStressPressureCoefficient = biotCoefficient * biotCoefficient / bulkModulus; - real64 const fixedStressTemperatureCoefficient = 3 * biotCoefficient * thermalExpansionCoefficient; + real64 const pressureCoefficient = biotCoefficient * biotCoefficient / bulkModulus; + real64 const temperatureCoefficient = 3 * biotCoefficient * thermalExpansionCoefficient; // total stress formulation for porosity update porosity = porosity_n - + biotCoefficient * averageMeanTotalStressIncrement_k / bulkModulus // change due to stress increment (at the previous - // sequential iteration) - + biotSkeletonModulusInverse * deltaPressureFromBeginningOfTimeStep // change due to pressure increment - - porosityThermalExpansion * deltaTemperatureFromBeginningOfTimeStep; // change due to temperature increment + // change due to stress increment + + biotCoefficient * averageMeanTotalStressIncrement_k / bulkModulus + // change due to pressure increment + + biotSkeletonModulusInverse * ( pressure - pressure_n ) + pressureCoefficient * ( pressure_k - pressure_n ) + // change due to temperature increment + - porosityThermalExpansion * ( temperature - temperature_n ) + temperatureCoefficient * ( temperature_k - temperature_n ); dPorosity_dPressure = biotSkeletonModulusInverse; dPorosity_dTemperature = -porosityThermalExpansion; // Fixed-stress part - porosity += fixedStressPressureCoefficient * deltaPressureFromBeginningOfTimeStep // fixed-stress pressure term - + fixedStressTemperatureCoefficient * deltaTemperatureFromBeginningOfTimeStep; // fixed-stress temperature term + real64 const fixedStressPressureCoefficient = biotCoefficient * biotCoefficient / fixedStressModulus; + real64 const fixedStressTemperatureCoefficient = 3 * biotCoefficient * thermalExpansionCoefficient * bulkModulus / fixedStressModulus; + porosity += fixedStressPressureCoefficient * ( pressure - pressure_k ) // fixed-stress pressure term + + fixedStressTemperatureCoefficient * ( temperature - temperature_k ); // fixed-stress temperature term dPorosity_dPressure += fixedStressPressureCoefficient; dPorosity_dTemperature += fixedStressTemperatureCoefficient; } + // this function is used in flow solver + // it uses average stress increment (element-based) GEOS_HOST_DEVICE - virtual void updateFromPressureAndTemperature( localIndex const k, - localIndex const q, - real64 const & pressure, // current - real64 const & GEOS_UNUSED_PARAM( pressure_k ), // last iteration (for sequential) - real64 const & pressure_n, // last time step - real64 const & temperature, - real64 const & GEOS_UNUSED_PARAM( temperature_k ), - real64 const & temperature_n ) const override final + virtual void updateFixedStress( localIndex const k, + localIndex const q, + real64 const & pressure, + real64 const & pressure_k, + real64 const & pressure_n, + real64 const & temperature, + real64 const & temperature_k, + real64 const & temperature_n ) const { - real64 const deltaPressureFromBeginningOfTimeStep = pressure - pressure_n; - real64 const deltaTemperatureFromBeginningOfTimeStep = temperature - temperature_n; - - computePorosity( deltaPressureFromBeginningOfTimeStep, - deltaTemperatureFromBeginningOfTimeStep, - m_porosity_n[k][q], - m_referencePorosity[k], - m_newPorosity[k][q], - m_dPorosity_dPressure[k][q], - m_dPorosity_dTemperature[k][q], - m_biotCoefficient[k], - m_thermalExpansionCoefficient[k], - m_averageMeanTotalStressIncrement_k[k], - m_bulkModulus[k] ); + real64 const fixedStressModulus = m_useUniaxialFixedStress ? (m_bulkModulus[k] + 4 * m_shearModulus[k] / 3) : m_bulkModulus[k]; + + computePorosityFixedStress( pressure, pressure_k, pressure_n, + temperature, temperature_k, temperature_n, + m_porosity_n[k][q], + m_referencePorosity[k], + m_newPorosity[k][q], + m_dPorosity_dPressure[k][q], + m_dPorosity_dTemperature[k][q], + m_biotCoefficient[k], + m_thermalExpansionCoefficient[k], + m_averageMeanTotalStressIncrement_k[k], + m_bulkModulus[k], + fixedStressModulus ); } GEOS_HOST_DEVICE - void updateBiotCoefficientAndAssignBulkModulus( localIndex const k, - real64 const bulkModulus ) const + void updateBiotCoefficientAndAssignModuli( localIndex const k, + real64 const bulkModulus, real64 const shearModulus ) const { m_bulkModulus[k] = bulkModulus; + m_shearModulus[k] = shearModulus; m_biotCoefficient[k] = 1 - bulkModulus / m_grainBulkModulus; } @@ -193,12 +209,17 @@ class BiotPorosityUpdates : public PorosityBaseUpdates /// View on the bulk modulus (updated by PorousSolid) arrayView1d< real64 > const m_bulkModulus; + /// View on the shear modulus (updated by PorousSolid) + arrayView1d< real64 > const m_shearModulus; + /// View on the mean total stress increment at quadrature points (updated by PorousSolid) arrayView2d< real64 > const m_meanTotalStressIncrement_k; /// View on the average mean total stress increment arrayView1d< real64 > const m_averageMeanTotalStressIncrement_k; + /// Flag enabling uniaxial approximation in fixed stress update + integer m_useUniaxialFixedStress; }; class BiotPorosity : public PorosityBase @@ -223,7 +244,11 @@ class BiotPorosity : public PorosityBase static constexpr char const *solidBulkModulusString() { return "solidBulkModulus"; } + static constexpr char const *solidShearModulusString() { return "solidShearModulus"; } + static constexpr char const *defaultThermalExpansionCoefficientString() { return "defaultPorosityTEC"; } + + static constexpr char const *useUniaxialFixedStressString() { return "useUniaxialFixedStress"; } } viewKeys; virtual void initializeState() const override final; @@ -273,7 +298,9 @@ class BiotPorosity : public PorosityBase m_meanTotalStressIncrement_k, m_averageMeanTotalStressIncrement_k, m_bulkModulus, - m_grainBulkModulus ); + m_shearModulus, + m_grainBulkModulus, + m_useUniaxialFixedStress ); } protected: @@ -292,6 +319,9 @@ class BiotPorosity : public PorosityBase /// Bulk modulus (updated in the update class, not read in input) array1d< real64 > m_bulkModulus; + /// Shear modulus (updated in the update class, not read in input) + array1d< real64 > m_shearModulus; + /// Mean total stress increment (updated in the update class, not read in input) array2d< real64 > m_meanTotalStressIncrement_k; @@ -300,6 +330,9 @@ class BiotPorosity : public PorosityBase /// Grain bulk modulus (read from XML) real64 m_grainBulkModulus; + + /// Flag enabling uniaxial approximation in fixed stress update + integer m_useUniaxialFixedStress; }; } /* namespace constitutive */ diff --git a/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp b/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp index 4485e30c089..595b8354fe1 100644 --- a/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp +++ b/src/coreComponents/constitutive/solid/porosity/PorosityBase.hpp @@ -58,27 +58,6 @@ class PorosityBaseUpdates m_referencePorosity ( referencePorosity ) {} - /** - * @brief Helper to save point stress back to m_newPorosity array - * - * This is mostly defined for improving code readability. - * - * @param[in] k Element index. - * @param[in] q Quadrature point index. - * @param[in] porosity porosity to be saved to m_newPorosity[k][q] - * @param[in] dPorosity_dPressure porosity derivative w.r.t pressure to be saved to m_dPorosity_dPressure[k][q] - */ - GEOS_HOST_DEVICE - inline - void savePorosity( localIndex const k, - localIndex const q, - real64 const & porosity, - real64 const & dPorosity_dPressure ) const - { - m_newPorosity[k][q] = porosity; - m_dPorosity_dPressure[k][q] = dPorosity_dPressure; - } - /** * @brief Helper to save porosity back to m_newPorosity array * @@ -128,20 +107,6 @@ class PorosityBaseUpdates return m_initialPorosity[k][q]; } - GEOS_HOST_DEVICE - virtual void updateFromPressureAndTemperature( localIndex const k, - localIndex const q, - real64 const & pressure, - real64 const & pressure_k, - real64 const & pressure_n, - real64 const & temperature, - real64 const & temperature_k, - real64 const & temperature_n ) const - { - GEOS_UNUSED_VAR( k, q, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n ); - GEOS_ERROR( "updateFromPressureAndTemperature is not implemented for porosityBase." ); - } - protected: /// New value of porosity @@ -289,17 +254,6 @@ class PorosityBase : public ConstitutiveBase return out.toView(); } - GEOS_HOST_DEVICE - inline - void savePorosity( localIndex const k, - localIndex const q, - real64 const & porosity, - real64 const & dPorosity_dPressure ) const - { - m_newPorosity[k][q] = porosity; - m_dPorosity_dPressure[k][q] = dPorosity_dPressure; - } - using KernelWrapper = PorosityBaseUpdates; /** diff --git a/src/coreComponents/constitutive/solid/porosity/PressurePorosity.hpp b/src/coreComponents/constitutive/solid/porosity/PressurePorosity.hpp index 584f69ce3e7..bb8663e183b 100644 --- a/src/coreComponents/constitutive/solid/porosity/PressurePorosity.hpp +++ b/src/coreComponents/constitutive/solid/porosity/PressurePorosity.hpp @@ -67,14 +67,10 @@ class PressurePorosityUpdates : public PorosityBaseUpdates } GEOS_HOST_DEVICE - virtual void updateFromPressureAndTemperature( localIndex const k, - localIndex const q, - real64 const & pressure, - real64 const & GEOS_UNUSED_PARAM( pressure_k ), - real64 const & GEOS_UNUSED_PARAM( pressure_n ), - real64 const & temperature, - real64 const & GEOS_UNUSED_PARAM( temperature_k ), - real64 const & GEOS_UNUSED_PARAM( temperature_n ) ) const override final + void updateFromPressureAndTemperature( localIndex const k, + localIndex const q, + real64 const & pressure, + real64 const & temperature ) const { computePorosity( pressure, temperature, diff --git a/src/coreComponents/fileIO/timeHistory/HDFFile.cpp b/src/coreComponents/fileIO/timeHistory/HDFFile.cpp index d9c046b86af..eda9360f14c 100644 --- a/src/coreComponents/fileIO/timeHistory/HDFFile.cpp +++ b/src/coreComponents/fileIO/timeHistory/HDFFile.cpp @@ -77,6 +77,7 @@ HDFFile::~HDFFile() { if( m_mpioFapl ) { +// H5Fflush( m_fileId, H5F_SCOPE_GLOBAL ); H5Pclose( m_faplId ); } H5Fclose( m_fileId ); diff --git a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp index fce83637687..7428485e820 100644 --- a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp +++ b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp @@ -143,7 +143,7 @@ static std::vector< int > getVtkConnectivity( ElementType const elementType, loc case ElementType::Vertex: return { 0 }; case ElementType::Line: return { 0, 1 }; case ElementType::Triangle: return { 0, 1, 2 }; - case ElementType::Quadrilateral: return { 0, 1, 3, 2 }; + case ElementType::Quadrilateral: return { 0, 1, 2, 3 }; case ElementType::Polygon: return { }; // TODO case ElementType::Tetrahedron: return { 0, 1, 2, 3 }; case ElementType::Pyramid: return { 0, 1, 3, 2, 4 }; diff --git a/src/coreComponents/finiteVolume/FluxApproximationBase.cpp b/src/coreComponents/finiteVolume/FluxApproximationBase.cpp index 05f0b2dbddd..259006f3d56 100644 --- a/src/coreComponents/finiteVolume/FluxApproximationBase.cpp +++ b/src/coreComponents/finiteVolume/FluxApproximationBase.cpp @@ -59,10 +59,6 @@ FluxApproximationBase::FluxApproximationBase( string const & name, Group * const setDescription( "Type of upwinding scheme. " "Valid options:\n* " + EnumStrings< UpwindingScheme >::concat( "\n* " ) ); -// registerWrapper( viewKeyStruct::epsC1PPUString(), &m_upwindingParams.epsC1PPU ). -// setApplyDefaultValue( 1e-10 ). -// setInputFlag( InputFlags::OPTIONAL ). -// setDescription( "Tolerance for C1-PPU smoothing" ); } FluxApproximationBase::CatalogInterface::CatalogType & diff --git a/src/coreComponents/finiteVolume/FluxApproximationBase.hpp b/src/coreComponents/finiteVolume/FluxApproximationBase.hpp index a26320b39c3..3830cf52cc1 100644 --- a/src/coreComponents/finiteVolume/FluxApproximationBase.hpp +++ b/src/coreComponents/finiteVolume/FluxApproximationBase.hpp @@ -38,6 +38,7 @@ enum class UpwindingScheme : integer { PPU, ///< PPU upwinding C1PPU, ///< C1-PPU upwinding from https://doi.org/10.1016/j.advwatres.2017.07.028 + IHU ///< IHU as in https://link.springer.com/content/pdf/10.1007/s10596-019-09835-6.pdf }; /** @@ -45,7 +46,8 @@ enum class UpwindingScheme : integer */ ENUM_STRINGS( UpwindingScheme, "PPU", - "C1PPU" ); + "C1PPU", + "IHU" ); /** * @struct UpwindingParameters @@ -54,7 +56,7 @@ ENUM_STRINGS( UpwindingScheme, */ struct UpwindingParameters { - /// PPU or C1-PPU + /// PPU or C1-PPU or IHU UpwindingScheme upwindingScheme; /// C1-PPU smoothing tolerance @@ -130,11 +132,9 @@ class FluxApproximationBase : public dataRepository::Group * @brief Add a new fracture stencil. * @param[in,out] mesh the mesh on which to add the fracture stencil * @param[in] faceElementRegionName the face element region name - * @param[in] initFields if true initialize physical fields, like pressure */ virtual void addToFractureStencil( MeshLevel & mesh, - string const & faceElementRegionName, - bool const initFields ) const = 0; + string const & faceElementRegionName ) const = 0; /** * @brief Add a new embedded fracture stencil. diff --git a/src/coreComponents/finiteVolume/SurfaceElementStencil.hpp b/src/coreComponents/finiteVolume/SurfaceElementStencil.hpp index 62f07d7dc51..714ac59115d 100644 --- a/src/coreComponents/finiteVolume/SurfaceElementStencil.hpp +++ b/src/coreComponents/finiteVolume/SurfaceElementStencil.hpp @@ -24,25 +24,6 @@ namespace geos { -/// @cond DO_NOT_DOCUMENT -// TODO remove! This option allows for the creation of new mass inside a newly -// created FaceElement. The new mass will be equal to: -// creationMass = defaultDensity * defaultAperture * faceArea. -// If 0, then the beginning of step density is artificially set to zero...which -// may cause some newton convergence problems. -#define ALLOW_CREATION_MASS 1 - - -// TODO remove! This option sets the pressure in a newly created FaceElement to -// be the lowest value of all attached non-new FaceElements. -#define SET_CREATION_PRESSURE 1 - -// TODO remove! This option sets the nodal displacements attached a newly -// created FaceElement to some scalar fraction of the aperture of the -// lowest attached non-new FaceElements. -#define SET_CREATION_DISPLACEMENT 0 -/// @endcond - /** * @brief Describes properties of SurfaceElementStencil. * diff --git a/src/coreComponents/finiteVolume/TwoPointFluxApproximation.cpp b/src/coreComponents/finiteVolume/TwoPointFluxApproximation.cpp index 8e96749683a..d4d2ce4c3cf 100644 --- a/src/coreComponents/finiteVolume/TwoPointFluxApproximation.cpp +++ b/src/coreComponents/finiteVolume/TwoPointFluxApproximation.cpp @@ -282,11 +282,6 @@ void TwoPointFluxApproximation::addFractureFractureConnectionsDFM( MeshLevel & m hydraulicAperture, fractureRegionIndex, elemGhostRank, -#if SET_CREATION_DISPLACEMENT==1 - faceToNodesMap, - totalDisplacement, - aperture, -#endif &fractureStencil] ( localIndex const k ) { @@ -365,237 +360,6 @@ void TwoPointFluxApproximation::addFractureFractureConnectionsDFM( MeshLevel & m } ); } -void TwoPointFluxApproximation::initNewFractureFieldsDFM( MeshLevel & mesh, - string const & faceElementRegionName ) const -{ - // TODO Note that all of this initialization should be performed elsewhere. - // This is just here because it was convenient, but it is not appropriate - // to have physics based initialization in the flux approximator. - -#if !defined(SET_CREATION_DISPLACEMENT) - static_assert( true, "must have SET_CREATION_DISPLACEMENT defined" ); -#endif - -#if !defined(ALLOW_CREATION_MASS) - static_assert( true, "must have ALLOW_CREATION_MASS defined" ); -#endif - -#if !defined(SET_CREATION_PRESSURE) - static_assert( true, "must have SET_CREATION_PRESSURE defined" ); -#endif - - ElementRegionManager & elemManager = mesh.getElemManager(); - ElementRegionManager::ElementViewAccessor< arrayView1d< integer const > > const elemGhostRank = - elemManager.constructArrayViewAccessor< integer, 1 >( ObjectManagerBase::viewKeyStruct::ghostRankString() ); - - SurfaceElementRegion & fractureRegion = elemManager.getRegion< SurfaceElementRegion >( faceElementRegionName ); - localIndex const fractureRegionIndex = fractureRegion.getIndexInParent(); - FaceElementSubRegion & fractureSubRegion = fractureRegion.getUniqueSubRegion< FaceElementSubRegion >(); - ArrayOfArraysView< localIndex const > const & fractureConnectorsToFaceElements = fractureSubRegion.m_2dFaceTo2dElems.toViewConst(); -#if SET_CREATION_DISPLACEMENT==1 - NodeManager & nodeManager = mesh.getNodeManager(); - FaceManager const & faceManager = mesh.getFaceManager(); - ArrayOfArraysView< localIndex const > const & faceToNodesMap = faceManager.nodeList(); - FaceElementSubRegion::FaceMapType const & faceMap = fractureSubRegion.faceList(); - array2dLayoutIncrDisplacementConst const incrementalDisplacement = - nodeManager.getField< fields::solidMechanics::incrementalDisplacement >(); - array2dLayoutTotalDisplacementConst const totalDisplacement = - nodeManager.getField< fields::solidMechanics::totalDisplacement >(); - arrayView1d< real64 > const aperture = fractureSubRegion.getReference< array1d< real64 > >( "elementAperture" ); -#endif - -#ifdef GEOSX_USE_SEPARATION_COEFFICIENT - arrayView1d< real64 > const apertureF = fractureSubRegion.getReference< array1d< real64 > >( "apertureAtFailure" ); -#endif - -#if ALLOW_CREATION_MASS==0 - arrayView1d< real64 > const dens = fractureSubRegion.getReference< array1d< real64 > >( "density_n" ); -#endif - -#if SET_CREATION_PRESSURE==1 - arrayView1d< real64 > const fluidPressure_n = fractureSubRegion.getField< fields::flow::pressure_n >(); - arrayView1d< real64 > const fluidPressure = fractureSubRegion.getField< fields::flow::pressure >(); - // Set the new face elements to some unphysical numbers to make sure they get set by the following routines. - SortedArrayView< localIndex const > const newFaceElements = fractureSubRegion.m_newFaceElements.toViewConst(); - - forAll< serialPolicy >( fractureSubRegion.m_newFaceElements.size(), [=]( localIndex const k ) - { - localIndex const kfe = newFaceElements[k]; - fluidPressure[kfe] = 1.0e99; -#ifdef GEOSX_USE_SEPARATION_COEFFICIENT - apertureF[kfe] = aperture[kfe]; -#endif -#if SET_CREATION_DISPLACEMENT==1 - aperture[kfe] = 1.0e99; -#endif - } ); - -#endif // SET_CREATION_PRESSURE - - SortedArray< localIndex > allNewElems; - allNewElems.insert( fractureSubRegion.m_newFaceElements.begin(), - fractureSubRegion.m_newFaceElements.end() ); - SortedArrayView< localIndex const > const recalculateFractureConnectorEdges = fractureSubRegion.m_recalculateConnectionsFor2dFaces.toViewConst(); - - // add new connectors/connections between face elements to the fracture stencil - forAll< serialPolicy >( recalculateFractureConnectorEdges.size(), - [ &allNewElems, - recalculateFractureConnectorEdges, - fractureConnectorsToFaceElements, - fractureRegionIndex, - elemGhostRank, - fluidPressure, - fluidPressure_n, -#if SET_CREATION_DISPLACEMENT==1 - faceToNodesMap, - totalDisplacement, - aperture, -#endif - &fractureSubRegion - ] - ( localIndex const k ) - { - localIndex const fci = recalculateFractureConnectorEdges[k]; - localIndex const numElems = fractureConnectorsToFaceElements.sizeOfArray( fci ); -#if SET_CREATION_PRESSURE==1 - real64 initialPressure = 1.0e99; -#endif -#if SET_CREATION_DISPLACEMENT==1 - real64 initialAperture = 1.0e99; -#endif - SortedArray< localIndex > newElems; - bool containsLocalElement = false; - - // loop over all face elements attached to the connector and add them to the stencil - for( localIndex kfe=0; kfe( totalDisplacement[node0] ) ) > 1.0e-99 && - LvArray::math::abs( LvArray::tensorOps::l2Norm< 3 >( totalDisplacement[node1] ) ) > 1.0e-99 ) - { - zeroDisp = false; - } - } - if( zeroDisp ) - { - aperture[newElemIndex] = 0; - } -#endif - } - } ); - - SortedArray< localIndex > touchedNodes; - forAll< serialPolicy >( allNewElems.size(), - [ &allNewElems - , fluidPressure - , fluidPressure_n -#if SET_CREATION_DISPLACEMENT==1 - , aperture - , faceMap - , faceNormal - , faceToNodesMap - , &touchedNodes - , incrementalDisplacement - , totalDisplacement - , this -#endif - ]( localIndex const k ) - { - localIndex const newElemIndex = allNewElems[k]; - // if the value of pressure was not set, then set it to zero and punt. - if( fluidPressure[newElemIndex] > 1.0e98 ) - { - fluidPressure[newElemIndex] = 0.0; - } - fluidPressure_n[newElemIndex] = fluidPressure[newElemIndex]; -#if ALLOW_CREATION_MASS==0 - // set the initial density of the face element to 0 to enforce mass conservation ( i.e. no creation of mass) - dens[newElemIndex] = 0.0; -#endif -#if SET_CREATION_DISPLACEMENT==1 - // If the aperture has been set, then we can set the estimate of displacements. - if( aperture[newElemIndex] < 1e98 ) - { - localIndex const faceIndex0 = faceMap( newElemIndex, 0 ); - localIndex const faceIndex1 = faceMap( newElemIndex, 1 ); - - real64 newDisp[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( faceNormal[ faceIndex0 ] ); - LvArray::tensorOps::scale< 3 >( newDisp, -aperture[newElemIndex] ); - localIndex const numNodesPerFace = faceToNodesMap.sizeOfArray( faceIndex0 ); - for( localIndex a=0; a( incrementalDisplacement[node0], newDisp ); - LvArray::tensorOps::add< 3 >( totalDisplacement[node0], newDisp ); - LvArray::tensorOps::subtract< 3 >( incrementalDisplacement[node1], newDisp ); - LvArray::tensorOps::subtract< 3 >( totalDisplacement[node1], newDisp ); - } - } - } - if( this->getLogLevel() > 1 ) - { - printf( "New elem index, init aper, init press = %4ld, %4.2e, %4.2e \n", - newElemIndex, - aperture[newElemIndex], - fluidPressure[newElemIndex] ); - } -#endif - } ); -} - void TwoPointFluxApproximation::cleanMatrixMatrixConnectionsDFM( MeshLevel & mesh, string const & faceElementRegionName ) const { @@ -761,17 +525,11 @@ void TwoPointFluxApproximation::addFractureMatrixConnectionsDFM( MeshLevel & mes } void TwoPointFluxApproximation::addToFractureStencil( MeshLevel & mesh, - string const & faceElementRegionName, - bool const initFields ) const + string const & faceElementRegionName ) const { this->addFractureFractureConnectionsDFM( mesh, faceElementRegionName ); this->cleanMatrixMatrixConnectionsDFM( mesh, faceElementRegionName ); this->addFractureMatrixConnectionsDFM( mesh, faceElementRegionName ); - - if( initFields ) - { - this->initNewFractureFieldsDFM( mesh, faceElementRegionName ); - } } void TwoPointFluxApproximation::addFractureMatrixConnectionsEDFM( MeshLevel & mesh, diff --git a/src/coreComponents/finiteVolume/TwoPointFluxApproximation.hpp b/src/coreComponents/finiteVolume/TwoPointFluxApproximation.hpp index 8820dd4a388..1cbd8453763 100644 --- a/src/coreComponents/finiteVolume/TwoPointFluxApproximation.hpp +++ b/src/coreComponents/finiteVolume/TwoPointFluxApproximation.hpp @@ -73,8 +73,7 @@ class TwoPointFluxApproximation : public FluxApproximationBase virtual void registerFractureStencil( Group & stencilGroup ) const override; virtual void addToFractureStencil( MeshLevel & mesh, - string const & faceElementRegionName, - bool const initFields ) const override; + string const & faceElementRegionName ) const override; virtual void registerBoundaryStencil( Group & stencilGroup, string const & setName ) const override; diff --git a/src/coreComponents/functions/TableFunction.cpp b/src/coreComponents/functions/TableFunction.cpp index 0a8751c28ab..3fa60e36e92 100644 --- a/src/coreComponents/functions/TableFunction.cpp +++ b/src/coreComponents/functions/TableFunction.cpp @@ -177,7 +177,10 @@ void TableFunction::checkCoord( real64 const coord, localIndex const dim ) const real64 const upperBound = m_coordinates[dim][m_coordinates.sizeOfArray( dim ) - 1]; GEOS_THROW_IF( coord > upperBound || coord < lowerBound, GEOS_FMT( "{}: Requested {} is out of the table bounds ( lower bound: {} -> upper bound: {} ).", - getDataContext(), units::formatValue( coord, getDimUnit( dim ) ), lowerBound, upperBound ), + getDataContext(), + units::formatValue( coord, getDimUnit( dim ) ), + units::formatValue( lowerBound, getDimUnit( dim ) ), + units::formatValue( upperBound, getDimUnit( dim ) ) ), SimulationError ); } diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.hpp index 6063db453c3..886d0a8b009 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/HypreMGR.hpp @@ -203,6 +203,7 @@ class MGRStrategyBase GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggPMaxElmts( solver.ptr, 16 ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetTol( solver.ptr, 0.0 ) ); #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP + GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggNumLevels( solver.ptr, 0 ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCoarsenType( solver.ptr, toUnderlying( AMGCoarseningType::PMIS ) ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxType( solver.ptr, getAMGRelaxationType( LinearSolverParameters::AMG::SmootherType::l1jacobi ) ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumSweeps( solver.ptr, 2 ) ); @@ -225,11 +226,12 @@ class MGRStrategyBase GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGCreate( &solver.ptr ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetPrintLevel( solver.ptr, 0 ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetMaxIter( solver.ptr, 1 ) ); - // TODO: keep or not 1 aggressive level? - GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggNumLevels( solver.ptr, 1 ) ); + GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggNumLevels( solver.ptr, 1 ) ); // TODO: keep or not 1 aggressive level? + GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggPMaxElmts( solver.ptr, 16 ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetTol( solver.ptr, 0.0 ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumFunctions( solver.ptr, 2 ) ); // pressure and temperature (CPTR) #if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP + GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggNumLevels( solver.ptr, 0 ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetCoarsenType( solver.ptr, toUnderlying( AMGCoarseningType::PMIS ) ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetRelaxType( solver.ptr, getAMGRelaxationType( LinearSolverParameters::AMG::SmootherType::l1jacobi ) ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumSweeps( solver.ptr, 2 ) ); diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/HyprePreconditioner.cpp b/src/coreComponents/linearAlgebra/interfaces/hypre/HyprePreconditioner.cpp index a6ed6bbd705..ca99a2e832f 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/HyprePreconditioner.cpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/HyprePreconditioner.cpp @@ -182,6 +182,7 @@ void createAMG( LinearSolverParameters const & params, GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetNumPaths( precond.ptr, params.amg.aggressiveNumPaths ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggNumLevels( precond.ptr, params.amg.aggressiveNumLevels ) ); GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggInterpType( precond.ptr, aggInterpType ) ); + GEOS_LAI_CHECK_ERROR( HYPRE_BoomerAMGSetAggPMaxElmts( precond.ptr, params.amg.aggressiveInterpMaxNonZeros ) ); } // Set coarsest level solver diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseFVM.hpp index 4c0f16f5766..241593eed7f 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseFVM.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseFVM.hpp @@ -70,8 +70,7 @@ class CompositionalMultiphaseFVM : public MGRStrategyBase< 2 > m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin; m_levelGlobalSmootherType[0] = MGRGlobalSmootherType::none; - m_levelFRelaxType[1] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[1] = 1; + m_levelFRelaxType[1] = MGRFRelaxationType::none; m_levelInterpType[1] = MGRInterpolationType::injection; m_levelRestrictType[1] = MGRRestrictionType::blockColLumped; // True-IMPES m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::galerkinRAI; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseHybridFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseHybridFVM.hpp index 091e55857b1..7c2f53c845a 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseHybridFVM.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseHybridFVM.hpp @@ -79,8 +79,7 @@ class CompositionalMultiphaseHybridFVM : public MGRStrategyBase< 3 > m_levelGlobalSmootherType[0] = MGRGlobalSmootherType::none; // Level 1 - m_levelFRelaxType[1] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[1] = 1; + m_levelFRelaxType[1] = MGRFRelaxationType::none; m_levelInterpType[1] = MGRInterpolationType::jacobi; m_levelRestrictType[1] = MGRRestrictionType::blockColLumped; // True-IMPES m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::galerkinRAI; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirFVM.hpp index 2c994aef5e3..55b8cfef2a0 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirFVM.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirFVM.hpp @@ -91,8 +91,7 @@ class CompositionalMultiphaseReservoirFVM : public MGRStrategyBase< 3 > m_levelGlobalSmootherType[1] = MGRGlobalSmootherType::none; // level 2 - m_levelFRelaxType[2] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[2] = 1; + m_levelFRelaxType[2] = MGRFRelaxationType::none; m_levelInterpType[2] = MGRInterpolationType::injection; m_levelRestrictType[2] = MGRRestrictionType::blockColLumped; // True-IMPES m_levelCoarseGridMethod[2] = MGRCoarseGridMethod::galerkinRAI; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirHybridFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirHybridFVM.hpp index 929c02d598c..37ea6379208 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirHybridFVM.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/CompositionalMultiphaseReservoirHybridFVM.hpp @@ -99,8 +99,7 @@ class CompositionalMultiphaseReservoirHybridFVM : public MGRStrategyBase< 4 > m_levelGlobalSmootherType[1] = MGRGlobalSmootherType::none; // Level 2 - m_levelFRelaxType[2] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[2] = 1; + m_levelFRelaxType[2] = MGRFRelaxationType::none; m_levelInterpType[2] = MGRInterpolationType::injection; m_levelRestrictType[2] = MGRRestrictionType::blockColLumped; // True-IMPES m_levelCoarseGridMethod[2] = MGRCoarseGridMethod::galerkinRAI; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/MultiphasePoromechanicsReservoirFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/MultiphasePoromechanicsReservoirFVM.hpp index 22b3843b4d6..46397b4519f 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/MultiphasePoromechanicsReservoirFVM.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/MultiphasePoromechanicsReservoirFVM.hpp @@ -107,8 +107,7 @@ class MultiphasePoromechanicsReservoirFVM : public MGRStrategyBase< 4 > m_levelGlobalSmootherType[2] = MGRGlobalSmootherType::none; // Level 3 - m_levelFRelaxType[2] = MGRFRelaxationType::jacobi; //default, i.e. Jacobi - m_levelFRelaxIters[2] = 1; + m_levelFRelaxType[3] = MGRFRelaxationType::none; m_levelInterpType[3] = MGRInterpolationType::injection; m_levelRestrictType[3] = MGRRestrictionType::blockColLumped; // True-IMPES m_levelCoarseGridMethod[3] = MGRCoarseGridMethod::galerkinRAI; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ReactiveCompositionalMultiphaseOBL.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ReactiveCompositionalMultiphaseOBL.hpp index 38792f6baff..03eec16db7e 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ReactiveCompositionalMultiphaseOBL.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ReactiveCompositionalMultiphaseOBL.hpp @@ -65,8 +65,7 @@ class ReactiveCompositionalMultiphaseOBL : public MGRStrategyBase< 1 > setupLabels(); - m_levelFRelaxType[0] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[0] = 1; + m_levelFRelaxType[0] = MGRFRelaxationType::none; m_levelInterpType[0] = MGRInterpolationType::injection; m_levelRestrictType[0] = MGRRestrictionType::injection; m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::cprLikeBlockDiag; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp index 0dfb0b0ec88..65341d2ba90 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/SinglePhasePoromechanicsConformingFractures.hpp @@ -38,15 +38,15 @@ namespace mgr * dofLabel: 0 = displacement, x-component * dofLabel: 1 = displacement, y-component * dofLabel: 2 = displacement, z-component - * dofLabel: 3 = pressure (cell elem + fracture elems) - * dofLabel: 4 = face-centered lagrange multiplier (tn) - * dofLabel: 5 = face-centered lagrange multiplier (tt1) - * dofLabel: 6 = face-centered lagrange multiplier (tt2) + * dofLabel: 3 = face-centered lagrange multiplier (tn) + * dofLabel: 4 = face-centered lagrange multiplier (tt1) + * dofLabel: 5 = face-centered lagrange multiplier (tt2) + * dofLabel: 6 = pressure (cell elem + fracture elems) * * Ingredients: - * 1. Level 1: F-points displacement (4,5,6), C-points pressure (0,1,2,3) - * 2. Level 2: F-points displacement (0,1,2), C-points pressure (3) + * 1. Level 1: F-points displacement (3,4,5), C-points pressure (0,1,2,6) + * 2. Level 2: F-points displacement (0,1,2), C-points pressure (6) * 2. F-points smoother: BoomerAMG, single V-cycle * 3. C-points coarse-grid/Schur complement solver: BoomerAMG * 4. Global smoother: none @@ -66,9 +66,9 @@ class SinglePhasePoromechanicsConformingFractures : public MGRStrategyBase< 2 > m_labels[0].push_back( 0 ); m_labels[0].push_back( 1 ); m_labels[0].push_back( 2 ); - m_labels[0].push_back( 3 ); + m_labels[0].push_back( 6 ); // we keep p - m_labels[1].push_back( 3 ); + m_labels[1].push_back( 6 ); setupLabels(); diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp index 0cea36ca96e..5870bb0cc37 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp @@ -70,13 +70,12 @@ class ThermalCompositionalMultiphaseFVM : public MGRStrategyBase< 2 > m_levelFRelaxIters[0] = 1; m_levelInterpType[0] = MGRInterpolationType::jacobi; // Diagonal scaling (Jacobi) m_levelRestrictType[0] = MGRRestrictionType::injection; - m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin; // Standard Galerkin + m_levelCoarseGridMethod[0] = MGRCoarseGridMethod::galerkin; m_levelGlobalSmootherType[0] = MGRGlobalSmootherType::blockGaussSeidel; m_levelGlobalSmootherIters[0] = 1; - m_levelFRelaxType[1] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[1] = 1; - m_levelInterpType[1] = MGRInterpolationType::injection; // Injection + m_levelFRelaxType[1] = MGRFRelaxationType::none; + m_levelInterpType[1] = MGRInterpolationType::injection; m_levelRestrictType[1] = MGRRestrictionType::injection; m_levelCoarseGridMethod[1] = MGRCoarseGridMethod::cprLikeBlockDiag; // Non-Galerkin Quasi-IMPES CPR m_levelGlobalSmootherType[1] = MGRGlobalSmootherType::ilu0; diff --git a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp index 68ea0e4cf10..bf12729ff28 100644 --- a/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp +++ b/src/coreComponents/linearAlgebra/interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp @@ -90,8 +90,7 @@ class ThermalMultiphasePoromechanics : public MGRStrategyBase< 3 > m_levelGlobalSmootherType[1] = MGRGlobalSmootherType::none; // Level 2 - m_levelFRelaxType[2] = MGRFRelaxationType::jacobi; - m_levelFRelaxIters[2] = 1; + m_levelFRelaxType[2] = MGRFRelaxationType::none; m_levelInterpType[2] = MGRInterpolationType::injection; m_levelRestrictType[2] = MGRRestrictionType::injection; m_levelCoarseGridMethod[2] = MGRCoarseGridMethod::cprLikeBlockDiag; diff --git a/src/coreComponents/linearAlgebra/unitTests/testKrylovSolvers.cpp b/src/coreComponents/linearAlgebra/unitTests/testKrylovSolvers.cpp index da8d734d661..63d8dbe2f8d 100644 --- a/src/coreComponents/linearAlgebra/unitTests/testKrylovSolvers.cpp +++ b/src/coreComponents/linearAlgebra/unitTests/testKrylovSolvers.cpp @@ -50,6 +50,7 @@ LinearSolverParameters params_GMRES() LinearSolverParameters parameters; parameters.krylov.relTolerance = 1e-8; parameters.krylov.maxIterations = 500; + parameters.krylov.maxRestart = 100; parameters.solverType = geos::LinearSolverParameters::SolverType::gmres; return parameters; } diff --git a/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp b/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp index 881fcc9984c..bdcf1de4eb2 100644 --- a/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp +++ b/src/coreComponents/linearAlgebra/utilities/LinearSolverParameters.hpp @@ -116,7 +116,11 @@ struct LinearSolverParameters { real64 relTolerance = 1e-6; ///< Relative convergence tolerance for iterative solvers integer maxIterations = 200; ///< Max iterations before declaring convergence failure - integer maxRestart = 200; ///< Max number of vectors in Krylov basis before restarting +#if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP + integer maxRestart = 50; ///< Max number of vectors in Krylov basis before restarting (GPUs) +#else + integer maxRestart = 200; ///< Max number of vectors in Krylov basis before restarting (CPUs) +#endif integer useAdaptiveTol = false; ///< Use Eisenstat-Walker adaptive tolerance real64 weakestTol = 1e-3; ///< Weakest allowed tolerance when using adaptive method } @@ -227,12 +231,12 @@ struct LinearSolverParameters rigidBodyModes ///< Rigid body modes }; -#if defined(GEOSX_USE_HYPRE_CUDA) || defined(GEOSX_USE_HYPRE_HIP) - CoarseningType coarseningType = CoarseningType::PMIS; ///< Coarsening algorithm - SmootherType smootherType = SmootherType::l1jacobi; ///< Smoother type +#if GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_CUDA || GEOS_USE_HYPRE_DEVICE == GEOS_USE_HYPRE_HIP + CoarseningType coarseningType = CoarseningType::PMIS; ///< Coarsening algorithm (GPUs) + SmootherType smootherType = SmootherType::l1jacobi; ///< Smoother type (GPUs) #else - CoarseningType coarseningType = CoarseningType::HMIS; ///< Coarsening algorithm - SmootherType smootherType = SmootherType::l1sgs; ///< Smoother type + CoarseningType coarseningType = CoarseningType::HMIS; ///< Coarsening algorithm (CPUs) + SmootherType smootherType = SmootherType::l1sgs; ///< Smoother type (CPUs) #endif integer maxLevels = 20; ///< Maximum number of coarsening levels @@ -246,6 +250,7 @@ struct LinearSolverParameters integer aggressiveNumPaths = 1; ///< Number of paths agg. coarsening. integer aggressiveNumLevels = 0; ///< Number of levels for aggressive coarsening. AggInterpType aggressiveInterpType = AggInterpType::multipass; ///< Interp. type for agg. coarsening. + integer aggressiveInterpMaxNonZeros = 16; ///< Aggressive Interpolation - Max. nonzeros/row. PreOrPost preOrPostSmoothing = PreOrPost::both; ///< Pre and/or post smoothing real64 threshold = 0.0; ///< Threshold for "strong connections" (for classical ///< and smoothed-aggregation AMG) diff --git a/src/coreComponents/mainInterface/ProblemManager.cpp b/src/coreComponents/mainInterface/ProblemManager.cpp index 3e677e9c4c8..0d86412e41f 100644 --- a/src/coreComponents/mainInterface/ProblemManager.cpp +++ b/src/coreComponents/mainInterface/ProblemManager.cpp @@ -79,7 +79,7 @@ ProblemManager::ProblemManager( conduit::Node & root ): registerGroup< MeshManager >( groupKeys.meshManager ); registerGroup< OutputManager >( groupKeys.outputManager ); m_physicsSolverManager = ®isterGroup< PhysicsSolverManager >( groupKeys.physicsSolverManager ); - registerGroup< TasksManager >( groupKeys.tasksManager ); + m_tasksManager = ®isterGroup< TasksManager >( groupKeys.tasksManager ); m_functionManager = ®isterGroup< FunctionManager >( groupKeys.functionManager ); // Command line entries @@ -683,13 +683,21 @@ void ProblemManager::generateMesh() FaceManager & faceManager = meshLevel.getFaceManager(); EdgeManager & edgeManager = meshLevel.getEdgeManager(); NodeManager const & nodeManager = meshLevel.getNodeManager(); + ElementRegionManager & elementManager = meshLevel.getElemManager(); - // The computation of geometric quantities is now possible for `FaceElementSubRegion`, - // because the ghosting ensures that the neighbor cells of the fracture elements are available. - // These neighbor cells are providing the node information to the fracture elements. - meshLevel.getElemManager().forElementSubRegions< FaceElementSubRegion >( [&]( FaceElementSubRegion & subRegion ) + elementManager.forElementSubRegions< FaceElementSubRegion >( [&]( FaceElementSubRegion & subRegion ) { + /// 1. The computation of geometric quantities which is now possible for `FaceElementSubRegion`, + // because the ghosting ensures that the neighbor cells of the fracture elements are available. + // These neighbor cells are providing the node information to the fracture elements. subRegion.calculateElementGeometricQuantities( nodeManager, faceManager ); + + // 2. Reorder the face map based on global numbering of neighboring cells + subRegion.flipFaceMap( faceManager, elementManager ); + + // 3. We flip the face normals of faces adjacent to the faceElements if they are not pointing in the + // direction of the fracture. + subRegion.fixNeighboringFacesNormals( faceManager, elementManager ); } ); faceManager.setIsExternal(); diff --git a/src/coreComponents/mainInterface/ProblemManager.hpp b/src/coreComponents/mainInterface/ProblemManager.hpp index aaeb01951da..00a453c34ea 100644 --- a/src/coreComponents/mainInterface/ProblemManager.hpp +++ b/src/coreComponents/mainInterface/ProblemManager.hpp @@ -20,7 +20,7 @@ #ifndef GEOS_MAININTERFACE_PROBLEMMANAGER_HPP_ #define GEOS_MAININTERFACE_PROBLEMMANAGER_HPP_ -#include "events/EventManager.hpp" +#include "dataRepository/Group.hpp" namespace geos { @@ -34,6 +34,8 @@ namespace constitutive { class ConstitutiveManager; } +class EventManager; +class TasksManager; class FunctionManager; class FieldSpecificationManager; struct CommandLineOptions; @@ -308,14 +310,20 @@ class ProblemManager : public dataRepository::Group return *m_fieldSpecificationManager; } - /** - * @brief Returns the const EventManager. - * @return The const EventManager. + * @brief Returns the EventManager. + * @return The EventManager. */ EventManager & getEventManager() {return *m_eventManager;} + /** + * @brief Returns the TasksManager. + * @return The TasksManager. + */ + TasksManager & getTasksManager() + {return *m_tasksManager;} + protected: /** * @brief Post process the command line input @@ -367,6 +375,9 @@ class ProblemManager : public dataRepository::Group /// The EventManager EventManager * m_eventManager; + /// The TasksManager + TasksManager * m_tasksManager; + /// The FunctionManager FunctionManager * m_functionManager; diff --git a/src/coreComponents/mainInterface/version.cpp b/src/coreComponents/mainInterface/version.cpp index 123025930d8..4c285e327c0 100644 --- a/src/coreComponents/mainInterface/version.cpp +++ b/src/coreComponents/mainInterface/version.cpp @@ -122,11 +122,11 @@ void outputVersionInfo() #endif #if defined(metis_VERSION) - GEOS_LOG_RANK_0( " - METIS version: " << STRINGIZE( METIS_VERSION ) ); + GEOS_LOG_RANK_0( " - METIS version: " << STRINGIZE( metis_VERSION ) ); #endif #if defined(parmetis_VERSION) - GEOS_LOG_RANK_0( " - PARAMETIS version: " << STRINGIZE( PARAMETIS_VERSION ) ); + GEOS_LOG_RANK_0( " - PARAMETIS version: " << STRINGIZE( parmetis_VERSION ) ); #endif #if defined(scotch_VERSION) diff --git a/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.cpp b/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.cpp index 6dd53dec055..d7101bfa3b8 100644 --- a/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.cpp +++ b/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.cpp @@ -40,24 +40,12 @@ void surfaceWithGhostNodes::insert( globalIndex const & edgeIndex ) EmbeddedSurfaceSubRegion::EmbeddedSurfaceSubRegion( string const & name, dataRepository::Group * const parent ): SurfaceElementSubRegion( name, parent ), - m_normalVector(), - m_tangentVector1(), - m_tangentVector2(), m_numOfJumpEnrichments( 3 ), m_connectivityIndex(), m_parentPlaneName() { m_elementType = ElementType::Polygon; - registerWrapper( viewKeyStruct::normalVectorString(), &m_normalVector ). - setDescription( "Unit normal vector to the embedded surface." ); - - registerWrapper( viewKeyStruct::t1VectorString(), &m_tangentVector1 ). - setDescription( "Unit vector in the first tangent direction to the embedded surface." ); - - registerWrapper( viewKeyStruct::t2VectorString(), &m_tangentVector2 ). - setDescription( "Unit vector in the second tangent direction to the embedded surface." ); - registerWrapper( viewKeyStruct::elementCenterString(), &m_elementCenter ). setDescription( "The center of each EmbeddedSurface element." ); diff --git a/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.hpp b/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.hpp index 95d5c649d4e..a0bf416d2a1 100644 --- a/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.hpp +++ b/src/coreComponents/mesh/EmbeddedSurfaceSubRegion.hpp @@ -178,15 +178,6 @@ class EmbeddedSurfaceSubRegion : public SurfaceElementSubRegion */ struct viewKeyStruct : SurfaceElementSubRegion::viewKeyStruct { - /// @return Embedded surface element normal vector string - static constexpr char const * normalVectorString() { return "normalVector"; } - - /// @return Tangent vector 1 string - static constexpr char const * t1VectorString() { return "tangentVector1"; } - - /// @return Tangent vector 2 string - static constexpr char const * t2VectorString() { return "tangentVector2"; } - /// @return Connectivity index string static constexpr char const * connectivityIndexString() { return "connectivityIndex"; } @@ -216,19 +207,6 @@ class EmbeddedSurfaceSubRegion : public SurfaceElementSubRegion */ localIndex const & numOfJumpEnrichments() const {return m_numOfJumpEnrichments;} - /** - * @brief Get normal vectors. - * @return an array of normal vectors. - */ - arrayView2d< real64 const > getNormalVector() const { return m_normalVector; } - - /** - * @brief Get normal vector of a specific embedded surface element. - * @param k index of the embedded surface element - * @return the normal vector of a specific embedded surface element - */ - arraySlice1d< real64 const > getNormalVector( localIndex k ) const { return m_normalVector[k]; } - /** * @brief Get the name of the bounding plate that was used to generate fracture element k. * @param k the index of the embedded surface element @@ -236,32 +214,6 @@ class EmbeddedSurfaceSubRegion : public SurfaceElementSubRegion */ string const & getFractureName( localIndex k ) const { return m_parentPlaneName[k]; } - /** - * @brief Get an array of the first tangent vector of the embedded surface elements. - * @return an array of the first tangent vector of the embedded surface elements - */ - arrayView2d< real64 const > getTangentVector1() const { return m_tangentVector1; } - - /** - * @brief Get the first tangent vector of a specific embedded surface element. - * @param k index of the embedded surface element - * @return the first tangent vector of a specific embedded surface element - */ - arraySlice1d< real64 const > getTangentVector1( localIndex k ) const { return m_tangentVector1[k]; } - - /** - * @brief Get an array of the second tangent vector of the embedded surface elements. - * @return an array of the second tangent vector of the embedded surface elements - */ - arrayView2d< real64 const > getTangentVector2() const { return m_tangentVector2.toViewConst(); } - - /** - * @brief Get the second tangent vector of a specific embedded surface element. - * @param k index of the embedded surface element - * @return the second tangent vector of a specific embedded surface element - */ - arraySlice1d< real64 const > getTangentVector2( localIndex k ) const { return m_tangentVector2[k];} - /** * @brief Get the connectivity index of the embedded surface element. * @return the connectivity index @@ -294,15 +246,6 @@ class EmbeddedSurfaceSubRegion : public SurfaceElementSubRegion localIndex packUpDownMapsImpl( buffer_unit_type * & buffer, arrayView1d< localIndex const > const & packList ) const; - /// normal vector to the embedded surface element - array2d< real64 > m_normalVector; - - // tangential direction 1 - array2d< real64 > m_tangentVector1; - - // tangential direction 2 - array2d< real64 > m_tangentVector2; - /// The number of jump enrichments localIndex m_numOfJumpEnrichments; diff --git a/src/coreComponents/mesh/FaceElementSubRegion.cpp b/src/coreComponents/mesh/FaceElementSubRegion.cpp index 894071a752c..bcef879113d 100644 --- a/src/coreComponents/mesh/FaceElementSubRegion.cpp +++ b/src/coreComponents/mesh/FaceElementSubRegion.cpp @@ -363,7 +363,7 @@ localIndex FaceElementSubRegion::unpackUpDownMaps( buffer_unit_type const * & bu * in the sense that each @p face for a given index must "belong" to @p 3d @p element at the same index. * @param[in] fractureName The name of the fracture for which we're checking the mapping consistency. * @param[in] elem2dToElems3d A mapping. - * @param[inout] elem2dToFaces This mapping will be corrected if needed to match @p elem2dToElems3d. + * @param[in,out] elem2dToFaces This mapping will be corrected if needed to match @p elem2dToElems3d. */ void fixNeighborMappingsInconsistency( string const & fractureName, OrderedVariableToManyElementRelation const & elem2dToElems3d, @@ -474,30 +474,48 @@ std::map< globalIndex, globalIndex > buildReferenceCollocatedNodes( ArrayOfArray /** - * @brief Returns a mapping that links any collocated edge to the collocated edge with the lowest index. - * @param referenceCollocatedNodes The mapping that links any collocated node to its collocated node with the lowest index. - * @param nl2g The local to glocal mapping for nodes. - * @param edgeToNodes The edge to nodes mapping. - * @param elem2dToEdges The 2d elem to edges mapping. - * @param edgeGhostRanks The ghost rank of the edges. - * @return The computed map. + * @brief Computes the mapping which links a pair of collocated nodes + * to all the edges having their nodes collocated to this key pair of nodes. + * @param referenceCollocatedNodes Mapping that link all the collocated nodes + * to the collocated node with the lowest index (considered as a reference). + * The reference node can then be used to make connection between geometrical objects + * relying on collocated nodes (in the case of this function, edges). + * @param nl2g The node local to global mapping. + * @param edgeToNodes The mapping from local edges to local nodes. + * @return The computed mapping. + * @details For each edge based on collocated nodes (i.e. each edge on the fracture), + * we consider each node and compute the reference collocated node. + * There will be multiple edges with the same pair of reference collocated nodes. + * This information is contained in the returned mapping. */ -std::map< localIndex, localIndex > buildReferenceCollocatedEdges( std::map< globalIndex, globalIndex > const & referenceCollocatedNodes, - arrayView1d< globalIndex const > const nl2g, - EdgeManager::NodeMapType const & edgeToNodes, - ArrayOfArraysView< localIndex const > const elem2dToEdges, - arrayView1d< integer const > edgeGhostRanks ) +std::map< std::pair< globalIndex, globalIndex >, std::set< localIndex > > +buildCollocatedEdgeBuckets( std::map< globalIndex, globalIndex > const & referenceCollocatedNodes, + arrayView1d< globalIndex const > const nl2g, + arrayView2d< localIndex const > const edgeToNodes ) { - // `edgeIds` maps the nodes of the edges of the face element sub-region to its index. + GEOS_ASSERT_EQ( edgeToNodes.size( 1 ), 2 ); + static constexpr std::string_view nodeNotFound = "Internal error when trying to access the reference collocated node for global node {}."; + + // Checks if the node `gni` is handled as a collocated node on the curren rank. + auto hasCollocatedNode = [&]( globalIndex const gni ) -> bool + { + return referenceCollocatedNodes.find( gni ) != referenceCollocatedNodes.cend(); + }; + + // `edgeIds` is a temporary container that maps the two nodes of any edge of all the face elements, + // to the local index of the edge itself. We fill this container using the `edgeToNodes` mapping + // because we want to be sure to test all the combinations of nodes, + // and therefore not to forget any possible edge. + // It's important to note that the key of `edgeIds` are the global indices of the nodes, in no particular order. std::map< std::pair< globalIndex, globalIndex >, localIndex > edgesIds; - for( int ei = 0; ei < elem2dToEdges.size(); ++ei ) + for( localIndex lei = 0; lei < edgeToNodes.size( 0 ); ++lei ) { - for( localIndex const & edi: elem2dToEdges[ei] ) + auto const & nodes = edgeToNodes[lei]; + globalIndex const & gni0 = nl2g[nodes[0]]; + globalIndex const & gni1 = nl2g[nodes[1]]; + if( hasCollocatedNode( gni0 ) && hasCollocatedNode( gni1 ) ) { - auto const nodes = edgeToNodes[edi]; - GEOS_ASSERT_EQ( nodes.size(), 2 ); - auto const p = std::minmax( { nl2g[nodes[0]], nl2g[nodes[1]] } ); - edgesIds[p] = edi; + edgesIds[{ gni0, gni1 }] = lei; } } @@ -506,22 +524,36 @@ std::map< localIndex, localIndex > buildReferenceCollocatedEdges( std::map< glob // But this trick lets us define some kind of _hash_ that allows to compare the location of the edges: // edges sharing the same hash lie in the same position. std::map< std::pair< globalIndex, globalIndex >, std::set< localIndex > > collocatedEdgeBuckets; - // The `collocatedEdgeIds` map gathers all the collocated edges together. for( auto const & p: edgesIds ) { std::pair< globalIndex, globalIndex > const & nodes = p.first; localIndex const & edge = p.second; auto it0 = referenceCollocatedNodes.find( nodes.first ); - globalIndex const n0 = it0 != referenceCollocatedNodes.cend() ? it0->second : nodes.first; + GEOS_ERROR_IF( it0 == referenceCollocatedNodes.cend(), GEOS_FMT( nodeNotFound, nodes.first ) ); + globalIndex const n0 = it0->second; auto it1 = referenceCollocatedNodes.find( nodes.second ); - globalIndex const n1 = it1 != referenceCollocatedNodes.cend() ? it1->second : nodes.second; + GEOS_ERROR_IF( it1 == referenceCollocatedNodes.cend(), GEOS_FMT( nodeNotFound, nodes.second ) ); + globalIndex const n1 = it1->second; std::pair< globalIndex, globalIndex > const edgeHash = std::minmax( n0, n1 ); collocatedEdgeBuckets[edgeHash].insert( edge ); } + return collocatedEdgeBuckets; +} + + +/** + * @brief Returns a mapping that links any collocated edge to the collocated edge with the lowest index. + * @param collocatedEdgeBuckets Links the pairs of reference collocated nodes to the edges overlapping those nodes (even with other nodes). + * @param edgeGhostRanks The ghost rank of the edges. + * @return The computed mapping. + */ +std::map< localIndex, localIndex > buildReferenceCollocatedEdges( std::map< std::pair< globalIndex, globalIndex >, std::set< localIndex > > const & collocatedEdgeBuckets, + arrayView1d< integer const > const edgeGhostRanks ) +{ std::map< localIndex, localIndex > referenceCollocatedEdges; // We want to consider in priority the edges that are owned by the rank. @@ -568,20 +600,20 @@ SortedArray< localIndex > makeSortedArrayIota( localIndex newSize, localIndex va /** * @brief Builds the 2d face to 2d elements mapping. - * @param num2dFaces The number of 2d faces. - * @param num2dElems The number of 2d elements. * @param elem2dToEdges The 2d element (geometrical faces in 3d) to edges mapping. * @param edgesTo2dFaces The edges to 2d faces (geometrical edges in 3d) mapping. * @param referenceCollocatedEdges The mapping that, for a given edge index, returns the collocated edge with lowest index. * @return The computed mapping. */ -ArrayOfArrays< geos::localIndex > build2dFaceTo2dElems( std::size_t num2dFaces, - localIndex num2dElems, - ArrayOfArraysView< localIndex const > const elem2dToEdges, +ArrayOfArrays< geos::localIndex > build2dFaceTo2dElems( ArrayOfArraysView< localIndex const > const elem2dToEdges, map< localIndex, localIndex > const & edgesTo2dFaces, std::map< geos::localIndex, geos::localIndex > const & referenceCollocatedEdges ) { - ArrayOfArrays< localIndex > m_2dFaceTo2dElems; + ArrayOfArrays< localIndex > face2dTo2dElems; + + auto const num2dElems = elem2dToEdges.size(); + auto const num2dFaces = edgesTo2dFaces.size(); + // `tmp` contains the 2d face to 2d elements mappings as a `std` container. // Eventually, it's copied into an `LvArray` container. std::vector< std::vector< localIndex > > tmp( num2dFaces ); @@ -589,6 +621,10 @@ ArrayOfArrays< geos::localIndex > build2dFaceTo2dElems( std::size_t num2dFaces, { for( auto const & e: elem2dToEdges[i] ) { + if( e < 0 ) + { + continue; + } tmp[edgesTo2dFaces.at( referenceCollocatedEdges.at( e ) )].push_back( i ); } } @@ -598,64 +634,245 @@ ArrayOfArrays< geos::localIndex > build2dFaceTo2dElems( std::size_t num2dFaces, { sizes.push_back( t.size() ); } - for( auto i = 0; i < m_2dFaceTo2dElems.size(); ++i ) - { - m_2dFaceTo2dElems.clearArray( i ); - } - m_2dFaceTo2dElems.resizeFromCapacities< serialPolicy >( sizes.size(), sizes.data() ); + + face2dTo2dElems.resizeFromCapacities< serialPolicy >( sizes.size(), sizes.data() ); for( std::size_t i = 0; i < tmp.size(); ++i ) { for( std::size_t j = 0; j < tmp[i].size(); ++j ) { - m_2dFaceTo2dElems.emplaceBack( i, tmp[i][j] ); + face2dTo2dElems.emplaceBack( i, tmp[i][j] ); } } - return m_2dFaceTo2dElems; + return face2dTo2dElems; } -void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager, - EdgeManager const & edgeManager, - FaceManager const & faceManager, - ElementRegionManager const & elemManager ) +/** + * @brief Adds some missing connections to the @p elem2dToNodes mapping. + * @param[in] elem2dToCollocatedNodesBuckets The bucket of all the collocated nodes nodes, for each 2d element. + * @param[in] ng2l The global to local node mapping. + * @param[in,out] elem2dToNodes The 2d element to nodes mapping that will receive new connections + * @details Due to the specific way 2d elements are managing nodes, some connections may be missing before the ghosting process. + * After the ghosting has been performed, those connections can be added using this function. + * @note This functions is meant to be called after the ghosting has occurred. + */ +void fillMissing2dElemToNodes( ArrayOfArrays< array1d< globalIndex > > const & elem2dToCollocatedNodesBuckets, + unordered_map< globalIndex, localIndex > const & ng2l, + ArrayOfArrays< localIndex > & elem2dToNodes ) { - arrayView1d< globalIndex const > const nl2g = nodeManager.localToGlobalMap(); + auto const num2dElems = elem2dToNodes.size(); - // First let's create the reference mappings for both nodes and edges. - std::map< globalIndex, globalIndex > const referenceCollocatedNodes = buildReferenceCollocatedNodes( m_2dElemToCollocatedNodesBuckets ); - std::map< localIndex, localIndex > const referenceCollocatedEdges = - buildReferenceCollocatedEdges( referenceCollocatedNodes, nl2g, edgeManager.nodeList(), m_toEdgesRelation.toViewConst(), edgeManager.ghostRank().toViewConst() ); + // We loop over all the collocated nodes attached to the 2d elements. + // If a node is on the rank while not attached to the 2d element, then we add a connection. + for( int e2d = 0; e2d < num2dElems; ++e2d ) + { + auto bucket = elem2dToCollocatedNodesBuckets[e2d]; + for( array1d< globalIndex > const & collocatedNodes: bucket ) + { + for( globalIndex const & collocatedNode: collocatedNodes ) + { + auto g2l = ng2l.find( collocatedNode ); + if( g2l != ng2l.cend() ) + { + localIndex const lni = g2l->second; + auto nodes = elem2dToNodes[e2d]; + if( std::find( nodes.begin(), nodes.end(), lni ) == nodes.end() ) + { + elem2dToNodes.emplaceBack( e2d, lni ); + } + } + } + } + } +} - localIndex const num2dElems = this->size(); - localIndex const num2dFaces = LvArray::integerConversion< localIndex >( referenceCollocatedEdges.size() ); + +/** + * @brief Adds some missing connections to the @p elem2dToEdges mapping. + * @param[in] elem2dToNodes The 2d elements to nodes mappings. + * @param[in] nodesToEdges The nodes to edges mapping. + * @param[in] nl2g The global to local mapping for nodes. + * @param[in] referenceCollocatedNodes A mapping that link all each collocated node to the node that must be used as a reference. + * @param[in] collocatedEdgeBuckets A specific mapping that links all pair of collocated nodes + * to the reference edge built on top of the two locations. + * @param[in,out] elem2dToEdges The 2d element to edges that will be completed/corrected. + * @details The @p elem2dToEdges is (for the moment) used to build connection between the 2d elements. + * Due to the specific way 2d elements are managing nodes, before the ghosting process: + * - some edges may be missing, + * - some edges may be "wrong" (in the sense where there may be multiple collocated edges, + * and we must be sure that all the elements use the same reference edges). + * After the ghosting's been performed, those connections can be reset. + */ +void fillMissing2dElemToEdges( ArrayOfArraysView< localIndex const > const elem2dToNodes, + ArrayOfSetsView< localIndex const > const nodesToEdges, + arrayView1d< globalIndex const > const nl2g, + std::map< globalIndex, globalIndex > const & referenceCollocatedNodes, + std::map< std::pair< globalIndex, globalIndex >, std::set< localIndex > > const & collocatedEdgeBuckets, + ArrayOfArrays< localIndex > & elem2dToEdges ) +{ + localIndex const num2dElems = elem2dToNodes.size(); + for( localIndex e2d = 0; e2d < num2dElems; ++e2d ) + { + auto const numNodes = elem2dToNodes.sizeOfArray( e2d ); + auto const numEdges = elem2dToEdges.sizeOfArray( e2d ); + if( 2 * numEdges == numNodes ) + { + // If the previous conditions is true, all the information could be constructed and therefore should be OK. + // There's no need to proceed. + continue; + } + + // `nodesOfEdgesTouching2dElem` deals with the edges that have at least one point touching the 2d element. + // While `nodesOfEdgesOf2dElem` deals with the edges for which all two nodes are on the 2d element. + // For both mappings, the key is the edge index and the values are the local nodes indices of the concerned edges. + std::map< localIndex, std::vector< localIndex > > nodesOfEdgesTouching2dElem, nodesOfEdgesOf2dElem; + for( localIndex const & n: elem2dToNodes[e2d] ) + { + for( localIndex const & e: nodesToEdges[n] ) + { + nodesOfEdgesTouching2dElem[e].push_back( n ); + } + } + for( auto const & ens: nodesOfEdgesTouching2dElem ) + { + if( ens.second.size() == 2 ) + { + nodesOfEdgesOf2dElem.insert( ens ); + } + } + // We are now recomputing all the edges of the 2d elements. + // Even if some edges were already present in the initial `elem2dToEdges` mapping, + // we'll ditch them and start with a new collection. + std::set< localIndex > allEdgesOf2dElem; + for( auto const & ens: nodesOfEdgesOf2dElem ) + { + std::vector< localIndex > const & nodesOfEdge = ens.second; + globalIndex const & gn0 = referenceCollocatedNodes.at( nl2g[ nodesOfEdge[0] ] ); + globalIndex const & gn1 = referenceCollocatedNodes.at( nl2g[ nodesOfEdge[1] ] ); + std::set< localIndex > candidateEdges = collocatedEdgeBuckets.at( std::minmax( { gn0, gn1 } ) ); + auto const min = std::min_element( candidateEdges.cbegin(), candidateEdges.cend() ); + allEdgesOf2dElem.insert( *min ); + } + elem2dToEdges.clearArray( e2d ); + for( localIndex const & e: allEdgesOf2dElem ) + { + elem2dToEdges.emplaceBack( e2d, e ); + } + } +} + + +/** + * @brief Builds a 2d face to edges mapping + * @param referenceCollocatedEdges Maps all the collocated edges to a single reference collocated edge. + * @return A 1d array that maps local index of a 2d face to the equivalent (3d) reference edge. + * @details The @p referenceCollocatedEdges input basically contains all the edges of the fracture. + * This function only selects the reference edges and builds a 2d face for each. + * The 2d face ordering is more or less random (actually it's sorted on the index of the reference edge). + * But the ordering is not critical as long as it's consistent withing the fracture. + */ +array1d< localIndex > build2dFaceToEdge( std::map< localIndex, localIndex > const & referenceCollocatedEdges ) +{ + std::set< localIndex > const referenceEdges = mapValues< std::set >( referenceCollocatedEdges ); + + localIndex const num2dFaces = LvArray::integerConversion< localIndex >( referenceEdges.size() ); // For the `m_2dFaceToEdge`, we can select any values that we want. // But then we need to be consistent... - m_2dFaceToEdge.clear(); - m_2dFaceToEdge.reserve( num2dFaces ); - for( auto const & p: referenceCollocatedEdges ) + array1d< localIndex > face2dToEdge; + face2dToEdge.reserve( num2dFaces ); + for( localIndex const & refEdge: referenceEdges ) { - globalIndex const & refEdge = p.second; - m_2dFaceToEdge.emplace_back( refEdge ); + face2dToEdge.emplace_back( refEdge ); } + GEOS_ASSERT_EQ( num2dFaces, face2dToEdge.size() ); + + return face2dToEdge; +} + + +/** + * @brief Builds the edges to 2d faces mappings by inverting the 2d faces to edges mappings. + * @param face2dToEdges The mappings to be inverted. + * @return The mapping + */ +map< localIndex, localIndex > buildEdgesToFace2d( arrayView1d< localIndex const > const face2dToEdges ) +{ + map< localIndex, localIndex > edgesToFace2d; + localIndex const num2dFaces = face2dToEdges.size(); - // `m_edgesTo2dFaces` is computed by the simple inversion of `m_2dFaceToEdge` - m_edgesTo2dFaces.clear(); for( localIndex i = 0; i < num2dFaces; ++i ) { - m_edgesTo2dFaces[m_2dFaceToEdge[i]] = i; + edgesToFace2d[face2dToEdges[i]] = i; + } + + GEOS_ASSERT_EQ_MSG( LvArray::integerConversion< localIndex >( edgesToFace2d.size() ), num2dFaces, "Internal error. The mappings `edgesToFace2d` and `face2dToEdges` should have the same size" ); + + return edgesToFace2d; +} + + +/** + * @brief Uses the two input mappings to reorder the @p elem2dToNodes mapping. + * @param[in] elem2dToFaces The 2d element to faces mapping. + * @param[in] facesToNodes The face to nodes mapping. + * @param[out] elem2dToNodes The 2d element to nodes that will be overwritten. + * @details The @p elem2dToNodes a priori does not respect any specific nodes order. + * But the vtk output expects the first half of the nodes to make a first face (in the correct order), + * and the second to make a second face. But nothing imposes this in our design. + * Even if we should have a more explicit design, + * the current function resets this implicit information in our mappings. + */ +void fixNodesOrder( ArrayOfArraysView< localIndex const > const elem2dToFaces, + ArrayOfArraysView< localIndex const > const facesToNodes, + ArrayOfArrays< localIndex > & elem2dToNodes ) +{ + localIndex const num2dElems = elem2dToNodes.size(); + for( localIndex e2d = 0; e2d < num2dElems; ++e2d ) + { + std::vector< localIndex > nodesOfFace; + for( localIndex fi: elem2dToFaces[e2d] ) + { + for( localIndex ni: facesToNodes[fi] ) + { + nodesOfFace.push_back( ni ); + } + } + elem2dToNodes.clearArray( e2d ); + elem2dToNodes.appendToArray( e2d, nodesOfFace.cbegin(), nodesOfFace.cend() ); } +} + +void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager, + EdgeManager const & edgeManager, + FaceManager const & faceManager, + ElementRegionManager const & elemManager ) +{ + arrayView1d< globalIndex const > const nl2g = nodeManager.localToGlobalMap(); + ArrayOfArraysView< localIndex const > const faceToNodes = faceManager.nodeList().toViewConst(); + + // First let's create the reference mappings for both nodes and edges. + std::map< globalIndex, globalIndex > const referenceCollocatedNodes = buildReferenceCollocatedNodes( m_2dElemToCollocatedNodesBuckets ); + + fillMissing2dElemToNodes( m_2dElemToCollocatedNodesBuckets, nodeManager.globalToLocalMap(), m_toNodesRelation ); + + std::map< std::pair< globalIndex, globalIndex >, std::set< localIndex > > const collocatedEdgeBuckets = buildCollocatedEdgeBuckets( referenceCollocatedNodes, nl2g, edgeManager.nodeList() ); + std::map< localIndex, localIndex > const referenceCollocatedEdges = buildReferenceCollocatedEdges( collocatedEdgeBuckets, edgeManager.ghostRank() ); + + m_2dFaceToEdge = build2dFaceToEdge( referenceCollocatedEdges ); + m_edgesTo2dFaces = buildEdgesToFace2d( m_2dFaceToEdge.toViewConst() ); + + localIndex const num2dElems = this->size(); + localIndex const num2dFaces = m_2dFaceToEdge.size(); // Mark 2d elements and their connections as "new" so they get considered during the stencil computations. // This is mainly due to the dynamic process of the fracture propagation and the legacy unique way to import the fracture // by splitting the mesh during the first steps of the simulations. m_newFaceElements = makeSortedArrayIota( num2dElems ); m_recalculateConnectionsFor2dFaces = makeSortedArrayIota( num2dFaces ); - m_2dFaceTo2dElems = build2dFaceTo2dElems( num2dFaces, num2dElems, m_toEdgesRelation.toViewConst(), m_edgesTo2dFaces, referenceCollocatedEdges ); - // When a fracture element has only one (or less!) neighbor, let's try to find the other one. // The `ElemPath` provides all the information of a given face: obviously its face index, // but also the element index that touch the face, and the node indices of the face as well. @@ -674,7 +891,7 @@ void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager }; // We are building the mapping that connects all the reference (collocated) nodes of any face to the elements those nodes are touching. - // Using this nodal information will let use reconnect the fracture 2d element to its 3d neighbor. + // Using this nodal information will let us reconnect the fracture 2d element to its 3d neighbor. std::map< std::set< globalIndex >, std::set< ElemPath > > faceRefNodesToElems; elemManager.forElementSubRegionsComplete< CellElementSubRegion >( [&]( localIndex const er, localIndex const esr, @@ -682,7 +899,6 @@ void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager CellElementSubRegion const & subRegion ) { auto const & elemToFaces = subRegion.faceList().base(); - auto const & faceToNodes = faceManager.nodeList(); for( localIndex ei = 0; ei < elemToFaces.size( 0 ); ++ei ) { for( auto const & face: elemToFaces[ei] ) @@ -705,18 +921,16 @@ void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager } // We still double-check that all the nodes of the face were found, // even if there's no chance for this entry to successfully match any request. - if( nodesOfFace.size() == LvArray::integerConversion< std::size_t >( faceToNodes[face].size() ) ) + auto const & nodes = faceToNodes[face]; + if( nodesOfFace.size() == LvArray::integerConversion< std::size_t >( nodes.size() ) ) { - std::vector< localIndex > const nodes( faceToNodes[face].begin(), faceToNodes[face].end() ); - faceRefNodesToElems[nodesOfFace].insert( ElemPath{ er, esr, ei, face, nodes } ); + std::vector< localIndex > const ns( nodes.begin(), nodes.end() ); + faceRefNodesToElems[nodesOfFace].insert( ElemPath{ er, esr, ei, face, ns } ); } } } } ); - // The `misMatches` array will contain fracture element that did not find all of its neighbors. - // This is used to display a more precise error message. - std::vector< localIndex > misMatches; // Here we loop over all the elements of the fracture. // When there's neighbor missing, we search for a face that would lie on the collocated nodes of the fracture element. for( int e2d = 0; e2d < num2dElems; ++e2d ) @@ -769,16 +983,17 @@ void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager m_toFacesRelation.emplaceBack( e2d, path.face ); for( localIndex const & n: path.nodes ) { - m_toNodesRelation.emplaceBack( e2d, n ); + auto currentNodes = m_toNodesRelation[e2d]; + if( std::find( currentNodes.begin(), currentNodes.end(), n ) == currentNodes.end() ) + { + m_toNodesRelation.emplaceBack( e2d, n ); + } } } } } } - GEOS_ERROR_IF( !misMatches.empty(), - "Fracture " << this->getName() << " has elements {" << stringutilities::join( misMatches, ", " ) << "} without two neighbors." ); - // Checking that each face has two neighboring elements. // If not, we pop up an error. std::vector< localIndex > isolatedFractureElements; @@ -792,7 +1007,18 @@ void FaceElementSubRegion::fixSecondaryMappings( NodeManager const & nodeManager GEOS_ERROR_IF( !isolatedFractureElements.empty(), "Fracture " << this->getName() << " has elements {" << stringutilities::join( isolatedFractureElements, ", " ) << "} with less than two neighbors." ); + fillMissing2dElemToEdges( m_toNodesRelation.toViewConst(), + nodeManager.edgeList().toViewConst(), + nl2g, + referenceCollocatedNodes, + collocatedEdgeBuckets, + m_toEdgesRelation ); + + m_2dFaceTo2dElems = build2dFaceTo2dElems( m_toEdgesRelation.toViewConst(), m_edgesTo2dFaces, referenceCollocatedEdges ); + fixNeighborMappingsInconsistency( getName(), m_2dElemToElems, m_toFacesRelation ); + + fixNodesOrder( m_toFacesRelation.toViewConst(), faceToNodes, m_toNodesRelation ); } void FaceElementSubRegion::inheritGhostRankFromParentFace( FaceManager const & faceManager, @@ -822,4 +1048,104 @@ std::set< std::set< globalIndex > > FaceElementSubRegion::getCollocatedNodes() c return result; } +void FaceElementSubRegion::flipFaceMap( FaceManager & faceManager, + ElementRegionManager const & elemManager ) +{ + ArrayOfArraysView< localIndex > const & elems2dToFaces = faceList().toView(); + arrayView2d< localIndex const > const & faceToElementRegionIndex = faceManager.elementRegionList(); + arrayView2d< localIndex const > const & faceToElementSubRegionIndex = faceManager.elementSubRegionList(); + arrayView2d< localIndex const > const & faceToElementIndex = faceManager.elementList(); + + ElementRegionManager::ElementViewAccessor< arrayView1d< globalIndex const > > const cellElemGlobalIndex = + elemManager.constructArrayViewAccessor< globalIndex, 1 >( ObjectManagerBase::viewKeyStruct::localToGlobalMapString() ); + + forAll< parallelHostPolicy >( this->size(), [=]( localIndex const kfe ) + { + if( elems2dToFaces.sizeOfArray( kfe ) != 2 ) + { + return; + } + + localIndex & f0 = elems2dToFaces[kfe][0]; + localIndex & f1 = elems2dToFaces[kfe][1]; + + localIndex const er0 = faceToElementRegionIndex[f0][0]; + localIndex const esr0 = faceToElementSubRegionIndex[f0][0]; + localIndex const ek0 = faceToElementIndex[f0][0]; + + localIndex const er1 = faceToElementRegionIndex[f1][0]; + localIndex const esr1 = faceToElementSubRegionIndex[f1][0]; + localIndex const ek1 = faceToElementIndex[f1][0]; + + globalIndex const globalIndexElem0 = cellElemGlobalIndex[er0][esr0][ek0]; + globalIndex const globalIndexElem1 = cellElemGlobalIndex[er1][esr1][ek1]; + + if( globalIndexElem0 > globalIndexElem1 ) + { + std::swap( f0, f1 ); + } + } ); + +} + +void FaceElementSubRegion::fixNeighboringFacesNormals( FaceManager & faceManager, + ElementRegionManager const & elemManager ) +{ + ArrayOfArraysView< localIndex > const & elems2dToFaces = faceList().toView(); + arrayView2d< localIndex const > const & faceToElementRegionIndex = faceManager.elementRegionList(); + arrayView2d< localIndex const > const & faceToElementSubRegionIndex = faceManager.elementSubRegionList(); + arrayView2d< localIndex const > const & faceToElementIndex = faceManager.elementList(); + + arrayView2d< real64 const > const faceCenter = faceManager.faceCenter(); + FaceManager::NodeMapType & faceToNodes = faceManager.nodeList(); + + auto elemCenter = elemManager.constructArrayViewAccessor< real64, 2 >( CellElementSubRegion::viewKeyStruct::elementCenterString() ); + + // We need to modify the normals and the nodes ordering to be consistent. + arrayView2d< real64 > const faceNormal = faceManager.faceNormal(); + forAll< parallelHostPolicy >( this->size(), [=, &faceToNodes]( localIndex const kfe ) + { + if( elems2dToFaces.sizeOfArray( kfe ) != 2 ) + { + return; + } + + localIndex const f0 = elems2dToFaces[kfe][0]; + localIndex const f1 = elems2dToFaces[kfe][1]; + + /// Note: I am assuming that the 0 element is the elementSubregion one for faces + /// touching both a 3D and a 2D cell. + localIndex const er0 = faceToElementRegionIndex[f0][0]; + localIndex const esr0 = faceToElementSubRegionIndex[f0][0]; + localIndex const ek0 = faceToElementIndex[f0][0]; + + localIndex const er1 = faceToElementRegionIndex[f1][0]; + localIndex const esr1 = faceToElementSubRegionIndex[f1][0]; + localIndex const ek1 = faceToElementIndex[f1][0]; + + real64 f0e0vector[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( faceCenter[f0] ); + real64 f1e1vector[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( faceCenter[f1] ); + + LvArray::tensorOps::subtract< 3 >( f0e0vector, elemCenter[er0][esr0][ek0] ); + LvArray::tensorOps::subtract< 3 >( f1e1vector, elemCenter[er1][esr1][ek1] ); + + // If the vector connecting the face center and the elem center is in the same + // direction as the unit normal, we flip the normal coz it should be pointing outward + // (i.e., towards the fracture element). + if( LvArray::tensorOps::AiBi< 3 >( faceNormal[f0], f0e0vector ) < 0.0 ) + { + GEOS_WARNING( GEOS_FMT( "For fracture element {}, I had to flip the normal nf0 of face {}", kfe, f0 ) ); + LvArray::tensorOps::scale< 3 >( faceNormal[f0], -1.0 ); + std::reverse( faceToNodes[f0].begin(), faceToNodes[f0].end() ); + } + if( LvArray::tensorOps::AiBi< 3 >( faceNormal[f1], f1e1vector ) < 0.0 ) + { + GEOS_WARNING( GEOS_FMT( "For fracture element {}, I had to flip the normal nf1 of face {}", kfe, f1 ) ); + LvArray::tensorOps::scale< 3 >( faceNormal[f1], -1.0 ); + std::reverse( faceToNodes[f1].begin(), faceToNodes[f1].end() ); + } + } ); + +} + } /* namespace geos */ diff --git a/src/coreComponents/mesh/FaceElementSubRegion.hpp b/src/coreComponents/mesh/FaceElementSubRegion.hpp index 262f0aeeba5..4823f96ce8b 100644 --- a/src/coreComponents/mesh/FaceElementSubRegion.hpp +++ b/src/coreComponents/mesh/FaceElementSubRegion.hpp @@ -133,6 +133,30 @@ class FaceElementSubRegion : public SurfaceElementSubRegion void inheritGhostRankFromParentFace( FaceManager const & faceManager, std::set< localIndex > const & indices ); + /** + * @brief Function to flip the face normals of faces adjacent to the faceElements if they are not pointing in the direction of the + * fracture. + * @param faceManager The face manager group + * @param elemManager The element region manager + * @details We want to flip the normals of the faces neighboring the fracture element. To do so, we check + * if the vector connecting the face center and the element center of the neighboring 3d cell is in the same + * direction as the unit normal of the face. If they are not, we flip the normal because it should be pointing outward + * (i.e., towards the fracture element). + */ + void fixNeighboringFacesNormals( FaceManager & faceManager, + ElementRegionManager const & elemManager ); + + /** + * @brief Function to flip the face map based on the gloal index of the nighboring elements + * @param faceManager The face manager group + * @param elemManager The element region manager + * @details In order to keep a consistent normal between multi processors ranks, we force the faces to be ordered + * based on the global numbering of the 3d elements attached to each face. The first face is always the one + * attached to the 3d cell with the smallest globalIndex. + */ + void flipFaceMap( FaceManager & faceManager, + ElementRegionManager const & elemManager ); + /** * @brief Struct containing the keys to all face element views. * @struct viewKeyStruct diff --git a/src/coreComponents/mesh/MeshFields.hpp b/src/coreComponents/mesh/MeshFields.hpp index 1b4cca146b3..f6b46623836 100644 --- a/src/coreComponents/mesh/MeshFields.hpp +++ b/src/coreComponents/mesh/MeshFields.hpp @@ -114,6 +114,14 @@ DECLARE_FIELD( elementAperture, WRITE_AND_READ, "Element aperture." ); +DECLARE_FIELD( elementArea, + "elementArea", + array1d< real64 >, + 0, + LEVEL_0, + WRITE_AND_READ, + "Element area." ); + DECLARE_FIELD( parentIndex, "parentIndex", array1d< localIndex >, @@ -146,6 +154,30 @@ DECLARE_FIELD( ruptureTime, WRITE_AND_READ, "Time that the object was ruptured/split." ); +DECLARE_FIELD( normalVector, + "normalVector", + array2d< real64 >, + 0.0, + LEVEL_0, + WRITE_AND_READ, + "Unit normal vector to the surface." ); + +DECLARE_FIELD( tangentVector1, + "tangentVector1", + array2d< real64 >, + 0.0, + LEVEL_0, + WRITE_AND_READ, + "Unit vector in the first tangent direction to the surface." ); + +DECLARE_FIELD( tangentVector2, + "tangentVector2", + array2d< real64 >, + 0.0, + LEVEL_0, + WRITE_AND_READ, + "Unit vector in the second tangent direction to the surface." ); + } // namespace fields } // namespace geos diff --git a/src/coreComponents/mesh/SurfaceElementRegion.cpp b/src/coreComponents/mesh/SurfaceElementRegion.cpp index 021e914310e..c9f036a6553 100644 --- a/src/coreComponents/mesh/SurfaceElementRegion.cpp +++ b/src/coreComponents/mesh/SurfaceElementRegion.cpp @@ -76,7 +76,7 @@ void SurfaceElementRegion::initializePreSubGroups() { this->forElementSubRegions< SurfaceElementSubRegion >( [&] ( SurfaceElementSubRegion & subRegion ) { - subRegion.getWrapper< array1d< real64 > >( SurfaceElementSubRegion::viewKeyStruct::elementApertureString() ). + subRegion.getWrapper< array1d< real64 > >( fields::elementAperture::key() ). setApplyDefaultValue( m_defaultAperture ); } ); } diff --git a/src/coreComponents/mesh/SurfaceElementSubRegion.cpp b/src/coreComponents/mesh/SurfaceElementSubRegion.cpp index 8261deb0bae..23c7e59eee6 100644 --- a/src/coreComponents/mesh/SurfaceElementSubRegion.cpp +++ b/src/coreComponents/mesh/SurfaceElementSubRegion.cpp @@ -20,6 +20,7 @@ #include "SurfaceElementSubRegion.hpp" #include "ElementRegionManager.hpp" +#include "MeshFields.hpp" namespace geos { @@ -34,7 +35,10 @@ SurfaceElementSubRegion::SurfaceElementSubRegion( string const & name, m_toNodesRelation(), m_toEdgesRelation(), m_elementAperture(), - m_elementArea() + m_elementArea(), + m_normalVector(), + m_tangentVector1(), + m_tangentVector2() { registerWrapper( viewKeyStruct::nodeListString(), &m_toNodesRelation ). setDescription( "Map to the nodes attached to each SurfaceElement." ); @@ -54,21 +58,24 @@ SurfaceElementSubRegion::SurfaceElementSubRegion( string const & name, setPlotLevel( PlotLevel::NOPLOT ). setDescription( "A map of face element local indices to the cell local indices" ); - registerWrapper( viewKeyStruct::elementApertureString(), &m_elementAperture ). - setApplyDefaultValue( 1.0e-5 ). - setPlotLevel( dataRepository::PlotLevel::LEVEL_0 ). - setDescription( "The aperture of each SurfaceElement." ); - - registerWrapper( viewKeyStruct::elementAreaString(), &m_elementArea ). - setApplyDefaultValue( -1.0 ). - setPlotLevel( dataRepository::PlotLevel::LEVEL_2 ). - setDescription( "The area of each SurfaceElement." ); - registerWrapper< real64_array >( viewKeyStruct::creationMassString() ). setApplyDefaultValue( 0.0 ). setPlotLevel( dataRepository::PlotLevel::LEVEL_1 ). setDescription( "The amount of remaining mass that was introduced when the SurfaceElement was created." ); + registerField( fields::elementAperture{}, &m_elementAperture ); + + registerField( fields::elementArea{}, &m_elementArea ); + + registerField( fields::normalVector{}, &m_normalVector ). + reference().resizeDimension< 1 >( 3 ); + + registerField( fields::tangentVector1{}, &m_tangentVector1 ). + reference().resizeDimension< 1 >( 3 ); + + registerField( fields::tangentVector2{}, &m_tangentVector2 ). + reference().resizeDimension< 1 >( 3 ); + excludeWrappersFromPacking( { viewKeyStruct::nodeListString(), viewKeyStruct::edgeListString(), viewKeyStruct::surfaceElementsToCellRegionsString(), diff --git a/src/coreComponents/mesh/SurfaceElementSubRegion.hpp b/src/coreComponents/mesh/SurfaceElementSubRegion.hpp index df5f199524e..1462a12aa83 100644 --- a/src/coreComponents/mesh/SurfaceElementSubRegion.hpp +++ b/src/coreComponents/mesh/SurfaceElementSubRegion.hpp @@ -32,7 +32,7 @@ namespace geos * @class SurfaceElementSubRegion * * The SurfaceElementSubRegion class contains the functionality to support the concept of a - * surface element that can be either and embedded surface element or a face element. + * surface element that can be either and surface element or a face element. */ class SurfaceElementSubRegion : public ElementSubRegionBase { @@ -201,10 +201,68 @@ class SurfaceElementSubRegion : public ElementSubRegionBase */ arrayView1d< real64 const > getElementArea() const { return m_elementArea; } + /** + * @brief Const accessor to the normal vectors. + * @return a const view to the array of normal vectors. + */ + arrayView2d< real64 const > getNormalVector() const { return m_normalVector; } + + /** + * @brief Non const accessor to the normal vectors. + * @return a non const view to the array of normal vectors. + */ + arrayView2d< real64 > getNormalVector() { return m_normalVector; } + + /** + * @brief Get normal vector of a specific surface element. + * @param k index of the surface element + * @return the normal vector of a specific surface element + */ + arraySlice1d< real64 const > getNormalVector( localIndex k ) const { return m_normalVector[k]; } + + /** + * @brief Get an array of the first tangent vector of the surface elements. + * @return an array of the first tangent vector of the surface elements + */ + arrayView2d< real64 const > getTangentVector1() const { return m_tangentVector1; } + + /** + * @brief Get an array of the first tangent vector of the surface elements. + * @return a non const view to the array of the first tangent vector of the surface elements + */ + arrayView2d< real64 > getTangentVector1() { return m_tangentVector1; } + + /** + * @brief Get the first tangent vector of a specific surface element. + * @param k index of the surface element + * @return the first tangent vector of a specific surface element + */ + arraySlice1d< real64 const > getTangentVector1( localIndex const k ) const { return m_tangentVector1[k]; } + + /** + * @brief Get an array of the second tangent vector of the surface elements. + * @return aconst view to the array of the second tangent vector of the surface elements + */ + arrayView2d< real64 const > getTangentVector2() const { return m_tangentVector2.toViewConst(); } + + /** + * @brief Get an array of the first tangent vector of the surface elements. + * @return a non const view to the array of the second tangent vector of the surface elements + */ + arrayView2d< real64 > getTangentVector2() { return m_tangentVector2; } + + /** + * @brief Get the second tangent vector of a specific surface element. + * @param k index of the surface element + * @return the second tangent vector of a specific surface element + */ + arraySlice1d< real64 const > getTangentVector2( localIndex const k ) const { return m_tangentVector2[k];} + + ///@} /** - * @brief Struct containing the keys to all embedded surface element views. + * @brief Struct containing the keys to all surface element views. * @struct viewKeyStruct */ struct viewKeyStruct : ElementSubRegionBase::viewKeyStruct @@ -218,17 +276,10 @@ class SurfaceElementSubRegion : public ElementSubRegionBase /// @return Face element to cell indices map string. static constexpr char const * surfaceElementsToCellIndexString() { return "fractureElementsToCellIndices"; } - - /// @return Embedded surface element aperture string - static constexpr char const * elementApertureString() { return "elementAperture"; } - - /// @return Embedded surface element surface are string - static constexpr char const * elementAreaString() { return "elementArea"; } - /// @return Mass creation string. constexpr static char const * creationMassString() { return "creationMass"; } - /// @return embedded surface element to parent plane string. + /// @return surface element to parent plane string. constexpr static char const * surfaceElementToParentPlaneString() { return "surfaceElementToParentPlane"; } }; @@ -252,6 +303,15 @@ class SurfaceElementSubRegion : public ElementSubRegionBase /// Member level field for the element center array1d< real64 > m_elementArea; + /// Normal vector to the surface element + array2d< real64 > m_normalVector; + + /// Unit vector indicating the first tangential direction + array2d< real64 > m_tangentVector1; + + /// Unit vector indicating the second tangential direction + array2d< real64 > m_tangentVector2; + }; } /* namespace geos */ diff --git a/src/coreComponents/mesh/docs/Mesh.rst b/src/coreComponents/mesh/docs/Mesh.rst index d4231f7ac20..c87441015b4 100644 --- a/src/coreComponents/mesh/docs/Mesh.rst +++ b/src/coreComponents/mesh/docs/Mesh.rst @@ -121,15 +121,18 @@ with the following code. nx="{5, 5}" ny="{5, 5}" nz="{3, 3, 3, 3}" - cellBlockNames="{b00,b01,b02,b03,b04,b05,b06,b07,b08,b09,b10,b11,b12,b13,b14,b15}"/> + cellBlockNames="{cb-0_0_0, cb-1_0_0, cb-0_1_0, cb-1_1_0, + cb-0_0_1, cb-1_0_1, cb-0_1_1, cb-1_1_1, + cb-0_0_2, cb-1_0_2, cb-0_1_2, cb-1_1_2, + cb-0_0_3, cb-1_0_3, cb-0_1_3, cb-1_1_3}"/> @@ -139,6 +142,7 @@ Thus, the generated mesh will be : :align: center :width: 500 +Note that ``CellBlocks`` are ordered following the natural IJK logic, with indices increasing first in I (x-direction), then in J (y-direction) and last in K (z-direction). .. _ExternalMeshUsage: diff --git a/src/coreComponents/mesh/docs/staircase.svg b/src/coreComponents/mesh/docs/staircase.svg index bda6f11f955..4a5dffd595d 100644 --- a/src/coreComponents/mesh/docs/staircase.svg +++ b/src/coreComponents/mesh/docs/staircase.svg @@ -2,24 +2,24 @@ + inkscape:export-ydpi="96" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + inkscape:object-paths="true" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" /> @@ -55,7 +58,7 @@ image/svg+xml - + @@ -1611,263 +1614,280 @@ transform="translate(433.05483,92.624135)"> b00 + sodipodi:role="line">cb_0-0-0 b01 + sodipodi:role="line">cb_0-0-1 b02 - b07 + sodipodi:role="line">cb_0-0-2 b03 - cb_0-0-3 + b08 - cb_1-0-0 + b09 - cb_1-0-1 + b10 - cb_1-0-2 + b11 + sodipodi:role="line" + id="tspan1275-0" + x="-237.57898" + y="16.654467" + style="stroke-width:0.264583">cb_1-0-3 b03 + sodipodi:role="line">cb_0-0-3 b08 - cb_1-0-0 + b09 - cb_1-0-1 + b10 - cb_1-0-2 + b11 + inkscape:export-ydpi="96" + transform="skewY(-40)">cb_1-0-3 + cb_1-1-0 + cb_1-1-1 + cb_1-1-2 + cb_1-1-3 b11 + style="stroke-width:0.264583">cb_1-0-3 b12 + style="stroke-width:0.264583" + y="-66.60495" + x="-256.42575" + id="tspan1311-8" + sodipodi:role="line">cb_0-1-3 b13 + id="tspan1331-0" + x="-165.55382" + y="-66.60495" + style="stroke-width:0.264583">cb_1-1-3 b14 - b15 - b15 + id="tspan1" + style="stroke-width:0.264583" /> diff --git a/src/coreComponents/mesh/generators/CellBlock.hpp b/src/coreComponents/mesh/generators/CellBlock.hpp index dbb686c0f44..01fa2124bd8 100644 --- a/src/coreComponents/mesh/generators/CellBlock.hpp +++ b/src/coreComponents/mesh/generators/CellBlock.hpp @@ -16,8 +16,6 @@ #define GEOS_MESH_CELLBLOCK_HPP_ #include "dataRepository/Group.hpp" -#include "mesh/utilities/ComputationalGeometry.hpp" -#include "common/GEOS_RAJA_Interface.hpp" #include "mesh/generators/CellBlockABC.hpp" #include "mesh/ElementType.hpp" diff --git a/src/coreComponents/mesh/generators/CellBlockManager.cpp b/src/coreComponents/mesh/generators/CellBlockManager.cpp index 356bd937d18..4c18351d70b 100644 --- a/src/coreComponents/mesh/generators/CellBlockManager.cpp +++ b/src/coreComponents/mesh/generators/CellBlockManager.cpp @@ -822,61 +822,78 @@ static array1d< real64 > gaussLobattoPoints( int order ) switch( order ) { - case 1: - GaussLobattoPts[0] = -1.0; - GaussLobattoPts[1] = 1.0; - break; case 2: - GaussLobattoPts[0] = -1.0; - GaussLobattoPts[1] = 0.0; - GaussLobattoPts[2] = 1.0; + GaussLobattoPts[0] = 0; break; case 3: static constexpr real64 sqrt5 = 2.2360679774997897; - GaussLobattoPts[0] = -1.0; - GaussLobattoPts[1] = -1./sqrt5; - GaussLobattoPts[2] = 1./sqrt5; - GaussLobattoPts[3] = 1.; + GaussLobattoPts[0] = -1./sqrt5; + GaussLobattoPts[1] = 1./sqrt5; break; case 4: static constexpr real64 sqrt3_7 = 0.6546536707079771; - GaussLobattoPts[0] = -1.0; - GaussLobattoPts[1] = -sqrt3_7; - GaussLobattoPts[2] = 0.0; - GaussLobattoPts[3] = sqrt3_7; - GaussLobattoPts[4] = 1.0; + GaussLobattoPts[0] = -sqrt3_7; + GaussLobattoPts[1] = 0.0; + GaussLobattoPts[2] = sqrt3_7; break; case 5: static constexpr real64 sqrt__7_plus_2sqrt7__ = 3.50592393273573196; static constexpr real64 sqrt__7_mins_2sqrt7__ = 1.30709501485960033; static constexpr real64 sqrt_inv21 = 0.218217890235992381; - GaussLobattoPts[0] = -1.0; - GaussLobattoPts[1] = -sqrt_inv21*sqrt__7_plus_2sqrt7__; - GaussLobattoPts[2] = -sqrt_inv21*sqrt__7_mins_2sqrt7__; - GaussLobattoPts[3] = sqrt_inv21*sqrt__7_mins_2sqrt7__; - GaussLobattoPts[4] = sqrt_inv21*sqrt__7_plus_2sqrt7__; - GaussLobattoPts[5] = 1.0; + GaussLobattoPts[0] = -sqrt_inv21*sqrt__7_plus_2sqrt7__; + GaussLobattoPts[1] = -sqrt_inv21*sqrt__7_mins_2sqrt7__; + GaussLobattoPts[2] = sqrt_inv21*sqrt__7_mins_2sqrt7__; + GaussLobattoPts[3] = sqrt_inv21*sqrt__7_plus_2sqrt7__; break; } return GaussLobattoPts; } +static void linearInterp( real64 const alpha, + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > const refPos, + localIndex const vi[2], + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > refPosNew, + localIndex const v ) +{ + for( int i=0; i<3; i++ ) + { + refPosNew( v, i ) = refPos( vi[0], i )*( 1.0-alpha )+ + refPos( vi[1], i )* alpha; + } +} +static void bilinearInterp( real64 const alpha, + real64 const beta, + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > const refPos, + localIndex const vi[4], + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > refPosNew, + localIndex const v ) +{ + for( int i=0; i<3; i++ ) + { + refPosNew( v, i ) = refPos( vi[0], i )*( 1.0-alpha )*( 1.0-beta )+ + refPos( vi[1], i )* alpha *( 1.0-beta )+ + refPos( vi[2], i )*( 1.0-alpha )* beta + + refPos( vi[3], i )* alpha * beta; + } +} static void trilinearInterp( real64 const alpha, real64 const beta, real64 const gamma, - real64 const (&X)[8][3], - real64 (& coords)[3] ) + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > const refPos, + localIndex const vi[8], + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > refPosNew, + localIndex const v ) { for( int i=0; i<3; i++ ) { - coords[i] = X[0][i]*( 1.0-alpha )*( 1.0-beta )*( 1.0-gamma )+ - X[1][i]* alpha *( 1.0-beta )*( 1.0-gamma )+ - X[2][i]*( 1.0-alpha )* beta *( 1.0-gamma )+ - X[3][i]* alpha * beta *( 1.0-gamma )+ - X[4][i]*( 1.0-alpha )*( 1.0-beta )* gamma+ - X[5][i]* alpha *( 1.0-beta )* gamma+ - X[6][i]*( 1.0-alpha )* beta * gamma+ - X[7][i]* alpha * beta * gamma; + refPosNew( v, i ) = refPos( vi[0], i ) *( 1.0-alpha )*( 1.0-beta )*( 1.0-gamma )+ + refPos( vi[1], i ) * alpha *( 1.0-beta )*( 1.0-gamma )+ + refPos( vi[2], i ) *( 1.0-alpha )* beta *( 1.0-gamma )+ + refPos( vi[3], i ) * alpha * beta *( 1.0-gamma )+ + refPos( vi[4], i ) *( 1.0-alpha )*( 1.0-beta )* gamma+ + refPos( vi[5], i ) * alpha *( 1.0-beta )* gamma+ + refPos( vi[6], i ) *( 1.0-alpha )* beta * gamma+ + refPos( vi[7], i ) * alpha * beta * gamma; } } @@ -888,10 +905,34 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, arrayView1d< globalIndex const > const faceLocalToGlobal ) { - // constants for hex mesh + // The general idea for building higher-order nodes is as follows: + // 1. Original mesh-level 0 nodes are added, keeping their global IDs; + // 2. Nodes internal to edges, faces and elements are added in this order. + // Their global IDs are computed based on the global IDs of the edge, face or element containing them. + // 3. The edge, face and element-to-node maps are created by adding nodes in a hierarchical order: + // Endpoints/vertices, then edge nodes, face nodes and element nodes last + // 4. The maps are then re-ordered in the usual tensor-product ordering using a hash map, using nodeKeys as the keys of the map. + // 5. Finally, global orientation consistency across MPI ranks is guaranteed by using a consistent global face/edge orientation + // to create node global IDs. This is obtained using nodeKeys, which always order nodes in a consistent manner. + // + // nodeKeys identify each high-order node with a list of 6 integers [i1, i2, i3, i4, a, b], as follows: + // - nodes on a mesh vertex v are identified by the vector [v, -1, -1, -1, -1, -1]; + // - nodes internal to an edge are given by a linear interpolation between vertices v1 and v2, 'a' steps away from v1. + // The edge erndpoints are oriented such that v1 < v2, and the vertex is and identified with [v1, v2, -1, -1, a, -1]); + // - nodes internal to a face are given by a bilinear interpolation between edges v1->v2 and v3->v4 + // (v1-v4 and v2-v3 are the diagonals), with interpolation parameters 'a' and 'b' respectively. + // Faces are oriented so that v1 is always the smallest index, and v2 < v3. Then face nodes are identified with [v1, v2, v3, v4, a, b]; + // - Nodes internal to mesh cells do not need to be oriented, as they are not used for global data exchange. + GEOS_MARK_FUNCTION; + // constants for hex mesh + localIndex const numEdgesPerFace = 4; + localIndex const numFacesPerCell = 6; + localIndex const numEdgesPerCell = 12; + localIndex const numVerticesPerFace = 4; localIndex const numVerticesPerCell = 8; + localIndex const numNodesPerEdge = ( order+1 ); localIndex const numNodesPerFace = ( order+1 )*( order+1 ); localIndex const numNodesPerCell = ( order+1 )*( order+1 )*( order+1 ); @@ -929,38 +970,26 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, m_edgeToNodes.resize( m_numEdges, order+1 ); m_nodesPositions.resize( m_numNodes ); + // also assign node coordinates using trilinear interpolation in th elements + arrayView2d< real64, nodes::REFERENCE_POSITION_USD > refPosNew = this->getNodePositions(); + refPosNew.setValues< parallelHostPolicy >( -1.0 ); + array1d< real64 > glCoords = gaussLobattoPoints( order ); - // --------------------------------------- - // initialize the node local to global map - // --------------------------------------- - - // The general idea for building nodes local-to-global map for the high-order meshes are: - // 1. for all the nodes that already in the base mesh-level, we keep their globalIDs the same - // 2. for the new nodes on the edges, we assign their global ID according to the global information from edgeLocalToGlobal map - // 3. for the new nodes on the faces, we assign their global ID according to the global information from faceLocalToGlobal map - // 4. for the new nodes on the internal of each elements, we assign the global ID for the new nodes - // according to the global information for the elements from elementLocalToGlobal map. arrayView1d< globalIndex > nodeLocalToGlobalNew = m_nodeLocalToGlobal.toView(); + localIndex localNodeOffset = 0; - // nodeIDs is a hash map that contains unique vertices and their indices for shared nodes: - // - A vertex is identified by 6 integers [i1 i2 i3 i4 a b], as follows: - // - nodes on a vertex v are identified by the vector [v -1 -1 -1 -1 -1] - // - nodes on a edge are given by a linear interpolation between vertices v1 and v2, 'a' steps away from v1 - // (we assume that v1 < v2 and identify these nodes with [v1 v2 -1 -1 a -1]). - // - nodes on a face are given by a bilinear interpolation between edges v1-v2 and v3-v4 - // (v1-v4 and v2-v3 are the diagonals), with interpolation parameters 'a' and 'b'. - // (we assume that v1 is the smallest, and that v2 < v3) Then these nodes are identified with [v1 v2 v3 v4 a b] - // - nodes within the internal of a cell are encountered only once, and thus do not need to be put in the hash map - std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; - - // Create new nodes, with local and global IDs - localIndex localNodeID = 0; - for( localIndex iter_vertex=0; iter_vertex < numLocalVertices; iter_vertex++ ) + forAll< parallelHostPolicy >( numLocalVertices, + [ nodeLocalToGlobalSource=nodeLocalToGlobalSource.toView(), + nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView(), + refPosSource=refPosSource.toView(), + refPosNew=refPosNew.toView() ]( localIndex const iter_vertex ) { - nodeLocalToGlobalNew[ localNodeID ] = nodeLocalToGlobalSource.toView()[ iter_vertex ]; - nodeIDs[ createNodeKey( iter_vertex ) ] = localNodeID; - localNodeID++; - } + nodeLocalToGlobalNew[ iter_vertex ] = nodeLocalToGlobalSource[ iter_vertex ]; + refPosNew[ iter_vertex ][0] = refPosSource[ iter_vertex ][0]; + refPosNew[ iter_vertex ][1] = refPosSource[ iter_vertex ][1]; + refPosNew[ iter_vertex ][2] = refPosSource[ iter_vertex ][2]; + } ); + localNodeOffset = numLocalVertices; ////////////////////////// // Edges @@ -972,34 +1001,47 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, arrayView2d< localIndex > edgeToNodeMapNew = m_edgeToNodes.toView(); // create / retrieve nodes on edges - localIndex offset = maxVertexGlobalID; - for( localIndex iter_edge = 0; iter_edge < numLocalEdges; iter_edge++ ) + localIndex globalNodeOffset = maxVertexGlobalID; + + forAll< parallelHostPolicy >( numLocalEdges, + [ edgeToNodesMapSource=edgeToNodesMapSource.toView(), + edgeToNodeMapNew=edgeToNodeMapNew.toView(), + refPosSrc=refPosSource.toView(), + refPosNew=refPosNew.toView(), + edgeLocalToGlobal=edgeLocalToGlobal.toView(), + nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView(), + numInternalNodesPerEdge, numNodesPerEdge, globalNodeOffset, glCoords, localNodeOffset, order]( localIndex const iter_edge ) { - localIndex v1 = edgeToNodesMapSource[ iter_edge ][ 0 ]; - localIndex v2 = edgeToNodesMapSource[ iter_edge ][ 1 ]; - globalIndex gv1 = nodeLocalToGlobalSource.toView()[v1]; - globalIndex gv2 = nodeLocalToGlobalSource.toView()[v2]; - for( int q=0; q, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + localIndex edgeHeadNode = edgeToNodesMapSource[ iter_edge ][ 0 ]; + localIndex edgeEndNode = edgeToNodesMapSource[ iter_edge ][ 1 ]; + globalIndex edgeHeadNodeG = nodeLocalToGlobalNew[ edgeHeadNode ]; + globalIndex edgeEndNodeG = nodeLocalToGlobalNew[ edgeEndNode ]; + array1d< localIndex > const edgeToNodeMapWork( numNodesPerEdge ); + edgeToNodeMapWork[ 0 ] = edgeHeadNode; + edgeToNodeMapWork[ 1 ] = edgeEndNode; + nodeIDs[ createNodeKey( edgeHeadNode ) ] = 0; + nodeIDs[ createNodeKey( edgeEndNode ) ] = 1; + + for( localIndex iter_node = 0; iter_node < numInternalNodesPerEdge; iter_node++ ) { - localIndex nodeID; - std::array< localIndex, 6 > nodeKey = createNodeKey( v1, v2, q, order ); - if( nodeIDs.count( nodeKey ) == 0 ) - { - // this is an internal edge node: create it - nodeID = localNodeID; - nodeIDs[ nodeKey ] = nodeID; - std::array< globalIndex, 6 > referenceOrientation = createNodeKey( gv1, gv2, q, order ); - int gq = referenceOrientation[4] - 1; - nodeLocalToGlobalNew[ nodeID ] = offset + edgeLocalToGlobal[ iter_edge ] * numInternalNodesPerEdge + gq; - localNodeID++; - } - else - { - nodeID = nodeIDs[ nodeKey ]; - } - edgeToNodeMapNew[ iter_edge ][ q ] = nodeID; + real64 alpha = ( glCoords[ iter_node ] + 1.0 ) / 2.0; + localIndex nodeLocalID = localNodeOffset + iter_edge * ( numInternalNodesPerEdge ) + iter_node; + edgeToNodeMapWork[ iter_node + 2 ] = nodeLocalID; + nodeIDs[ createNodeKey( edgeHeadNode, edgeEndNode, iter_node + 1, order ) ] = iter_node + 2; + std::array< globalIndex, 6 > referenceOrientation = createNodeKey( edgeHeadNodeG, edgeEndNodeG, iter_node + 1, order ); + int gq = referenceOrientation[4] - 1; + nodeLocalToGlobalNew[ nodeLocalID ] = globalNodeOffset + edgeLocalToGlobal[ iter_edge ] * numInternalNodesPerEdge + gq; + localIndex e[2] = { edgeHeadNode, edgeEndNode }; + linearInterp( alpha, refPosSrc, e, refPosNew, nodeLocalID ); } - } + // reorder map + for( localIndex q = 0; q < numNodesPerEdge; q++ ) + { + edgeToNodeMapNew[ iter_edge ][ q ] = edgeToNodeMapWork[ nodeIDs[ createNodeKey( edgeHeadNode, edgeEndNode, q, order ) ] ]; + } + } ); + localNodeOffset += numInternalNodesPerEdge * numLocalEdges; ///////////////////////// // Faces @@ -1022,48 +1064,76 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, } } ); - // create / retrieve nodes on faces - // by default, faces are oriented so that the normal has an outward orientation for the current rank. - // For this reason : - // - The 3rd and 4th node need to be swapped, to be consistent with the GL ordering - // - The global IDs of the internal nodes must be referred to a global "reference" orientation (using the createNodeKey method) - offset = maxVertexGlobalID + maxEdgeGlobalID * numInternalNodesPerEdge; - for( localIndex iter_face = 0; iter_face < numLocalFaces; iter_face++ ) + globalNodeOffset = maxVertexGlobalID + maxEdgeGlobalID * numInternalNodesPerEdge; + + forAll< parallelHostPolicy >( numLocalFaces, + [ =, faceToNodesMapSource=faceToNodesMapSource.toView(), + edgeToNodeMapNew=edgeToNodeMapNew.toView(), + faceToNodeMapNew=faceToNodeMapNew.toView(), + m_faceToEdges=m_faceToEdges.toView(), + refPosSrc=refPosSource.toView(), + refPosNew=refPosNew.toView(), + faceLocalToGlobal=faceLocalToGlobal.toView(), + nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView() ]( localIndex const iter_face ) { - localIndex v1 = faceToNodesMapSource[ iter_face ][ 0 ]; - localIndex v2 = faceToNodesMapSource[ iter_face ][ 1 ]; - localIndex v3 = faceToNodesMapSource[ iter_face ][ 2 ]; - localIndex v4 = faceToNodesMapSource[ iter_face ][ 3 ]; - std::swap( v3, v4 ); - globalIndex gv1 = nodeLocalToGlobalSource.toView()[v1]; - globalIndex gv2 = nodeLocalToGlobalSource.toView()[v2]; - globalIndex gv3 = nodeLocalToGlobalSource.toView()[v3]; - globalIndex gv4 = nodeLocalToGlobalSource.toView()[v4]; - for( int q1=0; q1, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + localIndex faceVertID[ numVerticesPerFace ]; + globalIndex faceVertGID[ numVerticesPerFace ]; + array1d< localIndex > const faceToNodeMapWork( numNodesPerFace ); + for( localIndex iter_node=0; iter_node nodeKey = createNodeKey( v1, v2, v3, v4, q1, q2, order ); - if( nodeIDs.count( nodeKey ) == 0 ) - { - // this is an internal face node: create it - nodeID = localNodeID; - nodeIDs[ nodeKey ] = nodeID; - std::array< globalIndex, 6 > referenceOrientation = createNodeKey( gv1, gv2, gv3, gv4, q1, q2, order ); - int gq1 = referenceOrientation[4] - 1; - int gq2 = referenceOrientation[5] - 1; - nodeLocalToGlobalNew[ nodeID ] = offset + faceLocalToGlobal[ iter_face ] * numInternalNodesPerFace + gq1* numInternalNodesPerEdge + gq2; - localNodeID++; - } - else - { - nodeID = nodeIDs[ nodeKey ]; - } - faceToNodeMapNew[ iter_face ][ q2 + q1*numNodesPerEdge ] = nodeID; + localIndex nodeIdxInMap = numVerticesPerFace + iter_edge * numInternalNodesPerEdge + iter_node; + localIndex edge = m_faceToEdges[ iter_face ][ iter_edge ]; + faceToNodeMapWork[ nodeIdxInMap ] = edgeToNodeMapNew[ edge ][ iter_node + 1 ]; + nodeIDs[ createNodeKey( edgeToNodeMapNew[ edge ][ 0 ], edgeToNodeMapNew[ edge ][ numNodesPerEdge - 1 ], iter_node + 1, order ) ] = nodeIdxInMap; } } - } + for( localIndex iter_node=0; iter_node referenceOrientation = createNodeKey( faceVertGID[ 0 ], faceVertGID[ 1 ], faceVertGID[ 2 ], faceVertGID[ 3 ], + q1 + 1, q2 + 1, order ); + int gq1 = referenceOrientation[4] - 1; + int gq2 = referenceOrientation[5] - 1; + nodeLocalToGlobalNew[ nodeLocalID ] = globalNodeOffset + faceLocalToGlobal[ iter_face ] * numInternalNodesPerFace + gq2 * numInternalNodesPerEdge + gq1; + + bilinearInterp( alpha, beta, refPosSrc, faceVertID, refPosNew, nodeLocalID ); + } + // reorder map + for( localIndex q = 0; q < numNodesPerFace; q++ ) + { + localIndex q1 = q % numNodesPerEdge; + localIndex q2 = ( q / numNodesPerEdge ) % numNodesPerEdge; + if( q1 == 0 || q1 == numNodesPerEdge - 1 || q2 == 0 || q2 == numNodesPerEdge - 1 ) + { + faceToNodeMapNew[ iter_face ][ q ] = faceToNodeMapWork[ + nodeIDs[ createNodeKey( faceVertID[0], faceVertID[1], faceVertID[2], faceVertID[3], q1, q2, order ) ] ]; + } + } + } ); + + localNodeOffset += numInternalNodesPerFace * numLocalFaces; // add all nodes to the target set "all" SortedArray< localIndex > & allNodesSet = this->getNodeSets()[ "all" ]; @@ -1074,20 +1144,12 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, allNodesSet.insert( iter_nodes ); } + ///////////////////////// // Elements ////////////////////////// - // also assign node coordinates using trilinear interpolation in th elements - arrayView2d< real64, nodes::REFERENCE_POSITION_USD > refPosNew = this->getNodePositions(); - refPosNew.setValues< parallelHostPolicy >( -1.0 ); - - real64 Xmesh[ numVerticesPerCell ][ 3 ] = { { } }; - real64 X[ 3 ] = { { } }; - array1d< real64 > glCoords = gaussLobattoPoints( order ); - localIndex elemMeshVertices[ numVerticesPerCell ] = { }; - offset = maxVertexGlobalID + maxEdgeGlobalID * numInternalNodesPerEdge + maxFaceGlobalID * numInternalNodesPerFace; - std::array< localIndex, 6 > const nullKey = std::array< localIndex, 6 >{ -1, -1, -1, -1, -1, -1 }; + globalNodeOffset = maxVertexGlobalID + maxEdgeGlobalID * numInternalNodesPerEdge + maxFaceGlobalID * numInternalNodesPerFace; // initialize the elements-to-nodes map arrayView2d< localIndex, cells::NODE_MAP_USD > elemsToNodesNew; @@ -1097,61 +1159,89 @@ void CellBlockManager::generateHighOrderMaps( localIndex const order, arrayView1d< globalIndex > elementLocalToGlobal( cellBlock.localToGlobalMap() ); array2d< localIndex, cells::NODE_MAP_PERMUTATION > elemsToNodesSource ( cellBlock.getElemToNodes() ); + array2d< localIndex > elemsToEdges ( cellBlock.getElemToEdges() ); + array2d< localIndex > elemsToFaces ( cellBlock.getElemToFaces() ); + cellBlock.resizeNumNodes( numNodesPerCell ); elemsToNodesNew = cellBlock.getElemToNode(); localIndex const numCellElements = cellBlock.numElements(); - // then loop through all the elements and assign the globalID according to the globalID of the Element - // and insert the new local to global ID ( for the internal nodes of elements ) into the nodeLocalToGlobal - // retrieve finite element type - for( localIndex iter_elem = 0; iter_elem < numCellElements; ++iter_elem ) + forAll< parallelHostPolicy >( numCellElements, + [ =, + elemsToNodesSource=elemsToNodesSource.toView(), + elemsToNodesNew=elemsToNodesNew.toView(), + elemsToEdges=elemsToEdges.toView(), + elemsToFaces=elemsToFaces.toView(), + edgeToNodeMapNew=edgeToNodeMapNew.toView(), + faceToNodeMapNew=faceToNodeMapNew.toView(), + refPosSrc=refPosSource.toView(), + refPosNew=refPosNew.toView(), + elementLocalToGlobal=elementLocalToGlobal.toView(), + nodeLocalToGlobalNew=nodeLocalToGlobalNew.toView() ]( localIndex const iter_elem ) { - localIndex newCellNodes = 0; - for( localIndex iter_vertex = 0; iter_vertex < numVerticesPerCell; iter_vertex++ ) + std::unordered_map< std::array< localIndex, 6 >, localIndex, NodeKeyHasher< localIndex > > nodeIDs; + localIndex elemVertID[ numVerticesPerCell]; + array1d< localIndex > const elemToNodeMapWork( numNodesPerCell ); + for( localIndex iter_node=0; iter_node < numVerticesPerCell; iter_node++ ) { - elemMeshVertices[ iter_vertex ] = elemsToNodesSource[ iter_elem ][ iter_vertex ]; - for( int i =0; i < 3; i++ ) - { - Xmesh[ iter_vertex ][ i ] = refPosSource[ elemMeshVertices[ iter_vertex ] ][ i ]; - } + elemVertID[ iter_node ] = elemsToNodesSource[ iter_elem ][ iter_node ]; + elemToNodeMapWork[ iter_node ] = elemVertID[ iter_node ]; + nodeIDs[ createNodeKey( elemVertID[ iter_node ] ) ] = iter_node; } - for( int q = 0; q < numNodesPerCell; q++ ) + for( localIndex iter_edge=0; iter_edge < numEdgesPerCell; iter_edge++ ) { - localIndex nodeID; - int dof = q; - int q1 = dof % numNodesPerEdge; - dof /= ( numNodesPerEdge ); - int q2 = dof % ( numNodesPerEdge ); - dof /= ( numNodesPerEdge ); - int q3 = dof % ( numNodesPerEdge ); - // compute node coords - real64 alpha = ( glCoords[ q1 ] + 1.0 ) / 2.0; - real64 beta = ( glCoords[ q2 ] + 1.0 ) / 2.0; - real64 gamma = ( glCoords[ q3 ] + 1.0 ) / 2.0; - trilinearInterp( alpha, beta, gamma, Xmesh, X ); - // find node ID - std::array< localIndex, 6 > nodeKey = createNodeKey( elemMeshVertices, q1, q2, q3, order ); - if( nodeKey == nullKey ) + for( localIndex iter_node=0; iter_node < numInternalNodesPerEdge; iter_node++ ) { - // the node is internal to a cell -- create it - nodeID = localNodeID; - nodeLocalToGlobalNew[ nodeID ] = offset + elementLocalToGlobal[ iter_elem ] * numInternalNodesPerCell + newCellNodes; - localNodeID++; - newCellNodes++; + localIndex nodeIdxInMap = numVerticesPerCell + iter_edge * numInternalNodesPerEdge + iter_node; + localIndex edge = elemsToEdges[iter_elem][iter_edge]; + elemToNodeMapWork[ nodeIdxInMap ] = edgeToNodeMapNew[ edge ][iter_node+1]; + nodeIDs[ createNodeKey( edgeToNodeMapNew[ edge ][ 0 ], edgeToNodeMapNew[ edge ][ numNodesPerEdge - 1 ], iter_node + 1, order ) ] = nodeIdxInMap; } - else + } + for( localIndex iter_face=0; iter_face < numFacesPerCell; iter_face++ ) + { + for( localIndex iter_node=0; iter_node < numInternalNodesPerFace; iter_node++ ) { - nodeID = nodeIDs[ nodeKey ]; + localIndex q1 = iter_node % numInternalNodesPerEdge; + localIndex q2 = ( iter_node / numInternalNodesPerEdge ) % numInternalNodesPerEdge; + localIndex nodeIdxInMap = numVerticesPerCell + numEdgesPerCell * numInternalNodesPerEdge + iter_face * numInternalNodesPerFace + iter_node; + localIndex face = elemsToFaces[iter_elem][iter_face]; + elemToNodeMapWork[ nodeIdxInMap ] = faceToNodeMapNew[face][(q2 + 1) * numNodesPerEdge + (q1 + 1 )]; + nodeIDs[ createNodeKey( faceToNodeMapNew[ face ][ 0 ], faceToNodeMapNew[ face ][ numNodesPerEdge - 1 ], + faceToNodeMapNew[ face ][ numNodesPerFace - numNodesPerEdge ], faceToNodeMapNew[ face ][ numNodesPerFace- 1 ], q1 + 1, q2 + 1, order ) ] = nodeIdxInMap; } - for( int i=0; i<3; i++ ) + } + for( localIndex iter_node=0; iter_node < numInternalNodesPerCell; iter_node++ ) + { + localIndex q1 = iter_node % numInternalNodesPerEdge; + localIndex q2 = ( iter_node / numInternalNodesPerEdge ) % numInternalNodesPerEdge; + localIndex q3 = ( iter_node / numInternalNodesPerEdge ) / numInternalNodesPerEdge; + real64 alpha = ( glCoords[ q1 ] + 1.0 ) / 2.0; + real64 beta = ( glCoords[ q2 ] + 1.0 ) / 2.0; + real64 gamma = ( glCoords[ q3 ] + 1.0 ) / 2.0; + + localIndex nodeLocalID = localNodeOffset + iter_elem * numInternalNodesPerCell + iter_node; + elemsToNodesNew[ iter_elem ][ (q3 + 1) * numNodesPerFace + (q2 + 1) * numNodesPerEdge + (q1 + 1) ] = nodeLocalID; + nodeLocalToGlobalNew[ nodeLocalID ] = globalNodeOffset + elementLocalToGlobal[ iter_elem ] * numInternalNodesPerCell + iter_node; + trilinearInterp( alpha, beta, gamma, refPosSrc, elemVertID, refPosNew, nodeLocalID ); + + } + // reorder map + for( localIndex q = 0; q < numNodesPerCell; q++ ) + { + localIndex q1 = q % numNodesPerEdge; + localIndex q2 = ( q / numNodesPerEdge ) % numNodesPerEdge; + localIndex q3 = ( q / numNodesPerEdge ) / numNodesPerEdge; + if( q1 == 0 || q1 == numNodesPerEdge - 1 || q2 == 0 || q2 == numNodesPerEdge - 1 || q3 == 0 || q3 == numNodesPerEdge - 1 ) { - refPosNew( nodeID, i ) = X[ i ]; + elemsToNodesNew[ iter_elem ][ q ] = elemToNodeMapWork[ + nodeIDs[ createNodeKey( elemVertID, q1, q2, q3, order ) ] ]; } - elemsToNodesNew[ iter_elem ][ q ] = nodeID; } - } + } ); + localNodeOffset += numCellElements; } ); } -} +} // namespace geos diff --git a/src/coreComponents/mesh/generators/CellBlockUtilities.cpp b/src/coreComponents/mesh/generators/CellBlockUtilities.cpp index 74190802863..d29fadbc5ef 100644 --- a/src/coreComponents/mesh/generators/CellBlockUtilities.cpp +++ b/src/coreComponents/mesh/generators/CellBlockUtilities.cpp @@ -15,8 +15,6 @@ #include "CellBlockUtilities.hpp" #include "codingUtilities/Utilities.hpp" -#include "common/GEOS_RAJA_Interface.hpp" -#include "common/TimingMacros.hpp" #include "mesh/generators/CellBlockManagerABC.hpp" #include "mesh/generators/PrismUtilities.hpp" diff --git a/src/coreComponents/mesh/generators/CollocatedNodes.cpp b/src/coreComponents/mesh/generators/CollocatedNodes.cpp index 80ebf967963..4351294fee2 100644 --- a/src/coreComponents/mesh/generators/CollocatedNodes.cpp +++ b/src/coreComponents/mesh/generators/CollocatedNodes.cpp @@ -14,6 +14,11 @@ #include "CollocatedNodes.hpp" +#include "common/MpiWrapper.hpp" + + +#include + namespace geos::vtk { diff --git a/src/coreComponents/mesh/generators/CollocatedNodes.hpp b/src/coreComponents/mesh/generators/CollocatedNodes.hpp index a4819d67e08..e028569b054 100644 --- a/src/coreComponents/mesh/generators/CollocatedNodes.hpp +++ b/src/coreComponents/mesh/generators/CollocatedNodes.hpp @@ -17,14 +17,10 @@ #include "common/DataTypes.hpp" -#include "common/MpiWrapper.hpp" - #include #include -#include #include - namespace geos::vtk { diff --git a/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp b/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp index 52727b04258..71410f24651 100644 --- a/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp +++ b/src/coreComponents/mesh/generators/InternalMeshGenerator.cpp @@ -20,7 +20,6 @@ #include "CellBlockManager.hpp" #include "common/DataTypes.hpp" -#include "common/TimingMacros.hpp" #include @@ -586,54 +585,54 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa // Find elemCenters for even uniform element sizes array1d< array1d< real64 > > elemCenterCoords( 3 ); - for( int i = 0; i < 3; ++i ) + for( int dim = 0; dim < m_dim; ++dim ) { - m_numElemsTotal[i] = 0; - for( int block = 0; block < m_nElems[i].size(); ++block ) + m_numElemsTotal[dim] = 0; + for( int block = 0; block < m_nElems[dim].size(); ++block ) { - m_numElemsTotal[i] += m_nElems[i][block]; + m_numElemsTotal[dim] += m_nElems[dim][block]; } array1d< int > const & parts = partition.getPartitions(); - GEOS_ERROR_IF( parts[i] > m_numElemsTotal[i], "Number of partitions in a direction should not exceed the number of elements in that direction" ); + GEOS_ERROR_IF( parts[dim] > m_numElemsTotal[dim], "Number of partitions in a direction should not exceed the number of elements in that direction" ); - elemCenterCoords[i].resize( m_numElemsTotal[i] ); - array1d< real64 > elemCenterCoordsLocal( m_numElemsTotal[i] ); - for( int k = 0; k < m_numElemsTotal[i]; ++k ) + elemCenterCoords[dim].resize( m_numElemsTotal[dim] ); + array1d< real64 > elemCenterCoordsLocal( m_numElemsTotal[dim] ); + for( integer k = 0; k < m_numElemsTotal[dim]; ++k ) { - elemCenterCoordsLocal[k] = m_min[i] + ( m_max[i] - m_min[i] ) * ( k + 0.5 ) / m_numElemsTotal[i]; + elemCenterCoordsLocal[k] = m_min[dim] + ( m_max[dim] - m_min[dim] ) * ( k + 0.5 ) / m_numElemsTotal[dim]; } MpiWrapper::allReduce( elemCenterCoordsLocal.data(), - elemCenterCoords[i].data(), - m_numElemsTotal[i], + elemCenterCoords[dim].data(), + m_numElemsTotal[dim], MPI_MAX, MPI_COMM_GEOSX ); } // Find starting/ending index // Get the first and last indices in this partition each direction - int firstElemIndexInPartition[3] = { -1, -1, -1 }; - int lastElemIndexInPartition[3] = { -2, -2, -2 }; + integer firstElemIndexInPartition[3] = { -1, -1, -1 }; + integer lastElemIndexInPartition[3] = { -2, -2, -2 }; - for( int i = 0; i < 3; ++i ) + for( int dim = 0; dim < m_dim; ++dim ) { // firstElemIndexInPartition[i] = -1; // lastElemIndexInPartition[i] = -2; - for( int k = 0; k < m_numElemsTotal[i]; ++k ) + for( int k = 0; k < m_numElemsTotal[dim]; ++k ) { - if( partition.isCoordInPartition( elemCenterCoords[i][k], i ) ) + if( partition.isCoordInPartition( elemCenterCoords[dim][k], dim ) ) { - firstElemIndexInPartition[i] = k; + firstElemIndexInPartition[dim] = k; break; } } - if( firstElemIndexInPartition[i] > -1 ) + if( firstElemIndexInPartition[dim] > -1 ) { - for( int k = firstElemIndexInPartition[i]; k < m_numElemsTotal[i]; ++k ) + for( int k = firstElemIndexInPartition[dim]; k < m_numElemsTotal[dim]; ++k ) { - if( partition.isCoordInPartition( elemCenterCoords[i][k], i ) ) + if( partition.isCoordInPartition( elemCenterCoords[dim][k], dim ) ) { - lastElemIndexInPartition[i] = k; + lastElemIndexInPartition[dim] = k; } } } @@ -648,28 +647,28 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa array1d< integer > firstElemIndexForBlockInPartition[3]; array1d< integer > lastElemIndexForBlockInPartition[3]; - for( int dir = 0; dir < 3; ++dir ) + for( int dim = 0; dim < 3; ++dim ) { - firstElemIndexForBlockInPartition[dir] = m_firstElemIndexForBlock[dir]; - lastElemIndexForBlockInPartition[dir] = m_lastElemIndexForBlock[dir]; + firstElemIndexForBlockInPartition[dim] = m_firstElemIndexForBlock[dim]; + lastElemIndexForBlockInPartition[dim] = m_lastElemIndexForBlock[dim]; - for( int block = 0; block < m_nElems[dir].size(); ++block ) + for( integer block = 0; block < m_nElems[dim].size(); ++block ) { - if( firstElemIndexForBlockInPartition[dir][block] > lastElemIndexInPartition[dir] || - lastElemIndexForBlockInPartition[dir][block] < firstElemIndexInPartition[dir] ) + if( firstElemIndexForBlockInPartition[dim][block] > lastElemIndexInPartition[dim] || + lastElemIndexForBlockInPartition[dim][block] < firstElemIndexInPartition[dim] ) { - firstElemIndexForBlockInPartition[dir][block] = -1; - lastElemIndexForBlockInPartition[dir][block] = -2; + firstElemIndexForBlockInPartition[dim][block] = -1; + lastElemIndexForBlockInPartition[dim][block] = -2; } else { - if( firstElemIndexForBlockInPartition[dir][block] < firstElemIndexInPartition[dir] ) + if( firstElemIndexForBlockInPartition[dim][block] < firstElemIndexInPartition[dim] ) { - firstElemIndexForBlockInPartition[dir][block] = firstElemIndexInPartition[dir]; + firstElemIndexForBlockInPartition[dim][block] = firstElemIndexInPartition[dim]; } - if( lastElemIndexForBlockInPartition[dir][block] > lastElemIndexInPartition[dir] ) + if( lastElemIndexForBlockInPartition[dim][block] > lastElemIndexInPartition[dim] ) { - lastElemIndexForBlockInPartition[dir][block] = lastElemIndexInPartition[dir]; + lastElemIndexForBlockInPartition[dim][block] = lastElemIndexInPartition[dim]; } } } @@ -677,11 +676,11 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa // TODO This needs to be rewritten for dimensions lower than 3. localIndex regionOffset = 0; - for( int iblock = 0; iblock < m_nElems[0].size(); ++iblock ) + for( integer kblock = 0; kblock < m_nElems[2].size(); ++kblock ) { - for( int jblock = 0; jblock < m_nElems[1].size(); ++jblock ) + for( integer jblock = 0; jblock < m_nElems[1].size(); ++jblock ) { - for( int kblock = 0; kblock < m_nElems[2].size(); ++kblock, ++regionOffset ) + for( integer iblock = 0; iblock < m_nElems[0].size(); ++iblock, ++regionOffset ) { numElemsInRegions[ m_regionNames[ regionOffset ] ] = 0; elemTypeInRegions[ m_regionNames[ regionOffset ] ] = ElementType::Quadrilateral; @@ -692,13 +691,13 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa regionOffset = 0; { localIndex iR = 0; - for( int iblock = 0; iblock < m_nElems[0].size(); ++iblock ) + for( integer kblock = 0; kblock < m_nElems[2].size(); ++kblock ) { - for( int jblock = 0; jblock < m_nElems[1].size(); ++jblock ) + for( integer jblock = 0; jblock < m_nElems[1].size(); ++jblock ) { - for( int kblock = 0; kblock < m_nElems[2].size(); ++kblock, ++regionOffset, ++iR ) + for( integer iblock = 0; iblock < m_nElems[0].size(); ++iblock, ++regionOffset, ++iR ) { - int numElemsInRegion = 1; + integer numElemsInRegion = 1; numElemsInRegion *= lastElemIndexForBlockInPartition[0][iblock] - firstElemIndexForBlockInPartition[0][iblock] + 1; if( m_dim > 1 ) @@ -720,10 +719,9 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa localIndex numNodes = 1; integer numNodesInDir[3] = { 1, 1, 1 }; - - for( int i = 0; i < m_dim; ++i ) + for( int dim = 0; dim < m_dim; ++dim ) { - numNodesInDir[i] = lastElemIndexInPartition[i] - firstElemIndexInPartition[i] + 2; + numNodesInDir[dim] = lastElemIndexInPartition[dim] - firstElemIndexInPartition[dim] + 2; } reduceNumNodesForPeriodicBoundary( partition, numNodesInDir ); numNodes = numNodesInDir[0] * numNodesInDir[1] * numNodesInDir[2]; @@ -736,17 +734,17 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa { localIndex localNodeIndex = 0; - for( int i = 0; i < numNodesInDir[0]; ++i ) + for( integer k = 0; k < numNodesInDir[2]; ++k ) { - for( int j = 0; j < numNodesInDir[1]; ++j ) + for( integer j = 0; j < numNodesInDir[1]; ++j ) { - for( int k = 0; k < numNodesInDir[2]; ++k ) + for( integer i = 0; i < numNodesInDir[0]; ++i ) { - int globalIJK[3] = { i, j, k }; + integer globalIJK[3] = { i, j, k }; - for( int a = 0; a < m_dim; ++a ) + for( int dim = 0; dim < m_dim; ++dim ) { - globalIJK[a] += firstElemIndexInPartition[a]; + globalIJK[dim] += firstElemIndexInPartition[dim]; } getNodePosition( globalIJK, m_trianglePattern, X[localNodeIndex] ); @@ -825,11 +823,11 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa numNodes = numNodesInDir[0] * numNodesInDir[1] * numNodesInDir[2]; } - for( int iblock = 0; iblock < m_nElems[0].size(); ++iblock ) + for( integer kblock = 0; kblock < m_nElems[2].size(); ++kblock ) { - for( int jblock = 0; jblock < m_nElems[1].size(); ++jblock ) + for( integer jblock = 0; jblock < m_nElems[1].size(); ++jblock ) { - for( int kblock = 0; kblock < m_nElems[2].size(); ++kblock, ++regionOffset, ++iR ) + for( integer iblock = 0; iblock < m_nElems[0].size(); ++iblock, ++regionOffset, ++iR ) { ElementType const elementType = EnumStrings< ElementType >::fromString( m_elementType[iR] ); @@ -840,25 +838,25 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa arrayView2d< localIndex, cells::NODE_MAP_USD > elemsToNodes = cellBlock.getElemToNode(); arrayView1d< globalIndex > const & elemLocalToGlobal = cellBlock.localToGlobalMap(); - int numElemsInDirForBlock[3] = + integer numElemsInDirForBlock[3] = { lastElemIndexForBlockInPartition[0][iblock] - firstElemIndexForBlockInPartition[0][iblock] + 1, lastElemIndexForBlockInPartition[1][jblock] - firstElemIndexForBlockInPartition[1][jblock] + 1, lastElemIndexForBlockInPartition[2][kblock] - firstElemIndexForBlockInPartition[2][kblock] + 1 }; - for( int i = 0; i < numElemsInDirForBlock[0]; ++i ) + for( integer k = 0; k < numElemsInDirForBlock[2]; ++k ) { - for( int j = 0; j < numElemsInDirForBlock[1]; ++j ) + for( integer j = 0; j < numElemsInDirForBlock[1]; ++j ) { - for( int k = 0; k < numElemsInDirForBlock[2]; ++k ) + for( integer i = 0; i < numElemsInDirForBlock[0]; ++i ) { - int globalIJK[3] = + integer globalIJK[3] = { i + firstElemIndexForBlockInPartition[0][iblock], j + firstElemIndexForBlockInPartition[1][jblock], k + firstElemIndexForBlockInPartition[2][kblock] }; - const localIndex firstNodeIndex = numNodesInDir[1] * numNodesInDir[2] * ( globalIJK[0] - firstElemIndexInPartition[0] ) - + numNodesInDir[2] * ( globalIJK[1] - firstElemIndexInPartition[1] ) - + ( globalIJK[2] - firstElemIndexInPartition[2] ); + localIndex const firstNodeIndex = ( globalIJK[0] - firstElemIndexInPartition[0] ) + + numNodesInDir[0] * ( globalIJK[1] - firstElemIndexInPartition[1] ) + + numNodesInDir[0] * numNodesInDir[1] * ( globalIJK[2] - firstElemIndexInPartition[2] ); localIndex nodeOfBox[8]; if( elementType == ElementType::Quadrilateral || elementType == ElementType::Triangle ) @@ -870,15 +868,17 @@ void InternalMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockMa } else { + localIndex const stride[3] = { 1, numNodesInDir[0], numNodesInDir[0] * numNodesInDir[1] }; + nodeOfBox[0] = firstNodeIndex; - nodeOfBox[1] = numNodesInDir[1] * numNodesInDir[2] + firstNodeIndex; - nodeOfBox[2] = numNodesInDir[1] * numNodesInDir[2] + numNodesInDir[2] + firstNodeIndex; - nodeOfBox[3] = numNodesInDir[2] + firstNodeIndex; + nodeOfBox[1] = nodeOfBox[0] + stride[0]; + nodeOfBox[2] = nodeOfBox[1] + stride[1]; + nodeOfBox[3] = nodeOfBox[0] + stride[1]; - nodeOfBox[4] = firstNodeIndex + 1; - nodeOfBox[5] = numNodesInDir[1] * numNodesInDir[2] + firstNodeIndex + 1; - nodeOfBox[6] = numNodesInDir[1] * numNodesInDir[2] + numNodesInDir[2] + firstNodeIndex + 1; - nodeOfBox[7] = numNodesInDir[2] + firstNodeIndex + 1; + nodeOfBox[4] = nodeOfBox[0] + stride[2]; + nodeOfBox[5] = nodeOfBox[1] + stride[2]; + nodeOfBox[6] = nodeOfBox[2] + stride[2]; + nodeOfBox[7] = nodeOfBox[3] + stride[2]; // 7___________________ 6 // / /| @@ -978,6 +978,8 @@ InternalMeshGenerator:: int const (&firstElemIndexInPartition)[3], localIndex (& nodeOfBox)[8] ) { + GEOS_ERROR_IF( component != 1, "Connectivity for periodic boundary implemented for the 1-component only" ); + // Condition is: // 1) element is last index in component direction // 2) first local element in component partition is zero @@ -987,14 +989,14 @@ InternalMeshGenerator:: // Last set of nodes int modGlobalIJK[3] = { globalIJK[0], globalIJK[1], globalIJK[2] }; modGlobalIJK[component] = 0; - const localIndex firstNodeIndex = numNodesInDir[1] * numNodesInDir[2] * ( modGlobalIJK[0] - firstElemIndexInPartition[0] ) - + numNodesInDir[2] * ( modGlobalIJK[1] - 0 ) - + ( modGlobalIJK[2] - firstElemIndexInPartition[2] ); + localIndex const firstNodeIndex = ( modGlobalIJK[0] - firstElemIndexInPartition[0] ) + + numNodesInDir[0] * ( modGlobalIJK[1] - firstElemIndexInPartition[1] ) + + numNodesInDir[0] * numNodesInDir[1] * ( modGlobalIJK[2] - firstElemIndexInPartition[2] ); nodeOfBox[3] = firstNodeIndex; - nodeOfBox[2] = numNodesInDir[1] * numNodesInDir[2] + firstNodeIndex; - nodeOfBox[7] = firstNodeIndex + 1; - nodeOfBox[6] = numNodesInDir[1] * numNodesInDir[2] + firstNodeIndex + 1; + nodeOfBox[2] = nodeOfBox[3] + 1; + nodeOfBox[7] = nodeOfBox[3] + numNodesInDir[0] * numNodesInDir[1]; + nodeOfBox[6] = nodeOfBox[7] + 1; } } diff --git a/src/coreComponents/mesh/generators/InternalMeshGenerator.hpp b/src/coreComponents/mesh/generators/InternalMeshGenerator.hpp index 9b95d975df9..bcb16630c92 100644 --- a/src/coreComponents/mesh/generators/InternalMeshGenerator.hpp +++ b/src/coreComponents/mesh/generators/InternalMeshGenerator.hpp @@ -271,7 +271,7 @@ class InternalMeshGenerator : public MeshGeneratorBase */ inline globalIndex nodeGlobalIndex( int const index[3] ) { - return index[0]*(m_numElemsTotal[1]+1)*(m_numElemsTotal[2]+1) + index[1]*(m_numElemsTotal[2]+1) + index[2]; + return index[0] + index[1]*(m_numElemsTotal[0]+1) + index[2]*(m_numElemsTotal[0]+1)*(m_numElemsTotal[1]+1); } /** @@ -280,7 +280,7 @@ class InternalMeshGenerator : public MeshGeneratorBase */ inline globalIndex elemGlobalIndex( int const index[3] ) { - return index[0]*m_numElemsTotal[1]*m_numElemsTotal[2] + index[1]*m_numElemsTotal[2] + index[2]; + return index[0] + index[1]*m_numElemsTotal[0] + index[2]*m_numElemsTotal[0]*m_numElemsTotal[1]; } /** diff --git a/src/coreComponents/mesh/generators/InternalWellboreGenerator.cpp b/src/coreComponents/mesh/generators/InternalWellboreGenerator.cpp index 9dfe5df2c53..9dbb3ab931a 100644 --- a/src/coreComponents/mesh/generators/InternalWellboreGenerator.cpp +++ b/src/coreComponents/mesh/generators/InternalWellboreGenerator.cpp @@ -18,7 +18,6 @@ #include "InternalWellboreGenerator.hpp" -#include "mesh/DomainPartition.hpp" #include "mesh/mpiCommunications/SpatialPartition.hpp" namespace geos diff --git a/src/coreComponents/mesh/generators/LineBlock.cpp b/src/coreComponents/mesh/generators/LineBlock.cpp index b49289325b4..05b655657b6 100644 --- a/src/coreComponents/mesh/generators/LineBlock.cpp +++ b/src/coreComponents/mesh/generators/LineBlock.cpp @@ -12,14 +12,7 @@ * ------------------------------------------------------------------------------------------------------------ */ -/** - * @file DomainPartition.cpp - */ - -#include "mesh/Perforation.hpp" #include "mesh/generators/LineBlock.hpp" -#include "mesh/generators/InternalWellGenerator.hpp" - namespace geos diff --git a/src/coreComponents/mesh/generators/LineBlock.hpp b/src/coreComponents/mesh/generators/LineBlock.hpp index 0582ee45f21..d81463dd4a3 100644 --- a/src/coreComponents/mesh/generators/LineBlock.hpp +++ b/src/coreComponents/mesh/generators/LineBlock.hpp @@ -16,7 +16,6 @@ #define GEOSX_WELLBLOCK_HPP #include "mesh/generators/LineBlockABC.hpp" -#include "mesh/generators/InternalWellGenerator.hpp" namespace geos diff --git a/src/coreComponents/mesh/generators/LineBlockABC.hpp b/src/coreComponents/mesh/generators/LineBlockABC.hpp index 240f1b633ef..723aaa69f7e 100644 --- a/src/coreComponents/mesh/generators/LineBlockABC.hpp +++ b/src/coreComponents/mesh/generators/LineBlockABC.hpp @@ -16,9 +16,7 @@ #define GEOSX_WELLBLOCKABC_HPP #include "dataRepository/Group.hpp" -#include "mesh/ElementType.hpp" #include "common/DataTypes.hpp" -#include "dataRepository/Group.hpp" #include diff --git a/src/coreComponents/mesh/generators/MeshGeneratorBase.hpp b/src/coreComponents/mesh/generators/MeshGeneratorBase.hpp index db085ee8b14..016e00e1389 100644 --- a/src/coreComponents/mesh/generators/MeshGeneratorBase.hpp +++ b/src/coreComponents/mesh/generators/MeshGeneratorBase.hpp @@ -20,7 +20,6 @@ #define GEOS_MESH_GENERATORS_MESHGENERATORBASE_HPP #include "mesh/mpiCommunications/SpatialPartition.hpp" -#include "mesh/generators/CellBlockManagerABC.hpp" #include "dataRepository/Group.hpp" #include "dataRepository/WrapperBase.hpp" diff --git a/src/coreComponents/mesh/generators/PTScotchInterface.hpp b/src/coreComponents/mesh/generators/PTScotchInterface.hpp index 6806ece7ed8..23999876031 100644 --- a/src/coreComponents/mesh/generators/PTScotchInterface.hpp +++ b/src/coreComponents/mesh/generators/PTScotchInterface.hpp @@ -20,6 +20,7 @@ #define GEOS_MESH_GENERATORS_PTSCOTCHINTERFACE_HPP_ #include "common/DataTypes.hpp" + #include "common/MpiWrapper.hpp" namespace geos diff --git a/src/coreComponents/mesh/generators/ParticleBlock.cpp b/src/coreComponents/mesh/generators/ParticleBlock.cpp index 55caa0aaadb..2d3b605ad9e 100644 --- a/src/coreComponents/mesh/generators/ParticleBlock.cpp +++ b/src/coreComponents/mesh/generators/ParticleBlock.cpp @@ -19,8 +19,6 @@ #include "ParticleBlock.hpp" -#include "common/GEOS_RAJA_Interface.hpp" - namespace geos { using namespace dataRepository; diff --git a/src/coreComponents/mesh/generators/ParticleBlock.hpp b/src/coreComponents/mesh/generators/ParticleBlock.hpp index ff054619bc4..333fb196ae3 100644 --- a/src/coreComponents/mesh/generators/ParticleBlock.hpp +++ b/src/coreComponents/mesh/generators/ParticleBlock.hpp @@ -15,12 +15,11 @@ #ifndef GEOSX_MESH_PARTICLEBLOCK_HPP_ #define GEOSX_MESH_PARTICLEBLOCK_HPP_ -#include "dataRepository/Group.hpp" -#include "mesh/utilities/ComputationalGeometry.hpp" -#include "common/GEOS_RAJA_Interface.hpp" #include "mesh/generators/ParticleBlockABC.hpp" #include "mesh/ParticleType.hpp" +#include "dataRepository/Group.hpp" + namespace geos { diff --git a/src/coreComponents/mesh/generators/ParticleBlockABC.hpp b/src/coreComponents/mesh/generators/ParticleBlockABC.hpp index 030e2ce3e92..17c232b1d60 100644 --- a/src/coreComponents/mesh/generators/ParticleBlockABC.hpp +++ b/src/coreComponents/mesh/generators/ParticleBlockABC.hpp @@ -15,8 +15,9 @@ #ifndef GEOSX_PARTICLEBLOCKABC_HPP #define GEOSX_PARTICLEBLOCKABC_HPP -#include "dataRepository/Group.hpp" #include "mesh/ParticleType.hpp" + +#include "dataRepository/Group.hpp" #include "common/DataTypes.hpp" #include diff --git a/src/coreComponents/mesh/generators/ParticleBlockManager.cpp b/src/coreComponents/mesh/generators/ParticleBlockManager.cpp index 48b8b0ba126..d5c4beeddb3 100644 --- a/src/coreComponents/mesh/generators/ParticleBlockManager.cpp +++ b/src/coreComponents/mesh/generators/ParticleBlockManager.cpp @@ -14,10 +14,6 @@ #include "ParticleBlockManager.hpp" -#include "mesh/generators/CellBlockUtilities.hpp" -#include "mesh/utilities/MeshMapUtilities.hpp" - -#include namespace geos { diff --git a/src/coreComponents/mesh/generators/ParticleBlockManager.hpp b/src/coreComponents/mesh/generators/ParticleBlockManager.hpp index 70c8cb588b8..c47bafb048f 100644 --- a/src/coreComponents/mesh/generators/ParticleBlockManager.hpp +++ b/src/coreComponents/mesh/generators/ParticleBlockManager.hpp @@ -19,8 +19,8 @@ #ifndef GEOSX_MESH_PARTICLEBLOCKMANAGER_H_ #define GEOSX_MESH_PARTICLEBLOCKMANAGER_H_ -#include "mesh/generators/ParticleBlockManagerABC.hpp" #include "mesh/generators/ParticleBlock.hpp" +#include "mesh/generators/ParticleBlockManagerABC.hpp" namespace geos { diff --git a/src/coreComponents/mesh/generators/ParticleBlockManagerABC.hpp b/src/coreComponents/mesh/generators/ParticleBlockManagerABC.hpp index 4777179f57d..4f6f5579bf6 100644 --- a/src/coreComponents/mesh/generators/ParticleBlockManagerABC.hpp +++ b/src/coreComponents/mesh/generators/ParticleBlockManagerABC.hpp @@ -16,9 +16,7 @@ #define GEOSX_PARTICLEBLOCKMANAGERABC_HPP #include "dataRepository/Group.hpp" -#include "mesh/ParticleType.hpp" #include "common/DataTypes.hpp" -#include "dataRepository/Group.hpp" namespace geos { diff --git a/src/coreComponents/mesh/generators/ParticleMeshGenerator.cpp b/src/coreComponents/mesh/generators/ParticleMeshGenerator.cpp index 5f3ad2510d6..f0a9e219668 100644 --- a/src/coreComponents/mesh/generators/ParticleMeshGenerator.cpp +++ b/src/coreComponents/mesh/generators/ParticleMeshGenerator.cpp @@ -17,11 +17,9 @@ */ #include "ParticleMeshGenerator.hpp" +#include "ParticleBlockManager.hpp" -#include "mesh/DomainPartition.hpp" -#include "mesh/mpiCommunications/PartitionBase.hpp" #include "mesh/mpiCommunications/SpatialPartition.hpp" -#include "ParticleBlockManager.hpp" #include "common/DataTypes.hpp" #include "common/TimingMacros.hpp" diff --git a/src/coreComponents/mesh/generators/ParticleMeshGenerator.hpp b/src/coreComponents/mesh/generators/ParticleMeshGenerator.hpp index 0ae0de19e9e..fd2d605bc19 100644 --- a/src/coreComponents/mesh/generators/ParticleMeshGenerator.hpp +++ b/src/coreComponents/mesh/generators/ParticleMeshGenerator.hpp @@ -19,8 +19,9 @@ #ifndef GEOSX_MESH_GENERATORS_PARTICLEMESHGENERATOR_HPP #define GEOSX_MESH_GENERATORS_PARTICLEMESHGENERATOR_HPP +#include "mesh/generators/MeshGeneratorBase.hpp" + #include "codingUtilities/EnumStrings.hpp" -#include "mesh/generators/ExternalMeshGeneratorBase.hpp" namespace geos { diff --git a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp index f76540ce576..832b350792f 100644 --- a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp +++ b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.cpp @@ -20,10 +20,10 @@ #include "dataRepository/Group.hpp" #include - +#include #include #include -#include +#include #include @@ -176,16 +176,18 @@ ArrayOfArrays< localIndex > build2dElemTo2dNodes( vtkSmartPointer< vtkDataSet > ArrayOfArrays< array1d< globalIndex > > buildCollocatedNodesBucketsOf2dElemsMap( ArrayOfArrays< localIndex > const & elem2dTo2dNodes, ArrayOfArrays< globalIndex > const & nodes2dToCollocatedNodes ) { + localIndex const num2dElems = elem2dTo2dNodes.size(); ArrayOfArrays< array1d< globalIndex > > result; // Allocation... - result.resize( elem2dTo2dNodes.size() ); - for( localIndex e2d = 0; e2d < elem2dTo2dNodes.size(); ++e2d ) + result.resize( num2dElems ); + for( localIndex e2d = 0; e2d < num2dElems; ++e2d ) { result.resizeArray( e2d, elem2dTo2dNodes[e2d].size() ); } - for( localIndex e2d = 0; e2d < elem2dTo2dNodes.size(); ++e2d ) + for( localIndex e2d = 0; e2d < num2dElems; ++e2d ) { - for( integer ni = 0; ni < elem2dTo2dNodes[e2d].size(); ++ni ) + auto const numNodes = elem2dTo2dNodes[e2d].size(); + for( integer ni = 0; ni < numNodes; ++ni ) { auto & dest = result( e2d, ni ); localIndex const node = elem2dTo2dNodes[e2d][ni]; @@ -269,7 +271,8 @@ ArrayOfArrays< localIndex > buildFace2dToElems2d( vtkPolyData * edges, * @param edges[in] The edges as computed by vtk. * @param collocatedNodes[in] The collocated nodes information. * @param nodeToEdges[in] The node to edges mapping. - * @return The 2d face to 3d edge mapping. + * @return The 2d face to 3d edge mapping. In the case where the face is at the boundary of the MPI domain, + * then the edge index will be set to @e -1 for further actions. */ array1d< localIndex > buildFace2dToEdge( vtkIdTypeArray const * globalPtIds, vtkPolyData * edges, @@ -314,7 +317,11 @@ array1d< localIndex > buildFace2dToEdge( vtkIdTypeArray const * globalPtIds, } } auto const res = std::max_element( edgeCount.cbegin(), edgeCount.cend(), comp ); - face2dToEdge[i] = LvArray::integerConversion< localIndex >( res->first ); + // If we're in a case where there aren't two edges sharing two nodes, + // then it means that we're in a corner case where the 2d element is on the boundary of the MPI domain, + // and maybe some nodes are missing for the 2d element to be properly and consistently defines. + // In this case, we explicitly set the edge index at `-1`, so we can get back on it later. + face2dToEdge[i] = res->second < 2 ? -1: LvArray::integerConversion< localIndex >( res->first ); } return face2dToEdge; @@ -361,7 +368,11 @@ ArrayOfArrays< localIndex > buildElem2dToEdges( vtkIdType num2dElements, { for( auto const & face2dIndex: elem2dToFace2d[elemIndex] ) { - elem2dToEdges.emplaceBack( elemIndex, face2dToEdge[face2dIndex] ); + localIndex const & e = face2dToEdge[face2dIndex]; + if( e > -1 ) + { + elem2dToEdges.emplaceBack( elemIndex, e ); + } } } @@ -369,17 +380,28 @@ ArrayOfArrays< localIndex > buildElem2dToEdges( vtkIdType num2dElements, } /** - * @brief Utility structure which connects 2d element to their 3d element and faces neighbors. + * @brief Utility structure which connects 2d element to their 3d element, faces and nodes neighbors. */ struct Elem2dTo3dInfo { ToCellRelation< ArrayOfArrays< localIndex > > elem2dToElem3d; ArrayOfArrays< localIndex > elem2dToFaces; + /** + * @brief All the neighboring points of the 2d element @e available on the current MPI rank. + * @note During the MPI partitioning, a 2d element may not already have its neighbors (face, 3d element). + * But this does not mean that the 2d element has no neighboring points. + * @note This container will not keep the order of the nodes. + * @note This container may not contain all the nodes of the 2d element. + * The missing nodes must therefore be added as part of the ghosting process. + */ + ArrayOfArrays< localIndex > elem2dToNodes; Elem2dTo3dInfo( ToCellRelation< ArrayOfArrays< localIndex > > && elem2dToElem3d_, - ArrayOfArrays< localIndex > && elem2dToFaces_ ) + ArrayOfArrays< localIndex > && elem2dToFaces_, + ArrayOfArrays< localIndex > && elem2dToNodes_ ) : elem2dToElem3d( elem2dToElem3d_ ), - elem2dToFaces( elem2dToFaces_ ) + elem2dToFaces( elem2dToFaces_ ), + elem2dToNodes( elem2dToNodes_ ) { } }; @@ -419,6 +441,12 @@ Elem2dTo3dInfo buildElem2dTo3dElemAndFaces( vtkSmartPointer< vtkDataSet > faceMe vtkIdTypeArray const * globalPtIds = vtkIdTypeArray::FastDownCast( mesh->GetPointData()->GetGlobalIds() ); vtkIdTypeArray const * globalCellIds = vtkIdTypeArray::FastDownCast( mesh->GetCellData()->GetGlobalIds() ); + std::map< vtkIdType, localIndex > ng2l; // global to local mapping for nodes. + for( vtkIdType i = 0; i < globalPtIds->GetNumberOfValues(); ++i ) + { + ng2l[globalPtIds->GetValue( i )] = i; + } + // Let's build the elem2d to elem3d mapping. We need to find the 3d elements! // First we compute the mapping from all the boundary nodes to the 3d elements that rely on those nodes. std::map< vtkIdType, std::vector< vtkIdType > > nodesToCellsFull; @@ -460,12 +488,13 @@ Elem2dTo3dInfo buildElem2dTo3dElemAndFaces( vtkSmartPointer< vtkDataSet > faceMe ArrayOfArrays< localIndex > elem2dToElem3d( num2dElements, 2 ); ArrayOfArrays< localIndex > elem2dToCellBlock( num2dElements, 2 ); ArrayOfArrays< localIndex > elem2dToFaces( num2dElements, 2 ); + ArrayOfArrays< localIndex > elem2dToNodes( num2dElements, 10 ); // Now we loop on all the 2d elements. - for( int i = 0; i < num2dElements; ++i ) + for( int e2d = 0; e2d < num2dElements; ++e2d ) { // We collect all the duplicated points that are involved for each 2d element. - vtkIdList * pointIds = faceMesh->GetCell( i )->GetPointIds(); + vtkIdList * pointIds = faceMesh->GetCell( e2d )->GetPointIds(); std::size_t const elem2dNumPoints = pointIds->GetNumberOfIds(); // All the duplicated points of the 2d element. Note that we lose the collocation of the duplicated nodes. std::set< vtkIdType > duplicatedPointOfElem2d; @@ -475,6 +504,21 @@ Elem2dTo3dInfo buildElem2dTo3dElemAndFaces( vtkSmartPointer< vtkDataSet > faceMe duplicatedPointOfElem2d.insert( ns.cbegin(), ns.cend() ); } + for( vtkIdType const & gni: duplicatedPointOfElem2d ) + { + auto it = ng2l.find( gni ); + if( it != ng2l.cend() ) // If the node is not on this rank, we want to ignore this entry. + { + // The node lists in `elem2dToNodes` may be in any order. + // Anyway, there will be a specific step to reset the appropriate order. + // Note that due to ghosting, there will also always be some cases where + // some nodes will be missing in `elem2dToNodes` _before_ the ghosting. + // After the ghosting, the whole information will be gathered, + // but a reordering step will always be compulsory. + elem2dToNodes.emplaceBack( e2d, it->second ); + } + } + // Here, we collect all the 3d elements that are concerned by at least one of those duplicated elements. std::map< vtkIdType, std::set< vtkIdType > > elem3dToDuplicatedNodes; for( vtkIdType const & n: duplicatedPointOfElem2d ) @@ -495,7 +539,7 @@ Elem2dTo3dInfo buildElem2dTo3dElemAndFaces( vtkSmartPointer< vtkDataSet > faceMe if( e2n.second.size() == elem2dNumPoints ) { // Now we know that the element 3d has a face that touches the element 2d. Let's find which one. - elem2dToElem3d.emplaceBack( i, elemToFaces.getElementIndexInCellBlock( e2n.first ) ); + elem2dToElem3d.emplaceBack( e2d, elemToFaces.getElementIndexInCellBlock( e2n.first ) ); // Computing the elem2dToFaces mapping. auto faces = elemToFaces[e2n.first]; for( int j = 0; j < faces.size( 0 ); ++j ) @@ -509,8 +553,8 @@ Elem2dTo3dInfo buildElem2dTo3dElemAndFaces( vtkSmartPointer< vtkDataSet > faceMe } if( globalNodes == e2n.second ) { - elem2dToFaces.emplaceBack( i, faceIndex ); - elem2dToCellBlock.emplaceBack( i, elemToFaces.getCellBlockIndex( e2n.first ) ); + elem2dToFaces.emplaceBack( e2d, faceIndex ); + elem2dToCellBlock.emplaceBack( e2d, elemToFaces.getCellBlockIndex( e2n.first ) ); break; } } @@ -519,44 +563,7 @@ Elem2dTo3dInfo buildElem2dTo3dElemAndFaces( vtkSmartPointer< vtkDataSet > faceMe } auto cellRelation = ToCellRelation< ArrayOfArrays< localIndex > >( std::move( elem2dToCellBlock ), std::move( elem2dToElem3d ) ); - return Elem2dTo3dInfo( std::move( cellRelation ), std::move( elem2dToFaces ) ); -} - - -/** - * @brief Computes the 2d element to nodes mapping. - * @param num2dElements Number of (2d) elements in the fracture. - * @param faceToNodes The face to nodes mapping. - * @param elem2dToFaces The 2d element to faces mapping. - * @return The computed mapping. - */ -ArrayOfArrays< localIndex > buildElem2dToNodes( vtkIdType num2dElements, - ArrayOfArraysView< localIndex const > faceToNodes, - ArrayOfArraysView< localIndex const > elem2dToFaces ) -{ - ArrayOfArrays< localIndex > elem2dToNodes( LvArray::integerConversion< localIndex >( num2dElements ) ); - for( localIndex elem2dIndex = 0; elem2dIndex < elem2dToFaces.size(); ++elem2dIndex ) - { - for( localIndex const & faceIndex: elem2dToFaces[elem2dIndex] ) - { - if( faceIndex < 0 ) - { - continue; - } - std::set< localIndex > tmp; - for( auto j = 0; j < faceToNodes[faceIndex].size(); ++j ) - { - localIndex const & nodeIndex = faceToNodes[faceIndex][j]; - tmp.insert( nodeIndex ); - } - for( localIndex const & nodeIndex: tmp ) - { - elem2dToNodes.emplaceBack( elem2dIndex, nodeIndex ); - } - } - } - - return elem2dToNodes; + return Elem2dTo3dInfo( std::move( cellRelation ), std::move( elem2dToFaces ), std::move( elem2dToNodes ) ); } @@ -615,20 +622,19 @@ void importFractureNetwork( string const & faceBlockName, vtkIdType const num2dElements = faceMesh->GetNumberOfCells(); // Now let's build the elem2dTo* mappings. Elem2dTo3dInfo elem2dTo3d = buildElem2dTo3dElemAndFaces( faceMesh, mesh, collocatedNodes, faceToNodes.toViewConst(), elemToFaces ); - ArrayOfArrays< localIndex > elem2dToNodes = buildElem2dToNodes( num2dElements, faceToNodes.toViewConst(), elem2dTo3d.elem2dToFaces.toViewConst() ); ArrayOfArrays< localIndex > face2dToElems2d = buildFace2dToElems2d( edges, faceMesh ); array1d< localIndex > face2dToEdge = buildFace2dToEdge( vtkIdTypeArray::FastDownCast( mesh->GetPointData()->GetGlobalIds() ), edges, collocatedNodes, nodeToEdges.toViewConst() ); ArrayOfArrays< localIndex > const elem2dToFace2d = buildElem2dToFace2d( num2dElements, face2dToElems2d.toViewConst() ); - ArrayOfArrays< localIndex > elem2DToEdges = buildElem2dToEdges( num2dElements, face2dToEdge.toViewConst(), elem2dToFace2d.toViewConst() ); + ArrayOfArrays< localIndex > elem2dToEdges = buildElem2dToEdges( num2dElements, face2dToEdge.toViewConst(), elem2dToFace2d.toViewConst() ); // Mappings are now computed. Just create the face block by value. FaceBlock & faceBlock = cellBlockManager.registerFaceBlock( faceBlockName ); faceBlock.setNum2dElements( num2dElements ); faceBlock.setNum2dFaces( num2dFaces ); - faceBlock.set2dElemToNodes( std::move( elem2dToNodes ) ); - faceBlock.set2dElemToEdges( std::move( elem2DToEdges ) ); + faceBlock.set2dElemToNodes( std::move( elem2dTo3d.elem2dToNodes ) ); + faceBlock.set2dElemToEdges( std::move( elem2dToEdges ) ); faceBlock.set2dFaceToEdge( std::move( face2dToEdge ) ); faceBlock.set2dFaceTo2dElems( std::move( face2dToElems2d ) ); diff --git a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.hpp b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.hpp index 468b54f107a..f812949c117 100644 --- a/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.hpp +++ b/src/coreComponents/mesh/generators/VTKFaceBlockUtilities.hpp @@ -15,9 +15,10 @@ #ifndef GEOS_VTKFACEBLOCKUTILITIES_HPP #define GEOS_VTKFACEBLOCKUTILITIES_HPP -#include "common/DataTypes.hpp" #include "CellBlockManager.hpp" +#include "common/DataTypes.hpp" + #include #include diff --git a/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp b/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp index 63e66cdeb85..b45ed3f9e30 100644 --- a/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp +++ b/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp @@ -22,8 +22,6 @@ #include "mesh/generators/VTKMeshGeneratorTools.hpp" #include "mesh/generators/CellBlockManager.hpp" #include "common/DataTypes.hpp" -#include "common/DataLayouts.hpp" -#include "common/MpiWrapper.hpp" #include diff --git a/src/coreComponents/mesh/generators/VTKMeshGenerator.hpp b/src/coreComponents/mesh/generators/VTKMeshGenerator.hpp index 7fa30004ee6..3fae5d6d343 100644 --- a/src/coreComponents/mesh/generators/VTKMeshGenerator.hpp +++ b/src/coreComponents/mesh/generators/VTKMeshGenerator.hpp @@ -21,6 +21,7 @@ #include "mesh/generators/ExternalMeshGeneratorBase.hpp" #include "mesh/generators/VTKUtilities.hpp" +#include "mesh/mpiCommunications/SpatialPartition.hpp" #include diff --git a/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.cpp b/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.cpp index e76a2079f17..c7d067777bd 100644 --- a/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.cpp +++ b/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.cpp @@ -19,15 +19,13 @@ #include "VTKMeshGeneratorTools.hpp" #include -#include #include +#include // NOTE: do NOT include anything from GEOS here. // See full explanation in VTKMeshGeneratorTools.hpp. -namespace geos -{ -namespace vtk +namespace geos::vtk { vtkSmartPointer< vtkUnstructuredGrid > @@ -264,5 +262,4 @@ exchangeBoundingBoxes( vtkDataSet & dataSet, MPI_Comm mpiComm ) return boxes; } -} // namespace vtk -} // namespace geos +} // namespace geos::vtk diff --git a/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.hpp b/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.hpp index 0e70f32d766..04ca9af0ee3 100644 --- a/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.hpp +++ b/src/coreComponents/mesh/generators/VTKMeshGeneratorTools.hpp @@ -19,21 +19,19 @@ #ifndef GEOS_VTK_MESH_GENERATORS_VTKMESHGENERATORTOOLS_HPP_ #define GEOS_VTK_MESH_GENERATORS_VTKMESHGENERATORTOOLS_HPP_ +#include #include #include -#include #include -// NOTE: do NOT include anything from GEOSX here. +// NOTE: do NOT include anything from GEOS here. // In particular, nothing that directly or transitively includes "common/Format.hpp". -// The reason is "diy2" library includes an older version of {fmt} than the one used by GEOSX. +// The reason is "diy2" library includes an older version of {fmt} than the one used by GEOS. // Collision of includes leads to all kinds of impossible to fix compilation errors. // Thankfully, no link errors, owing to namespace versioning employed by {fmt}. -namespace geos -{ -namespace vtk +namespace geos::vtk { /** @@ -59,7 +57,6 @@ redistribute( vtkPartitionedDataSet & localParts, MPI_Comm mpiComm ); std::vector< vtkBoundingBox > exchangeBoundingBoxes( vtkDataSet & dataSet, MPI_Comm mpiComm ); -} // namespace vtk -} // namespace geos +} // namespace geos::vtk #endif //GEOS_VTK_MESH_GENERATORS_VTKMESHGENERATORTOOLS_HPP_ diff --git a/src/coreComponents/mesh/generators/VTKUtilities.hpp b/src/coreComponents/mesh/generators/VTKUtilities.hpp index bbe3581877b..6f8e97a2180 100644 --- a/src/coreComponents/mesh/generators/VTKUtilities.hpp +++ b/src/coreComponents/mesh/generators/VTKUtilities.hpp @@ -20,14 +20,12 @@ #define GEOS_MESH_GENERATORS_VTKUTILITIES_HPP #include "common/DataTypes.hpp" -#include "common/DataLayouts.hpp" #include "common/MpiWrapper.hpp" -#include "mesh/DomainPartition.hpp" #include "mesh/generators/CellBlockManager.hpp" -#include #include #include +#include #include #include diff --git a/src/coreComponents/mesh/generators/VTKWellGenerator.cpp b/src/coreComponents/mesh/generators/VTKWellGenerator.cpp index 3dc7fe343bf..3ea92f78551 100644 --- a/src/coreComponents/mesh/generators/VTKWellGenerator.cpp +++ b/src/coreComponents/mesh/generators/VTKWellGenerator.cpp @@ -21,7 +21,6 @@ #include "mesh/generators/VTKUtilities.hpp" #include -#include #include #include #include diff --git a/src/coreComponents/mesh/generators/VTKWellGenerator.hpp b/src/coreComponents/mesh/generators/VTKWellGenerator.hpp index 1290db3f7fe..2c9b265143e 100644 --- a/src/coreComponents/mesh/generators/VTKWellGenerator.hpp +++ b/src/coreComponents/mesh/generators/VTKWellGenerator.hpp @@ -20,7 +20,6 @@ #define GEOS_MESH_GENERATORS_VTKWELLGENERATOR_HPP #include "mesh/generators/WellGeneratorBase.hpp" -#include "mesh/Perforation.hpp" #include "dataRepository/Group.hpp" #include "codingUtilities/Utilities.hpp" #include "common/DataTypes.hpp" diff --git a/src/coreComponents/mesh/unitTests/CMakeLists.txt b/src/coreComponents/mesh/unitTests/CMakeLists.txt index c017bec6962..862bbca219e 100644 --- a/src/coreComponents/mesh/unitTests/CMakeLists.txt +++ b/src/coreComponents/mesh/unitTests/CMakeLists.txt @@ -4,7 +4,7 @@ set( mesh_tests testComputationalGeometry.cpp testGeometricObjects.cpp ) -set( dependencyList gtest mesh ${parallelDeps} ) +set( dependencyList blas lapack gtest mesh ${parallelDeps} ) # Add gtest C++ based tests foreach(test ${mesh_tests}) diff --git a/src/coreComponents/mesh/utilities/ComputationalGeometry.hpp b/src/coreComponents/mesh/utilities/ComputationalGeometry.hpp index d90df153066..4b4383f6848 100644 --- a/src/coreComponents/mesh/utilities/ComputationalGeometry.hpp +++ b/src/coreComponents/mesh/utilities/ComputationalGeometry.hpp @@ -422,7 +422,7 @@ void getBoundingBox( localIndex const elemIndex, LvArray::NumericLimits< real64 >::max }; // boxDims is used to hold the max coordinates. - LvArray::tensorOps::fill< 3 >( boxDims, LvArray::NumericLimits< real64 >::min ); + LvArray::tensorOps::fill< 3 >( boxDims, LvArray::NumericLimits< real64 >::lowest ); // loop over all the vertices of the element to get the min and max coords for( localIndex a = 0; a < pointIndices.size( 1 ); ++a ) diff --git a/src/coreComponents/physicsSolvers/CMakeLists.txt b/src/coreComponents/physicsSolvers/CMakeLists.txt index c7d26a6bfd3..d23d07265e6 100644 --- a/src/coreComponents/physicsSolvers/CMakeLists.txt +++ b/src/coreComponents/physicsSolvers/CMakeLists.txt @@ -130,20 +130,27 @@ set( physicsSolvers_headers surfaceGeneration/kernels/surfaceGenerationKernelsHelpers.hpp wavePropagation/WaveSolverBase.hpp wavePropagation/WaveSolverUtils.hpp + wavePropagation/PrecomputeSourcesAndReceiversKernel.hpp wavePropagation/AcousticFields.hpp wavePropagation/AcousticWaveEquationSEM.hpp wavePropagation/AcousticWaveEquationSEMKernel.hpp + wavePropagation/AcousticTimeSchemeSEMKernel.hpp + wavePropagation/AcousticMatricesSEMKernel.hpp + wavePropagation/AcousticPMLSEMKernel.hpp wavePropagation/ElasticFields.hpp wavePropagation/ElasticWaveEquationSEM.hpp wavePropagation/ElasticWaveEquationSEMKernel.hpp + wavePropagation/ElasticTimeSchemeSEMKernel.hpp wavePropagation/ElasticFirstOrderWaveEquationSEM.hpp wavePropagation/ElasticFirstOrderWaveEquationSEMKernel.hpp wavePropagation/AcousticFirstOrderWaveEquationSEM.hpp wavePropagation/AcousticFirstOrderWaveEquationSEMKernel.hpp + wavePropagation/ElasticMatricesSEMKernel.hpp wavePropagation/AcousticVTIFields.hpp wavePropagation/AcousticVTIWaveEquationSEM.hpp wavePropagation/AcousticVTIWaveEquationSEMKernel.hpp wavePropagation/AcoustoElasticFields.hpp + wavePropagation/AcoustoElasticTimeSchemeSEMKernel.hpp wavePropagation/AcousticElasticWaveEquationSEM.hpp wavePropagation/AcousticElasticWaveEquationSEMKernel.hpp ) diff --git a/src/coreComponents/physicsSolvers/SolverBase.cpp b/src/coreComponents/physicsSolvers/SolverBase.cpp index 59d5e29a041..e2d15594a1b 100644 --- a/src/coreComponents/physicsSolvers/SolverBase.cpp +++ b/src/coreComponents/physicsSolvers/SolverBase.cpp @@ -16,7 +16,6 @@ #include "PhysicsSolverManager.hpp" #include "common/TimingMacros.hpp" -#include "linearAlgebra/utilities/LinearSolverParameters.hpp" #include "linearAlgebra/solvers/KrylovSolver.hpp" #include "mesh/DomainPartition.hpp" #include "math/interpolation/Interpolation.hpp" @@ -1121,7 +1120,7 @@ void debugOutputLAObject( T const & obj, if( toFile ) { string const filename = GEOS_FMT( "{}_{:06}_{:02}.mtx", filePrefix.c_str(), cycleNumber, nonlinearIteration ); - obj.write( filename, LAIOutputFormat::MATRIX_MARKET ); + obj.write( filename, LAIOutputFormat::NATIVE_ASCII ); GEOS_LOG_RANK_0( screenName << " written to " << filename ); } } @@ -1353,7 +1352,7 @@ bool SolverBase::checkSequentialSolutionIncrements( DomainPartition & GEOS_UNUSE return true; } -void SolverBase::saveSequentialIterationState( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) const +void SolverBase::saveSequentialIterationState( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) { // up to specific solver to save what is needed GEOS_ERROR( "Call to SolverBase::saveSequentialIterationState. Method should be overloaded by the solver" ); diff --git a/src/coreComponents/physicsSolvers/SolverBase.hpp b/src/coreComponents/physicsSolvers/SolverBase.hpp index b3390f828e6..6e79f0cf05c 100644 --- a/src/coreComponents/physicsSolvers/SolverBase.hpp +++ b/src/coreComponents/physicsSolvers/SolverBase.hpp @@ -21,13 +21,11 @@ #include "linearAlgebra/interfaces/InterfaceTypes.hpp" #include "linearAlgebra/utilities/LinearSolverResult.hpp" #include "linearAlgebra/DofManager.hpp" -#include "mesh/DomainPartition.hpp" #include "mesh/MeshBody.hpp" #include "physicsSolvers/NonlinearSolverParameters.hpp" #include "physicsSolvers/LinearSolverParameters.hpp" #include "physicsSolvers/SolverStatistics.hpp" - #include namespace geos @@ -629,7 +627,7 @@ class SolverBase : public ExecutableGroup virtual bool checkSequentialSolutionIncrements( DomainPartition & domain ) const; - virtual void saveSequentialIterationState( DomainPartition & domain ) const; + virtual void saveSequentialIterationState( DomainPartition & domain ); /** * @brief accessor for the linear solver parameters. diff --git a/src/coreComponents/physicsSolvers/contact/ContactFields.hpp b/src/coreComponents/physicsSolvers/contact/ContactFields.hpp index 214ca10513c..32cbfe32d1d 100644 --- a/src/coreComponents/physicsSolvers/contact/ContactFields.hpp +++ b/src/coreComponents/physicsSolvers/contact/ContactFields.hpp @@ -55,7 +55,15 @@ DECLARE_FIELD( dispJump, 0, LEVEL_0, WRITE_AND_READ, - "Displacement jump vector" ); + "Displacement jump vector in the local reference system" ); + +DECLARE_FIELD( slip, + "slip", + array1d< real64 >, + 0, + LEVEL_0, + NO_WRITE, + "Slip." ); DECLARE_FIELD( deltaDispJump, "deltaDisplacementJump", @@ -78,8 +86,8 @@ DECLARE_FIELD( traction, array2d< real64 >, 0, LEVEL_0, - NO_WRITE, - "Fracture traction vector" ); + WRITE_AND_READ, + "Fracture traction vector in the local reference system." ); DECLARE_FIELD( deltaTraction, "deltaTraction", @@ -89,7 +97,6 @@ DECLARE_FIELD( deltaTraction, NO_WRITE, "An array that holds the traction increments on the fracture." ); - DECLARE_FIELD( dTraction_dJump, "dTraction_dJump", array3d< real64 >, diff --git a/src/coreComponents/physicsSolvers/contact/ContactSolverBase.cpp b/src/coreComponents/physicsSolvers/contact/ContactSolverBase.cpp index a1b9c46441a..da4433b0989 100644 --- a/src/coreComponents/physicsSolvers/contact/ContactSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/contact/ContactSolverBase.cpp @@ -73,6 +73,8 @@ void ContactSolverBase::registerDataOnMesh( dataRepository::Group & meshBodies ) fractureRegion.forElementSubRegions< SurfaceElementSubRegion >( [&]( SurfaceElementSubRegion & subRegion ) { + setConstitutiveNamesCallSuper( subRegion ); + subRegion.registerField< fields::contact::dispJump >( getName() ). setDimLabels( 1, labels ). reference().resizeDimension< 1 >( 3 ); @@ -92,6 +94,8 @@ void ContactSolverBase::registerDataOnMesh( dataRepository::Group & meshBodies ) subRegion.registerField< fields::contact::fractureState >( getName() ); subRegion.registerField< fields::contact::oldFractureState >( getName() ); + + subRegion.registerField< fields::contact::slip >( getName() ); } ); } ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEFEMKernels.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEFEMKernels.hpp index a1c2b6c5b08..9bb7a3702dd 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEFEMKernels.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEFEMKernels.hpp @@ -305,7 +305,8 @@ struct StateUpdateKernel arrayView2d< real64 const > const & jump, arrayView2d< real64 > const & fractureTraction, arrayView3d< real64 > const & dFractureTraction_dJump, - arrayView1d< integer const > const & fractureState ) + arrayView1d< integer const > const & fractureState, + arrayView1d< real64 > const & slip ) { forAll< POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) { @@ -313,6 +314,9 @@ struct StateUpdateKernel fractureState[k], fractureTraction[k], dFractureTraction_dJump[k] ); + + slip[ k ] = LvArray::math::sqrt( LvArray::math::square( jump( k, 1 ) ) + + LvArray::math::square( jump( k, 2 ) ) ); } ); } diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp index 0a082067cfa..a1b6f02c927 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.cpp @@ -723,6 +723,8 @@ void SolidMechanicsEmbeddedFractures::updateState( DomainPartition & domain ) arrayView1d< integer const > const & fractureState = subRegion.getField< contact::fractureState >(); + arrayView1d< real64 > const & slip = subRegion.getField< fields::contact::slip >(); + constitutiveUpdatePassThru( contact, [&] ( auto & castedContact ) { using ContactType = TYPEOFREF( castedContact ); @@ -735,7 +737,8 @@ void SolidMechanicsEmbeddedFractures::updateState( DomainPartition & domain ) jump, fractureTraction, dFractureTraction_dJump, - fractureState ); + fractureState, + slip ); } ); } ); } ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp index 3069cfd28e6..23153c33df6 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsEmbeddedFractures.hpp @@ -106,9 +106,15 @@ class SolidMechanicsEmbeddedFractures : public ContactSolverBase real64 const dt, DomainPartition & domain ); - virtual bool updateConfiguration( DomainPartition & domain ) override final; + bool useStaticCondensation() const { return m_useStaticCondensation; } + + struct viewKeyStruct : ContactSolverBase::viewKeyStruct + { + constexpr static char const * useStaticCondensationString() { return "useStaticCondensation"; } + }; + protected: virtual void initializePostInitialConditionsPreSubGroups() override final; @@ -124,10 +130,6 @@ class SolidMechanicsEmbeddedFractures : public ContactSolverBase /// decide whether to use static condensation or not integer m_useStaticCondensation; - struct viewKeyStruct : ContactSolverBase::viewKeyStruct - { - constexpr static char const * useStaticCondensationString() { return "useStaticCondensation"; } - }; }; diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp index 82502764d63..f9d018d9803 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.cpp @@ -64,6 +64,11 @@ SolidMechanicsLagrangeContact::SolidMechanicsLagrangeContact( const string & nam setInputFlag( InputFlags::REQUIRED ). setDescription( "Name of the stabilization to use in the lagrangian contact solver" ); + registerWrapper( viewKeyStruct::stabilizationScalingCoefficientString(), &m_stabilitzationScalingCoefficient ). + setInputFlag( InputFlags::OPTIONAL ). + setApplyDefaultValue( 1.0 ). + setDescription( "It be used to increase the scale of the stabilization entries. A value < 1.0 results in larger entries in the stabilization matrix." ); + LinearSolverParameters & linSolParams = m_linearSolverParameters.get(); linSolParams.mgr.strategy = LinearSolverParameters::MGR::StrategyType::lagrangianContactMechanics; linSolParams.mgr.separateComponents = true; @@ -147,18 +152,18 @@ void SolidMechanicsLagrangeContact::initializePreSubGroups() fluxApprox.addFieldName( contact::traction::key() ); fluxApprox.setCoeffName( "penaltyStiffness" ); + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const & meshBodyName, - MeshLevel &, + MeshLevel & mesh, arrayView1d< string const > const & regionNames ) { - array1d< string > & stencilTargetRegions = fluxApprox.targetRegions( meshBodyName ); - std::set< string > stencilTargetRegionsSet( stencilTargetRegions.begin(), stencilTargetRegions.end() ); - stencilTargetRegionsSet.insert( regionNames.begin(), regionNames.end() ); - stencilTargetRegions.clear(); - for( auto const & targetRegion: stencilTargetRegionsSet ) + mesh.getElemManager().forElementRegions< SurfaceElementRegion >( regionNames, + [&]( localIndex const, + SurfaceElementRegion const & region ) { - stencilTargetRegions.emplace_back( targetRegion ); - } + array1d< string > & stencilTargetRegions = fluxApprox.targetRegions( meshBodyName ); + stencilTargetRegions.emplace_back( region.getName() ); + } ); } ); } @@ -452,9 +457,12 @@ void SolidMechanicsLagrangeContact::computeFaceDisplacementJump( DomainPartition arrayView3d< real64 > const & rotationMatrix = subRegion.getReference< array3d< real64 > >( viewKeyStruct::rotationMatrixString() ); ArrayOfArraysView< localIndex const > const & elemsToFaces = subRegion.faceList().toViewConst(); - arrayView2d< real64 > const & dispJump = subRegion.getField< contact::dispJump >(); arrayView1d< real64 const > const & area = subRegion.getElementArea().toViewConst(); + arrayView2d< real64 > const & dispJump = subRegion.getField< contact::dispJump >(); + arrayView1d< real64 > const & slip = subRegion.getField< fields::contact::slip >(); + arrayView1d< real64 > const & aperture = subRegion.getField< fields::elementAperture >(); + forAll< parallelHostPolicy >( subRegion.size(), [=] ( localIndex const kfe ) { if( elemsToFaces.sizeOfArray( kfe ) != 2 ) @@ -483,6 +491,10 @@ void SolidMechanicsLagrangeContact::computeFaceDisplacementJump( DomainPartition real64 dispJumpTemp[ 3 ]; LvArray::tensorOps::Ri_eq_AjiBj< 3, 3 >( dispJumpTemp, rotationMatrix[ kfe ], globalJumpTemp ); LvArray::tensorOps::copy< 3 >( dispJump[ kfe ], dispJumpTemp ); + + slip[ kfe ] = LvArray::math::sqrt( LvArray::math::square( dispJump( kfe, 1 ) ) + + LvArray::math::square( dispJump( kfe, 2 ) ) ); + aperture[ kfe ] = dispJump[ kfe ][ 0 ]; } ); } } ); @@ -518,15 +530,16 @@ void SolidMechanicsLagrangeContact::setupDofs( DomainPartition const & domain, 3, meshTargets ); - dofManager.addCoupling( contact::traction::key(), - contact::traction::key(), - DofManager::Connector::Face, - meshTargets ); - dofManager.addCoupling( solidMechanics::totalDisplacement::key(), contact::traction::key(), DofManager::Connector::Elem, meshTargets ); + + NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); + FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); + FluxApproximationBase const & stabilizationMethod = fvManager.getFluxApproximation( m_stabilizationName ); + + dofManager.addCoupling( contact::traction::key(), stabilizationMethod ); } void SolidMechanicsLagrangeContact::assembleSystem( real64 const time, @@ -548,6 +561,17 @@ void SolidMechanicsLagrangeContact::assembleSystem( real64 const time, localRhs ); assembleContact( domain, dofManager, localMatrix, localRhs ); + + // for sequenatial: add (fixed) pressure force contribution into residual (no derivatives) + if( m_isFixedStressPoromechanicsUpdate ) + { + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, + MeshLevel const & mesh, + arrayView1d< string const > const & regionNames ) + { + assembleForceResidualPressureContribution( mesh, regionNames, dofManager, localMatrix, localRhs ); + } ); + } } void SolidMechanicsLagrangeContact::assembleContact( DomainPartition & domain, @@ -568,47 +592,117 @@ void SolidMechanicsLagrangeContact::assembleContact( DomainPartition & domain, } ); } -real64 SolidMechanicsLagrangeContact::calculateResidualNorm( real64 const & time, - real64 const & dt, - DomainPartition const & domain, - DofManager const & dofManager, - arrayView1d< real64 const > const & localRhs ) +void SolidMechanicsLagrangeContact:: + assembleForceResidualPressureContribution( MeshLevel const & mesh, + arrayView1d< string const > const & regionNames, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ) { GEOS_MARK_FUNCTION; - real64 const solidResidual = SolidMechanicsLagrangianFEM::calculateResidualNorm( time, dt, domain, dofManager, localRhs ); + FaceManager const & faceManager = mesh.getFaceManager(); + NodeManager const & nodeManager = mesh.getNodeManager(); + ElementRegionManager const & elemManager = mesh.getElemManager(); - real64 momentumR2 = 0.0; - real64 contactR2 = 0.0; + ArrayOfArraysView< localIndex const > const & faceToNodeMap = faceManager.nodeList().toViewConst(); + arrayView2d< real64 const > const & faceNormal = faceManager.faceNormal(); - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, - MeshLevel const & mesh, - arrayView1d< string const > const & regionNames ) - { - NodeManager const & nodeManager = mesh.getNodeManager(); - arrayView1d< globalIndex const > const & dispDofNumber = - nodeManager.getReference< array1d< globalIndex > >( dofManager.getKey( solidMechanics::totalDisplacement::key() ) ); + string const & dispDofKey = dofManager.getKey( solidMechanics::totalDisplacement::key() ); + + arrayView1d< globalIndex const > const & + dispDofNumber = nodeManager.getReference< globalIndex_array >( dispDofKey ); + globalIndex const rankOffset = dofManager.rankOffset(); - string const & dofKey = dofManager.getKey( contact::traction::key() ); - globalIndex const rankOffset = dofManager.rankOffset(); + // Get the coordinates for all nodes + arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const & nodePosition = nodeManager.referencePosition(); - arrayView1d< integer const > const & elemGhostRank = nodeManager.ghostRank(); + elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, + [&]( localIndex const, + FaceElementSubRegion const & subRegion ) + { + arrayView1d< real64 const > const & pressure = subRegion.getReference< array1d< real64 > >( flow::pressure::key() ); + ArrayOfArraysView< localIndex const > const & elemsToFaces = subRegion.faceList().toViewConst(); - RAJA::ReduceSum< parallelDeviceReduce, real64 > localSum0( 0.0 ); - forAll< parallelDevicePolicy<> >( nodeManager.size(), - [localRhs, localSum0, dispDofNumber, rankOffset, elemGhostRank] GEOS_HOST_DEVICE ( localIndex const k ) + forAll< serialPolicy >( subRegion.size(), [=]( localIndex const kfe ) { - if( elemGhostRank[k] < 0 ) + localIndex const kf0 = elemsToFaces[kfe][0]; + localIndex const numNodesPerFace = faceToNodeMap.sizeOfArray( kf0 ); + + real64 Nbar[3]; + Nbar[ 0 ] = faceNormal[elemsToFaces[kfe][0]][0] - faceNormal[elemsToFaces[kfe][1]][0]; + Nbar[ 1 ] = faceNormal[elemsToFaces[kfe][0]][1] - faceNormal[elemsToFaces[kfe][1]][1]; + Nbar[ 2 ] = faceNormal[elemsToFaces[kfe][0]][2] - faceNormal[elemsToFaces[kfe][1]][2]; + LvArray::tensorOps::normalize< 3 >( Nbar ); + + globalIndex rowDOF[12]; + real64 nodeRHS[12]; + stackArray1d< real64, 12 > dRdP( 3*numNodesPerFace ); + + for( localIndex kf=0; kf<2; ++kf ) { - localIndex const localRow = LvArray::integerConversion< localIndex >( dispDofNumber[k] - rankOffset ); - for( localIndex dim = 0; dim < 3; ++dim ) + localIndex const faceIndex = elemsToFaces[kfe][kf]; + + for( localIndex a=0; a nodalArea; + computeFaceNodalArea( nodePosition, faceToNodeMap, elemsToFaces[kfe][kf], nodalArea ); + + real64 const nodalForceMag = -( pressure[kfe] ) * nodalArea[a]; + array1d< real64 > globalNodalForce( 3 ); + LvArray::tensorOps::scaledCopy< 3 >( globalNodalForce, Nbar, nodalForceMag ); + + for( localIndex i=0; i<3; ++i ) + { + rowDOF[3*a+i] = dispDofNumber[faceToNodeMap( faceIndex, a )] + LvArray::integerConversion< globalIndex >( i ); + // Opposite sign w.r.t. theory because of minus sign in stiffness matrix definition (K < 0) + nodeRHS[3*a+i] = +globalNodalForce[i] * pow( -1, kf ); + } + } + + for( localIndex idof = 0; idof < numNodesPerFace * 3; ++idof ) + { + localIndex const localRow = LvArray::integerConversion< localIndex >( rowDOF[idof] - rankOffset ); + + if( localRow >= 0 && localRow < localMatrix.numRows() ) + { + RAJA::atomicAdd( parallelHostAtomic{}, &localRhs[localRow], nodeRHS[idof] ); + } } } } ); - momentumR2 += localSum0.get(); + } ); +} + +real64 SolidMechanicsLagrangeContact::calculateResidualNorm( real64 const & time, + real64 const & dt, + DomainPartition const & domain, + DofManager const & dofManager, + arrayView1d< real64 const > const & localRhs ) +{ + GEOS_MARK_FUNCTION; + + real64 const solidResidual = SolidMechanicsLagrangianFEM::calculateResidualNorm( time, dt, domain, dofManager, localRhs ); + + real64 const contactResidual = calculateContactResidualNorm( domain, dofManager, localRhs ); + + return sqrt( solidResidual * solidResidual + contactResidual * contactResidual ); +} +real64 SolidMechanicsLagrangeContact::calculateContactResidualNorm( DomainPartition const & domain, + DofManager const & dofManager, + arrayView1d< real64 const > const & localRhs ) +{ + string const & dofKey = dofManager.getKey( contact::traction::key() ); + globalIndex const rankOffset = dofManager.rankOffset(); + + real64 contactResidual = 0.0; + + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel const & mesh, + arrayView1d< string const > const & regionNames ) + { mesh.getElemManager().forElementSubRegions< FaceElementSubRegion >( regionNames, [&]( localIndex const, FaceElementSubRegion const & subRegion ) { @@ -627,68 +721,29 @@ real64 SolidMechanicsLagrangeContact::calculateResidualNorm( real64 const & time } } } ); - contactR2 += localSum.get(); + contactResidual += localSum.get(); } ); } ); - real64 localR2[2] = { momentumR2, contactR2 }; - real64 globalResidualNorm[3]{}; - - int const rank = MpiWrapper::commRank( MPI_COMM_GEOSX ); - int const size = MpiWrapper::commSize( MPI_COMM_GEOSX ); - array1d< real64 > globalR2( 2 * size ); - globalR2.zero(); - - // Everything is done on rank 0 - MpiWrapper::gather( localR2, - 2, - globalR2.data(), - 2, - 0, - MPI_COMM_GEOSX ); - - if( rank==0 ) - { - globalResidualNorm[0] = 0.0; - globalResidualNorm[1] = 0.0; - for( int r=0; rm_nonlinearSolverParameters.m_numNewtonIterations == 0 ) { - m_initialResidual[0] = globalResidualNorm[0]; - m_initialResidual[1] = globalResidualNorm[1]; - m_initialResidual[2] = globalResidualNorm[2]; - globalResidualNorm[0] = 1.0; - globalResidualNorm[1] = 1.0; - globalResidualNorm[2] = 1.0; + this->m_initialContactResidual = contactResidual; + contactResidual = 1.0; } else { - globalResidualNorm[0] /= (m_initialResidual[0]+1.0); - globalResidualNorm[1] /= (m_initialResidual[1]+1.0); - // Add 0 just to match Matlab code results - globalResidualNorm[2] /= (m_initialResidual[2]+1.0); + contactResidual /= (this->m_initialContactResidual + 1.0); } - if( getLogLevel() >= 1 && logger::internal::rank == 0 ) + + if( getLogLevel() >= 1 && logger::internal::rank==0 ) { - std::cout<< GEOS_FMT( - " ( Rdisplacement, Rtraction, Rtotal ) = ( {:15.6e}, {:15.6e}, {:15.6e} )", - globalResidualNorm[0], - globalResidualNorm[1], - globalResidualNorm[2] ); + std::cout << GEOS_FMT( " ( Rtraction ) = ( {:15.6e} )", contactResidual ); } - return sqrt( globalResidualNorm[2]*globalResidualNorm[2] + solidResidual*solidResidual ); + + return contactResidual; } void SolidMechanicsLagrangeContact::createPreconditioner( DomainPartition const & domain ) @@ -770,18 +825,20 @@ void SolidMechanicsLagrangeContact::computeRotationMatrices( DomainPartition & d arrayView1d< string const > const & regionNames ) { FaceManager const & faceManager = mesh.getFaceManager(); - ElementRegionManager & elemManager = mesh.getElemManager(); - arrayView2d< real64 const > const & faceNormal = faceManager.faceNormal(); + arrayView2d< real64 const > const faceNormal = faceManager.faceNormal(); - elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, - [&]( localIndex const, - FaceElementSubRegion & subRegion ) + mesh.getElemManager().forElementSubRegions< FaceElementSubRegion >( regionNames, + [&]( localIndex const, + FaceElementSubRegion & subRegion ) { ArrayOfArraysView< localIndex const > const & elemsToFaces = subRegion.faceList().toViewConst(); arrayView3d< real64 > const & rotationMatrix = subRegion.getReference< array3d< real64 > >( viewKeyStruct::rotationMatrixString() ); + arrayView2d< real64 > const unitNormal = subRegion.getNormalVector(); + arrayView2d< real64 > const unitTangent1 = subRegion.getTangentVector1(); + arrayView2d< real64 > const unitTangent2 = subRegion.getTangentVector2(); forAll< parallelHostPolicy >( subRegion.size(), [=]( localIndex const kfe ) { @@ -790,14 +847,27 @@ void SolidMechanicsLagrangeContact::computeRotationMatrices( DomainPartition & d return; } + localIndex const f0 = elemsToFaces[kfe][0]; + localIndex const f1 = elemsToFaces[kfe][1]; + stackArray1d< real64, 3 > Nbar( 3 ); - localIndex const & f0 = elemsToFaces[kfe][0], f1 = elemsToFaces[kfe][1]; Nbar[ 0 ] = faceNormal[f0][0] - faceNormal[f1][0]; Nbar[ 1 ] = faceNormal[f0][1] - faceNormal[f1][1]; Nbar[ 2 ] = faceNormal[f0][2] - faceNormal[f1][2]; LvArray::tensorOps::normalize< 3 >( Nbar ); computationalGeometry::RotationMatrix_3D( Nbar.toSliceConst(), rotationMatrix[kfe] ); + real64 const columnVector1[3] = { rotationMatrix[kfe][ 0 ][ 1 ], + rotationMatrix[kfe][ 1 ][ 1 ], + rotationMatrix[kfe][ 2 ][ 1 ] }; + + real64 const columnVector2[3] = { rotationMatrix[kfe][ 0 ][ 2 ], + rotationMatrix[kfe][ 1 ][ 2 ], + rotationMatrix[kfe][ 2 ][ 2 ] }; + + LvArray::tensorOps::copy< 3 >( unitNormal[kfe], Nbar ); + LvArray::tensorOps::copy< 3 >( unitTangent1[kfe], columnVector1 ); + LvArray::tensorOps::copy< 3 >( unitTangent2[kfe], columnVector2 ); } ); } ); } ); @@ -1090,11 +1160,11 @@ void SolidMechanicsLagrangeContact:: { if( i == 0 ) { - elemRHS[i] = +Ja * dispJump[kfe][i]; + elemRHS[i] = Ja * dispJump[kfe][i]; } else { - elemRHS[i] = +Ja * ( dispJump[kfe][i] - previousDispJump[kfe][i] ); + elemRHS[i] = Ja * ( dispJump[kfe][i] - previousDispJump[kfe][i] ); } } @@ -1122,7 +1192,7 @@ void SolidMechanicsLagrangeContact:: case contact::FractureState::Slip: case contact::FractureState::NewSlip: { - elemRHS[0] = +Ja * dispJump[kfe][0]; + elemRHS[0] = Ja * dispJump[kfe][0]; for( localIndex kf = 0; kf < 2; ++kf ) { @@ -1153,7 +1223,10 @@ void SolidMechanicsLagrangeContact:: { for( localIndex i = 1; i < 3; ++i ) { - elemRHS[i] = +Ja * ( traction[kfe][i] - limitTau * sliding[ i-1 ] / slidingNorm ); + elemRHS[i] = Ja * ( traction[kfe][i] - limitTau * sliding[ i-1 ] / slidingNorm ); + + dRdT( i, 0 ) = Ja * dLimitTau_dNormalTraction * sliding[ i-1 ] / slidingNorm; + dRdT( i, i ) = Ja; } // A symmetric 2x2 matrix. @@ -1181,11 +1254,6 @@ void SolidMechanicsLagrangeContact:: } } } - for( localIndex i = 1; i < 3; ++i ) - { - dRdT( i, 0 ) = Ja * dLimitTau_dNormalTraction * sliding[ i-1 ] / slidingNorm; - dRdT( i, i ) = Ja; - } } else { @@ -1195,21 +1263,18 @@ void SolidMechanicsLagrangeContact:: { for( localIndex i = 1; i < 3; ++i ) { - elemRHS[i] = +Ja * ( traction[kfe][i] - limitTau * vaux[ i-1 ] / vauxNorm ); - } - for( localIndex i = 1; i < 3; ++i ) - { + elemRHS[i] = Ja * traction[kfe][i] * ( 1.0 - limitTau / vauxNorm ); + + dRdT( i, 0 ) = Ja * traction[kfe][i] * dLimitTau_dNormalTraction / vauxNorm; dRdT( i, i ) = Ja; } } else { - for( localIndex i = 1; i < 3; ++i ) + for( int i = 1; i < 3; ++i ) { elemRHS[i] = 0.0; - } - for( localIndex i = 1; i < 3; ++i ) - { + dRdT( i, i ) = Ja; } } @@ -1218,13 +1283,10 @@ void SolidMechanicsLagrangeContact:: } case contact::FractureState::Open: { - for( localIndex i = 0; i < 3; ++i ) + for( int i = 0; i < 3; ++i ) { - elemRHS[i] = +Ja * traction[kfe][i]; - } + elemRHS[i] = Ja * traction[kfe][i]; - for( localIndex i = 0; i < 3; ++i ) - { dRdT( i, i ) = Ja; } break; @@ -1233,13 +1295,13 @@ void SolidMechanicsLagrangeContact:: localIndex const localRow = LvArray::integerConversion< localIndex >( elemDOF[0] - rankOffset ); - for( localIndex idof = 0; idof < 3; ++idof ) { localRhs[localRow + idof] += elemRHS[idof]; if( fractureState[kfe] != contact::FractureState::Open ) { + localMatrix.addToRowBinarySearchUnsorted< serialAtomic >( localRow + idof, nodeDOF, dRdU[idof].dataIfContiguous(), @@ -1465,7 +1527,7 @@ void SolidMechanicsLagrangeContact::assembleStabilization( MeshLevel const & mes // Combine E and nu to obtain a stiffness approximation (like it was an hexahedron) for( localIndex j = 0; j < 3; ++j ) { - stiffDiagApprox[ kf ][ i ][ j ] = E / ( ( 1.0 + nu )*( 1.0 - 2.0*nu ) ) * 2.0 / 9.0 * ( 2.0 - 3.0 * nu ) * volume / ( boxSize[j]*boxSize[j] ); + stiffDiagApprox[ kf ][ i ][ j ] = m_stabilitzationScalingCoefficient * E / ( ( 1.0 + nu )*( 1.0 - 2.0*nu ) ) * 2.0 / 9.0 * ( 2.0 - 3.0 * nu ) * volume / ( boxSize[j]*boxSize[j] ); } } } @@ -1715,7 +1777,6 @@ void SolidMechanicsLagrangeContact::applySystemSolution( DofManager const & dofM void SolidMechanicsLagrangeContact::updateState( DomainPartition & domain ) { GEOS_MARK_FUNCTION; - computeFaceDisplacementJump( domain ); } @@ -1848,6 +1909,7 @@ bool SolidMechanicsLagrangeContact::updateConfiguration( DomainPartition & domai hasConfigurationConverged &= checkActiveSetSub.get(); } ); } ); + // Need to synchronize the fracture state due to the use will be made of in AssemblyStabilization synchronizeFractureState( domain ); diff --git a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp index f2999e54c01..28485284008 100644 --- a/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp +++ b/src/coreComponents/physicsSolvers/contact/SolidMechanicsLagrangeContact.hpp @@ -25,7 +25,7 @@ namespace geos { -class SolidMechanicsLagrangianFEM; +class NumericalMethodsManager; class SolidMechanicsLagrangeContact : public ContactSolverBase { @@ -123,6 +123,12 @@ class SolidMechanicsLagrangeContact : public ContactSolverBase CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ); + void assembleForceResidualPressureContribution( MeshLevel const & mesh, + arrayView1d< string const > const & regionNames, + DofManager const & dofManager, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs ); + void assembleStabilization( MeshLevel const & mesh, NumericalMethodsManager const & numericalMethodManager, DofManager const & dofManager, @@ -148,12 +154,20 @@ class SolidMechanicsLagrangeContact : public ContactSolverBase string getStabilizationName() const { return m_stabilizationName; } +protected: + + real64 calculateContactResidualNorm( DomainPartition const & domain, + DofManager const & dofManager, + arrayView1d< real64 const > const & localRhs ); + private: string m_stabilizationName; real64 const m_slidingCheckTolerance = 0.05; - real64 m_initialResidual[3] = {0.0, 0.0, 0.0}; + real64 m_initialContactResidual = 0.0; + + real64 m_stabilitzationScalingCoefficient = 1.0; void createPreconditioner( DomainPartition const & domain ); @@ -166,10 +180,14 @@ class SolidMechanicsLagrangeContact : public ContactSolverBase constexpr static char const * rotationMatrixString() { return "rotationMatrix"; } constexpr static char const * normalDisplacementToleranceString() { return "normalDisplacementTolerance"; } + constexpr static char const * normalTractionToleranceString() { return "normalTractionTolerance"; } + constexpr static char const * slidingToleranceString() { return "slidingTolerance"; } constexpr static char const * transMultiplierString() { return "penaltyStiffnessTransMultiplier"; } + + constexpr static char const * stabilizationScalingCoefficientString() { return "stabilizationScalingCoefficient"; } }; }; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index b1a01eec570..1a322d78e90 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -18,8 +18,6 @@ #include "CompositionalMultiphaseBase.hpp" -#include "common/DataTypes.hpp" -#include "common/TimingMacros.hpp" #include "constitutive/ConstitutiveManager.hpp" #include "constitutive/capillaryPressure/CapillaryPressureFields.hpp" #include "constitutive/capillaryPressure/capillaryPressureSelector.hpp" @@ -32,10 +30,8 @@ #include "constitutive/fluid/multifluid/MultiFluidSelector.hpp" #include "constitutive/relativePermeability/RelativePermeabilityFields.hpp" #include "constitutive/relativePermeability/RelativePermeabilitySelector.hpp" -#include "constitutive/solid/SolidBase.hpp" #include "constitutive/solid/SolidInternalEnergy.hpp" #include "constitutive/thermalConductivity/MultiPhaseThermalConductivitySelector.hpp" -#include "constitutive/permeability/PermeabilityFields.hpp" #include "fieldSpecification/AquiferBoundaryCondition.hpp" #include "fieldSpecification/EquilibriumInitialCondition.hpp" #include "fieldSpecification/SourceFluxBoundaryCondition.hpp" @@ -363,10 +359,15 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) subRegion.registerField< dPhaseMobility >( getName() ). reference().resizeDimension< 1, 2 >( m_numPhases, m_numComponents + 2 ); // dP, dT, dC + // needed for time step selector subRegion.registerField< phaseVolumeFraction_n >( getName() ). reference().resizeDimension< 1 >( m_numPhases ); - subRegion.registerField< phaseMobility_n >( getName() ). - reference().resizeDimension< 1 >( m_numPhases ); + + subRegion.registerField< compAmount >( getName() ). + reference().resizeDimension< 1 >( m_numComponents ); + subRegion.registerField< compAmount_n >( getName() ). + reference().resizeDimension< 1 >( m_numComponents ); + } ); FaceManager & faceManager = mesh.getFaceManager(); @@ -701,6 +702,57 @@ void CompositionalMultiphaseBase::updateCapPressureModel( ObjectManagerBase & da } } +void CompositionalMultiphaseBase::updateCompAmount( ElementSubRegionBase & subRegion ) const +{ + GEOS_MARK_FUNCTION; + + string const & solidName = subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ); + CoupledSolidBase const & porousMaterial = getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); + arrayView2d< real64 const > const porosity = porousMaterial.getPorosity(); + arrayView1d< real64 const > const volume = subRegion.getElementVolume(); + arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.getField< fields::flow::globalCompDensity >(); + arrayView2d< real64, compflow::USD_COMP > const compAmount = subRegion.getField< fields::flow::compAmount >(); + + integer const numComp = m_numComponents; + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) + { + for( integer ic = 0; ic < numComp; ++ic ) + { + compAmount[ei][ic] = porosity[ei][0] * volume[ei] * compDens[ei][ic]; + } + } ); +} + +void CompositionalMultiphaseBase::updateEnergy( ElementSubRegionBase & subRegion ) const +{ + GEOS_MARK_FUNCTION; + + string const & solidName = subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ); + CoupledSolidBase const & porousMaterial = getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); + arrayView2d< real64 const > const porosity = porousMaterial.getPorosity(); + arrayView2d< real64 const > rockInternalEnergy = porousMaterial.getInternalEnergy(); + arrayView1d< real64 const > const volume = subRegion.getElementVolume(); + arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = subRegion.getField< fields::flow::phaseVolumeFraction >(); + string const & fluidName = getConstitutiveName< MultiFluidBase >( subRegion ); + MultiFluidBase & fluid = subRegion.getConstitutiveModel< MultiFluidBase >( fluidName ); + arrayView3d< real64 const, multifluid::USD_PHASE > const phaseDens = fluid.phaseDensity(); + arrayView3d< real64 const, multifluid::USD_PHASE > const phaseInternalEnergy = fluid.phaseInternalEnergy(); + + arrayView1d< real64 > const energy = subRegion.getField< fields::flow::energy >(); + + integer const numPhases = m_numPhases; + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) + { + energy[ei] = volume[ei] * (1.0 - porosity[ei][0]) * rockInternalEnergy[ei][0]; + for( integer ip = 0; ip < numPhases; ++ip ) + { + energy[ei] += volume[ei] * porosity[ei][0] * phaseVolFrac[ei][ip] * phaseDens[ei][0][ip] * phaseInternalEnergy[ei][0][ip]; + } + } ); +} + void CompositionalMultiphaseBase::updateSolidInternalEnergyModel( ObjectManagerBase & dataGroup ) const { arrayView1d< real64 const > const temp = dataGroup.getField< fields::flow::temperature >(); @@ -719,12 +771,13 @@ void CompositionalMultiphaseBase::updateSolidInternalEnergyModel( ObjectManagerB temp ); } -real64 CompositionalMultiphaseBase::updateFluidState( ObjectManagerBase & subRegion ) const +real64 CompositionalMultiphaseBase::updateFluidState( ElementSubRegionBase & subRegion ) const { GEOS_MARK_FUNCTION; updateGlobalComponentFraction( subRegion ); updateFluidModel( subRegion ); + updateCompAmount( subRegion ); real64 const maxDeltaPhaseVolFrac = updatePhaseVolumeFraction( subRegion ); updateRelPermModel( subRegion ); updatePhaseMobility( subRegion ); @@ -772,7 +825,6 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, compDens[ei][ic] = totalDens[ei][0] * compFrac[ei][ic]; } } ); - } ); // with initial component densities defined - check if they need to be corrected to avoid zero diags etc @@ -800,6 +852,7 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, porousSolid.scaleReferencePorosity( netToGross ); saveConvergedState( subRegion ); // necessary for a meaningful porosity update in sequential schemes updatePorosityAndPermeability( subRegion ); + updateCompAmount( subRegion ); updatePhaseVolumeFraction( subRegion ); // Now, we initialize and update each constitutive model one by one @@ -887,6 +940,8 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, SolidInternalEnergy const & solidInternalEnergyMaterial = getConstitutiveModel< SolidInternalEnergy >( subRegion, solidInternalEnergyName ); solidInternalEnergyMaterial.saveConvergedState(); + + updateEnergy( subRegion ); } // Step 4.7: if the diffusion and/or dispersion is/are supported, initialize the two models @@ -1179,7 +1234,6 @@ void CompositionalMultiphaseBase::initializePostInitialConditionsPreSubGroups() DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); - // set mass fraction flag on fluid models forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) @@ -1195,16 +1249,17 @@ void CompositionalMultiphaseBase::initializePostInitialConditionsPreSubGroups() [&]( localIndex const, auto & subRegion ) { + // set mass fraction flag on fluid models string const & fluidName = subRegion.template getReference< string >( viewKeyStruct::fluidNamesString() ); MultiFluidBase & fluid = getConstitutiveModel< MultiFluidBase >( subRegion, fluidName ); fluid.setMassFlag( m_useMass ); - CoupledSolidBase const & porousSolid = - getConstitutiveModel< CoupledSolidBase >( subRegion, - subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); saveConvergedState( subRegion ); // necessary for a meaningful porosity update in sequential schemes updatePorosityAndPermeability( subRegion ); + CoupledSolidBase const & porousSolid = + getConstitutiveModel< CoupledSolidBase >( subRegion, + subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); porousSolid.initializeState(); } ); @@ -1255,19 +1310,13 @@ CompositionalMultiphaseBase::implicitStepSetup( real64 const & GEOS_UNUSED_PARAM updateSolidInternalEnergyModel( subRegion ); } - // after the update, save the new saturation and phase mobilities + // after the update, save the new saturation arrayView2d< real64 const, compflow::USD_PHASE > const phaseVolFrac = subRegion.template getField< fields::flow::phaseVolumeFraction >(); arrayView2d< real64, compflow::USD_PHASE > const phaseVolFrac_n = subRegion.template getField< fields::flow::phaseVolumeFraction_n >(); phaseVolFrac_n.setValues< parallelDevicePolicy<> >( phaseVolFrac ); - arrayView2d< real64 const, compflow::USD_PHASE > const phaseMob = - subRegion.template getField< fields::flow::phaseMobility >(); - arrayView2d< real64, compflow::USD_PHASE > const phaseMob_n = - subRegion.template getField< fields::flow::phaseMobility_n >(); - phaseMob_n.setValues< parallelDevicePolicy<> >( phaseMob ); - } ); } ); } @@ -1286,11 +1335,22 @@ void CompositionalMultiphaseBase::assembleSystem( real64 const GEOS_UNUSED_PARAM localMatrix, localRhs ); - assembleFluxTerms( dt, - domain, - dofManager, - localMatrix, - localRhs ); + if( m_isJumpStabilized ) + { + assembleStabilizedFluxTerms( dt, + domain, + dofManager, + localMatrix, + localRhs ); + } + else + { + assembleFluxTerms( dt, + domain, + dofManager, + localMatrix, + localRhs ); + } } void CompositionalMultiphaseBase::assembleAccumulationAndVolumeBalanceTerms( DomainPartition & domain, @@ -2385,6 +2445,13 @@ void CompositionalMultiphaseBase::saveConvergedState( ElementSubRegionBase & sub arrayView2d< real64, compflow::USD_COMP > const & compDens_n = subRegion.template getField< fields::flow::globalCompDensity_n >(); compDens_n.setValues< parallelDevicePolicy<> >( compDens ); + + arrayView2d< real64 const, compflow::USD_COMP > const & compAmount = + subRegion.template getField< fields::flow::compAmount >(); + arrayView2d< real64, compflow::USD_COMP > const & compAmount_n = + subRegion.template getField< fields::flow::compAmount_n >(); + compAmount_n.setValues< parallelDevicePolicy<> >( compAmount ); + if( m_isFixedStressPoromechanicsUpdate ) { arrayView2d< real64, compflow::USD_COMP > const & compDens_k = @@ -2393,25 +2460,58 @@ void CompositionalMultiphaseBase::saveConvergedState( ElementSubRegionBase & sub } } -void CompositionalMultiphaseBase::saveSequentialIterationState( DomainPartition & domain ) const +void CompositionalMultiphaseBase::saveSequentialIterationState( DomainPartition & domain ) { FlowSolverBase::saveSequentialIterationState( domain ); -} -void CompositionalMultiphaseBase::saveSequentialIterationState( ElementSubRegionBase & subRegion ) const -{ - FlowSolverBase::saveSequentialIterationState( subRegion ); + integer const numComp = m_numComponents; - arrayView2d< real64 const, compflow::USD_COMP > const compDens = subRegion.template getField< fields::flow::globalCompDensity >(); - arrayView2d< real64, compflow::USD_COMP > const compDens_k = subRegion.template getField< fields::flow::globalCompDensity_k >(); - compDens_k.setValues< parallelDevicePolicy<> >( compDens ); -} + real64 maxCompDensChange = 0.0; + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) + { + mesh.getElemManager().forElementSubRegions( regionNames, + [&]( localIndex const, + ElementSubRegionBase & subRegion ) + { + arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); + arrayView2d< real64 const, compflow::USD_COMP > + const compDens = subRegion.getField< fields::flow::globalCompDensity >(); + arrayView2d< real64, compflow::USD_COMP > + const compDens_k = subRegion.getField< fields::flow::globalCompDensity_k >(); + + RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxCompDensChange( 0.0 ); + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] + GEOS_HOST_DEVICE ( localIndex + const ei ) + { + if( ghostRank[ei] < 0 ) + { + for( integer ic = 0; ic < numComp; ++ic ) + { + subRegionMaxCompDensChange.max( LvArray::math::abs( compDens[ei][ic] - compDens_k[ei][ic] ) ); + compDens_k[ei][ic] = compDens[ei][ic]; + } + } + } ); + + maxCompDensChange = LvArray::math::max( maxCompDensChange, subRegionMaxCompDensChange.get() ); + } ); + } ); + + m_sequentialCompDensChange = MpiWrapper::max( maxCompDensChange ); // store to be later used for convergence check +} void CompositionalMultiphaseBase::updateState( DomainPartition & domain ) { GEOS_MARK_FUNCTION; + if( m_keepFlowVariablesConstantDuringInitStep ) + return; + real64 maxDeltaPhaseVolFrac = 0.0; forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, @@ -2430,6 +2530,7 @@ void CompositionalMultiphaseBase::updateState( DomainPartition & domain ) if( m_isThermal ) { updateSolidInternalEnergyModel( subRegion ); + updateEnergy( subRegion ); } } ); } ); @@ -2443,50 +2544,11 @@ bool CompositionalMultiphaseBase::checkSequentialSolutionIncrements( DomainParti { bool isConverged = FlowSolverBase::checkSequentialSolutionIncrements( domain ); - integer const numComp = m_numComponents; - - real64 maxCompDensChange = 0.0; - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) - { - mesh.getElemManager().forElementSubRegions( regionNames, - [&]( localIndex const, - ElementSubRegionBase & subRegion ) - { - arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - - arrayView2d< real64 const, compflow::USD_COMP > - const compDens = subRegion.getField< fields::flow::globalCompDensity >(); - arrayView2d< real64 const, compflow::USD_COMP > - const compDens_k = subRegion.getField< fields::flow::globalCompDensity_k >(); - - RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxCompDensChange( 0.0 ); - - forAll< parallelDevicePolicy<> >( subRegion.size(), [=] - GEOS_HOST_DEVICE ( localIndex - const ei ) - { - if( ghostRank[ei] < 0 ) - { - for( integer ic = 0; ic < numComp; ++ic ) - { - subRegionMaxCompDensChange.max( LvArray::math::abs( compDens[ei][ic] - compDens_k[ei][ic] ) ); - } - } - } ); - - maxCompDensChange = LvArray::math::max( maxCompDensChange, subRegionMaxCompDensChange.get() ); - } ); - } ); - - maxCompDensChange = MpiWrapper::max( maxCompDensChange ); - string const unit = m_useMass ? "kg/m3" : "mol/m3"; GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( " {}: Max component density change during outer iteration: {} {}", - getName(), fmt::format( "{:.{}f}", maxCompDensChange, 3 ), unit ) ); + getName(), fmt::format( "{:.{}f}", m_sequentialCompDensChange, 3 ), unit ) ); - return isConverged && (maxCompDensChange < m_maxSequentialCompDensChange); + return isConverged && (m_sequentialCompDensChange < m_maxSequentialCompDensChange); } real64 CompositionalMultiphaseBase::setNextDt( const geos::real64 & currentDt, geos::DomainPartition & domain ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp index 21e16c269d2..594b452f270 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp @@ -19,12 +19,8 @@ #ifndef GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONALMULTIPHASEBASE_HPP_ #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONALMULTIPHASEBASE_HPP_ -#include "common/DataLayouts.hpp" -#include "constitutive/fluid/multifluid/Layouts.hpp" -#include "constitutive/relativePermeability/layouts.hpp" -#include "constitutive/capillaryPressure/layouts.hpp" -#include "fieldSpecification/FieldSpecificationManager.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBase.hpp" +#include "fieldSpecification/FieldSpecificationManager.hpp" namespace geos { @@ -137,6 +133,18 @@ class CompositionalMultiphaseBase : public FlowSolverBase */ void updateCapPressureModel( ObjectManagerBase & dataGroup ) const; + /** + * @brief Update components mass/moles + * @param subRegion the subregion storing the required fields + */ + void updateCompAmount( ElementSubRegionBase & subRegion ) const; + + /** + * @brief Update energy + * @param subRegion the subregion storing the required fields + */ + void updateEnergy( ElementSubRegionBase & subRegion ) const; + /** * @brief Update all relevant solid internal energy models using current values of temperature * @param dataGroup the group storing the required fields @@ -149,11 +157,11 @@ class CompositionalMultiphaseBase : public FlowSolverBase */ virtual void updatePhaseMobility( ObjectManagerBase & dataGroup ) const = 0; - real64 updateFluidState( ObjectManagerBase & dataGroup ) const; + real64 updateFluidState( ElementSubRegionBase & subRegion ) const; virtual void saveConvergedState( ElementSubRegionBase & subRegion ) const override final; - virtual void saveSequentialIterationState( DomainPartition & domain ) const override final; + virtual void saveSequentialIterationState( DomainPartition & domain ) override final; virtual void updateState( DomainPartition & domain ) override final; @@ -417,8 +425,6 @@ class CompositionalMultiphaseBase : public FlowSolverBase string const fieldKey, string const boundaryFieldKey ) const; - virtual void saveSequentialIterationState( ElementSubRegionBase & subRegion ) const override final; - /// the max number of fluid phases integer m_numPhases; @@ -483,6 +489,7 @@ class CompositionalMultiphaseBase : public FlowSolverBase string m_referenceFluidModelName; /// maximum (absolute) component density change in a sequential iteration + real64 m_sequentialCompDensChange; real64 m_maxSequentialCompDensChange; /// the targeted CFL for timestep diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBaseFields.hpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBaseFields.hpp index 847126b111b..2c687f7dfb8 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBaseFields.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBaseFields.hpp @@ -119,6 +119,7 @@ DECLARE_FIELD( dPhaseMobility, NO_WRITE, "Derivative of phase volume fraction with respect to pressure, temperature, global component density" ); +// this is needed for time step selector DECLARE_FIELD( phaseVolumeFraction_n, "phaseVolumeFraction_n", array2dLayoutPhase, @@ -127,14 +128,6 @@ DECLARE_FIELD( phaseVolumeFraction_n, WRITE_AND_READ, "Phase volume fraction at the previous converged time step" ); -DECLARE_FIELD( phaseMobility_n, - "phaseMobility_n", - array2dLayoutPhase, - 0, - NOPLOT, - WRITE_AND_READ, - "Phase mobility at the previous converged time step" ); - DECLARE_FIELD( phaseOutflux, "phaseOutflux", array2dLayoutPhase, @@ -175,6 +168,22 @@ DECLARE_FIELD( globalCompDensityScalingFactor, NO_WRITE, "Scaling factors for global component densities" ); +DECLARE_FIELD( compAmount, + "compAmount", + array2dLayoutComp, + 0, + LEVEL_0, + WRITE_AND_READ, + "Component amount" ); + +DECLARE_FIELD( compAmount_n, + "compAmount_n", + array2dLayoutComp, + 0, + LEVEL_0, + WRITE_AND_READ, + "Component amount at the previous converged time step" ); + } } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp index 92c447071a4..2387a59291b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp @@ -18,9 +18,7 @@ #include "CompositionalMultiphaseFVM.hpp" -#include "common/DataTypes.hpp" #include "common/MpiWrapper.hpp" -#include "common/TimingMacros.hpp" #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" #include "constitutive/relativePermeability/RelativePermeabilityBase.hpp" #include "constitutive/solid/CoupledSolidBase.hpp" @@ -972,6 +970,7 @@ void CompositionalMultiphaseFVM::applyFaceDirichletBC( real64 const time_n, if( m_isThermal ) { + //todo (jafranc) extend upwindScheme name if satisfied in isothermalCase thermalCompositionalMultiphaseFVMKernels:: DirichletFaceBasedAssemblyKernelFactory:: createAndLaunch< parallelDevicePolicy<> >( m_numComponents, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp index 431a7320860..b83902dcf0b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp @@ -18,7 +18,6 @@ #include "CompositionalMultiphaseHybridFVM.hpp" -#include "common/TimingMacros.hpp" #include "constitutive/ConstitutivePassThru.hpp" #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" #include "constitutive/relativePermeability/RelativePermeabilityBase.hpp" @@ -31,7 +30,7 @@ #include "physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVMKernels.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseBaseKernels.hpp" -#include "physicsSolvers/fluidFlow/SinglePhaseHybridFVMKernels.hpp" +#include "physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVMKernels.hpp" /** * @namespace the geosx namespace that encapsulates the majority of the code diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.hpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.hpp index 12e85758df4..428fc115a06 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.hpp @@ -20,7 +20,6 @@ #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONALMULTIPHASEHYBRIDFVM_HPP_ #include "physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp" -#include "physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVMKernels.hpp" namespace geos { diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index 26aec0a2c1a..65e4508e4c7 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -32,7 +32,6 @@ #include "physicsSolvers/fluidFlow/FluxKernelsHelper.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBaseKernels.hpp" -#include "physicsSolvers/NonlinearSolverParameters.hpp" namespace geos { @@ -40,29 +39,6 @@ namespace geos using namespace dataRepository; using namespace constitutive; -template< typename POROUSWRAPPER_TYPE > -void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE porousWrapper, - CellElementSubRegion & subRegion, - arrayView1d< real64 const > const & pressure, - arrayView1d< real64 const > const & pressure_n, - arrayView1d< real64 const > const & temperature, - arrayView1d< real64 const > const & temperature_n ) -{ - forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_DEVICE ( localIndex const k ) - { - for( localIndex q = 0; q < porousWrapper.numGauss(); ++q ) - { - porousWrapper.updateStateFromPressureAndTemperature( k, q, - pressure[k], - pressure[k], // will not be used - pressure_n[k], // will not be used - temperature[k], - temperature[k], // will not be used - temperature_n[k] ); // will not be used - } - } ); -} - template< typename POROUSWRAPPER_TYPE > void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE porousWrapper, CellElementSubRegion & subRegion, @@ -75,7 +51,6 @@ void updatePorosityAndPermeabilityFromPressureAndTemperature( POROUSWRAPPER_TYPE { forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_DEVICE ( localIndex const k ) { - for( localIndex q = 0; q < porousWrapper.numGauss(); ++q ) { porousWrapper.updateStateFromPressureAndTemperature( k, q, @@ -114,7 +89,8 @@ FlowSolverBase::FlowSolverBase( string const & name, SolverBase( name, parent ), m_numDofPerCell( 0 ), m_isThermal( 0 ), - m_isFixedStressPoromechanicsUpdate( false ) + m_isFixedStressPoromechanicsUpdate( false ), + m_isJumpStabilized( false ) { this->registerWrapper( viewKeyStruct::isThermalString(), &m_isThermal ). setApplyDefaultValue( 0 ). @@ -185,6 +161,11 @@ void FlowSolverBase::registerDataOnMesh( Group & meshBodies ) { subRegion.registerField< fields::flow::temperature_k >( getName() ); // needed for the fixed-stress porosity update } + if( m_isThermal ) + { + subRegion.registerField< fields::flow::energy >( getName() ); + subRegion.registerField< fields::flow::energy_n >( getName() ); + } } ); elemManager.forElementSubRegionsComplete< SurfaceElementSubRegion >( [&]( localIndex const, @@ -243,6 +224,13 @@ void FlowSolverBase::saveConvergedState( ElementSubRegionBase & subRegion ) cons arrayView1d< real64 > const temp_n = subRegion.template getField< fields::flow::temperature_n >(); temp_n.setValues< parallelDevicePolicy<> >( temp ); + if( m_isThermal ) + { + arrayView1d< real64 const > const energy = subRegion.template getField< fields::flow::energy >(); + arrayView1d< real64 > const energy_n = subRegion.template getField< fields::flow::energy_n >(); + energy_n.setValues< parallelDevicePolicy<> >( energy ); + } + if( m_isFixedStressPoromechanicsUpdate ) { arrayView1d< real64 > const pres_k = subRegion.template getField< fields::flow::pressure_k >(); @@ -252,31 +240,49 @@ void FlowSolverBase::saveConvergedState( ElementSubRegionBase & subRegion ) cons } } -void FlowSolverBase::saveSequentialIterationState( ElementSubRegionBase & subRegion ) const +void FlowSolverBase::saveSequentialIterationState( DomainPartition & domain ) { GEOS_ASSERT( m_isFixedStressPoromechanicsUpdate ); - arrayView1d< real64 const > const pres = subRegion.template getField< fields::flow::pressure >(); - arrayView1d< real64 const > const temp = subRegion.template getField< fields::flow::temperature >(); - arrayView1d< real64 > const pres_k = subRegion.template getField< fields::flow::pressure_k >(); - arrayView1d< real64 > const temp_k = subRegion.template getField< fields::flow::temperature_k >(); - pres_k.setValues< parallelDevicePolicy<> >( pres ); - temp_k.setValues< parallelDevicePolicy<> >( temp ); -} - -void FlowSolverBase::saveSequentialIterationState( DomainPartition & domain ) const -{ - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) + real64 maxPresChange = 0.0; + real64 maxTempChange = 0.0; + forDiscretizationOnMeshTargets ( domain.getMeshBodies(), [&]( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) { - mesh.getElemManager().forElementSubRegions( regionNames, - [&]( localIndex const, - ElementSubRegionBase & subRegion ) + mesh.getElemManager().forElementSubRegions ( regionNames, + [&]( localIndex const, + ElementSubRegionBase & subRegion ) { - saveSequentialIterationState( subRegion ); + arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); + + arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); + arrayView1d< real64 > const pres_k = subRegion.getField< fields::flow::pressure_k >(); + arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); + arrayView1d< real64 > const temp_k = subRegion.getField< fields::flow::temperature_k >(); + + RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxPresChange( 0.0 ); + RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxTempChange( 0.0 ); + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) + { + if( ghostRank[ei] < 0 ) + { + subRegionMaxPresChange.max( LvArray::math::abs( pres[ei] - pres_k[ei] ) ); + pres_k[ei] = pres[ei]; + subRegionMaxTempChange.max( LvArray::math::abs( temp[ei] - temp_k[ei] ) ); + temp_k[ei] = temp[ei]; + } + } ); + + maxPresChange = LvArray::math::max( maxPresChange, subRegionMaxPresChange.get() ); + maxTempChange = LvArray::math::max( maxTempChange, subRegionMaxTempChange.get() ); } ); } ); + + // store to be later used in convergence check + m_sequentialPresChange = MpiWrapper::max( maxPresChange ); + m_sequentialTempChange = m_isThermal ? MpiWrapper::max( maxTempChange ) : 0.0; } void FlowSolverBase::enableFixedStressPoromechanicsUpdate() @@ -284,6 +290,11 @@ void FlowSolverBase::enableFixedStressPoromechanicsUpdate() m_isFixedStressPoromechanicsUpdate = true; } +void FlowSolverBase::enableJumpStabilization() +{ + m_isJumpStabilized = true; +} + void FlowSolverBase::setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const { SolverBase::setConstitutiveNamesCallSuper( subRegion ); @@ -495,23 +506,16 @@ void FlowSolverBase::updatePorosityAndPermeability( CellElementSubRegion & subRe constitutive::ConstitutivePassThru< CoupledSolidBase >::execute( porousSolid, [=, &subRegion] ( auto & castedPorousSolid ) { typename TYPEOFREF( castedPorousSolid ) ::KernelWrapper porousWrapper = castedPorousSolid.createKernelUpdates(); - - if( m_isFixedStressPoromechanicsUpdate ) // for sequential simulations + if( m_isFixedStressPoromechanicsUpdate ) { arrayView1d< real64 const > const & pressure_k = subRegion.getField< fields::flow::pressure_k >(); arrayView1d< real64 const > const & temperature_k = subRegion.getField< fields::flow::temperature_k >(); - - updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, - pressure, pressure_k, pressure_n, - temperature, temperature_k, temperature_n ); + updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_k, pressure_n, temperature, temperature_k, temperature_n ); } - else // for fully implicit simulations + else { - updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, - pressure, pressure_n, - temperature, temperature_n ); + updatePorosityAndPermeabilityFromPressureAndTemperature( porousWrapper, subRegion, pressure, pressure_n, pressure_n, temperature, temperature_n, temperature_n ); } - } ); } @@ -785,54 +789,19 @@ void FlowSolverBase::updateStencilWeights( DomainPartition & domain ) const } ); } -bool FlowSolverBase::checkSequentialSolutionIncrements( DomainPartition & domain ) const +bool FlowSolverBase::checkSequentialSolutionIncrements( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) const { - real64 maxPresChange = 0.0; - real64 maxTempChange = 0.0; - forDiscretizationOnMeshTargets ( domain.getMeshBodies(), [&]( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) - { - mesh.getElemManager().forElementSubRegions ( regionNames, - [&]( localIndex const, - ElementSubRegionBase & subRegion ) - { - arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - - arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); - arrayView1d< real64 const > const pres_k = subRegion.getField< fields::flow::pressure_k >(); - arrayView1d< real64 const > const temp = subRegion.getField< fields::flow::temperature >(); - arrayView1d< real64 const > const temp_k = subRegion.getField< fields::flow::temperature_k >(); - - RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxPresChange( 0.0 ); - RAJA::ReduceMax< parallelDeviceReduce, real64 > subRegionMaxTempChange( 0.0 ); - - forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) - { - if( ghostRank[ei] < 0 ) - { - subRegionMaxPresChange.max( LvArray::math::abs( pres[ei] - pres_k[ei] ) ); - subRegionMaxTempChange.max( LvArray::math::abs( temp[ei] - temp_k[ei] ) ); - } - } ); - - maxPresChange = LvArray::math::max( maxPresChange, subRegionMaxPresChange.get() ); - maxTempChange = LvArray::math::max( maxTempChange, subRegionMaxTempChange.get() ); - } ); - } ); - maxPresChange = MpiWrapper::max( maxPresChange ); GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( " {}: Max pressure change during outer iteration: {} Pa", - getName(), fmt::format( "{:.{}f}", maxPresChange, 3 ) ) ); + getName(), fmt::format( "{:.{}f}", m_sequentialPresChange, 3 ) ) ); if( m_isThermal ) { - maxTempChange = MpiWrapper::max( maxTempChange ); GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( " {}: Max temperature change during outer iteration: {} K", - getName(), fmt::format( "{:.{}f}", maxTempChange, 3 ) ) ); + getName(), fmt::format( "{:.{}f}", m_sequentialTempChange, 3 ) ) ); } - return (maxPresChange < m_maxSequentialPresChange) && (maxTempChange < m_maxSequentialTempChange); + return (m_sequentialPresChange < m_maxSequentialPresChange) && (m_sequentialTempChange < m_maxSequentialTempChange); } } // namespace geos diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp index 0dac0799c6b..f917c1673e8 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp @@ -93,6 +93,8 @@ class FlowSolverBase : public SolverBase void enableFixedStressPoromechanicsUpdate(); + void enableJumpStabilization(); + void updatePorosityAndPermeability( CellElementSubRegion & subRegion ) const; virtual void updatePorosityAndPermeability( SurfaceElementSubRegion & subRegion ) const; @@ -101,7 +103,7 @@ class FlowSolverBase : public SolverBase * @brief Utility function to save the iteration state (useful for sequential simulations) * @param[in] domain the domain partition */ - virtual void saveSequentialIterationState( DomainPartition & domain ) const override; + virtual void saveSequentialIterationState( DomainPartition & domain ) override; /** * @brief For each equilibrium initial condition, loop over all the target cells and compute the min/max elevation @@ -159,12 +161,6 @@ class FlowSolverBase : public SolverBase */ virtual void saveConvergedState( ElementSubRegionBase & subRegion ) const; - /** - * @brief Utility function to save the state at the end of a sequential iteration - * @param[in] subRegion the element subRegion - */ - virtual void saveSequentialIterationState( ElementSubRegionBase & subRegion ) const; - /** * @brief Helper function to compute/report the elements with small pore volumes * @param[in] domain the domain partition @@ -189,6 +185,9 @@ class FlowSolverBase : public SolverBase /// enable the fixed stress poromechanics update of porosity bool m_isFixedStressPoromechanicsUpdate; + /// enable pressure jump stabilzation for fixed-stress poromechanics + bool m_isJumpStabilized; + /// flag if negative pressure is allowed integer m_allowNegativePressure; @@ -196,9 +195,11 @@ class FlowSolverBase : public SolverBase real64 m_maxAbsolutePresChange; /// maximum (absolute) pressure change in a sequential iteration + real64 m_sequentialPresChange; real64 m_maxSequentialPresChange; /// maximum (absolute) temperature change in a sequential iteration + real64 m_sequentialTempChange; real64 m_maxSequentialTempChange; private: diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp index ae68a6a2a17..53f7ea8704f 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp @@ -104,14 +104,6 @@ DECLARE_FIELD( temperature, WRITE_AND_READ, "Temperature" ); -DECLARE_FIELD( faceTemperature, - "faceTemperature", - array1d< real64 >, - 0, - LEVEL_0, - WRITE_AND_READ, - "Face temperature" ); - DECLARE_FIELD( temperature_n, "temperature_n", array1d< real64 >, @@ -124,7 +116,7 @@ DECLARE_FIELD( temperature_k, "temperature_k", array1d< real64 >, 0, - LEVEL_0, + NOPLOT, NO_WRITE, "Temperature at the previous sequential iteration" ); @@ -136,6 +128,14 @@ DECLARE_FIELD( initialTemperature, WRITE_AND_READ, "Initial temperature" ); +DECLARE_FIELD( faceTemperature, + "faceTemperature", + array1d< real64 >, + 0, + LEVEL_0, + WRITE_AND_READ, + "Face temperature" ); + DECLARE_FIELD( netToGross, "netToGross", array1d< real64 >, @@ -248,6 +248,38 @@ DECLARE_FIELD( temperatureScalingFactor, NO_WRITE, "Scaling factors for temperature" ); +DECLARE_FIELD( mass, + "mass", + array1d< real64 >, + 0, + LEVEL_0, + WRITE_AND_READ, + "Mass" ); + +DECLARE_FIELD( mass_n, + "mass_n", + array1d< real64 >, + 0, + NOPLOT, + WRITE_AND_READ, + "Mass at the previous converged time step" ); + +DECLARE_FIELD( energy, + "energy", + array1d< real64 >, + 0, + LEVEL_0, + WRITE_AND_READ, + "Energy" ); + +DECLARE_FIELD( energy_n, + "energy_n", + array1d< real64 >, + 0, + NOPLOT, + WRITE_AND_READ, + "Energy at the previous converged time step" ); + } } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseBaseKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseBaseKernels.hpp index 8adafb2945a..f0a3c194c5b 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseBaseKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseBaseKernels.hpp @@ -587,21 +587,17 @@ class ElementBasedAssemblyKernel m_dofNumber( subRegion.getReference< array1d< globalIndex > >( dofKey ) ), m_elemGhostRank( subRegion.ghostRank() ), m_volume( subRegion.getElementVolume() ), - m_porosity_n( solid.getPorosity_n() ), m_porosity( solid.getPorosity() ), m_dPoro_dPres( solid.getDporosity_dPressure() ), m_dCompFrac_dCompDens( subRegion.getField< fields::flow::dGlobalCompFraction_dGlobalCompDensity >() ), - m_phaseVolFrac_n( subRegion.getField< fields::flow::phaseVolumeFraction_n >() ), m_phaseVolFrac( subRegion.getField< fields::flow::phaseVolumeFraction >() ), m_dPhaseVolFrac( subRegion.getField< fields::flow::dPhaseVolumeFraction >() ), - m_phaseDens_n( fluid.phaseDensity_n() ), m_phaseDens( fluid.phaseDensity() ), m_dPhaseDens( fluid.dPhaseDensity() ), - m_phaseCompFrac_n( fluid.phaseCompFraction_n() ), m_phaseCompFrac( fluid.phaseCompFraction() ), m_dPhaseCompFrac( fluid.dPhaseCompFraction() ), m_compDens( subRegion.getField< fields::flow::globalCompDensity >() ), - m_compDens_n( subRegion.getField< fields::flow::globalCompDensity_n >() ), + m_compAmount_n( subRegion.getField< fields::flow::compAmount_n >() ), m_localMatrix( localMatrix ), m_localRhs( localRhs ), m_kernelFlags( kernelFlags ) @@ -620,9 +616,6 @@ class ElementBasedAssemblyKernel /// Pore volume at time n+1 real64 poreVolume = 0.0; - /// Pore volume at the previous converged time step - real64 poreVolume_n = 0.0; - /// Derivative of pore volume with respect to pressure real64 dPoreVolume_dPres = 0.0; @@ -663,7 +656,6 @@ class ElementBasedAssemblyKernel { // initialize the pore volume stack.poreVolume = m_volume[ei] * m_porosity[ei][0]; - stack.poreVolume_n = m_volume[ei] * m_porosity_n[ei][0]; stack.dPoreVolume_dPres = m_volume[ei] * m_dPoro_dPres[ei][0]; // set row index and degrees of freedom indices for this element @@ -694,7 +686,7 @@ class ElementBasedAssemblyKernel for( integer ic = 0; ic < numComp; ++ic ) { real64 const compAmount = stack.poreVolume * m_compDens[ei][ic]; - real64 const compAmount_n = stack.poreVolume_n * m_compDens_n[ei][ic]; + real64 const compAmount_n = m_compAmount_n[ei][ic]; stack.localResidual[ic] += compAmount - compAmount_n; @@ -714,15 +706,12 @@ class ElementBasedAssemblyKernel // construct the slices for variables accessed multiple times arraySlice2d< real64 const, compflow::USD_COMP_DC - 1 > dCompFrac_dCompDens = m_dCompFrac_dCompDens[ei]; - arraySlice1d< real64 const, compflow::USD_PHASE - 1 > phaseVolFrac_n = m_phaseVolFrac_n[ei]; arraySlice1d< real64 const, compflow::USD_PHASE - 1 > phaseVolFrac = m_phaseVolFrac[ei]; arraySlice2d< real64 const, compflow::USD_PHASE_DC - 1 > dPhaseVolFrac = m_dPhaseVolFrac[ei]; - arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseDens_n = m_phaseDens_n[ei][0]; arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseDens = m_phaseDens[ei][0]; arraySlice2d< real64 const, multifluid::USD_PHASE_DC - 2 > dPhaseDens = m_dPhaseDens[ei][0]; - arraySlice2d< real64 const, multifluid::USD_PHASE_COMP - 2 > phaseCompFrac_n = m_phaseCompFrac_n[ei][0]; arraySlice2d< real64 const, multifluid::USD_PHASE_COMP - 2 > phaseCompFrac = m_phaseCompFrac[ei][0]; arraySlice3d< real64 const, multifluid::USD_PHASE_COMP_DC - 2 > dPhaseCompFrac = m_dPhaseCompFrac[ei][0]; @@ -730,11 +719,16 @@ class ElementBasedAssemblyKernel real64 dPhaseAmount_dC[numComp]{}; real64 dPhaseCompFrac_dC[numComp]{}; + // start with old time step values + for( integer ic = 0; ic < numComp; ++ic ) + { + stack.localResidual[ic] = -m_compAmount_n[ei][ic]; + } + // sum contributions to component accumulation from each phase for( integer ip = 0; ip < m_numPhases; ++ip ) { real64 const phaseAmount = stack.poreVolume * phaseVolFrac[ip] * phaseDens[ip]; - real64 const phaseAmount_n = stack.poreVolume_n * phaseVolFrac_n[ip] * phaseDens_n[ip]; real64 const dPhaseAmount_dP = stack.dPoreVolume_dPres * phaseVolFrac[ip] * phaseDens[ip] + stack.poreVolume * ( dPhaseVolFrac[ip][Deriv::dP] * phaseDens[ip] @@ -754,12 +748,11 @@ class ElementBasedAssemblyKernel for( integer ic = 0; ic < numComp; ++ic ) { real64 const phaseCompAmount = phaseAmount * phaseCompFrac[ip][ic]; - real64 const phaseCompAmount_n = phaseAmount_n * phaseCompFrac_n[ip][ic]; real64 const dPhaseCompAmount_dP = dPhaseAmount_dP * phaseCompFrac[ip][ic] + phaseAmount * dPhaseCompFrac[ip][ic][Deriv::dP]; - stack.localResidual[ic] += phaseCompAmount - phaseCompAmount_n; + stack.localResidual[ic] += phaseCompAmount; stack.localJacobian[ic][0] += dPhaseCompAmount_dP; // jc - index of component w.r.t. whose compositional var the derivative is being taken @@ -778,17 +771,10 @@ class ElementBasedAssemblyKernel // call the lambda in the phase loop to allow the reuse of the phase amounts and their derivatives // possible use: assemble the derivatives wrt temperature, and the accumulation term of the energy equation for this phase - phaseAmountKernelOp( ip, phaseAmount, phaseAmount_n, dPhaseAmount_dP, dPhaseAmount_dC ); + phaseAmountKernelOp( ip, phaseAmount, dPhaseAmount_dP, dPhaseAmount_dC ); } } - - // check zero diagonal (works only in debug) - for( integer ic = 0; ic < numComp; ++ic ) - { - GEOS_ASSERT_MSG( LvArray::math::abs( stack.localJacobian[ic][ic] ) > minDensForDivision, - GEOS_FMT( "Zero diagonal in Jacobian: equation {}, value = {}", ic, stack.localJacobian[ic][ic] ) ); - } } /** @@ -918,7 +904,6 @@ class ElementBasedAssemblyKernel arrayView1d< real64 const > const m_volume; /// Views on the porosity - arrayView2d< real64 const > const m_porosity_n; arrayView2d< real64 const > const m_porosity; arrayView2d< real64 const > const m_dPoro_dPres; @@ -926,23 +911,22 @@ class ElementBasedAssemblyKernel arrayView3d< real64 const, compflow::USD_COMP_DC > const m_dCompFrac_dCompDens; /// Views on the phase volume fractions - arrayView2d< real64 const, compflow::USD_PHASE > const m_phaseVolFrac_n; arrayView2d< real64 const, compflow::USD_PHASE > const m_phaseVolFrac; arrayView3d< real64 const, compflow::USD_PHASE_DC > const m_dPhaseVolFrac; /// Views on the phase densities - arrayView3d< real64 const, multifluid::USD_PHASE > const m_phaseDens_n; arrayView3d< real64 const, multifluid::USD_PHASE > const m_phaseDens; arrayView4d< real64 const, multifluid::USD_PHASE_DC > const m_dPhaseDens; /// Views on the phase component fraction - arrayView4d< real64 const, multifluid::USD_PHASE_COMP > const m_phaseCompFrac_n; arrayView4d< real64 const, multifluid::USD_PHASE_COMP > const m_phaseCompFrac; arrayView5d< real64 const, multifluid::USD_PHASE_COMP_DC > const m_dPhaseCompFrac; - // Views on component densities + // View on component densities arrayView2d< real64 const, compflow::USD_COMP > m_compDens; - arrayView2d< real64 const, compflow::USD_COMP > m_compDens_n; + + // View on component amount (mass/moles) from previous time step + arrayView2d< real64 const, compflow::USD_COMP > m_compAmount_n; /// View on the local CRS matrix CRSMatrixView< real64, globalIndex const > const m_localMatrix; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp index f63126c5cbb..9824d8a17e4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernelUtilities.hpp @@ -182,6 +182,94 @@ struct PotGrad }; +struct PhaseComponentFlux +{ + /** + * @brief Compute the component flux for a given phase + * @tparam numComp number of components + * @tparam numFluxSupportPoints number of flux support points + * @param ip phase index + * @param k_up uptream index for this phase + * @param seri arraySlice of the stencil-implied element region index + * @param sesri arraySlice of the stencil-implied element subregion index + * @param sei arraySlice of the stencil-implied element index + * @param phaseCompFrac phase component fraction + * @param dPhaseCompFrac derivative of phase component fraction wrt pressure, temperature, component fraction + * @param dCompFrac_dCompDens derivative of component fraction wrt component density + * @param phaseFlux phase flux + * @param dPhaseFlux_dP derivative of phase flux wrt pressure + * @param dPhaseFlux_dC derivative of phase flux wrt comp density + * @param compFlux component flux + * @param dCompFlux_dP derivative of phase flux wrt pressure + * @param dCompFlux_dC derivative of phase flux wrt comp density + */ + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static void + compute( localIndex const ip, + localIndex const k_up, + localIndex const ( &seri )[numFluxSupportPoints], + localIndex const ( &sesri )[numFluxSupportPoints], + localIndex const ( &sei )[numFluxSupportPoints], + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, + ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + real64 const & phaseFlux, + real64 const ( &dPhaseFlux_dP )[numFluxSupportPoints], + real64 const ( &dPhaseFlux_dC )[numFluxSupportPoints][numComp], + real64 ( & compFlux )[numComp], + real64 ( & dCompFlux_dP )[numFluxSupportPoints][numComp], + real64 ( & dCompFlux_dC )[numFluxSupportPoints][numComp][numComp] ) + { + localIndex const er_up = seri[k_up]; + localIndex const esr_up = sesri[k_up]; + localIndex const ei_up = sei[k_up]; + + real64 dProp_dC[numComp]{}; + + // slice some constitutive arrays to avoid too much indexing in component loop + arraySlice1d< real64 const, constitutive::multifluid::USD_PHASE_COMP-3 > phaseCompFracSub = + phaseCompFrac[er_up][esr_up][ei_up][0][ip]; + arraySlice2d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC-3 > dPhaseCompFracSub = + dPhaseCompFrac[er_up][esr_up][ei_up][0][ip]; + + // compute component fluxes and derivatives using upstream cell composition + for( integer ic = 0; ic < numComp; ++ic ) + { + real64 const ycp = phaseCompFracSub[ic]; + compFlux[ic] += phaseFlux * ycp; + + // derivatives stemming from phase flux + for( integer ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dCompFlux_dP[ke][ic] += dPhaseFlux_dP[ke] * ycp; + for( integer jc = 0; jc < numComp; ++jc ) + { + dCompFlux_dC[ke][ic][jc] += dPhaseFlux_dC[ke][jc] * ycp; + } + } + + // additional derivatives stemming from upstream cell phase composition + dCompFlux_dP[k_up][ic] += phaseFlux * dPhaseCompFracSub[ic][Deriv::dP]; + + // convert derivatives of comp fraction w.r.t. comp fractions to derivatives w.r.t. comp densities + applyChainRule( numComp, + dCompFrac_dCompDens[er_up][esr_up][ei_up], + dPhaseCompFracSub[ic], + dProp_dC, + Deriv::dC ); + for( integer jc = 0; jc < numComp; ++jc ) + { + dCompFlux_dC[k_up][ic][jc] += phaseFlux * dProp_dC[jc]; + } + } + + + + } + +}; + struct PPUPhaseFlux { /** @@ -228,6 +316,8 @@ struct PPUPhaseFlux ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, + ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, @@ -237,7 +327,10 @@ struct PPUPhaseFlux real64 & potGrad, real64 ( &phaseFlux ), real64 ( & dPhaseFlux_dP )[numFluxSupportPoints], - real64 ( & dPhaseFlux_dC )[numFluxSupportPoints][numComp] ) + real64 ( & dPhaseFlux_dC )[numFluxSupportPoints][numComp], + real64 ( & compFlux )[numComp], + real64 ( & dCompFlux_dP )[numFluxSupportPoints][numComp], + real64 ( & dCompFlux_dC )[numFluxSupportPoints][numComp][numComp] ) { real64 dPresGrad_dP[numFluxSupportPoints]{}; real64 dPresGrad_dC[numFluxSupportPoints][numComp]{}; @@ -283,6 +376,11 @@ struct PPUPhaseFlux { dPhaseFlux_dC[k_up][jc] += dPhaseMobSub[Deriv::dC+jc] * potGrad; } + + //distribute on phaseComponentFlux here + PhaseComponentFlux::compute( ip, k_up, seri, sesri, sei, phaseCompFrac, dPhaseCompFrac, dCompFrac_dCompDens, phaseFlux + , dPhaseFlux_dP, dPhaseFlux_dC, compFlux, dCompFlux_dP, dCompFlux_dC ); + } }; @@ -322,7 +420,6 @@ struct C1PPUPhaseFlux compute( integer const numPhase, integer const ip, integer const hasCapPressure, - //real64 const epsC1PPU, localIndex const ( &seri )[numFluxSupportPoints], localIndex const ( &sesri )[numFluxSupportPoints], localIndex const ( &sei )[numFluxSupportPoints], @@ -333,6 +430,8 @@ struct C1PPUPhaseFlux ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, + ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, @@ -342,7 +441,10 @@ struct C1PPUPhaseFlux real64 & potGrad, real64 ( &phaseFlux ), real64 ( & dPhaseFlux_dP )[numFluxSupportPoints], - real64 ( & dPhaseFlux_dC )[numFluxSupportPoints][numComp] ) + real64 ( & dPhaseFlux_dC )[numFluxSupportPoints][numComp], + real64 ( & compFlux )[numComp], + real64 ( & dCompFlux_dP )[numFluxSupportPoints][numComp], + real64 ( & dCompFlux_dC )[numFluxSupportPoints][numComp][numComp] ) { real64 dPresGrad_dP[numFluxSupportPoints]{}; real64 dPresGrad_dC[numFluxSupportPoints][numComp]{}; @@ -452,94 +554,1930 @@ struct C1PPUPhaseFlux // choose upstream cell for composition upwinding k_up = (phaseFlux >= 0) ? 0 : 1; + //distribute on phaseComponentFlux here + PhaseComponentFlux::compute( ip, k_up, seri, sesri, sei, phaseCompFrac, dPhaseCompFrac, dCompFrac_dCompDens, phaseFlux + , dPhaseFlux_dP, dPhaseFlux_dC, compFlux, dCompFlux_dP, dCompFlux_dC ); } }; -struct PhaseComponentFlux + + +/************************* HELPERS ******************/ +namespace UpwindHelpers +{ + +static constexpr double minTotMob = 1e-12; + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void +upwindMobilityViscous( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totFlux, //in fine should be a ElemnetViewConst once seq form are in place + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & upwindDir, + real64 & mobility, + real64( &dMobility_dP), + real64 ( & dMobility_dC)[numComp] + ) +{ + + //reinit + mobility = 0.0; + dMobility_dP = 0.0; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMobility_dC[ic] = 0.0; + } + + UPWIND scheme; + scheme.template getUpwindDirectionViscous< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + phaseMob, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + upwindDir ); + + localIndex const er_up = seri[upwindDir]; + localIndex const esr_up = sesri[upwindDir]; + localIndex const ei_up = sei[upwindDir]; + + if( std::fabs( phaseMob[er_up][esr_up][ei_up][ip] ) > 1e-20 ) + { + mobility = phaseMob[er_up][esr_up][ei_up][ip]; + dMobility_dP = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dP]; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMobility_dC[ic] = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dC + ic]; + } + } +} + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void +upwindMobilityGravity( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totFlux, //in fine should be a ElemnetViewConst once seq form are in place + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & upwindDir, + real64 & mobility, + real64( &dMobility_dP), + real64 ( & dMobility_dC)[numComp] + ) +{ + + //reinit + mobility = 0.0; + dMobility_dP = 0.0; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMobility_dC[ic] = 0.0; + } + + UPWIND scheme; + scheme.template getUpwindDirectionGravity< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + phaseMob, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + upwindDir ); + + localIndex const er_up = seri[upwindDir]; + localIndex const esr_up = sesri[upwindDir]; + localIndex const ei_up = sei[upwindDir]; + + if( std::fabs( phaseMob[er_up][esr_up][ei_up][ip] ) > 1e-20 ) + { + mobility = phaseMob[er_up][esr_up][ei_up][ip]; + dMobility_dP = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dP]; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMobility_dC[ic] = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dC + ic]; + } + } +} + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void +upwindMobilityCapillary( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totFlux, //in fine should be a ElemnetViewConst once seq form are in place + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & upwindDir, + real64 & mobility, + real64( &dMobility_dP), + real64 ( & dMobility_dC)[numComp] + ) +{ + + //reinit + mobility = 0.0; + dMobility_dP = 0.0; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMobility_dC[ic] = 0.0; + } + + UPWIND scheme; + scheme.template getUpwindDirectionCapillary< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + phaseMob, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + upwindDir ); + + localIndex const er_up = seri[upwindDir]; + localIndex const esr_up = sesri[upwindDir]; + localIndex const ei_up = sei[upwindDir]; + + if( std::fabs( phaseMob[er_up][esr_up][ei_up][ip] ) > 1e-20 ) + { + mobility = phaseMob[er_up][esr_up][ei_up][ip]; + dMobility_dP = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dP]; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMobility_dC[ic] = dPhaseMob[er_up][esr_up][ei_up][ip][Deriv::dC + ic]; + } + } +} + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void +computeFractionalFlowViscous( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + localIndex const & k_up_ppu, + real64 const totFlux, + real64 const totMob, + real64 const (&dTotMob_dP)[numFluxSupportPoints], + real64 const (&dTotMob_dC)[numFluxSupportPoints][numComp], + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & k_up_main, + real64 & fractionalFlow, + real64 ( & dFractionalFlow_dP)[numFluxSupportPoints], + real64 ( & dFractionalFlow_dC)[numFluxSupportPoints][numComp] ) +{ + // get var to memorized the numerator mobility properly upwinded + real64 mainMob{}; + real64 dMMob_dP{}; + real64 dMMob_dC[numComp]{}; + +// real64 totMob{}; +// real64 dTotMob_dP[numFluxSupportPoints]{}; +// real64 dTotMob_dC[numFluxSupportPoints][numComp]{}; + + //reinit + //fractional flow too low to let the upstream phase flow + k_up_main = -1; //to throw error if unmodified + fractionalFlow = 0; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dFractionalFlow_dP[ke] = 0; + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[ke][jc] = 0; + } + } + + localIndex k_up; + real64 mob{}; + real64 dMob_dP{}; + real64 dMob_dC[numComp]{}; + + upwindMobilityViscous< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up, + mob, + dMob_dP, + dMob_dC ); + + k_up_main = k_up; + mainMob = mob; + dMMob_dP = dMob_dP; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMMob_dC[ic] = dMob_dC[ic]; + } + + //guard against no flow region + if( std::fabs( mainMob ) > 1e-20 ) + { + fractionalFlow = mainMob / LvArray::math::max( totMob, minTotMob ); + dFractionalFlow_dP[k_up_main] = dMMob_dP / LvArray::math::max( totMob, minTotMob ); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[k_up_main][jc] = dMMob_dC[jc] / totMob; + + } + + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dFractionalFlow_dP[ke] -= fractionalFlow * dTotMob_dP[k_up_ppu] / LvArray::math::max( totMob, minTotMob ); + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[ke][jc] -= fractionalFlow * dTotMob_dC[k_up_ppu][jc] / LvArray::math::max( totMob, minTotMob ); + } + } + } +} + + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void +computeFractionalFlowGravity( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + localIndex const & k_up_ppu, + real64 const totFlux, + real64 const totMob, + real64 const (&dTotMob_dP)[numFluxSupportPoints], + real64 const (&dTotMob_dC)[numFluxSupportPoints][numComp], + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & k_up_main, + real64 & fractionalFlow, + real64 ( & dFractionalFlow_dP)[numFluxSupportPoints], + real64 ( & dFractionalFlow_dC)[numFluxSupportPoints][numComp] + ) +{ + // get var to memorized the numerator mobility properly upwinded + real64 mainMob{}; + real64 dMMob_dP{}; + real64 dMMob_dC[numComp]{}; + + //reinit + //fractional flow too low to let the upstream phase flow + k_up_main = -1; //to throw error if unmodified + fractionalFlow = 0; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dFractionalFlow_dP[ke] = 0; + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[ke][jc] = 0; + } + } + + + localIndex k_up; + real64 mob{}; + real64 dMob_dP{}; + real64 dMob_dC[numComp]{}; + + upwindMobilityGravity< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up, + mob, + dMob_dP, + dMob_dC ); + + k_up_main = k_up; + mainMob = mob; + dMMob_dP = dMob_dP; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMMob_dC[ic] = dMob_dC[ic]; + } + + //guard against no flow region + if( std::fabs( mainMob ) > 1e-20 ) + { + fractionalFlow = mainMob / LvArray::math::max( totMob, minTotMob ); + dFractionalFlow_dP[k_up_main] = dMMob_dP / LvArray::math::max( totMob, minTotMob ); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[k_up_main][jc] = dMMob_dC[jc] / totMob; + + } + + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dFractionalFlow_dP[ke] -= fractionalFlow * dTotMob_dP[k_up_ppu] / LvArray::math::max( totMob, minTotMob ); + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[ke][jc] -= fractionalFlow * dTotMob_dC[k_up_ppu][jc] / LvArray::math::max( totMob, minTotMob ); + } + } + } +} + + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void +computeFractionalFlowCapillary( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + localIndex const & k_up_ppu, + real64 const totFlux, + real64 const totMob, + real64 const (&dTotMob_dP)[numFluxSupportPoints], + real64 const (&dTotMob_dC)[numFluxSupportPoints][numComp], + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & k_up_main, + real64 & fractionalFlow, + real64 ( & dFractionalFlow_dP)[numFluxSupportPoints], + real64 ( & dFractionalFlow_dC)[numFluxSupportPoints][numComp] + ) +{ + // get var to memorized the numerator mobility properly upwinded + real64 mainMob{}; + real64 dMMob_dP{}; + real64 dMMob_dC[numComp]{}; + + //reinit + //fractional flow too low to let the upstream phase flow + k_up_main = -1; //to throw error if unmodified + fractionalFlow = 0; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dFractionalFlow_dP[ke] = 0; + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[ke][jc] = 0; + } + } + + + localIndex k_up; + real64 mob{}; + real64 dMob_dP{}; + real64 dMob_dC[numComp]{}; + + upwindMobilityCapillary< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up, + mob, + dMob_dP, + dMob_dC ); + + + k_up_main = k_up; + mainMob = mob; + dMMob_dP = dMob_dP; + for( localIndex ic = 0; ic < numComp; ++ic ) + { + dMMob_dC[ic] = dMob_dC[ic]; + } + + //guard against no flow region + if( std::fabs( mainMob ) > 1e-20 ) + { + fractionalFlow = mainMob / LvArray::math::max( totMob, minTotMob ); + dFractionalFlow_dP[k_up_main] = dMMob_dP / LvArray::math::max( totMob, minTotMob ); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[k_up_main][jc] = dMMob_dC[jc] / LvArray::math::max( totMob, minTotMob ); + + } + + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dFractionalFlow_dP[ke] -= fractionalFlow * dTotMob_dP[k_up_ppu] / LvArray::math::max( totMob, minTotMob ); + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dFractionalFlow_dC[ke][jc] -= fractionalFlow * dTotMob_dC[k_up_ppu][jc] / LvArray::math::max( totMob, minTotMob ); + } + } + } +} + +/** + * @brief Struct defining formation of potential from different Physics (flagged by enum type T) to be used + * in Upwind discretization schemes + * @tparam numComp number of component + * @tparam T the concerned physics (Viscou,Gravity or Capillary) + * @tparam numFluxSupportPoints number of point in the stencil + */ +struct computePotentialViscous +{ + + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static void compute( localIndex const GEOS_UNUSED_PARAM( numPhase ), + localIndex const GEOS_UNUSED_PARAM( ip ), + localIndex const (&GEOS_UNUSED_PARAM( seri ))[numFluxSupportPoints], + localIndex const (&GEOS_UNUSED_PARAM( sesri ))[numFluxSupportPoints], + localIndex const (&GEOS_UNUSED_PARAM( sei ))[numFluxSupportPoints], + real64 const (&GEOS_UNUSED_PARAM( transmissibility ))[2], + real64 const (&GEOS_UNUSED_PARAM( dTrans_dPres ))[2], + real64 const totFlux, + ElementViewConst< arrayView1d< real64 const > > const & GEOS_UNUSED_PARAM( gravCoef ), + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & + GEOS_UNUSED_PARAM( dCompFrac_dCompDens ), + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & + GEOS_UNUSED_PARAM( phaseMassDens ), + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & + GEOS_UNUSED_PARAM( dPhaseMassDens ), + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & + GEOS_UNUSED_PARAM( dPhaseVolFrac ), + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & + GEOS_UNUSED_PARAM( phaseCapPressure ), + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & + GEOS_UNUSED_PARAM( dPhaseCapPressure_dPhaseVolFrac ), + real64 & pot, + real64( &GEOS_UNUSED_PARAM( dPot_dPres ))[numFluxSupportPoints], + real64( &GEOS_UNUSED_PARAM( dPot_dComp ))[numFluxSupportPoints][numComp], + real64( &GEOS_UNUSED_PARAM( dProp_dComp ))[numComp] ) + { + pot = totFlux; + //could be relevant for symmetry to include derivative + + } +}; + +/*! @copydoc computePotential + */ +struct computePotentialGravity +{ + /*! @copydoc computePotential::compute + * + * @brief specialization for gravitational driving forces which only relies on total flux + */ + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static void compute( localIndex const GEOS_UNUSED_PARAM( numPhase ), + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const GEOS_UNUSED_PARAM( totFlux ), + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & + GEOS_UNUSED_PARAM( dPhaseVolFrac ), + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & + GEOS_UNUSED_PARAM( phaseCapPressure ), + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & + GEOS_UNUSED_PARAM( dPhaseCapPressure_dPhaseVolFrac ), + real64 & pot, + real64 ( & dPot_dPres )[numFluxSupportPoints], + real64 (& dPot_dComp )[numFluxSupportPoints][numComp], + real64 ( & dProp_dComp )[numComp] ) + { + //working arrays + real64 densMean{}; + real64 dDensMean_dPres[numFluxSupportPoints]{}; + real64 dDensMean_dComp[numFluxSupportPoints][numComp]{}; + + //init + pot = 0.0; + for( localIndex i = 0; i < numFluxSupportPoints; ++i ) + { + dPot_dPres[i] = 0.0; + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPot_dComp[i][jc] = 0.0; + dProp_dComp[jc] = 0.0; + } + } + + //inner loop to get average density + for( localIndex i = 0; i < numFluxSupportPoints; ++i ) + { + localIndex const er = seri[i]; + localIndex const esr = sesri[i]; + localIndex const ei = sei[i]; + + // density + real64 const density = phaseMassDens[er][esr][ei][0][ip]; + real64 const dDens_dPres = dPhaseMassDens[er][esr][ei][0][ip][Deriv::dP]; + + applyChainRule( numComp, + dCompFrac_dCompDens[er][esr][ei], + dPhaseMassDens[er][esr][ei][0][ip], + dProp_dComp, + Deriv::dC ); + + // average density and derivatives + densMean += 0.5 * density; + dDensMean_dPres[i] = 0.5 * dDens_dPres; + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dDensMean_dComp[i][jc] = 0.5 * dProp_dComp[jc]; + } + } + + // compute potential difference MPFA-style + for( localIndex i = 0; i < numFluxSupportPoints; ++i ) + { + localIndex const er = seri[i]; + localIndex const esr = sesri[i]; + localIndex const ei = sei[i]; + + real64 const gravD = transmissibility[i] * gravCoef[er][esr][ei]; + real64 const dGravD_dP = dTrans_dPres[i] * gravCoef[er][esr][ei]; + pot += densMean * gravD; + + // need to add contributions from both cells the mean density depends on + for( localIndex j = 0; j < numFluxSupportPoints; ++j ) + { + dPot_dPres[j] += dDensMean_dPres[j] * gravD + densMean * dGravD_dP; + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPot_dComp[j][jc] += dDensMean_dComp[j][jc] * gravD; + } + } + } + + } +}; + +/*! @copydoc computePotential + */ +struct computePotentialCapillary +{ + /*! @copydoc computePotential::compute + * + * @brief specialization for capillary driving forces which only relies on total flux + */ + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static void compute( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const GEOS_UNUSED_PARAM( totFlux ), + ElementViewConst< arrayView1d< real64 const > > const & GEOS_UNUSED_PARAM( gravCoef ), + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & + GEOS_UNUSED_PARAM( dCompFrac_dCompDens ), + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & + GEOS_UNUSED_PARAM( phaseMassDens ), + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & + GEOS_UNUSED_PARAM( dPhaseMassDens ), + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + real64 & pot, + real64 ( & dPot_dPres)[numFluxSupportPoints], + real64 (& dPot_dComp)[numFluxSupportPoints][numComp], + real64( &GEOS_UNUSED_PARAM( dProp_dComp ))[numComp] ) + { + + + for( localIndex i = 0; i < numFluxSupportPoints; ++i ) + { + localIndex const er = seri[i]; + localIndex const esr = sesri[i]; + localIndex const ei = sei[i]; + + pot += transmissibility[i] * phaseCapPressure[er][esr][ei][0][ip]; + // need to add contributions from both cells + for( localIndex jp = 0; jp < numPhase; ++jp ) + { + + real64 const dCapPressure_dS = dPhaseCapPressure_dPhaseVolFrac[er][esr][ei][0][ip][jp]; + dPot_dPres[i] += + transmissibility[i] * dCapPressure_dS * dPhaseVolFrac[er][esr][ei][jp][Deriv::dP] + + dTrans_dPres[i] * phaseCapPressure[er][esr][ei][0][jp]; + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPot_dComp[i][jc] += transmissibility[i] * dCapPressure_dS * + dPhaseVolFrac[er][esr][ei][jp][Deriv::dC + jc]; + } + + } + + } + + } +}; + + +/// Form potential-related parts of fluxes + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void computePotentialFluxesGravity( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + localIndex const & k_up_ppu, + real64 const totFlux, + real64 const totMob, + real64 const (&dTotMob_dP)[numFluxSupportPoints], + real64 const (&dTotMob_dC)[numFluxSupportPoints][numComp], + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + localIndex const capPressureFlag, + localIndex( &k_up), + localIndex (&k_up_o), + real64 & phaseFlux, + real64 (& dPhaseFlux_dP)[numFluxSupportPoints], + real64 ( & dPhaseFlux_dC)[numFluxSupportPoints][numComp] ) +{ + + real64 fflow{}; + real64 dFflow_dP[numFluxSupportPoints]{}; + real64 dFflow_dC[numFluxSupportPoints][numComp]{}; + + real64 pot{}; + real64 dPot_dP[numFluxSupportPoints]{}; + real64 dPot_dC[numFluxSupportPoints][numComp]{}; + real64 dProp_dC[numComp]{}; + + // + UpwindHelpers::computePotentialGravity::compute< numComp, numFluxSupportPoints >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + pot, + dPot_dP, + dPot_dC, + dProp_dC ); + + // and the fractional flow for gravitational part as \lambda_i^{up}/\sum_{numPhase}(\lambda_k^{up}) with up decided upon + // the Upwind strategy + UpwindHelpers::computeFractionalFlowGravity< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + k_up_ppu, + totFlux, + totMob, + dTotMob_dP, + dTotMob_dC, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up, + fflow, + dFflow_dP, + dFflow_dC ); + + + for( localIndex jp = 0; jp < numPhase; ++jp ) + { + if( ip != jp ) + { + + real64 potOther{}; + real64 dPotOther_dP[numFluxSupportPoints]{}; + real64 dPotOther_dC[numFluxSupportPoints][numComp]{}; + real64 dPropOther_dC[numComp]{}; + + //Fetch pot for phase j!=i defined as \rho_j g dz/dx + UpwindHelpers::computePotentialGravity::compute< numComp, numFluxSupportPoints >( numPhase, + jp, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + potOther, + dPotOther_dP, + dPotOther_dC, + dPropOther_dC ); + + //Eventually get the mobility of the second phase + real64 mobOther{}; + real64 dMobOther_dP{}; + real64 dMobOther_dC[numComp]{}; + + // and the other mobility for gravitational part as \lambda_j^{up} with up decided upon + // the Upwind strategy - Note that it should be the same as the gravitational fractional flow + + UpwindHelpers::upwindMobilityGravity< numComp, numFluxSupportPoints, UPWIND >( numPhase, + jp, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up_o, + mobOther, + dMobOther_dP, + dMobOther_dC ); + + + // Assembling gravitational flux phase-wise as \phi_{i,g} = \sum_{k\nei} \lambda_k^{up,g} f_k^{up,g} (G_i - G_k) + phaseFlux -= fflow * mobOther * (pot - potOther); + dPhaseFlux_dP[k_up_o] -= fflow * dMobOther_dP * (pot - potOther); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPhaseFlux_dC[k_up_o][jc] -= fflow * dMobOther_dC[jc] * (pot - potOther); + } + + //mob related part of dFflow_dP is only upstream defined but totMob related is defined everywhere + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] -= dFflow_dP[ke] * mobOther * (pot - potOther); + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPhaseFlux_dC[ke][jc] -= dFflow_dC[ke][jc] * mobOther * (pot - potOther); + } + } + + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] -= fflow * mobOther * (dPot_dP[ke] - dPotOther_dP[ke]); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPhaseFlux_dC[ke][jc] -= fflow * mobOther * (dPot_dC[ke][jc] - dPotOther_dC[ke][jc]); + } + } + } + } + +} + +template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > +GEOS_HOST_DEVICE +static void computePotentialFluxesCapillary( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + localIndex const & k_up_ppu, + real64 const totFlux, + real64 const totMob, + real64 const (&dTotMob_dP)[numFluxSupportPoints], + real64 const (&dTotMob_dC)[numFluxSupportPoints][numComp], + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + localIndex const capPressureFlag, + localIndex( &k_up), + localIndex (&k_up_o), + real64 & phaseFlux, + real64 (& dPhaseFlux_dP)[numFluxSupportPoints], + real64 ( & dPhaseFlux_dC)[numFluxSupportPoints][numComp] ) +{ + + real64 fflow{}; + real64 dFflow_dP[numFluxSupportPoints]{}; + real64 dFflow_dC[numFluxSupportPoints][numComp]{}; + + real64 pot{}; + real64 dPot_dP[numFluxSupportPoints]{}; + real64 dPot_dC[numFluxSupportPoints][numComp]{}; + real64 dProp_dC[numComp]{}; + + UpwindHelpers::computePotentialCapillary::compute< numComp, numFluxSupportPoints >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + pot, + dPot_dP, + dPot_dC, + dProp_dC ); + + // and the fractional flow for gravitational part as \lambda_i^{up}/\sum_{numPhase}(\lambda_k^{up}) with up decided upon + // the Upwind strategy + UpwindHelpers::computeFractionalFlowCapillary< numComp, numFluxSupportPoints, UPWIND >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + k_up_ppu, + totFlux, + totMob, + dTotMob_dP, + dTotMob_dC, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up, + fflow, + dFflow_dP, + dFflow_dC ); + + + for( localIndex jp = 0; jp < numPhase; ++jp ) + { + if( ip != jp ) + { + + real64 potOther{}; + real64 dPotOther_dP[numFluxSupportPoints]{}; + real64 dPotOther_dC[numFluxSupportPoints][numComp]{}; + real64 dPropOther_dC[numComp]{}; + + //Fetch pot for phase j!=i defined as \rho_j g dz/dx + UpwindHelpers::computePotentialCapillary::compute< numComp, numFluxSupportPoints >( numPhase, + jp, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + potOther, + dPotOther_dP, + dPotOther_dC, + dPropOther_dC ); + + //Eventually get the mobility of the second phase + real64 mobOther{}; + real64 dMobOther_dP{}; + real64 dMobOther_dC[numComp]{}; + + // and the other mobility for gravitational part as \lambda_j^{up} with up decided upon + // the Upwind strategy - Note that it should be the same as the gravitational fractional flow + + UpwindHelpers::upwindMobilityCapillary< numComp, numFluxSupportPoints, UPWIND >( numPhase, + jp, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + k_up_o, + mobOther, + dMobOther_dP, + dMobOther_dC ); + + + // Assembling gravitational flux phase-wise as \phi_{i,g} = \sum_{k\nei} \lambda_k^{up,g} f_k^{up,g} (G_i - G_k) + phaseFlux -= fflow * mobOther * (pot - potOther); + dPhaseFlux_dP[k_up_o] -= fflow * dMobOther_dP * (pot - potOther); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPhaseFlux_dC[k_up_o][jc] -= fflow * dMobOther_dC[jc] * (pot - potOther); + } + + //mob related part of dFflow_dP is only upstream defined but totMob related is defined everywhere + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] -= dFflow_dP[ke] * mobOther * (pot - potOther); + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPhaseFlux_dC[ke][jc] -= dFflow_dC[ke][jc] * mobOther * (pot - potOther); + } + } + + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] -= fflow * mobOther * (dPot_dP[ke] - dPotOther_dP[ke]); + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dPhaseFlux_dC[ke][jc] -= fflow * mobOther * (dPot_dC[ke][jc] - dPotOther_dC[ke][jc]); + } + } + } + } + +} + + +}//end of struct UpwindHelpers + +/************************* UPWIND ******************/ + +/** + * @brief Template base class for different upwind Scheme + * @tparam T physics concerned by the scheme if specialized + */ +class UpwindScheme +{ + +public: + + //default ctor + UpwindScheme() = default; + + //usual copy ctor + UpwindScheme( UpwindScheme const & scheme ) = default; + + //default move ctor + UpwindScheme( UpwindScheme && ) = default; + + //deleted copy and move assignement + UpwindScheme & operator=( UpwindScheme const & ) = delete; + + UpwindScheme & operator=( UpwindScheme && ) = delete; + + virtual ~UpwindScheme() = default; + + template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > + GEOS_HOST_DEVICE + inline + void getUpwindDirectionViscous( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totFlux, //in fine should be a ElemnetViewConst once seq form are in place + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & upwindDir + ) + { + real64 pot{}; + + /// each derived concrete class has to define a computePotential method that is calling UpwindScheme::potential method with a specific + /// lamda defining how to get these potentials + UPWIND::template computePotentialViscous< numComp, numFluxSupportPoints >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + phaseMob, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + pot ); + + //all definition has been changed to fit pot>0 => first cell is upstream + upwindDir = (pot > 0) ? 0 : 1; + } + + + template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > + GEOS_HOST_DEVICE + void getUpwindDirectionGravity( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totFlux, + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & upwindDir + ) + { + real64 pot{}; + + /// each derived concrete class has to define a computePotential method that is calling UpwindScheme::potential method with a specific + /// lamda defining how to get these potentials + UPWIND::template computePotentialGravity< numComp, numFluxSupportPoints >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + phaseMob, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + pot ); + + //all definition has been changed to fit pot>0 => first cell is upstream + upwindDir = (pot >= 0) ? 0 : 1; + } + + + template< localIndex numComp, localIndex numFluxSupportPoints, class UPWIND > + GEOS_HOST_DEVICE + void getUpwindDirectionCapillary( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totFlux, //in fine should be a ElemnetViewConst once seq form are in + // place + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const capPressureFlag, + localIndex & upwindDir + ) + { + real64 pot{}; + + // each derived concrete class has to define a computePotential method that is calling UpwindScheme::potential method with a specific + // lamda defining how to get these potentials + UPWIND::template computePotentialCapillary< numComp, numFluxSupportPoints >( numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totFlux, + pres, + gravCoef, + phaseMob, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + capPressureFlag, + pot ); + + //all definition has been changed to fit pot>0 => first cell is upstream + upwindDir = (pot >= 0) ? 0 : 1; + } + + + + // templated way of evaluating the potential (to the exception of viscous one) which relies on + // up-or-downwinded mobility terms pre-multiplying potential differences + template< localIndex numComp, localIndex numFluxSupportPoints, typename LAMBDA > + GEOS_HOST_DEVICE + static void potential( localIndex numPhase, + localIndex ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + real64 & weightedPotential, + LAMBDA && fn ) + { + //getPhase Pot + real64 pot{}; + real64 pot_dP[numFluxSupportPoints]{}; + real64 pot_dC[numFluxSupportPoints][numComp]{}; + real64 dProp_dC[numComp]{}; + + fn( ip, pot, pot_dP, pot_dC, dProp_dC ); + + localIndex const k_up = 0; + localIndex const k_dw = 1; + + //loop other other phases to form + for( localIndex jp = 0; jp < numPhase; ++jp ) + { + if( jp != ip ) + { + localIndex const er_up = seri[k_up]; + localIndex const esr_up = sesri[k_up]; + localIndex const ei_up = sei[k_up]; + + localIndex const er_dw = seri[k_dw]; + localIndex const esr_dw = sesri[k_dw]; + localIndex const ei_dw = sei[k_dw]; + + real64 potOther{}; + real64 potOther_dP[numFluxSupportPoints]{}; + real64 potOther_dC[numFluxSupportPoints][numComp]{}; + real64 dPropOther_dC[numComp]{}; + + fn( jp, potOther, potOther_dP, potOther_dC, dPropOther_dC ); + + real64 const mob_up = phaseMob[er_up][esr_up][ei_up][jp]; + real64 const mob_dw = phaseMob[er_dw][esr_dw][ei_dw][jp]; + + weightedPotential += (pot - potOther >= 0) ? mob_dw * (potOther - pot) : mob_up * (potOther - pot); + + } + } + } + +}; + +/** + * @brief Class describing the Hybrid Upwind scheme as defined in "Consistent upwinding for sequential fully implicit + * multiscale compositional simulation" (Moncorge,2020) + */ +class HybridUpwind : public UpwindScheme +{ + +public: + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static + void computePotentialViscous( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totalFlux, + ElementViewConst< arrayView1d< real64 const > > const & GEOS_UNUSED_PARAM( pres ), + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & + GEOS_UNUSED_PARAM( phaseMob ), + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const GEOS_UNUSED_PARAM( capPressureFlag ), + real64 & potential + ) + { + real64 dPot_dP[numFluxSupportPoints]{}; + real64 dPot_dC[numFluxSupportPoints][numComp]{}; + real64 dProp_dC[numComp]{}; + + + UpwindHelpers::computePotentialViscous::compute< numComp, numFluxSupportPoints >( + numPhase, + ip, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totalFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + potential, + dPot_dP, + dPot_dC, + dProp_dC ); + } + + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static + void computePotentialGravity( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totalFlux, + ElementViewConst< arrayView1d< real64 const > > const & GEOS_UNUSED_PARAM( pres ), + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const GEOS_UNUSED_PARAM( capPressureFlag ), + real64 & potential + ) + { + + //Form total velocity + potential = 0; + + //the arg lambda allows us to access some genericity + UpwindScheme::template potential< numComp, numFluxSupportPoints >( numPhase, ip, seri, sesri, sei, + phaseMob, potential, + [&]( localIndex ipp, + real64 & potential_, + real64 (& dPotential_dP_)[numFluxSupportPoints], + real64 (& dPotential_dC_)[numFluxSupportPoints][numComp], + real64 (& dProp_dC)[numComp] ) { + + UpwindHelpers::computePotentialGravity::compute< numComp, numFluxSupportPoints >( + numPhase, + ipp, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totalFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + potential_, + dPotential_dP_, + dPotential_dC_, + dProp_dC ); + + } ); + } + + + template< localIndex numComp, localIndex numFluxSupportPoints > + GEOS_HOST_DEVICE + static + void computePotentialCapillary( localIndex const numPhase, + localIndex const ip, + localIndex const (&seri)[numFluxSupportPoints], + localIndex const (&sesri)[numFluxSupportPoints], + localIndex const (&sei)[numFluxSupportPoints], + real64 const (&transmissibility)[2], + real64 const (&dTrans_dPres)[2], + real64 const totalFlux, + ElementViewConst< arrayView1d< real64 const > > const & GEOS_UNUSED_PARAM( pres ), + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & + phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + integer const GEOS_UNUSED_PARAM( capPressureFlag ), + real64 & potential ) + + { + + //Form total velocity + potential = 0; + + //the arg lambda allows us to access some genericity + UpwindScheme::template potential< numComp, numFluxSupportPoints >( numPhase, ip, seri, sesri, sei, + phaseMob, potential, + [&]( localIndex ipp, + real64 & potential_, + real64 (& dPotential_dP_)[numFluxSupportPoints], + real64 (& dPotential_dC_)[numFluxSupportPoints][numComp], + real64 (& dProp_dC)[numComp] ) { + + UpwindHelpers::computePotentialCapillary::compute< numComp, numFluxSupportPoints >( + numPhase, + ipp, + seri, + sesri, + sei, + transmissibility, + dTrans_dPres, + totalFlux, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + potential_, + dPotential_dP_, + dPotential_dC_, + dProp_dC ); + } ); + } + +}; + +/*** IHU ***/ + +struct IHUPhaseFlux { + + using UPWIND_SCHEME = HybridUpwind; + /** - * @brief Compute the component flux for a given phase + * @brief Form the Implicit Hybrid Upwind from pressure gradient and gravitational head * @tparam numComp number of components * @tparam numFluxSupportPoints number of flux support points + * @param numPhase number of phases * @param ip phase index - * @param k_up uptream index for this phase + * @param hasCapPressure flag indicating if there is capillary pressure * @param seri arraySlice of the stencil-implied element region index * @param sesri arraySlice of the stencil-implied element subregion index * @param sei arraySlice of the stencil-implied element index - * @param phaseCompFrac phase component fraction - * @param dPhaseCompFrac derivative of phase component fraction wrt pressure, temperature, component fraction + * @param trans transmissibility at the connection + * @param dTrans_dPres derivative of transmissibility wrt pressure + * @param pres pressure + * @param gravCoef gravitational coefficient + * @param phaseMob phase mobility + * @param dPhaseMob derivative of phase mobility wrt pressure, temperature, comp density + * @param dPhaseVolFrac derivative of phase volume fraction wrt pressure, temperature, comp density * @param dCompFrac_dCompDens derivative of component fraction wrt component density + * @param phaseMassDens phase mass density + * @param dPhaseMassDens derivative of phase mass density wrt pressure, temperature, comp fraction + * @param phaseCapPressure phase capillary pressure + * @param dPhaseCapPressure_dPhaseVolFrac derivative of phase capillary pressure wrt phase volume fraction + * @param k_up uptream index for this phase + * @param potGrad potential gradient for this phase * @param phaseFlux phase flux * @param dPhaseFlux_dP derivative of phase flux wrt pressure * @param dPhaseFlux_dC derivative of phase flux wrt comp density - * @param compFlux component flux - * @param dCompFlux_dP derivative of phase flux wrt pressure - * @param dCompFlux_dC derivative of phase flux wrt comp density */ - template< localIndex numComp, localIndex numFluxSupportPoints > + template< integer numComp, integer numFluxSupportPoints > GEOS_HOST_DEVICE static void - compute( localIndex const ip, - localIndex const k_up, + compute( integer const numPhase, + integer const ip, + integer const hasCapPressure, localIndex const ( &seri )[numFluxSupportPoints], localIndex const ( &sesri )[numFluxSupportPoints], localIndex const ( &sei )[numFluxSupportPoints], + real64 const ( &trans )[2], + real64 const ( &dTrans_dPres )[2], + ElementViewConst< arrayView1d< real64 const > > const & pres, + ElementViewConst< arrayView1d< real64 const > > const & gravCoef, + ElementViewConst< arrayView2d< real64 const, compflow::USD_PHASE > > const & phaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseMob, + ElementViewConst< arrayView3d< real64 const, compflow::USD_PHASE_DC > > const & dPhaseVolFrac, ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_COMP > > const & phaseCompFrac, ElementViewConst< arrayView5d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC > > const & dPhaseCompFrac, ElementViewConst< arrayView3d< real64 const, compflow::USD_COMP_DC > > const & dCompFrac_dCompDens, - real64 const & phaseFlux, - real64 const ( &dPhaseFlux_dP )[numFluxSupportPoints], - real64 const ( &dPhaseFlux_dC )[numFluxSupportPoints][numComp], + ElementViewConst< arrayView3d< real64 const, constitutive::multifluid::USD_PHASE > > const & phaseMassDens, + ElementViewConst< arrayView4d< real64 const, constitutive::multifluid::USD_PHASE_DC > > const & dPhaseMassDens, + ElementViewConst< arrayView3d< real64 const, constitutive::cappres::USD_CAPPRES > > const & phaseCapPressure, + ElementViewConst< arrayView4d< real64 const, constitutive::cappres::USD_CAPPRES_DS > > const & dPhaseCapPressure_dPhaseVolFrac, + localIndex & k_up, + real64 & potGrad, + real64 ( &phaseFlux ), + real64 ( & dPhaseFlux_dP )[numFluxSupportPoints], + real64 ( & dPhaseFlux_dC )[numFluxSupportPoints][numComp], real64 ( & compFlux )[numComp], real64 ( & dCompFlux_dP )[numFluxSupportPoints][numComp], real64 ( & dCompFlux_dC )[numFluxSupportPoints][numComp][numComp] ) { - localIndex const er_up = seri[k_up]; - localIndex const esr_up = sesri[k_up]; - localIndex const ei_up = sei[k_up]; - real64 dProp_dC[numComp]{}; + //loop over all phases to form total velocity + real64 totFlux{}; + real64 dTotFlux_dP[numFluxSupportPoints]{}; + real64 dTotFlux_dC[numFluxSupportPoints][numComp]{}; - // slice some constitutive arrays to avoid too much indexing in component loop - arraySlice1d< real64 const, constitutive::multifluid::USD_PHASE_COMP-3 > phaseCompFracSub = - phaseCompFrac[er_up][esr_up][ei_up][0][ip]; - arraySlice2d< real64 const, constitutive::multifluid::USD_PHASE_COMP_DC-3 > dPhaseCompFracSub = - dPhaseCompFrac[er_up][esr_up][ei_up][0][ip]; + //store totMob upwinded by PPU for later schemes + real64 totMob{}; + real64 dTotMob_dP[numFluxSupportPoints]{}; + real64 dTotMob_dC[numFluxSupportPoints][numComp]{}; + localIndex k_up_ppu = -1; - // compute component fluxes and derivatives using upstream cell composition - for( integer ic = 0; ic < numComp; ++ic ) - { - real64 const ycp = phaseCompFracSub[ic]; - compFlux[ic] += phaseFlux * ycp; + //unelegant but need dummy when forming PPU total velocity + real64 dummy[numComp]; + real64 dDummy_dP[numFluxSupportPoints][numComp]; + real64 dDummy_dC[numFluxSupportPoints][numComp][numComp]; - // derivatives stemming from phase flux - for( integer ke = 0; ke < numFluxSupportPoints; ++ke ) + + for( integer jp = 0; jp < numPhase; ++jp ) + { + PPUPhaseFlux::compute( numPhase, jp, hasCapPressure, + seri, sesri, sei, + trans, dTrans_dPres, + pres, gravCoef, + phaseMob, dPhaseMob, + dPhaseVolFrac, + phaseCompFrac, dPhaseCompFrac, + dCompFrac_dCompDens, + phaseMassDens, dPhaseMassDens, + phaseCapPressure, dPhaseCapPressure_dPhaseVolFrac, + k_up_ppu, potGrad, + phaseFlux, dPhaseFlux_dP, dPhaseFlux_dC, + dummy, dDummy_dP, dDummy_dC ); + + totFlux += phaseFlux; + + phaseFlux = 0.; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) { - dCompFlux_dP[ke][ic] += dPhaseFlux_dP[ke] * ycp; - for( integer jc = 0; jc < numComp; ++jc ) + dTotFlux_dP[ke] += dPhaseFlux_dP[ke]; + totMob += phaseMob[seri[ke]][sesri[ke]][sei[ke]][jp]; + dTotMob_dP[ke] += dPhaseMob[seri[ke]][sesri[ke]][sei[ke]][jp][Deriv::dP]; + dPhaseFlux_dP[ke] = 0.; + + for( localIndex jc = 0; jc < numComp; ++jc ) { - dCompFlux_dC[ke][ic][jc] += dPhaseFlux_dC[ke][jc] * ycp; + dTotFlux_dC[ke][jc] += dPhaseFlux_dC[ke][jc]; + dTotMob_dC[ke][jc] += dPhaseMob[seri[ke]][sesri[ke]][sei[ke]][jp][Deriv::dC + jc]; + dPhaseFlux_dC[ke][jc] = 0.; } } - // additional derivatives stemming from upstream cell phase composition - dCompFlux_dP[k_up][ic] += phaseFlux * dPhaseCompFracSub[ic][Deriv::dP]; - // convert derivatives of comp fraction w.r.t. comp fractions to derivatives w.r.t. comp densities - applyChainRule( numComp, - dCompFrac_dCompDens[er_up][esr_up][ei_up], - dPhaseCompFracSub[ic], - dProp_dC, - Deriv::dC ); - for( integer jc = 0; jc < numComp; ++jc ) + } + + //fractional flow loop with IHU + //maybe needed to have density out for upwinding + + // choose upstream cell + // create local work arrays + real64 viscousPhaseFlux{}; + real64 dViscousPhaseFlux_dP[numFluxSupportPoints]{}; + real64 dViscousPhaseFlux_dC[numFluxSupportPoints][numComp]{}; + + real64 fractionalFlow{}; + real64 dFractionalFlow_dP[numFluxSupportPoints]{}; + real64 dFractionalFlow_dC[numFluxSupportPoints][numComp]{}; + + // and the fractional flow for viscous part as \lambda_i^{up}/\sum_{NP}(\lambda_j^{up}) with up decided upon + // the Upwind strategy + UpwindHelpers::computeFractionalFlowViscous< numComp, numFluxSupportPoints, + UPWIND_SCHEME >( numPhase, + ip, + seri, + sesri, + sei, + trans, + dTrans_dPres, + k_up_ppu, + totFlux, + totMob, + dTotMob_dP, + dTotMob_dC, + pres, + gravCoef, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + hasCapPressure, + k_up, + fractionalFlow, + dFractionalFlow_dP, + dFractionalFlow_dC ); + + + /// Assembling the viscous flux (and derivatives) from fractional flow and total velocity as \phi_{\mu} = f_i^{up,\mu} uT + viscousPhaseFlux = fractionalFlow * totFlux; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dViscousPhaseFlux_dP[ke] += dFractionalFlow_dP[ke] * totFlux; + + + for( localIndex jc = 0; jc < numComp; ++jc ) { - dCompFlux_dC[k_up][ic][jc] += phaseFlux * dProp_dC[jc]; + dViscousPhaseFlux_dC[ke][jc] += dFractionalFlow_dC[ke][jc] * totFlux; + } + } + + //NON-FIXED UT -- to be canceled out if considered fixed + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dViscousPhaseFlux_dP[ke] += fractionalFlow * dTotFlux_dP[ke]; + + + for( localIndex jc = 0; jc < numComp; ++jc ) + { + dViscousPhaseFlux_dC[ke][jc] += fractionalFlow * dTotFlux_dC[ke][jc]; } } + //distribute on phaseComponentFlux here + PhaseComponentFlux::compute( ip, k_up, + seri, sesri, sei, + phaseCompFrac, dPhaseCompFrac, dCompFrac_dCompDens, + viscousPhaseFlux, dViscousPhaseFlux_dP, dViscousPhaseFlux_dC, + compFlux, dCompFlux_dP, dCompFlux_dC ); + + // accumulate in the flux and its derivatives + phaseFlux += viscousPhaseFlux; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] += dViscousPhaseFlux_dP[ke]; + + + for( localIndex ic = 0; ic < numComp; ++ic ) + dPhaseFlux_dC[ke][ic] += dViscousPhaseFlux_dC[ke][ic]; + } + + /// Assembling the gravitational flux (and derivatives) from fractional flow and total velocity as \phi_{g} = f_i^{up,g} uT + localIndex k_up_g = -1; + localIndex k_up_og = -1; + + real64 gravitationalPhaseFlux{}; + real64 gravitationalPhaseFlux_dP[numFluxSupportPoints]{}; + real64 gravitationalPhaseFlux_dC[numFluxSupportPoints][numComp]{}; + + UpwindHelpers::computePotentialFluxesGravity< numComp, + numFluxSupportPoints, UPWIND_SCHEME >( + numPhase, + ip, + seri, + sesri, + sei, + trans, + dTrans_dPres, + k_up_ppu, + totFlux, + totMob, + dTotMob_dP, + dTotMob_dC, + pres, + gravCoef, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + hasCapPressure, + k_up_g, + k_up_og, + gravitationalPhaseFlux, + gravitationalPhaseFlux_dP, + gravitationalPhaseFlux_dC ); + + + + //distribute on phaseComponentFlux here + PhaseComponentFlux::compute( ip, k_up_g, + seri, sesri, sei, + phaseCompFrac, dPhaseCompFrac, dCompFrac_dCompDens, + gravitationalPhaseFlux, gravitationalPhaseFlux_dP, gravitationalPhaseFlux_dC, + compFlux, dCompFlux_dP, dCompFlux_dC ); + + + //update phaseFlux from gravitational + phaseFlux += gravitationalPhaseFlux; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] += gravitationalPhaseFlux_dP[ke]; + for( localIndex ic = 0; ic < numComp; ++ic ) + dPhaseFlux_dC[ke][ic] += gravitationalPhaseFlux_dC[ke][ic]; + } + + + if( hasCapPressure ) + { + /// Assembling the capillary flux (and derivatives) from fractional flow and total velocity as \phi_{g} = f_i^{up,g} uT + localIndex k_up_pc = -1; + localIndex k_up_opc = -1; + + real64 capillaryPhaseFlux{}; + real64 capillaryPhaseFlux_dP[numFluxSupportPoints]{}; + real64 capillaryPhaseFlux_dC[numFluxSupportPoints][numComp]{}; + + UpwindHelpers::computePotentialFluxesCapillary< numComp, + numFluxSupportPoints, UPWIND_SCHEME >( + numPhase, + ip, + seri, + sesri, + sei, + trans, + dTrans_dPres, + k_up_ppu, + totFlux, + totMob, + dTotMob_dP, + dTotMob_dC, + pres, + gravCoef, + phaseMob, + dPhaseMob, + dPhaseVolFrac, + dCompFrac_dCompDens, + phaseMassDens, + dPhaseMassDens, + phaseCapPressure, + dPhaseCapPressure_dPhaseVolFrac, + hasCapPressure, + k_up_pc, + k_up_opc, + capillaryPhaseFlux, + capillaryPhaseFlux_dP, + capillaryPhaseFlux_dC ); + + //distribute on phaseComponentFlux here + PhaseComponentFlux::compute( ip, k_up_pc, + seri, sesri, sei, + phaseCompFrac, dPhaseCompFrac, dCompFrac_dCompDens, + capillaryPhaseFlux, capillaryPhaseFlux_dP, capillaryPhaseFlux_dC, + compFlux, dCompFlux_dP, dCompFlux_dC ); + + + //update phaseFlux from capillary + phaseFlux += capillaryPhaseFlux; + for( localIndex ke = 0; ke < numFluxSupportPoints; ++ke ) + { + dPhaseFlux_dP[ke] += capillaryPhaseFlux_dP[ke]; + for( localIndex ic = 0; ic < numComp; ++ic ) + dPhaseFlux_dC[ke][ic] += capillaryPhaseFlux_dC[ke][ic]; + + } + + }//end if cappres + } }; + + } // namespace isothermalCompositionalMultiPhaseFVMKernelUtilities } // namespace geosx diff --git a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp index da4e426d578..7efdb9aa8d3 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/IsothermalCompositionalMultiphaseFVMKernels.hpp @@ -65,12 +65,13 @@ enum class FaceBasedAssemblyKernelFlags TotalMassEquation = 1 << 1, // 2 /// Flag indicating whether C1-PPU is used or not C1PPU = 1 << 2, // 4 - /// Add more flags like that if needed: - // Flag4 = 1 << 3, // 8 - // Flag5 = 1 << 4, // 16 - // Flag6 = 1 << 5, // 32 - // Flag7 = 1 << 6, // 64 - // Flag8 = 1 << 7 //128 + /// Flag indicating whether IHU is used or not + IHU = 1 << 3 // 8 + /// Add more flags like that if needed: + // Flag5 = 1 << 4, // 16 + // Flag6 = 1 << 5, // 32 + // Flag7 = 1 << 6, // 64 + // Flag8 = 1 << 7 //128 }; /******************************** PhaseMobilityKernel ********************************/ @@ -529,8 +530,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase */ GEOS_HOST_DEVICE inline - localIndex stencilSize( localIndex const iconn ) const - { return m_sei[iconn].size(); } + localIndex stencilSize( localIndex const iconn ) const { return m_sei[iconn].size(); } /** * @brief Getter for the number of elements at this connection @@ -539,8 +539,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase */ GEOS_HOST_DEVICE inline - localIndex numPointsInFlux( localIndex const iconn ) const - { return m_stencilWrapper.numPointsInFlux( iconn ); } + localIndex numPointsInFlux( localIndex const iconn ) const { return m_stencilWrapper.numPointsInFlux( iconn ); } /** @@ -579,6 +578,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase StackVariables & stack, FUNC && compFluxKernelOp = NoOpFunc{} ) const { + // first, compute the transmissibilities at this face m_stencilWrapper.computeWeights( iconn, m_permeability, @@ -621,7 +621,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase localIndex k_up = -1; - if( m_kernelFlags.isSet( FaceBasedAssemblyKernelFlags::C1PPU )) + if( m_kernelFlags.isSet( FaceBasedAssemblyKernelFlags::C1PPU ) ) { isothermalCompositionalMultiphaseFVMKernelUtilities::C1PPUPhaseFlux::compute< numComp, numFluxSupportPoints > ( m_numPhases, @@ -634,6 +634,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase m_gravCoef, m_phaseMob, m_dPhaseMob, m_dPhaseVolFrac, + m_phaseCompFrac, m_dPhaseCompFrac, m_dCompFrac_dCompDens, m_phaseMassDens, m_dPhaseMassDens, m_phaseCapPressure, m_dPhaseCapPressure_dPhaseVolFrac, @@ -641,7 +642,36 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase potGrad, phaseFlux, dPhaseFlux_dP, - dPhaseFlux_dC ); + dPhaseFlux_dC, + compFlux, + dCompFlux_dP, + dCompFlux_dC ); + } + else if( m_kernelFlags.isSet( FaceBasedAssemblyKernelFlags::IHU ) ) + { + isothermalCompositionalMultiphaseFVMKernelUtilities::IHUPhaseFlux::compute< numComp, numFluxSupportPoints > + ( m_numPhases, + ip, + m_kernelFlags.isSet( FaceBasedAssemblyKernelFlags::CapPressure ), + seri, sesri, sei, + trans, + dTrans_dPres, + m_pres, + m_gravCoef, + m_phaseMob, m_dPhaseMob, + m_dPhaseVolFrac, + m_phaseCompFrac, m_dPhaseCompFrac, + m_dCompFrac_dCompDens, + m_phaseMassDens, m_dPhaseMassDens, + m_phaseCapPressure, m_dPhaseCapPressure_dPhaseVolFrac, + k_up, + potGrad, + phaseFlux, + dPhaseFlux_dP, + dPhaseFlux_dC, + compFlux, + dCompFlux_dP, + dCompFlux_dC ); } else { @@ -656,6 +686,7 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase m_gravCoef, m_phaseMob, m_dPhaseMob, m_dPhaseVolFrac, + m_phaseCompFrac, m_dPhaseCompFrac, m_dCompFrac_dCompDens, m_phaseMassDens, m_dPhaseMassDens, m_phaseCapPressure, m_dPhaseCapPressure_dPhaseVolFrac, @@ -663,28 +694,21 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase potGrad, phaseFlux, dPhaseFlux_dP, - dPhaseFlux_dC ); + dPhaseFlux_dC, + compFlux, + dCompFlux_dP, + dCompFlux_dC ); } - isothermalCompositionalMultiphaseFVMKernelUtilities:: - PhaseComponentFlux::compute< numComp, numFluxSupportPoints > - ( ip, - k_up, - seri, sesri, sei, - m_phaseCompFrac, m_dPhaseCompFrac, - m_dCompFrac_dCompDens, - phaseFlux, dPhaseFlux_dP, dPhaseFlux_dC, - compFlux, dCompFlux_dP, dCompFlux_dC ); - // call the lambda in the phase loop to allow the reuse of the phase fluxes and their derivatives // possible use: assemble the derivatives wrt temperature, and the flux term of the energy equation for this phase compFluxKernelOp( ip, k, seri, sesri, sei, connectionIndex, k_up, seri[k_up], sesri[k_up], sei[k_up], potGrad, phaseFlux, dPhaseFlux_dP, dPhaseFlux_dC ); - } // loop over phases + } // loop over phases - // populate local flux vector and derivatives + /// populate local flux vector and derivatives for( integer ic = 0; ic < numComp; ++ic ) { integer const eqIndex0 = k[0] * numEqn + ic; @@ -751,7 +775,8 @@ class FaceBasedAssemblyKernel : public FaceBasedAssemblyKernelBase for( integer ic = 0; ic < numComp; ++ic ) { - RAJA::atomicAdd( parallelDeviceAtomic{}, &m_localRhs[localRow + ic], stack.localFlux[i * numEqn + ic] ); + RAJA::atomicAdd( parallelDeviceAtomic{}, &m_localRhs[localRow + ic], + stack.localFlux[i * numEqn + ic] ); m_localMatrix.addToRowBinarySearchUnsorted< parallelDeviceAtomic > ( localRow + ic, stack.dofColIndices.data(), @@ -875,6 +900,9 @@ class FaceBasedAssemblyKernelFactory if( upwindingParams.upwindingScheme == UpwindingScheme::C1PPU && isothermalCompositionalMultiphaseFVMKernelUtilities::epsC1PPU > 0 ) kernelFlags.set( FaceBasedAssemblyKernelFlags::C1PPU ); + else if( upwindingParams.upwindingScheme == UpwindingScheme::IHU ) + kernelFlags.set( FaceBasedAssemblyKernelFlags::IHU ); + using kernelType = FaceBasedAssemblyKernel< NUM_COMP, NUM_DOF, STENCILWRAPPER >; typename kernelType::CompFlowAccessors compFlowAccessors( elemManager, solverName ); @@ -1743,8 +1771,7 @@ class DirichletFaceBasedAssemblyKernel : public FaceBasedAssemblyKernel< NUM_COM */ GEOS_HOST_DEVICE StackVariables( localIndex const GEOS_UNUSED_PARAM( size ), - localIndex GEOS_UNUSED_PARAM( numElems ) ) - {} + localIndex GEOS_UNUSED_PARAM( numElems )) {} // Transmissibility real64 transmissibility = 0.0; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp index bbfe022fbf6..2eb5c29eac4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp @@ -564,7 +564,6 @@ void ReactiveCompositionalMultiphaseOBL::initializePostInitialConditionsPreSubGr DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); - // set mass fraction flag on fluid models forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp index c54757e0ba3..e6666b596c1 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp @@ -85,6 +85,9 @@ void SinglePhaseBase::registerDataOnMesh( Group & meshBodies ) subRegion.registerField< mobility >( getName() ); subRegion.registerField< dMobility_dPressure >( getName() ); + subRegion.registerField< fields::flow::mass >( getName() ); + subRegion.registerField< fields::flow::mass_n >( getName() ); + if( m_isThermal ) { subRegion.registerField< dMobility_dTemperature >( getName() ); @@ -247,6 +250,60 @@ void SinglePhaseBase::updateFluidModel( ObjectManagerBase & dataGroup ) const } ); } +void SinglePhaseBase::updateMass( ElementSubRegionBase & subRegion ) const +{ + GEOS_MARK_FUNCTION; + + arrayView1d< real64 > const mass = subRegion.getField< fields::flow::mass >(); + arrayView1d< real64 > const mass_n = subRegion.getField< fields::flow::mass_n >(); + + CoupledSolidBase const & porousSolid = + getConstitutiveModel< CoupledSolidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); + arrayView2d< real64 const > const porosity = porousSolid.getPorosity(); + arrayView2d< real64 const > const porosity_n = porousSolid.getPorosity_n(); + + arrayView1d< real64 const > const volume = subRegion.getElementVolume(); + arrayView1d< real64 > const deltaVolume = subRegion.getField< fields::flow::deltaVolume >(); + + SingleFluidBase & fluid = + getConstitutiveModel< SingleFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); + arrayView2d< real64 const > const density = fluid.density(); + arrayView2d< real64 const > const density_n = fluid.density_n(); + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) + { + mass[ei] = porosity[ei][0] * ( volume[ei] + deltaVolume[ei] ) * density[ei][0]; + if( isZero( mass_n[ei] ) ) // this is a hack for hydrofrac cases + mass_n[ei] = porosity_n[ei][0] * volume[ei] * density_n[ei][0]; // initialize newly created element mass + } ); +} + +void SinglePhaseBase::updateEnergy( ElementSubRegionBase & subRegion ) const +{ + GEOS_MARK_FUNCTION; + + arrayView1d< real64 > const energy = subRegion.getField< fields::flow::energy >(); + + CoupledSolidBase const & porousSolid = + getConstitutiveModel< CoupledSolidBase >( subRegion, subRegion.template getReference< string >( viewKeyStruct::solidNamesString() ) ); + arrayView2d< real64 const > const porosity = porousSolid.getPorosity(); + arrayView2d< real64 const > const rockInternalEnergy = porousSolid.getInternalEnergy(); + + arrayView1d< real64 const > const volume = subRegion.getElementVolume(); + arrayView1d< real64 > const deltaVolume = subRegion.getField< fields::flow::deltaVolume >(); + + SingleFluidBase & fluid = + getConstitutiveModel< SingleFluidBase >( subRegion, subRegion.getReference< string >( viewKeyStruct::fluidNamesString() ) ); + arrayView2d< real64 const > const density = fluid.density(); + arrayView2d< real64 const > const fluidInternalEnergy = fluid.internalEnergy(); + + forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei ) + { + energy[ei] = ( volume[ei] + deltaVolume[ei] ) * + ( porosity[ei][0] * density[ei][0] * fluidInternalEnergy[ei][0] + ( 1.0 - porosity[ei][0] ) * rockInternalEnergy[ei][0] ); + } ); +} + void SinglePhaseBase::updateSolidInternalEnergyModel( ObjectManagerBase & dataGroup ) const { arrayView1d< real64 const > const temp = dataGroup.getField< fields::flow::temperature >(); @@ -274,9 +331,10 @@ void SinglePhaseBase::updateThermalConductivity( ElementSubRegionBase & subRegio conductivityMaterial.update( porosity ); } -void SinglePhaseBase::updateFluidState( ObjectManagerBase & subRegion ) const +void SinglePhaseBase::updateFluidState( ElementSubRegionBase & subRegion ) const { updateFluidModel( subRegion ); + updateMass( subRegion ); updateMobility( subRegion ); } @@ -391,7 +449,6 @@ void SinglePhaseBase::initializePostInitialConditionsPreSubGroups() SolidInternalEnergy const & solidInternalEnergyMaterial = getConstitutiveModel< SolidInternalEnergy >( subRegion, solidInternalEnergyName ); solidInternalEnergyMaterial.saveConvergedState(); - } } ); @@ -412,16 +469,21 @@ void SinglePhaseBase::initializePostInitialConditionsPreSubGroups() } ); } ); - // Save initial pressure field mesh.getElemManager().forElementSubRegions( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { + // Save initial pressure field arrayView1d< real64 const > const pres = subRegion.getField< fields::flow::pressure >(); arrayView1d< real64 > const initPres = subRegion.getField< fields::flow::initialPressure >(); arrayView1d< real64 const > const & temp = subRegion.template getField< fields::flow::temperature >(); arrayView1d< real64 > const initTemp = subRegion.template getField< fields::flow::initialTemperature >(); initPres.setValues< parallelDevicePolicy<> >( pres ); initTemp.setValues< parallelDevicePolicy<> >( temp ); + + // finally update mass and energy + updateMass( subRegion ); + if( m_isThermal ) + updateEnergy( subRegion ); } ); } ); @@ -631,6 +693,7 @@ void SinglePhaseBase::implicitStepSetup( real64 const & GEOS_UNUSED_PARAM( time_ { updateSolidInternalEnergyModel( subRegion ); updateThermalConductivity( subRegion ); + updateEnergy( subRegion ); } } ); @@ -1196,6 +1259,9 @@ void SinglePhaseBase::updateState( DomainPartition & domain ) { GEOS_MARK_FUNCTION; + if( m_keepFlowVariablesConstantDuringInitStep ) + return; + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) @@ -1209,6 +1275,7 @@ void SinglePhaseBase::updateState( DomainPartition & domain ) if( m_isThermal ) { updateSolidInternalEnergyModel( subRegion ); + updateEnergy( subRegion ); } } ); } ); @@ -1240,6 +1307,7 @@ void SinglePhaseBase::resetStateToBeginningOfStep( DomainPartition & domain ) if( m_isThermal ) { updateSolidInternalEnergyModel( subRegion ); + updateEnergy( subRegion ); } } ); } ); @@ -1327,4 +1395,13 @@ bool SinglePhaseBase::checkSystemSolution( DomainPartition & domain, return (m_allowNegativePressure || numNegativePressures == 0) ? 1 : 0; } +void SinglePhaseBase::saveConvergedState( ElementSubRegionBase & subRegion ) const +{ + FlowSolverBase::saveConvergedState( subRegion ); + + arrayView1d< real64 const > const mass = subRegion.template getField< fields::flow::mass >(); + arrayView1d< real64 > const mass_n = subRegion.template getField< fields::flow::mass_n >(); + mass_n.setValues< parallelDevicePolicy<> >( mass ); +} + } /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp index 3ae393f00e4..cbd1f680244 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.hpp @@ -273,10 +273,10 @@ class SinglePhaseBase : public FlowSolverBase /** * @brief Function to update all constitutive state and dependent variables - * @param dataGroup group that contains the fields + * @param subRegion subregion that contains the fields */ void - updateFluidState( ObjectManagerBase & subRegion ) const; + updateFluidState( ElementSubRegionBase & subRegion ) const; /** @@ -286,6 +286,20 @@ class SinglePhaseBase : public FlowSolverBase virtual void updateFluidModel( ObjectManagerBase & dataGroup ) const; + /** + * @brief Function to update fluid mass + * @param subRegion subregion that contains the fields + */ + void + updateMass( ElementSubRegionBase & subRegion ) const; + + /** + * @brief Function to update energy + * @param subRegion subregion that contains the fields + */ + void + updateEnergy( ElementSubRegionBase & subRegion ) const; + /** * @brief Update all relevant solid internal energy models using current values of temperature * @param dataGroup the group storing the required fields @@ -363,6 +377,11 @@ class SinglePhaseBase : public FlowSolverBase virtual void setConstitutiveNamesCallSuper( ElementSubRegionBase & subRegion ) const override; + /** + * @brief Utility function to save the converged state + * @param[in] subRegion the element subRegion + */ + virtual void saveConvergedState( ElementSubRegionBase & subRegion ) const override; /** * @brief Structure holding views into fluid properties used by the base solver. diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseKernels.hpp index 1a53a221166..2d908b6dc10 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBaseKernels.hpp @@ -151,12 +151,11 @@ class ElementBasedAssemblyKernel m_elemGhostRank( subRegion.ghostRank() ), m_volume( subRegion.getElementVolume() ), m_deltaVolume( subRegion.template getField< fields::flow::deltaVolume >() ), - m_porosity_n( solid.getPorosity_n() ), - m_porosityNew( solid.getPorosity() ), + m_porosity( solid.getPorosity() ), m_dPoro_dPres( solid.getDporosity_dPressure() ), - m_density_n( fluid.density_n() ), m_density( fluid.density() ), m_dDensity_dPres( fluid.dDensity_dPressure() ), + m_mass_n( subRegion.template getField< fields::flow::mass_n >() ), m_localMatrix( localMatrix ), m_localRhs( localRhs ) {} @@ -174,9 +173,6 @@ class ElementBasedAssemblyKernel /// Pore volume at time n+1 real64 poreVolume = 0.0; - /// Pore volume at the previous converged time step - real64 poreVolume_n = 0.0; - /// Derivative of pore volume with respect to pressure real64 dPoreVolume_dPres = 0.0; @@ -216,8 +212,7 @@ class ElementBasedAssemblyKernel StackVariables & stack ) const { // initialize the pore volume - stack.poreVolume = ( m_volume[ei] + m_deltaVolume[ei] ) * m_porosityNew[ei][0]; - stack.poreVolume_n = m_volume[ei] * m_porosity_n[ei][0]; + stack.poreVolume = ( m_volume[ei] + m_deltaVolume[ei] ) * m_porosity[ei][0]; stack.dPoreVolume_dPres = ( m_volume[ei] + m_deltaVolume[ei] ) * m_dPoro_dPres[ei][0]; // set row index and degrees of freedom indices for this element @@ -242,7 +237,7 @@ class ElementBasedAssemblyKernel FUNC && kernelOp = NoOpFunc{} ) const { // Residual contribution is mass conservation in the cell - stack.localResidual[0] = stack.poreVolume * m_density[ei][0] - stack.poreVolume_n * m_density_n[ei][0]; + stack.localResidual[0] = stack.poreVolume * m_density[ei][0] - m_mass_n[ei]; // Derivative of residual wrt to pressure in the cell stack.localJacobian[0][0] = stack.dPoreVolume_dPres * m_density[ei][0] + m_dDensity_dPres[ei][0] * stack.poreVolume; @@ -314,15 +309,16 @@ class ElementBasedAssemblyKernel arrayView1d< real64 const > const m_deltaVolume; /// Views on the porosity - arrayView2d< real64 const > const m_porosity_n; - arrayView2d< real64 const > const m_porosityNew; + arrayView2d< real64 const > const m_porosity; arrayView2d< real64 const > const m_dPoro_dPres; /// Views on density - arrayView2d< real64 const > const m_density_n; arrayView2d< real64 const > const m_density; arrayView2d< real64 const > const m_dDensity_dPres; + /// View on mass + arrayView1d< real64 const > const m_mass_n; + /// View on the local CRS matrix CRSMatrixView< real64, globalIndex const > const m_localMatrix; /// View on the local RHS @@ -359,14 +355,8 @@ class SurfaceElementBasedAssemblyKernel : public ElementBasedAssemblyKernel< Sur CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ) : Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ) -#if ALLOW_CREATION_MASS , m_creationMass( subRegion.getReference< array1d< real64 > >( SurfaceElementSubRegion::viewKeyStruct::creationMassString() ) ) -#endif - { -#if !defined(ALLOW_CREATION_MASS) - static_assert( true, "must have ALLOW_CREATION_MASS defined" ); -#endif - } + {} /** * @brief Compute the local accumulation contributions to the residual and Jacobian @@ -380,20 +370,16 @@ class SurfaceElementBasedAssemblyKernel : public ElementBasedAssemblyKernel< Sur { Base::computeAccumulation( ei, stack, [&] () { -#if ALLOW_CREATION_MASS - if( Base::m_volume[ei] * Base::m_density_n[ei][0] > 1.1 * m_creationMass[ei] ) + if( Base::m_mass_n[ei] > 1.1 * m_creationMass[ei] ) { stack.localResidual[0] += m_creationMass[ei] * 0.25; } -#endif } ); } protected: -#if ALLOW_CREATION_MASS arrayView1d< real64 const > const m_creationMass; -#endif }; @@ -480,24 +466,20 @@ class ResidualNormKernel : public solverBaseKernels::ResidualNormKernelBase< 1 > arrayView1d< globalIndex const > const & dofNumber, arrayView1d< localIndex const > const & ghostRank, ElementSubRegionBase const & subRegion, - constitutive::SingleFluidBase const & fluid, - constitutive::CoupledSolidBase const & solid, real64 const minNormalizer ) : Base( rankOffset, localResidual, dofNumber, ghostRank, minNormalizer ), - m_volume( subRegion.getElementVolume() ), - m_porosity_n( solid.getPorosity_n() ), - m_density_n( fluid.density_n() ) + m_mass_n( subRegion.template getField< fields::flow::mass_n >() ) {} GEOS_HOST_DEVICE virtual void computeLinf( localIndex const ei, LinfStackVariables & stack ) const override { - real64 const massNormalizer = LvArray::math::max( m_minNormalizer, m_density_n[ei][0] * m_porosity_n[ei][0] * m_volume[ei] ); + real64 const massNormalizer = LvArray::math::max( m_minNormalizer, m_mass_n[ei] ); real64 const valMass = LvArray::math::abs( m_localResidual[stack.localRow] ) / massNormalizer; if( valMass > stack.localValue[0] ) { @@ -509,7 +491,7 @@ class ResidualNormKernel : public solverBaseKernels::ResidualNormKernelBase< 1 > virtual void computeL2( localIndex const ei, L2StackVariables & stack ) const override { - real64 const massNormalizer = LvArray::math::max( m_minNormalizer, m_density_n[ei][0] * m_porosity_n[ei][0] * m_volume[ei] ); + real64 const massNormalizer = LvArray::math::max( m_minNormalizer, m_mass_n[ei] ); stack.localValue[0] += m_localResidual[stack.localRow] * m_localResidual[stack.localRow]; stack.localNormalizer[0] += massNormalizer; } @@ -517,14 +499,8 @@ class ResidualNormKernel : public solverBaseKernels::ResidualNormKernelBase< 1 > protected: - /// View on the volume - arrayView1d< real64 const > const m_volume; - - /// View on porosity at the previous converged time step - arrayView2d< real64 const > const m_porosity_n; - - /// View on total mass/molar density at the previous converged time step - arrayView2d< real64 const > const m_density_n; + /// View on mass at the previous converged time step + arrayView1d< real64 const > const m_mass_n; }; @@ -555,8 +531,6 @@ class ResidualNormKernelFactory string const dofKey, arrayView1d< real64 const > const & localResidual, ElementSubRegionBase const & subRegion, - constitutive::SingleFluidBase const & fluid, - constitutive::CoupledSolidBase const & solid, real64 const minNormalizer, real64 (& residualNorm)[1], real64 (& residualNormalizer)[1] ) @@ -564,7 +538,7 @@ class ResidualNormKernelFactory arrayView1d< globalIndex const > const dofNumber = subRegion.getReference< array1d< globalIndex > >( dofKey ); arrayView1d< integer const > const ghostRank = subRegion.ghostRank(); - ResidualNormKernel kernel( rankOffset, localResidual, dofNumber, ghostRank, subRegion, fluid, solid, minNormalizer ); + ResidualNormKernel kernel( rankOffset, localResidual, dofNumber, ghostRank, subRegion, minNormalizer ); if( normType == solverBaseKernels::NormType::Linf ) { ResidualNormKernel::launchLinf< POLICY >( subRegion.size(), kernel, residualNorm ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp index e207d50ad99..565a4621fbe 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseFVM.cpp @@ -150,13 +150,13 @@ real64 SinglePhaseFVM< BASE >::calculateResidualNorm( real64 const & GEOS_UNUSED string const & fluidName = subRegion.template getReference< string >( BASE::viewKeyStruct::fluidNamesString() ); SingleFluidBase const & fluid = SolverBase::getConstitutiveModel< SingleFluidBase >( subRegion, fluidName ); - string const & solidName = subRegion.template getReference< string >( BASE::viewKeyStruct::solidNamesString() ); - CoupledSolidBase const & solid = SolverBase::getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); - // step 1: compute the norm in the subRegion if( m_isThermal ) { + string const & solidName = subRegion.template getReference< string >( BASE::viewKeyStruct::solidNamesString() ); + CoupledSolidBase const & solid = SolverBase::getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); + string const & solidInternalEnergyName = subRegion.template getReference< string >( BASE::viewKeyStruct::solidInternalEnergyNamesString() ); SolidInternalEnergy const & solidInternalEnergy = SolverBase::getConstitutiveModel< SolidInternalEnergy >( subRegion, solidInternalEnergyName ); @@ -185,8 +185,6 @@ real64 SinglePhaseFVM< BASE >::calculateResidualNorm( real64 const & GEOS_UNUSED dofKey, localRhs, subRegion, - fluid, - solid, m_nonlinearSolverParameters.m_minNormalizer, subRegionFlowResidualNorm, subRegionFlowResidualNormalizer ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp index 898c729b291..703f8658777 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp @@ -18,7 +18,6 @@ #include "SinglePhaseHybridFVM.hpp" -#include "common/TimingMacros.hpp" #include "constitutive/ConstitutivePassThru.hpp" #include "constitutive/fluid/singlefluid/SingleFluidBase.hpp" #include "fieldSpecification/AquiferBoundaryCondition.hpp" @@ -28,6 +27,7 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" #include "physicsSolvers/fluidFlow/SinglePhaseBaseFields.hpp" +#include "physicsSolvers/fluidFlow/SinglePhaseHybridFVMKernels.hpp" /** @@ -471,9 +471,6 @@ real64 SinglePhaseHybridFVM::calculateResidualNorm( real64 const & GEOS_UNUSED_P defaultViscosity += fluid.defaultViscosity(); subRegionCounter++; - string const & solidName = subRegion.getReference< string >( viewKeyStruct::solidNamesString() ); - CoupledSolidBase const & solid = getConstitutiveModel< CoupledSolidBase >( subRegion, solidName ); - // step 1.1: compute the norm in the subRegion singlePhaseBaseKernels:: @@ -483,8 +480,6 @@ real64 SinglePhaseHybridFVM::calculateResidualNorm( real64 const & GEOS_UNUSED_P elemDofKey, localRhs, subRegion, - fluid, - solid, m_nonlinearSolverParameters.m_minNormalizer, subRegionResidualNorm, subRegionResidualNormalizer ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.hpp index ff956507b61..65ceae5786e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.hpp @@ -20,7 +20,6 @@ #define GEOS_PHYSICSSOLVERS_FLUIDFLOW_SINGLEPHASEHYBRIDFVM_HPP_ #include "physicsSolvers/fluidFlow/SinglePhaseBase.hpp" -#include "physicsSolvers/fluidFlow/SinglePhaseHybridFVMKernels.hpp" namespace geos { diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp index e74bdc9619a..6ad40238385 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseProppantBase.cpp @@ -22,12 +22,9 @@ #include "constitutive/ConstitutivePassThru.hpp" #include "constitutive/fluid/singlefluid/SlurryFluidSelector.hpp" #include "constitutive/fluid/singlefluid/SingleFluidFields.hpp" -#include "constitutive/fluid/singlefluid/SlurryFluidFields.hpp" -#include "constitutive/permeability/PermeabilityFields.hpp" #include "constitutive/solid/CoupledSolidBase.hpp" #include "constitutive/solid/ProppantSolid.hpp" #include "constitutive/solid/porosity/ProppantPorosity.hpp" -#include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/fluidFlow/proppantTransport/ProppantTransportFields.hpp" #include "physicsSolvers/fluidFlow/SinglePhaseProppantBaseKernels.hpp" diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseBaseKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseBaseKernels.hpp index 0fec20002a4..8df182ad30e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseBaseKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ThermalCompositionalMultiphaseBaseKernels.hpp @@ -159,17 +159,13 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK using Base::m_dofNumber; using Base::m_elemGhostRank; using Base::m_volume; - using Base::m_porosity_n; using Base::m_porosity; using Base::m_dPoro_dPres; using Base::m_dCompFrac_dCompDens; - using Base::m_phaseVolFrac_n; using Base::m_phaseVolFrac; using Base::m_dPhaseVolFrac; - using Base::m_phaseDens_n; using Base::m_phaseDens; using Base::m_dPhaseDens; - using Base::m_phaseCompFrac_n; using Base::m_phaseCompFrac; using Base::m_dPhaseCompFrac; using Base::m_localMatrix; @@ -197,12 +193,11 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK BitFlags< isothermalCompositionalMultiphaseBaseKernels::ElementBasedAssemblyKernelFlags > const kernelFlags ) : Base( numPhases, rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs, kernelFlags ), m_dPoro_dTemp( solid.getDporosity_dTemperature() ), - m_phaseInternalEnergy_n( fluid.phaseInternalEnergy_n() ), m_phaseInternalEnergy( fluid.phaseInternalEnergy() ), m_dPhaseInternalEnergy( fluid.dPhaseInternalEnergy() ), - m_rockInternalEnergy_n( solid.getInternalEnergy_n() ), m_rockInternalEnergy( solid.getInternalEnergy() ), - m_dRockInternalEnergy_dTemp( solid.getDinternalEnergy_dTemperature() ) + m_dRockInternalEnergy_dTemp( solid.getDinternalEnergy_dTemperature() ), + m_energy_n( subRegion.getField< fields::flow::energy_n >() ) {} struct StackVariables : public Base::StackVariables @@ -214,9 +209,6 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK : Base::StackVariables() {} - using Base::StackVariables::poreVolume; - using Base::StackVariables::poreVolume_n; - using Base::StackVariables::dPoreVolume_dPres; using Base::StackVariables::localRow; using Base::StackVariables::dofIndices; using Base::StackVariables::localResidual; @@ -230,9 +222,6 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK /// Solid energy at time n+1 real64 solidEnergy = 0.0; - /// Solid energy at the previous converged time step - real64 solidEnergy_n = 0.0; - /// Derivative of solid internal energy with respect to pressure real64 dSolidEnergy_dPres = 0.0; @@ -257,13 +246,11 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK // initialize the solid volume real64 const solidVolume = m_volume[ei] * ( 1.0 - m_porosity[ei][0] ); - real64 const solidVolume_n = m_volume[ei] * ( 1.0 - m_porosity_n[ei][0] ); real64 const dSolidVolume_dPres = -m_volume[ei] * m_dPoro_dPres[ei][0]; real64 const dSolidVolume_dTemp = -stack.dPoreVolume_dTemp; // initialize the solid internal energy stack.solidEnergy = solidVolume * m_rockInternalEnergy[ei][0]; - stack.solidEnergy_n = solidVolume_n * m_rockInternalEnergy_n[ei][0]; stack.dSolidEnergy_dPres = dSolidVolume_dPres * m_rockInternalEnergy[ei][0]; stack.dSolidEnergy_dTemp = solidVolume * m_dRockInternalEnergy_dTemp[ei][0] + dSolidVolume_dTemp * m_rockInternalEnergy[ei][0]; @@ -281,9 +268,11 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK { using Deriv = multifluid::DerivativeOffset; + // start with old time step value + stack.localResidual[numEqn-1] = -m_energy_n[ei]; + Base::computeAccumulation( ei, stack, [&] ( integer const ip, real64 const & phaseAmount, - real64 const & phaseAmount_n, real64 const & dPhaseAmount_dP, real64 const (&dPhaseAmount_dC)[numComp] ) { @@ -302,7 +291,6 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK arraySlice2d< real64 const, multifluid::USD_PHASE_DC - 2 > dPhaseDens = m_dPhaseDens[ei][0]; arraySlice2d< real64 const, multifluid::USD_PHASE_COMP - 2 > phaseCompFrac = m_phaseCompFrac[ei][0]; arraySlice3d< real64 const, multifluid::USD_PHASE_COMP_DC - 2 > dPhaseCompFrac = m_dPhaseCompFrac[ei][0]; - arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseInternalEnergy_n = m_phaseInternalEnergy_n[ei][0]; arraySlice1d< real64 const, multifluid::USD_PHASE - 2 > phaseInternalEnergy = m_phaseInternalEnergy[ei][0]; arraySlice2d< real64 const, multifluid::USD_PHASE_DC - 2 > dPhaseInternalEnergy = m_dPhaseInternalEnergy[ei][0]; @@ -319,14 +307,13 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK // Step 2: assemble the phase-dependent part of the accumulation term of the energy equation real64 const phaseEnergy = phaseAmount * phaseInternalEnergy[ip]; - real64 const phaseEnergy_n = phaseAmount_n * phaseInternalEnergy_n[ip]; real64 const dPhaseEnergy_dP = dPhaseAmount_dP * phaseInternalEnergy[ip] + phaseAmount * dPhaseInternalEnergy[ip][Deriv::dP]; real64 const dPhaseEnergy_dT = dPhaseAmount_dT * phaseInternalEnergy[ip] + phaseAmount * dPhaseInternalEnergy[ip][Deriv::dT]; // local accumulation - stack.localResidual[numEqn-1] += phaseEnergy - phaseEnergy_n; + stack.localResidual[numEqn-1] += phaseEnergy; // derivatives w.r.t. pressure and temperature stack.localJacobian[numEqn-1][0] += dPhaseEnergy_dP; @@ -344,7 +331,7 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK // Step 3: assemble the solid part of the accumulation term // local accumulation and derivatives w.r.t. pressure and temperature - stack.localResidual[numEqn-1] += stack.solidEnergy - stack.solidEnergy_n; + stack.localResidual[numEqn-1] += stack.solidEnergy; stack.localJacobian[numEqn-1][0] += stack.dSolidEnergy_dPres; stack.localJacobian[numEqn-1][numDof-1] += stack.dSolidEnergy_dTemp; @@ -396,15 +383,16 @@ class ElementBasedAssemblyKernel : public isothermalCompositionalMultiphaseBaseK arrayView2d< real64 const > const m_dPoro_dTemp; /// Views on phase internal energy - arrayView3d< real64 const, multifluid::USD_PHASE > m_phaseInternalEnergy_n; arrayView3d< real64 const, multifluid::USD_PHASE > m_phaseInternalEnergy; arrayView4d< real64 const, multifluid::USD_PHASE_DC > m_dPhaseInternalEnergy; /// Views on rock internal energy - arrayView2d< real64 const > m_rockInternalEnergy_n; arrayView2d< real64 const > m_rockInternalEnergy; arrayView2d< real64 const > m_dRockInternalEnergy_dTemp; + /// Views on energy + arrayView1d< real64 const > m_energy_n; + }; /** diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ThermalSinglePhaseBaseKernels.hpp b/src/coreComponents/physicsSolvers/fluidFlow/ThermalSinglePhaseBaseKernels.hpp index 8db24520903..bc006a230c6 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ThermalSinglePhaseBaseKernels.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ThermalSinglePhaseBaseKernels.hpp @@ -120,10 +120,8 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs using Base::m_elemGhostRank; using Base::m_volume; using Base::m_deltaVolume; - using Base::m_porosity_n; - using Base::m_porosityNew; + using Base::m_porosity; using Base::m_dPoro_dPres; - using Base::m_density_n; using Base::m_density; using Base::m_dDensity_dPres; using Base::m_localMatrix; @@ -149,13 +147,12 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs : Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ), m_dDensity_dTemp( fluid.dDensity_dTemperature() ), m_dPoro_dTemp( solid.getDporosity_dTemperature() ), - m_internalEnergy_n( fluid.internalEnergy_n() ), m_internalEnergy( fluid.internalEnergy() ), m_dInternalEnergy_dPres( fluid.dInternalEnergy_dPressure() ), m_dInternalEnergy_dTemp( fluid.dInternalEnergy_dTemperature() ), - m_rockInternalEnergy_n( solid.getInternalEnergy_n() ), m_rockInternalEnergy( solid.getInternalEnergy() ), - m_dRockInternalEnergy_dTemp( solid.getDinternalEnergy_dTemperature() ) + m_dRockInternalEnergy_dTemp( solid.getDinternalEnergy_dTemperature() ), + m_energy_n( subRegion.template getField< fields::flow::energy_n >() ) {} /** @@ -172,7 +169,6 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs {} using Base::StackVariables::poreVolume; - using Base::StackVariables::poreVolume_n; using Base::StackVariables::dPoreVolume_dPres; using Base::StackVariables::localRow; using Base::StackVariables::dofIndices; @@ -187,9 +183,6 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs /// Solid energy at time n+1 real64 solidEnergy = 0.0; - /// Solid energy at the previous converged time step - real64 solidEnergy_n = 0.0; - /// Derivative of solid internal energy with respect to pressure real64 dSolidEnergy_dPres = 0.0; @@ -212,14 +205,12 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs stack.dPoreVolume_dTemp = ( m_volume[ei] + m_deltaVolume[ei] ) * m_dPoro_dTemp[ei][0]; // initialize the solid volume - real64 const solidVolume = ( m_volume[ei] + m_deltaVolume[ei] ) * ( 1.0 - m_porosityNew[ei][0] ); - real64 const solidVolume_n = m_volume[ei] * ( 1.0 - m_porosity_n[ei][0] ); + real64 const solidVolume = ( m_volume[ei] + m_deltaVolume[ei] ) * ( 1.0 - m_porosity[ei][0] ); real64 const dSolidVolume_dPres = -( m_volume[ei] + m_deltaVolume[ei] ) * m_dPoro_dPres[ei][0]; real64 const dSolidVolume_dTemp = -( m_volume[ei] + m_deltaVolume[ei] ) * m_dPoro_dTemp[ei][0]; // initialize the solid internal energy stack.solidEnergy = solidVolume * m_rockInternalEnergy[ei][0]; - stack.solidEnergy_n = solidVolume_n * m_rockInternalEnergy_n[ei][0]; stack.dSolidEnergy_dPres = dSolidVolume_dPres * m_rockInternalEnergy[ei][0]; stack.dSolidEnergy_dTemp = solidVolume * m_dRockInternalEnergy_dTemp[ei][0] + dSolidVolume_dTemp * m_rockInternalEnergy[ei][0]; } @@ -235,6 +226,8 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs void computeAccumulation( localIndex const ei, StackVariables & stack ) const { + stack.localResidual[numEqn-1] = -m_energy_n[ei]; + Base::computeAccumulation( ei, stack, [&] () { // Step 1: assemble the derivatives of the mass balance equation w.r.t temperature @@ -242,7 +235,6 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs // Step 2: assemble the fluid part of the accumulation term of the energy equation real64 const fluidEnergy = stack.poreVolume * m_density[ei][0] * m_internalEnergy[ei][0]; - real64 const fluidEnergy_n = stack.poreVolume_n * m_density_n[ei][0] * m_internalEnergy_n[ei][0]; real64 const dFluidEnergy_dP = stack.dPoreVolume_dPres * m_density[ei][0] * m_internalEnergy[ei][0] + stack.poreVolume * m_dDensity_dPres[ei][0] * m_internalEnergy[ei][0] @@ -253,7 +245,7 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs + stack.dPoreVolume_dTemp * m_density[ei][0] * m_internalEnergy[ei][0]; // local accumulation - stack.localResidual[numEqn-1] = fluidEnergy - fluidEnergy_n; + stack.localResidual[numEqn-1] += fluidEnergy; // derivatives w.r.t. pressure and temperature stack.localJacobian[numEqn-1][0] = dFluidEnergy_dP; @@ -261,7 +253,7 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs } ); // Step 3: assemble the solid part of the accumulation term of the energy equation - stack.localResidual[numEqn-1] += stack.solidEnergy - stack.solidEnergy_n; + stack.localResidual[numEqn-1] += stack.solidEnergy; stack.localJacobian[numEqn-1][0] += stack.dSolidEnergy_dPres; stack.localJacobian[numEqn-1][numDof-1] += stack.dSolidEnergy_dTemp; } @@ -297,15 +289,16 @@ class ElementBasedAssemblyKernel : public singlePhaseBaseKernels::ElementBasedAs arrayView2d< real64 const > const m_dPoro_dTemp; /// Views on fluid internal energy - arrayView2d< real64 const > const m_internalEnergy_n; arrayView2d< real64 const > const m_internalEnergy; arrayView2d< real64 const > const m_dInternalEnergy_dPres; arrayView2d< real64 const > const m_dInternalEnergy_dTemp; /// Views on rock internal energy - arrayView2d< real64 const > m_rockInternalEnergy_n; - arrayView2d< real64 const > m_rockInternalEnergy; - arrayView2d< real64 const > m_dRockInternalEnergy_dTemp; + arrayView2d< real64 const > const m_rockInternalEnergy; + arrayView2d< real64 const > const m_dRockInternalEnergy_dTemp; + + /// View on energy + arrayView1d< real64 const > const m_energy_n; }; @@ -337,15 +330,9 @@ class SurfaceElementBasedAssemblyKernel : public ElementBasedAssemblyKernel< Sur constitutive::CoupledSolidBase const & solid, CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ) - : Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ) -#if ALLOW_CREATION_MASS - , m_creationMass( subRegion.getReference< array1d< real64 > >( SurfaceElementSubRegion::viewKeyStruct::creationMassString() ) ) -#endif - { -#if !defined(ALLOW_CREATION_MASS) - static_assert( true, "must have ALLOW_CREATION_MASS defined" ); -#endif - } + : Base( rankOffset, dofKey, subRegion, fluid, solid, localMatrix, localRhs ), + m_creationMass( subRegion.getReference< array1d< real64 > >( SurfaceElementSubRegion::viewKeyStruct::creationMassString() ) ) + {} /** * @brief Compute the local accumulation contributions to the residual and Jacobian @@ -358,20 +345,15 @@ class SurfaceElementBasedAssemblyKernel : public ElementBasedAssemblyKernel< Sur Base::StackVariables & stack ) const { Base::computeAccumulation( ei, stack ); - -#if ALLOW_CREATION_MASS - if( Base::m_volume[ei] * Base::m_density_n[ei][0] > 1.1 * m_creationMass[ei] ) + if( Base::m_mass_n[ei] > 1.1 * m_creationMass[ei] ) { stack.localResidual[0] += m_creationMass[ei] * 0.25; } -#endif } protected: -#if ALLOW_CREATION_MASS arrayView1d< real64 const > const m_creationMass; -#endif }; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp index be24ccd834d..365c38eda92 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp @@ -35,6 +35,8 @@ #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/fluidFlow/proppantTransport/ProppantTransportFields.hpp" #include "physicsSolvers/fluidFlow/proppantTransport/ProppantTransportKernels.hpp" +#include "mesh/MeshFields.hpp" + /** * @namespace the geosx namespace that encapsulates the majority of the code @@ -286,7 +288,7 @@ void ProppantTransport::updateProppantMobility( ObjectManagerBase & dataGroup ) GEOS_MARK_FUNCTION; arrayView1d< real64 const > const conc = dataGroup.getField< fields::proppant::proppantConcentration >(); - arrayView1d< real64 const > const aperture = dataGroup.getReference< array1d< real64 > >( FaceElementSubRegion::viewKeyStruct::elementApertureString() ); + arrayView1d< real64 const > const aperture = dataGroup.getReference< array1d< real64 > >( fields::elementAperture::key() ); arrayView1d< integer > const isProppantMobile = dataGroup.getField< fields::proppant::isProppantMobile >(); real64 const minAperture = m_minAperture; @@ -1054,7 +1056,7 @@ void ProppantTransport::updateProppantPackVolume( real64 const GEOS_UNUSED_PARAM elemManager.constructViewAccessor< array1d< real64 >, arrayView1d< real64 > >( fields::proppant::proppantLiftFlux::key() ); ElementRegionManager::ElementViewAccessor< arrayView1d< real64 const > > const - aperture = elemManager.constructArrayViewAccessor< real64, 1 >( FaceElementSubRegion::viewKeyStruct::elementApertureString() ); + aperture = elemManager.constructArrayViewAccessor< real64, 1 >( fields::elementAperture::key() ); typename ProppantPackVolumeKernel::FlowAccessors flowAccessors( elemManager, getName() ); typename ProppantPackVolumeKernel::SlurryFluidAccessors slurryFluidAccessors( elemManager, getName() ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWellKernels.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWellKernels.cpp index 70a8e51721d..74cafe77cc4 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWellKernels.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWellKernels.cpp @@ -1690,7 +1690,7 @@ PresTempCompFracInitializationKernel:: { foundNegativeTemp.max( 1 ); } - if( !isZero( sumCompFracForCheck - 1.0 ) ) + if( !isZero( sumCompFracForCheck - 1.0, constitutive::MultiFluidConstants::minForSpeciesPresence ) ) { foundInconsistentCompFrac.max( 1 ); } diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp index 108dfed9d80..3d0ab667ee4 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp @@ -90,7 +90,7 @@ class CompositionalMultiphaseReservoirAndWells : public CoupledReservoirAndWells void keepFlowVariablesConstantDuringInitStep( bool const keepFlowVariablesConstantDuringInitStep ) { flowSolver()->keepFlowVariablesConstantDuringInitStep( keepFlowVariablesConstantDuringInitStep ); } - real64 updateFluidState( ObjectManagerBase & subRegion ) const + real64 updateFluidState( ElementSubRegionBase & subRegion ) const { return flowSolver()->updateFluidState( subRegion ); } void updatePorosityAndPermeability( CellElementSubRegion & subRegion ) const { flowSolver()->updatePorosityAndPermeability( subRegion ); } @@ -106,7 +106,10 @@ class CompositionalMultiphaseReservoirAndWells : public CoupledReservoirAndWells void enableFixedStressPoromechanicsUpdate() { flowSolver()->enableFixedStressPoromechanicsUpdate(); } - virtual void saveSequentialIterationState( DomainPartition & domain ) const override final { flowSolver()->saveSequentialIterationState( domain ); } + void enableJumpStabilization() + {flowSolver()->enableJumpStabilization(); } + + virtual void saveSequentialIterationState( DomainPartition & domain ) override final { flowSolver()->saveSequentialIterationState( domain ); } protected: diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index e08ccb8ea4a..0a5d2f4eff4 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -26,6 +26,7 @@ #include "constitutive/permeability/PermeabilityFields.hpp" #include "constitutive/permeability/PermeabilityBase.hpp" #include "mesh/PerforationFields.hpp" +#include "mesh/DomainPartition.hpp" #include "physicsSolvers/fluidFlow/wells/WellControls.hpp" #include "physicsSolvers/fluidFlow/wells/WellSolverBase.hpp" diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp index 61b69720a39..d51345298cd 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledSolver.hpp @@ -355,14 +355,6 @@ class CoupledSolver : public SolverBase return isConverged; } - virtual void saveSequentialIterationState( DomainPartition & domain ) const override - { - forEachArgInTuple( m_solvers, [&]( auto & solver, auto ) - { - solver->saveSequentialIterationState( domain ); - } ); - } - protected: /** @@ -460,6 +452,9 @@ class CoupledSolver : public SolverBase cycleNumber, domain ); + // save fields (e.g. pressure and temperature) after inner solve + solver->saveSequentialIterationState( domain ); + mapSolutionBetweenSolvers( domain, idx() ); if( solverDt < stepDt ) // subsolver had to cut the time step @@ -475,9 +470,6 @@ class CoupledSolver : public SolverBase stepDt, domain ); - // save fields (e.g. pressure and temperature) at the end of this iteration - saveSequentialIterationState( domain ); - if( isConverged ) { // exit outer loop @@ -547,10 +539,10 @@ class CoupledSolver : public SolverBase GEOS_UNUSED_VAR( domain, solverType ); } - bool checkSequentialConvergence( int const & iter, - real64 const & time_n, - real64 const & dt, - DomainPartition & domain ) + virtual bool checkSequentialConvergence( int const & iter, + real64 const & time_n, + real64 const & dt, + DomainPartition & domain ) { NonlinearSolverParameters const & params = getNonlinearSolverParameters(); bool isConverged = true; diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp index 46d83cd528c..dfa208b5794 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.cpp @@ -26,6 +26,7 @@ #include "physicsSolvers/multiphysics/SinglePhasePoromechanics.hpp" #include "physicsSolvers/multiphysics/MultiphasePoromechanics.hpp" #include "physicsSolvers/fluidFlow/SinglePhaseBase.hpp" +#include "mesh/MeshFields.hpp" namespace geos { @@ -75,7 +76,8 @@ HydrofractureSolver< POROMECHANICS_SOLVER >::HydrofractureSolver( const string & m_surfaceGeneratorName(), m_surfaceGenerator( nullptr ), m_maxNumResolves( 10 ), - m_isMatrixPoroelastic() + m_isMatrixPoroelastic(), + m_newFractureInitializationType() { registerWrapper( viewKeyStruct::surfaceGeneratorNameString(), &m_surfaceGeneratorName ). setRTTypeName( rtTypes::CustomTypes::groupNameRef ). @@ -96,6 +98,12 @@ HydrofractureSolver< POROMECHANICS_SOLVER >::HydrofractureSolver( const string & setApplyDefaultValue( 0 ). setInputFlag( InputFlags::OPTIONAL ); + /// GEOS mainly initializes pressure in the new fracture elements. + registerWrapper( viewKeyStruct::newFractureInitializationTypeString(), &m_newFractureInitializationType ). + setInputFlag( InputFlags::OPTIONAL ). + setApplyDefaultValue( InitializationType::Pressure ). + setDescription( "Type of new fracture element initialization. Can be Pressure or Displacement. " ); + registerWrapper( viewKeyStruct::useQuasiNewtonString(), &m_useQuasiNewton ). setApplyDefaultValue( 0 ). setInputFlag( InputFlags::OPTIONAL ); @@ -176,6 +184,9 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::postProcessInput() static const std::set< integer > binaryOptions = { 0, 1 }; GEOS_ERROR_IF( binaryOptions.count( m_isMatrixPoroelastic ) == 0, viewKeyStruct::isMatrixPoroelasticString() << " option can be either 0 (false) or 1 (true)" ); + GEOS_ERROR_IF( m_newFractureInitializationType != InitializationType::Pressure && m_newFractureInitializationType != InitializationType::Displacement, + viewKeyStruct::newFractureInitializationTypeString() << " option can be either Pressure or Displacement" ); + m_surfaceGenerator = &this->getParent().template getGroup< SurfaceGenerator >( m_surfaceGeneratorName ); flowSolver()->allowNegativePressure(); @@ -189,6 +200,11 @@ real64 HydrofractureSolver< POROMECHANICS_SOLVER >::fullyCoupledSolverStep( real int const cycleNumber, DomainPartition & domain ) { + if( cycleNumber == 0 && time_n <= 0 ) + { + initializeNewFractureFields( domain ); + } + real64 dtReturn = dt; implicitStepSetup( time_n, dt, domain ); @@ -236,11 +252,14 @@ real64 HydrofractureSolver< POROMECHANICS_SOLVER >::fullyCoupledSolverStep( real } else { + // We initialize the fields for new fracture cells + initializeNewFractureFields( domain ); + FieldIdentifiers fieldsToBeSync; fieldsToBeSync.addElementFields( { flow::pressure::key(), flow::pressure_n::key(), - SurfaceElementSubRegion::viewKeyStruct::elementApertureString() }, + fields::elementAperture::key() }, { m_surfaceGenerator->getFractureRegionName() } ); fieldsToBeSync.addFields( FieldLocation::Node, @@ -971,6 +990,171 @@ void HydrofractureSolver< POROMECHANICS_SOLVER >::setUpDflux_dApertureMatrix( Do } ); } +template< typename POROMECHANICS_SOLVER > +void HydrofractureSolver< POROMECHANICS_SOLVER >::initializeNewFractureFields( DomainPartition & domain ) +{ + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel & meshLevel, + arrayView1d< string const > const & regionNames ) + { + ElementRegionManager & elemManager = meshLevel.getElemManager(); + NodeManager & nodeManager = meshLevel.getNodeManager(); + FaceManager const & faceManager = meshLevel.getFaceManager(); + ArrayOfArraysView< localIndex const > const faceToNodesMap = faceManager.nodeList().toViewConst(); + arrayView2d< real64 const > faceNormal = faceManager.faceNormal(); + + solidMechanics::arrayView2dLayoutIncrDisplacement const incrementalDisplacement = + nodeManager.getField< fields::solidMechanics::incrementalDisplacement >(); + solidMechanics::arrayView2dLayoutTotalDisplacement const totalDisplacement = + nodeManager.getField< fields::solidMechanics::totalDisplacement >(); + + elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, + [=]( localIndex const, + FaceElementSubRegion & subRegion ) + { + ArrayOfArraysView< localIndex const > const facesToEdges = subRegion.edgeList().toViewConst(); + ArrayOfArraysView< localIndex const > const & fractureConnectorsToFaceElements = subRegion.m_2dFaceTo2dElems.toViewConst(); + map< localIndex, localIndex > const & edgesToConnectorEdges = subRegion.m_edgesTo2dFaces; + + ArrayOfArraysView< localIndex const > const faceMap = subRegion.faceList().toViewConst(); + + arrayView1d< real64 > const fluidPressure_n = subRegion.getField< fields::flow::pressure_n >(); + arrayView1d< real64 > const fluidPressure = subRegion.getField< fields::flow::pressure >(); + + arrayView1d< real64 > const aperture = subRegion.getField< fields::elementAperture >(); + + // Get the list of newFractureElements + SortedArrayView< localIndex const > const newFractureElements = subRegion.m_newFaceElements.toViewConst(); + + #ifdef GEOSX_USE_SEPARATION_COEFFICIENT + arrayView1d< real64 > const apertureF = subRegion.getReference< array1d< real64 > >( "apertureAtFailure" ); + #endif + + // arrayView1d< real64 > const dens = subRegion.getReference< array1d< real64 > >( "density_n" ); // change it to make aperture + // zero + + forAll< serialPolicy >( newFractureElements.size(), [&] ( localIndex const k ) + { + localIndex const newElemIndex = newFractureElements[k]; + real64 initialPressure = 1.0e99; + real64 initialAperture = 1.0e99; + #ifdef GEOSX_USE_SEPARATION_COEFFICIENT + apertureF[newElemIndex] = aperture[newElemIndex]; + #endif + if( m_newFractureInitializationType == InitializationType::Displacement ) + { + aperture[newElemIndex] = 1.0e99; + } + arraySlice1d< localIndex const > const faceToEdges = facesToEdges[newElemIndex]; + + for( localIndex ke=0; ke 1.0e98? 0.0:initialPressure; + fluidPressure_n[newElemIndex] = fluidPressure[newElemIndex]; + } + else if( m_newFractureInitializationType == InitializationType::Displacement ) + { + // Set the aperture/fluid pressure for the new face element to be the minimum + // of the existing value, smallest aperture/pressure from a connected face element. + // aperture[newElemIndex] = std::min(aperture[newElemIndex], initialAperture); + + localIndex const faceIndex0 = faceMap[newElemIndex][0]; + localIndex const faceIndex1 = faceMap[newElemIndex][1]; + + localIndex const numNodesPerFace = faceToNodesMap.sizeOfArray( faceIndex0 ); + + bool zeroDisp = true; + + for( localIndex a=0; a( totalDisplacement[node0] ) ) > 1.0e-99 && + LvArray::math::abs( LvArray::tensorOps::l2Norm< 3 >( totalDisplacement[node1] ) ) > 1.0e-99 ) + { + zeroDisp = false; + } + } + if( zeroDisp ) + { + aperture[newElemIndex] = 0; + } + } + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "New elem index = {:4d} , init aper = {:4.2e}, init press = {:4.2e} ", + newElemIndex, aperture[newElemIndex], fluidPressure[newElemIndex] ) ); + } ); + + if( m_newFractureInitializationType == InitializationType::Displacement ) + { + SortedArray< localIndex > touchedNodes; + forAll< serialPolicy >( newFractureElements.size(), [ newFractureElements + , aperture + , faceMap + , faceNormal + , faceToNodesMap + , &touchedNodes + , incrementalDisplacement + , totalDisplacement ]( localIndex const k ) + { + localIndex const newElemIndex = newFractureElements[k]; + + if( aperture[newElemIndex] < 1e98 ) + { + localIndex const faceIndex0 = faceMap( newElemIndex, 0 ); + localIndex const faceIndex1 = faceMap( newElemIndex, 1 ); + localIndex const numNodesPerFace = faceToNodesMap.sizeOfArray( faceIndex0 ); + + real64 newDisp[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( faceNormal[ faceIndex0 ] ); + LvArray::tensorOps::scale< 3 >( newDisp, -aperture[newElemIndex] ); + for( localIndex a=0; a( incrementalDisplacement[node0], newDisp ); + LvArray::tensorOps::add< 3 >( totalDisplacement[node0], newDisp ); + LvArray::tensorOps::subtract< 3 >( incrementalDisplacement[node1], newDisp ); + LvArray::tensorOps::subtract< 3 >( totalDisplacement[node1], newDisp ); + } + } + } + } ); + } + + subRegion.m_recalculateConnectionsFor2dFaces.clear(); + subRegion.m_newFaceElements.clear(); + } ); + } ); +} + namespace { typedef HydrofractureSolver< SinglePhasePoromechanics< SinglePhaseBase > > SinglePhaseHydrofracture; diff --git a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp index 9ee4adcdd04..152169f57c9 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/HydrofractureSolver.hpp @@ -138,6 +138,12 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER return m_derivativeFluxResidual_dAperture->toViewConst(); } + enum class InitializationType : integer + { + Pressure, + Displacement, + }; + struct viewKeyStruct : Base::viewKeyStruct { constexpr static char const * contactRelationNameString() { return "contactRelationName"; } @@ -148,6 +154,8 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER constexpr static char const * isMatrixPoroelasticString() { return "isMatrixPoroelastic"; } + constexpr static char const * newFractureInitializationTypeString() { return "newFractureInitializationType"; } + constexpr static char const * useQuasiNewtonString() { return "useQuasiNewton"; } #ifdef GEOSX_USE_SEPARATION_COEFFICIENT @@ -194,6 +202,13 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER int const cycleNumber, DomainPartition & domain ) override final; + + /** + * @brief Initialize fields on the newly created elements of the fracture. + * @param domain the physical domain object + */ + void initializeNewFractureFields( DomainPartition & domain ); + // name of the contact relation string m_contactRelationName; @@ -211,10 +226,17 @@ class HydrofractureSolver : public POROMECHANICS_SOLVER integer m_isMatrixPoroelastic; + // flag to determine which initialization type to use for the new fracture cell + InitializationType m_newFractureInitializationType; + integer m_useQuasiNewton; // use Quasi-Newton (see https://arxiv.org/abs/2111.00264) }; +ENUM_STRINGS( HydrofractureSolver< SinglePhasePoromechanics< SinglePhaseBase > >::InitializationType, + "Pressure", + "Displacement" ); + } /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp index ac12d92bbf7..9367234c0ce 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.cpp @@ -118,6 +118,12 @@ void MultiphasePoromechanics< FLOW_SOLVER >::registerDataOnMesh( Group & meshBod if( m_stabilizationType == StabilizationType::Global || m_stabilizationType == StabilizationType::Local ) { + + if( this->getNonlinearSolverParameters().m_couplingType == NonlinearSolverParameters::CouplingType::Sequential ) + { + this->flowSolver()->enableJumpStabilization(); + } + this->template forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, MeshLevel & mesh, arrayView1d< string const > const & regionNames ) @@ -224,6 +230,7 @@ void MultiphasePoromechanics< FLOW_SOLVER >::assembleElementBasedTerms( real64 c this->flowSolver()->numFluidComponents(), this->flowSolver()->numFluidPhases(), this->flowSolver()->useTotalMassEquation(), + this->m_performStressInitialization, FlowSolverBase::viewKeyStruct::fluidNamesString() ); } else @@ -242,6 +249,7 @@ void MultiphasePoromechanics< FLOW_SOLVER >::assembleElementBasedTerms( real64 c this->flowSolver()->numFluidPhases(), this->flowSolver()->useSimpleAccumulation(), this->flowSolver()->useTotalMassEquation(), + this->m_performStressInitialization, FlowSolverBase::viewKeyStruct::fluidNamesString() ); } } ); @@ -361,6 +369,20 @@ void MultiphasePoromechanics< FLOW_SOLVER >::initializePreSubGroups() InputError ); } +template< typename FLOW_SOLVER > +void MultiphasePoromechanics< FLOW_SOLVER >::implicitStepSetup( real64 const & time_n, + real64 const & dt, + DomainPartition & domain ) +{ + Base::implicitStepSetup( time_n, dt, domain ); + if( this->getNonlinearSolverParameters().m_couplingType == NonlinearSolverParameters::CouplingType::Sequential && + (this->m_stabilizationType == StabilizationType::Global || this->m_stabilizationType == StabilizationType::Local)) + { + this->updateStabilizationParameters( domain ); + } + +} + template< typename FLOW_SOLVER > void MultiphasePoromechanics< FLOW_SOLVER >::updateStabilizationParameters( DomainPartition & domain ) const { diff --git a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp index 0d0835869cb..2ba88eba253 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/MultiphasePoromechanics.hpp @@ -104,6 +104,10 @@ class MultiphasePoromechanics : public PoromechanicsSolver< FLOW_SOLVER > virtual void updateState( DomainPartition & domain ) override; + virtual void implicitStepSetup( real64 const & time_n, + real64 const & dt, + DomainPartition & domain ) override; + /**@}*/ /* diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp index cb0e6541120..350e5994273 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp @@ -25,51 +25,21 @@ #include "physicsSolvers/fluidFlow/SinglePhaseBase.hpp" #include "physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp" #include "physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.hpp" +#include "physicsSolvers/solidMechanics/SolidMechanicsStatistics.hpp" +#include "events/tasks/TasksManager.hpp" namespace geos { using namespace dataRepository; -namespace -{ - -// This is meant to be specialized to work, see below -template< typename POROMECHANICS_SOLVER > class - PoromechanicsCatalogNames {}; - -// Class specializations for a POROMECHANICS_SOLVER set to SinglePhasePoromechanics -template<> class PoromechanicsCatalogNames< SinglePhasePoromechanics< SinglePhaseBase > > -{ -public: - static string name() { return SinglePhasePoromechanics< SinglePhaseBase >::catalogName() + "Initialization"; } -}; -template<> class PoromechanicsCatalogNames< SinglePhasePoromechanics< SinglePhaseReservoirAndWells< SinglePhaseBase > > > -{ -public: - static string name() { return SinglePhasePoromechanics< SinglePhaseReservoirAndWells< SinglePhaseBase > >::catalogName() + "Initialization"; } -}; -// Class specializations for a POROMECHANICS_SOLVER set to MultiphasePoromechanics -template<> class PoromechanicsCatalogNames< MultiphasePoromechanics< CompositionalMultiphaseBase > > -{ -public: - static string name() { return MultiphasePoromechanics< CompositionalMultiphaseBase >::catalogName() + "Initialization"; } -}; -template<> class PoromechanicsCatalogNames< MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells< CompositionalMultiphaseBase > > > -{ -public: - static string name() { return MultiphasePoromechanics< CompositionalMultiphaseReservoirAndWells< CompositionalMultiphaseBase > >::catalogName() + "Initialization"; } -}; - -} - // provide a definition for catalogName() template< typename POROMECHANICS_SOLVER > string PoromechanicsInitialization< POROMECHANICS_SOLVER >:: catalogName() { - return PoromechanicsCatalogNames< POROMECHANICS_SOLVER >::name(); + return POROMECHANICS_SOLVER::catalogName() + "Initialization"; } template< typename POROMECHANICS_SOLVER > @@ -78,6 +48,7 @@ PoromechanicsInitialization( const string & name, Group * const parent ): TaskBase( name, parent ), m_poromechanicsSolverName(), + m_solidMechanicsStatistics(), m_solidMechanicsStateResetTask( name, parent ) { enableLogLevelInput(); @@ -87,10 +58,11 @@ PoromechanicsInitialization( const string & name, setInputFlag( InputFlags::REQUIRED ). setDescription( "Name of the poromechanics solver" ); - registerWrapper( viewKeyStruct::performStressInitializationString(), &m_performStressInitialization ). - setApplyDefaultValue( true ). - setInputFlag( InputFlags::REQUIRED ). - setDescription( "Flag to indicate that the solver is going to perform stress initialization" ); + registerWrapper( viewKeyStruct::solidMechanicsStatisticsNameString(), &m_solidMechanicsStatisticsName ). + setRTTypeName( rtTypes::CustomTypes::groupNameRef ). + setInputFlag( InputFlags::OPTIONAL ). + setApplyDefaultValue( "" ). + setDescription( "Name of the solid mechanics statistics" ); } template< typename POROMECHANICS_SOLVER > @@ -112,6 +84,19 @@ postProcessInput() m_poromechanicsSolver = &physicsSolverManager.getGroup< POROMECHANICS_SOLVER >( m_poromechanicsSolverName ); + if( !m_solidMechanicsStatisticsName.empty()) + { + TasksManager & tasksManager = problemManager.getTasksManager(); + + GEOS_THROW_IF( !tasksManager.hasGroup( m_solidMechanicsStatisticsName ), + GEOS_FMT( "{}: statistics task named {} not found", + getWrapperDataContext( viewKeyStruct::solidMechanicsStatisticsNameString() ), + m_solidMechanicsStatisticsName ), + InputError ); + + m_solidMechanicsStatistics = &tasksManager.getGroup< SolidMechanicsStatistics >( m_solidMechanicsStatisticsName ); + } + m_solidMechanicsStateResetTask.setLogLevel( getLogLevel()); m_solidMechanicsStateResetTask.m_solidSolverName = m_poromechanicsSolver->solidMechanicsSolver()->getName(); m_solidMechanicsStateResetTask.postProcessInput(); @@ -127,17 +112,21 @@ execute( real64 const time_n, real64 const eventProgress, DomainPartition & domain ) { - if( m_performStressInitialization ) - { - GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "Task `{}`: at time {}s, physics solver `{}` is set to perform stress initialization during the next time step(s)", - getName(), time_n, m_poromechanicsSolverName ) ); - m_poromechanicsSolver->setStressInitialization( true ); - } - else + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "Task `{}`: at time {}s, physics solver `{}` is set to perform stress initialization during the next time step(s)", + getName(), time_n, m_poromechanicsSolverName ) ); + m_poromechanicsSolver->setStressInitialization( true ); + + m_solidMechanicsStateResetTask.execute( time_n, dt, cycleNumber, eventCounter, eventProgress, domain ); + + m_poromechanicsSolver->execute( time_n, dt, cycleNumber, eventCounter, eventProgress, domain ); + + GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "Task `{}`: at time {}s, physics solver `{}` has completed stress initialization", + getName(), time_n + dt, m_poromechanicsSolverName ) ); + m_poromechanicsSolver->setStressInitialization( false ); + + if( m_solidMechanicsStatistics != nullptr ) { - GEOS_LOG_LEVEL_RANK_0( 1, GEOS_FMT( "Task `{}`: at time {}s, physics solver `{}` has completed stress initialization", - getName(), time_n, m_poromechanicsSolverName ) ); - m_poromechanicsSolver->setStressInitialization( false ); + m_solidMechanicsStatistics->execute( time_n, dt, cycleNumber, eventCounter, eventProgress, domain ); } m_solidMechanicsStateResetTask.execute( time_n, dt, cycleNumber, eventCounter, eventProgress, domain ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp index 22f971dcdb3..22f86654464 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.hpp @@ -24,6 +24,7 @@ namespace geos { +class SolidMechanicsStatistics; /** * @class PoromechanicsInitialization @@ -80,21 +81,25 @@ class PoromechanicsInitialization : public TaskBase { /// String for the poromechanics solver name constexpr static char const * poromechanicsSolverNameString() { return "poromechanicsSolverName"; } - /// String for the solver configuration - constexpr static char const * performStressInitializationString() { return "performStressInitialization"; } + /// String for the solid mechanics statistics name + constexpr static char const * solidMechanicsStatisticsNameString() { return "solidMechanicsStatisticsName"; } }; - void postProcessInput() override; +// void registerDataOnMesh( Group & meshBodies ) override; + /// Name of the poromechanics solver string m_poromechanicsSolverName; - /// Pointer to the multiphase poromechanics solver + /// Name of the solid mechanics statistics + string m_solidMechanicsStatisticsName; + + /// Pointer to the poromechanics solver POROMECHANICS_SOLVER * m_poromechanicsSolver; - /// Flag to indicate that the solver is going to perform stress initialization - integer m_performStressInitialization; + /// Pointer to the solid mechanics statistics + SolidMechanicsStatistics * m_solidMechanicsStatistics; SolidMechanicsStateReset m_solidMechanicsStateResetTask; diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp index 06a2b437905..6d85889df85 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp @@ -25,6 +25,7 @@ #include "physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp" #include "constitutive/solid/CoupledSolidBase.hpp" #include "constitutive/solid/PorousSolid.hpp" +#include "mesh/DomainPartition.hpp" #include "mesh/utilities/AverageOverQuadraturePointsKernel.hpp" #include "codingUtilities/Utilities.hpp" @@ -73,7 +74,7 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER setDescription( "Flag to indicate that the solver is going to perform stress initialization" ); } - void initializePostInitialConditionsPreSubGroups() + virtual void initializePostInitialConditionsPreSubGroups() override { Base::initializePostInitialConditionsPreSubGroups(); @@ -94,7 +95,7 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER arrayView1d< string const > const & regionNames ) { ElementRegionManager & elementRegionManager = mesh.getElemManager(); - elementRegionManager.forElementSubRegions< ElementSubRegionBase >( regionNames, + elementRegionManager.forElementSubRegions< CellElementSubRegion >( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { @@ -112,8 +113,6 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER this->catalogName(), this->getDataContext().toString(), subRegion.getName() ), InputError ); - - if( subRegion.hasField< fields::poromechanics::bulkDensity >() ) { // get the solid model to know the number of quadrature points and resize the bulk density @@ -142,7 +141,7 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER { ElementRegionManager & elemManager = mesh.getElemManager(); - elemManager.forElementSubRegions< ElementSubRegionBase >( regionNames, + elemManager.forElementSubRegions< CellElementSubRegion >( regionNames, [&]( localIndex const, ElementSubRegionBase & subRegion ) { @@ -187,6 +186,25 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER this->setupCoupling( domain, dofManager ); } + virtual bool checkSequentialConvergence( int const & iter, + real64 const & time_n, + real64 const & dt, + DomainPartition & domain ) override + { + // always force outer loop for initialization + auto & subcycling = this->getNonlinearSolverParameters().m_subcyclingOption; + auto const subcycling_orig = subcycling; + if( m_performStressInitialization ) + subcycling = 1; + + bool isConverged = Base::checkSequentialConvergence( iter, time_n, dt, domain ); + + // restore original + subcycling = subcycling_orig; + + return isConverged; + } + /** * @brief accessor for the pointer to the solid mechanics solver * @return a pointer to the solid mechanics solver @@ -371,7 +389,8 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER } /// After the solid mechanics solver - if( solverType == static_cast< integer >( SolverType::SolidMechanics ) ) + if( solverType == static_cast< integer >( SolverType::SolidMechanics ) + && !m_performStressInitialization ) // do not update during poromechanics initialization { // compute the average of the mean total stress increment over quadrature points averageMeanTotalStressIncrement( domain ); @@ -387,6 +406,8 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER // update the porosity after a change in displacement (after mechanics solve) // or a change in pressure/temperature (after a flow solve) flowSolver()->updatePorosityAndPermeability( subRegion ); + // update bulk density to reflect porosity change into mechanics + updateBulkDensity( subRegion ); } ); } ); } diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp index d21eef612ae..445661f7daf 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanics.cpp @@ -223,6 +223,7 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleElementB localRhs, dt, flowDofKey, + this->m_performStressInitialization, FlowSolverBase::viewKeyStruct::fluidNamesString() ); } else @@ -237,6 +238,7 @@ void SinglePhasePoromechanics< FLOW_SOLVER, MECHANICS_SOLVER >::assembleElementB localRhs, dt, flowDofKey, + this->m_performStressInitialization, FlowSolverBase::viewKeyStruct::fluidNamesString() ); } } ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp index d1ae968c6b0..0c215c0db50 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsConformingFractures.cpp @@ -191,9 +191,6 @@ void SinglePhasePoromechanicsConformingFractures::assembleElementBasedContributi /// 3. assemble Force Residual w.r.t. pressure and Flow mass residual w.r.t. displacement Base::assembleElementBasedTerms( time_n, dt, domain, dofManager, localMatrix, localRhs ); - this->solidMechanicsSolver()->getMaxForce() = 0.0; - /// TODO: this is to be consistent with old version but it should be changed. We likely want to scale the residual for contact the same - /// way we scale the mechanics one. // Flow accumulation for fractures forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, @@ -390,6 +387,8 @@ void SinglePhasePoromechanicsConformingFractures:: arrayView1d< globalIndex const > const & presDofNumber = fractureSubRegion.getReference< globalIndex_array >( presDofKey ); + globalIndex const rankOffset = dofManager.rankOffset(); + ArrayOfArraysView< localIndex const > const & elemsToFaces = fractureSubRegion.faceList().toViewConst(); stabilizationMethod.forStencils< SurfaceElementStencil >( mesh, [&]( SurfaceElementStencil const & stencil ) @@ -407,7 +406,7 @@ void SinglePhasePoromechanicsConformingFractures:: for( localIndex kf = 0; kf < 2; ++kf ) { // Set row DOF index - globalIndex const rowIndex = presDofNumber[sei[iconn][1-kf]]; + globalIndex const rowIndex = presDofNumber[sei[iconn][1-kf]] - rankOffset; if( rowIndex > 0 && rowIndex < pattern.numRows() ) { @@ -706,26 +705,6 @@ void SinglePhasePoromechanicsConformingFractures::updateState( DomainPartition & // update the stencil weights using the updated hydraulic aperture flowSolver()->updateStencilWeights( domain ); - - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) - { - ElementRegionManager & elemManager = mesh.getElemManager(); - - elemManager.forElementSubRegions< FaceElementSubRegion >( regionNames, - [&]( localIndex const, - FaceElementSubRegion & subRegion ) - { - // update fluid model - flowSolver()->updateFluidState( subRegion ); - if( m_isThermal ) - { - // update solid internal energy - flowSolver()->updateSolidInternalEnergyModel( subRegion ); - } - } ); - } ); } void SinglePhasePoromechanicsConformingFractures::updateHydraulicApertureAndFracturePermeability( DomainPartition & domain ) diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index 5d890ad3003..74413953f66 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -50,9 +50,19 @@ SinglePhasePoromechanicsEmbeddedFractures::SinglePhasePoromechanicsEmbeddedFract SinglePhasePoromechanicsEmbeddedFractures::~SinglePhasePoromechanicsEmbeddedFractures() {} +void SinglePhasePoromechanicsEmbeddedFractures::postProcessInput() +{ + Base::postProcessInput(); + + GEOS_ERROR_IF( solidMechanicsSolver()->useStaticCondensation(), + GEOS_FMT( "{}: {} = 1 in {} solver named {} is not supported for {}", + this->getName(), SolidMechanicsEmbeddedFractures::viewKeyStruct::useStaticCondensationString(), + solidMechanicsSolver()->getCatalogName(), solidMechanicsSolver()->getName(), getCatalogName() )); +} + void SinglePhasePoromechanicsEmbeddedFractures::registerDataOnMesh( dataRepository::Group & meshBodies ) { - SinglePhasePoromechanics::registerDataOnMesh( meshBodies ); + Base::registerDataOnMesh( meshBodies ); forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, MeshLevel & mesh, @@ -69,7 +79,7 @@ void SinglePhasePoromechanicsEmbeddedFractures::registerDataOnMesh( dataReposito void SinglePhasePoromechanicsEmbeddedFractures::initializePostInitialConditionsPreSubGroups() { - SinglePhasePoromechanics::initializePostInitialConditionsPreSubGroups(); + Base::initializePostInitialConditionsPreSubGroups(); updateState( this->getGroupByPath< DomainPartition >( "/Problem/domain" ) ); } @@ -406,7 +416,7 @@ void SinglePhasePoromechanicsEmbeddedFractures::assembleSystem( real64 const tim thermoPoromechanicsEFEMKernels::ThermalSinglePhasePoromechanicsEFEMKernelFactory >( mesh, dofManager, regionNames, - SinglePhasePoromechanics::viewKeyStruct::porousMaterialNamesString(), + Base::viewKeyStruct::porousMaterialNamesString(), localMatrix, localRhs, dt ); @@ -419,7 +429,7 @@ void SinglePhasePoromechanicsEmbeddedFractures::assembleSystem( real64 const tim poromechanicsEFEMKernels::SinglePhaseKernelFactory >( mesh, dofManager, regionNames, - SinglePhasePoromechanics::viewKeyStruct::porousMaterialNamesString(), + Base::viewKeyStruct::porousMaterialNamesString(), localMatrix, localRhs, dt ); @@ -438,84 +448,12 @@ void SinglePhasePoromechanicsEmbeddedFractures::assembleSystem( real64 const tim } -void SinglePhasePoromechanicsEmbeddedFractures::applyBoundaryConditions( real64 const time_n, - real64 const dt, - DomainPartition & domain, - DofManager const & dofManager, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) -{ - solidMechanicsSolver()->applyBoundaryConditions( time_n, dt, - domain, - dofManager, - localMatrix, - localRhs ); - - flowSolver()->applyBoundaryConditions( time_n, dt, - domain, - dofManager, - localMatrix, - localRhs ); -} - -void SinglePhasePoromechanicsEmbeddedFractures::implicitStepSetup( real64 const & time_n, - real64 const & dt, - DomainPartition & domain ) -{ - flowSolver()->implicitStepSetup( time_n, dt, domain ); - solidMechanicsSolver()->implicitStepSetup( time_n, dt, domain ); -} - -void SinglePhasePoromechanicsEmbeddedFractures::implicitStepComplete( real64 const & time_n, - real64 const & dt, - DomainPartition & domain ) -{ - solidMechanicsSolver()->implicitStepComplete( time_n, dt, domain ); - flowSolver()->implicitStepComplete( time_n, dt, domain ); -} - -void SinglePhasePoromechanicsEmbeddedFractures::resetStateToBeginningOfStep( DomainPartition & domain ) -{ - flowSolver()->resetStateToBeginningOfStep( domain ); - solidMechanicsSolver()->resetStateToBeginningOfStep( domain ); -} - - -real64 SinglePhasePoromechanicsEmbeddedFractures::calculateResidualNorm( real64 const & time_n, - real64 const & dt, - DomainPartition const & domain, - DofManager const & dofManager, - arrayView1d< real64 const > const & localRhs ) -{ - // compute norm of momentum balance residual equations - real64 const momentumResidualNorm = solidMechanicsSolver()->calculateResidualNorm( time_n, dt, domain, dofManager, localRhs ); - - // compute norm of mass balance residual equations - real64 const massResidualNorm = flowSolver()->calculateResidualNorm( time_n, dt, domain, dofManager, localRhs ); - - real64 const residual = sqrt( momentumResidualNorm * momentumResidualNorm + massResidualNorm * massResidualNorm ); - - return residual; -} - -void SinglePhasePoromechanicsEmbeddedFractures::applySystemSolution( DofManager const & dofManager, - arrayView1d< real64 const > const & localSolution, - real64 const scalingFactor, - real64 const dt, - DomainPartition & domain ) -{ - // update displacement and jump - solidMechanicsSolver()->applySystemSolution( dofManager, localSolution, scalingFactor, dt, domain ); - // update pressure field - flowSolver()->applySystemSolution( dofManager, localSolution, scalingFactor, dt, domain ); -} - void SinglePhasePoromechanicsEmbeddedFractures::updateState( DomainPartition & domain ) { GEOS_MARK_FUNCTION; /// 1. update the reservoir - SinglePhasePoromechanics::updateState( domain ); + Base::updateState( domain ); // remove the contribution of the hydraulic aperture from the stencil weights flowSolver()->prepareStencilWeights( domain ); diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp index e34b3289a7a..f33efce4a10 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.hpp @@ -29,6 +29,9 @@ namespace geos class SinglePhasePoromechanicsEmbeddedFractures : public SinglePhasePoromechanics< SinglePhaseBase, SolidMechanicsEmbeddedFractures > { public: + + using Base = SinglePhasePoromechanics< SinglePhaseBase, SolidMechanicsEmbeddedFractures >; + SinglePhasePoromechanicsEmbeddedFractures( const std::string & name, Group * const parent ); ~SinglePhasePoromechanicsEmbeddedFractures() override; @@ -38,7 +41,7 @@ class SinglePhasePoromechanicsEmbeddedFractures : public SinglePhasePoromechanic * @return string that contains the catalog name to generate a new SinglePhasePoromechanicsEmbeddedFractures object through the object * catalog. */ - static string catalogName() { return "SinglePhasePoromechanicsEmbeddedFractures"; } + static string catalogName() { return Base::catalogName() + "EmbeddedFractures"; } /** * @copydoc SolverBase::getCatalogName() */ @@ -57,11 +60,6 @@ class SinglePhasePoromechanicsEmbeddedFractures : public SinglePhasePoromechanic setupDofs( DomainPartition const & domain, DofManager & dofManager ) const override; - virtual void - implicitStepSetup( real64 const & time_n, - real64 const & dt, - DomainPartition & domain ) override final; - virtual void assembleSystem( real64 const time, real64 const dt, @@ -70,36 +68,6 @@ class SinglePhasePoromechanicsEmbeddedFractures : public SinglePhasePoromechanic CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ) override; - virtual void - applyBoundaryConditions( real64 const time_n, - real64 const dt, - DomainPartition & domain, - DofManager const & dofManager, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs ) override; - - virtual real64 - calculateResidualNorm( real64 const & time_n, - real64 const & dt, - DomainPartition const & domain, - DofManager const & dofManager, - arrayView1d< real64 const > const & localRhs ) override; - - virtual void - applySystemSolution( DofManager const & dofManager, - arrayView1d< real64 const > const & localSolution, - real64 const scalingFactor, - real64 const dt, - DomainPartition & domain ) override; - - virtual void - implicitStepComplete( real64 const & time_n, - real64 const & dt, - DomainPartition & domain ) override final; - - virtual void - resetStateToBeginningOfStep( DomainPartition & domain ) override; - /** * @Brief add extra nnz to each row induced by the coupling * @param domain the physical domain object @@ -132,6 +100,8 @@ class SinglePhasePoromechanicsEmbeddedFractures : public SinglePhasePoromechanic protected: + virtual void postProcessInput() override final; + virtual void initializePostInitialConditionsPreSubGroups() override final; private: @@ -185,6 +155,7 @@ real64 SinglePhasePoromechanicsEmbeddedFractures::assemblyLaunch( MeshLevel & me dt, gravityVectorData, flowDofKey, + m_performStressInitialization, FlowSolverBase::viewKeyStruct::fluidNamesString() ); real64 const maxForce = diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp index ef7315a6c95..2d1c5057c85 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.hpp @@ -82,7 +82,7 @@ class SinglePhaseReservoirAndWells : public CoupledReservoirAndWellsBase< SINGLE void keepFlowVariablesConstantDuringInitStep( bool const keepFlowVariablesConstantDuringInitStep ) { flowSolver()->keepFlowVariablesConstantDuringInitStep( keepFlowVariablesConstantDuringInitStep ); } - void updateFluidState( ObjectManagerBase & subRegion ) const + void updateFluidState( ElementSubRegionBase & subRegion ) const { flowSolver()->updateFluidState( subRegion ); } void updatePorosityAndPermeability( CellElementSubRegion & subRegion ) const { flowSolver()->updatePorosityAndPermeability( subRegion ); } @@ -93,7 +93,7 @@ class SinglePhaseReservoirAndWells : public CoupledReservoirAndWellsBase< SINGLE void enableFixedStressPoromechanicsUpdate() { flowSolver()->enableFixedStressPoromechanicsUpdate(); } - virtual void saveSequentialIterationState( DomainPartition & domain ) const override { flowSolver()->saveSequentialIterationState( domain ); } + virtual void saveSequentialIterationState( DomainPartition & domain ) override { flowSolver()->saveSequentialIterationState( domain ); } protected: diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics.hpp index 0367fb42b67..c6dabc3a35a 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics.hpp @@ -102,6 +102,7 @@ class MultiphasePoromechanics : localIndex const numPhases, integer const useSimpleAccumulation, integer const useTotalMassEquation, + integer const performStressInitialization, string const fluidModelKey ); //***************************************************************************** @@ -354,6 +355,8 @@ class MultiphasePoromechanics : /// Use total mass equation flag integer const m_useTotalMassEquation; + + integer const m_performStressInitialization; }; using MultiphasePoromechanicsKernelFactory = @@ -369,6 +372,7 @@ using MultiphasePoromechanicsKernelFactory = localIndex const, integer const, integer const, + integer const, string const >; /** diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp index 5669a9631e9..b7104c38fb8 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/MultiphasePoromechanics_impl.hpp @@ -54,6 +54,7 @@ MultiphasePoromechanics( NodeManager const & nodeManager, localIndex const numPhases, integer const useSimpleAccumulation, integer const useTotalMassEquation, + integer const performStressInitialization, string const fluidModelKey ): Base( nodeManager, edgeManager, @@ -79,7 +80,8 @@ MultiphasePoromechanics( NodeManager const & nodeManager, m_numComponents( numComponents ), m_numPhases( numPhases ), m_useSimpleAccumulation( useSimpleAccumulation ), - m_useTotalMassEquation( useTotalMassEquation ) + m_useTotalMassEquation( useTotalMassEquation ), + m_performStressInitialization( performStressInitialization ) { GEOS_ERROR_IF_GT_MSG( m_numComponents, maxNumComponents, "MultiphasePoromechanics solver allows at most " << @@ -152,9 +154,9 @@ smallStrainUpdate( localIndex const k, // Step 1: call the constitutive model to evaluate the total stress and compute porosity m_constitutiveUpdate.smallStrainUpdatePoromechanics( k, q, - m_pressure_n[k], - m_pressure[k], m_dt, + m_pressure[k], + m_pressure_n[k], stack.temperature, stack.deltaTemperatureFromLastStep, stack.strainIncrement, @@ -162,6 +164,7 @@ smallStrainUpdate( localIndex const k, stack.dTotalStress_dPressure, stack.dTotalStress_dTemperature, stack.stiffness, + m_performStressInitialization, porosity, porosity_n, dPorosity_dVolStrain, diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics.hpp index c286c6dff8c..f8902f25f4e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics.hpp @@ -94,6 +94,7 @@ class SinglePhasePoromechanics : real64 const inputDt, real64 const (&gravityVector)[3], string const inputFlowDofKey, + integer const performStressInitialization, string const fluidModelKey ); //***************************************************************************** @@ -257,6 +258,7 @@ class SinglePhasePoromechanics : /// Derivative of fluid density wrt pressure arrayView2d< real64 const > const m_dFluidDensity_dPressure; + integer const m_performStressInitialization; }; using SinglePhasePoromechanicsKernelFactory = @@ -268,10 +270,11 @@ using SinglePhasePoromechanicsKernelFactory = real64 const, real64 const (&)[3], string const, + integer const, string const >; /** - * @class BulkDensityKernel + * @class SinglePhaseBulkDensityKernel * @brief Kernel to update the bulk density before a mechanics solve in sequential schemes */ class SinglePhaseBulkDensityKernel diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics_impl.hpp index 6ce167b97d9..e76c112220a 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/SinglePhasePoromechanics_impl.hpp @@ -50,6 +50,7 @@ SinglePhasePoromechanics( NodeManager const & nodeManager, real64 const inputDt, real64 const (&gravityVector)[3], string const inputFlowDofKey, + integer const performStressInitialization, string const fluidModelKey ): Base( nodeManager, edgeManager, @@ -68,7 +69,8 @@ SinglePhasePoromechanics( NodeManager const & nodeManager, fluidModelKey ), m_fluidDensity( elementSubRegion.template getConstitutiveModel< constitutive::SingleFluidBase >( elementSubRegion.template getReference< string >( fluidModelKey ) ).density() ), m_fluidDensity_n( elementSubRegion.template getConstitutiveModel< constitutive::SingleFluidBase >( elementSubRegion.template getReference< string >( fluidModelKey ) ).density_n() ), - m_dFluidDensity_dPressure( elementSubRegion.template getConstitutiveModel< constitutive::SingleFluidBase >( elementSubRegion.template getReference< string >( fluidModelKey ) ).dDensity_dPressure() ) + m_dFluidDensity_dPressure( elementSubRegion.template getConstitutiveModel< constitutive::SingleFluidBase >( elementSubRegion.template getReference< string >( fluidModelKey ) ).dDensity_dPressure() ), + m_performStressInitialization( performStressInitialization ) {} template< typename SUBREGION_TYPE, @@ -90,9 +92,9 @@ smallStrainUpdate( localIndex const k, // Step 1: call the constitutive model to evaluate the total stress and compute porosity m_constitutiveUpdate.smallStrainUpdatePoromechanics( k, q, - m_pressure_n[k], - m_pressure[k], m_dt, + m_pressure[k], + m_pressure_n[k], stack.temperature, stack.deltaTemperatureFromLastStep, stack.strainIncrement, @@ -100,6 +102,7 @@ smallStrainUpdate( localIndex const k, stack.dTotalStress_dPressure, stack.dTotalStress_dTemperature, stack.stiffness, + m_performStressInitialization, porosity, porosity_n, dPorosity_dVolStrain, diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics.hpp index 5c60e6820da..62833506841 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics.hpp @@ -76,6 +76,7 @@ class ThermalMultiphasePoromechanics : using Base::m_numComponents; using Base::m_numPhases; using Base::m_useTotalMassEquation; + using Base::m_performStressInitialization; using Base::m_solidDensity; using Base::m_fluidPhaseMassDensity; using Base::m_dFluidPhaseMassDensity; @@ -110,6 +111,7 @@ class ThermalMultiphasePoromechanics : localIndex const numComponents, localIndex const numPhases, integer const useTotalMassEquation, + integer const performStressInitialization, string const fluidModelKey ); /** @@ -341,6 +343,7 @@ using ThermalMultiphasePoromechanicsKernelFactory = localIndex const, localIndex const, integer const, + integer const, string const >; } // namespace thermalporomechanicsKernels diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp index 23409cf5db3..fe18bd5f75c 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalMultiphasePoromechanics_impl.hpp @@ -52,6 +52,7 @@ ThermalMultiphasePoromechanics( NodeManager const & nodeManager, localIndex const numComponents, localIndex const numPhases, integer const useTotalMassEquation, + integer const performStressInitialization, string const fluidModelKey ): Base( nodeManager, edgeManager, @@ -71,6 +72,7 @@ ThermalMultiphasePoromechanics( NodeManager const & nodeManager, numPhases, false, // do not use simple accumulation form useTotalMassEquation, + performStressInitialization, fluidModelKey ), m_rockInternalEnergy_n( inputConstitutiveType.getInternalEnergy_n() ), m_rockInternalEnergy( inputConstitutiveType.getInternalEnergy() ), @@ -127,9 +129,9 @@ smallStrainUpdate( localIndex const k, // Step 1: call the constitutive model to update the total stress, the porosity and their derivatives m_constitutiveUpdate.smallStrainUpdatePoromechanics( k, q, - m_pressure_n[k], - m_pressure[k], m_dt, + m_pressure[k], + m_pressure_n[k], stack.temperature, stack.deltaTemperatureFromLastStep, stack.strainIncrement, @@ -137,6 +139,7 @@ smallStrainUpdate( localIndex const k, stack.dTotalStress_dPressure, stack.dTotalStress_dTemperature, stack.stiffness, + m_performStressInitialization, porosity, porosity_n, dPorosity_dVolStrain, diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics.hpp index 5fe11040d59..178da2ea3bc 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics.hpp @@ -70,6 +70,7 @@ class ThermalSinglePhasePoromechanics : using Base::m_solidDensity; using Base::m_flowDofNumber; using Base::m_dt; + using Base::m_performStressInitialization; /** * @brief Constructor @@ -90,6 +91,7 @@ class ThermalSinglePhasePoromechanics : real64 const inputDt, real64 const (&gravityVector)[3], string const inputFlowDofKey, + integer const performStressInitialization, string const fluidModelKey ); //***************************************************************************** @@ -305,6 +307,7 @@ using ThermalSinglePhasePoromechanicsKernelFactory = real64 const, real64 const (&)[3], string const, + integer const, string const >; } // namespace thermalPoromechanicsKernels diff --git a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics_impl.hpp index 4974aa6fd27..76584fb52dd 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/poromechanicsKernels/ThermalSinglePhasePoromechanics_impl.hpp @@ -46,6 +46,7 @@ ThermalSinglePhasePoromechanics( NodeManager const & nodeManager, real64 const inputDt, real64 const (&gravityVector)[3], string const inputFlowDofKey, + integer const performStressInitialization, string const fluidModelKey ): Base( nodeManager, edgeManager, @@ -61,6 +62,7 @@ ThermalSinglePhasePoromechanics( NodeManager const & nodeManager, inputDt, gravityVector, inputFlowDofKey, + performStressInitialization, fluidModelKey ), m_dFluidDensity_dTemperature( elementSubRegion.template getConstitutiveModel< constitutive::SingleFluidBase >( elementSubRegion.template getReference< string >( fluidModelKey ) ).dDensity_dTemperature() ), @@ -111,9 +113,9 @@ smallStrainUpdate( localIndex const k, // Step 1: call the constitutive model to evaluate the total stress and compute porosity m_constitutiveUpdate.smallStrainUpdatePoromechanics( k, q, - m_pressure_n[k], - m_pressure[k], m_dt, + m_pressure[k], + m_pressure_n[k], stack.temperature, stack.deltaTemperatureFromLastStep, stack.strainIncrement, @@ -121,6 +123,7 @@ smallStrainUpdate( localIndex const k, stack.dTotalStress_dPressure, stack.dTotalStress_dTemperature, stack.stiffness, + m_performStressInitialization, porosity, porosity_n, dPorosity_dVolStrain, diff --git a/src/coreComponents/physicsSolvers/python/PySolver.cpp b/src/coreComponents/physicsSolvers/python/PySolver.cpp index b4feca82892..8e9cdf0438d 100644 --- a/src/coreComponents/physicsSolvers/python/PySolver.cpp +++ b/src/coreComponents/physicsSolvers/python/PySolver.cpp @@ -5,6 +5,7 @@ #include "PySolver.hpp" #include "dataRepository/python/PyGroupType.hpp" #include "PySolverType.hpp" +#include "mesh/DomainPartition.hpp" #define VERIFY_NON_NULL_SELF( self ) \ PYTHON_ERROR_IF( self == nullptr, PyExc_RuntimeError, "Passed a nullptr as self.", nullptr ) diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp index 75818129611..d314092bebc 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.cpp @@ -645,7 +645,7 @@ void PhaseFieldDamageFEM::applyIrreversibilityConstraint( DofManager const & dof } ); } -void PhaseFieldDamageFEM::saveSequentialIterationState( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) const +void PhaseFieldDamageFEM::saveSequentialIterationState( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) { // nothing to save yet } diff --git a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.hpp b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.hpp index 6c623e73fe3..a38c1ad3d79 100644 --- a/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.hpp +++ b/src/coreComponents/physicsSolvers/simplePDE/PhaseFieldDamageFEM.hpp @@ -131,7 +131,7 @@ class PhaseFieldDamageFEM : public SolverBase CRSMatrixView< real64, globalIndex const > const & localMatrix, arrayView1d< real64 > const & localRhs ); - virtual void saveSequentialIterationState( DomainPartition & domain ) const override; + virtual void saveSequentialIterationState( DomainPartition & domain ) override; enum class TimeIntegrationOption { diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 591d2e03f33..92faf16b5b5 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -142,12 +142,18 @@ SolidMechanicsLagrangianFEM::~SolidMechanicsLagrangianFEM() void SolidMechanicsLagrangianFEM::registerDataOnMesh( Group & meshBodies ) { - SolverBase::registerDataOnMesh( meshBodies ); - forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, MeshLevel & meshLevel, arrayView1d< string const > const & regionNames ) { + ElementRegionManager & elemManager = meshLevel.getElemManager(); + elemManager.forElementSubRegions< CellElementSubRegion >( regionNames, + [&]( localIndex const, + ElementSubRegionBase & subRegion ) + { + setConstitutiveNamesCallSuper( subRegion ); + } ); + NodeManager & nodes = meshLevel.getNodeManager(); nodes.registerField< solidMechanics::totalDisplacement >( getName() ). @@ -228,12 +234,6 @@ void SolidMechanicsLagrangianFEM::setConstitutiveNamesCallSuper( ElementSubRegio } -void SolidMechanicsLagrangianFEM::setConstitutiveNames( ElementSubRegionBase & subRegion ) const -{ - GEOS_UNUSED_VAR( subRegion ); -} - - void SolidMechanicsLagrangianFEM::initializePreSubGroups() { SolverBase::initializePreSubGroups(); @@ -1022,42 +1022,97 @@ void SolidMechanicsLagrangianFEM::assembleSystem( real64 const GEOS_UNUSED_PARAM localMatrix.zero(); localRhs.zero(); - if( m_isFixedStressPoromechanicsUpdate ) - { - //GEOS_UNUSED_VAR( dt ); - assemblyLaunch< constitutive::PorousSolid< ElasticIsotropic >, // TODO: change once there is a cmake solution - solidMechanicsLagrangianFEMKernels::FixedStressThermoPoromechanicsFactory >( domain, - dofManager, - localMatrix, - localRhs, - dt ); - } - else + forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, + MeshLevel & mesh, + arrayView1d< string const > const & regionNames ) { - if( m_timeIntegrationOption == TimeIntegrationOption::QuasiStatic ) + if( m_isFixedStressPoromechanicsUpdate ) { - //GEOS_UNUSED_VAR( dt ); - assemblyLaunch< constitutive::SolidBase, - solidMechanicsLagrangianFEMKernels::QuasiStaticFactory >( domain, - dofManager, - localMatrix, - localRhs, - dt ); + set< string > poromechanicsRegions; + set< string > mechanicsRegions; + ElementRegionManager const & elementRegionManager = mesh.getElemManager(); + elementRegionManager.forElementSubRegions< CellElementSubRegion >( regionNames, + [&] + ( localIndex const regionIndex, auto & elementSubRegion ) + { + if( elementSubRegion.template hasWrapper< string >( FlowSolverBase::viewKeyStruct::solidNamesString() ) ) + { + poromechanicsRegions.insert( regionNames[regionIndex] ); + } + else + { + mechanicsRegions.insert( regionNames[regionIndex] ); + } + } ); + + array1d< string > poromechanicsRegionNames; + poromechanicsRegionNames.reserve( poromechanicsRegions.size()); + for( auto const & region : poromechanicsRegions ) + { + poromechanicsRegionNames.emplace_back( region ); + } + array1d< string > mechanicsRegionNames; + mechanicsRegionNames.reserve( mechanicsRegions.size()); + for( auto const & region : mechanicsRegions ) + { + mechanicsRegionNames.emplace_back( region ); + } + + // first pass for coupled poromechanics regions + real64 const poromechanicsMaxForce= assemblyLaunch< constitutive::PorousSolid< ElasticIsotropic >, // TODO: change once there is a + // cmake solution + solidMechanicsLagrangianFEMKernels::FixedStressThermoPoromechanicsFactory >( mesh, + dofManager, + poromechanicsRegionNames, + FlowSolverBase::viewKeyStruct::solidNamesString(), + localMatrix, + localRhs, + dt ); + // second pass for pure mechanics regions + real64 const mechanicsMaxForce = assemblyLaunch< constitutive::SolidBase, + solidMechanicsLagrangianFEMKernels::QuasiStaticFactory >( mesh, + dofManager, + mechanicsRegionNames, + viewKeyStruct::solidMaterialNamesString(), + localMatrix, + localRhs, + dt ); + + m_maxForce = LvArray::math::max( mechanicsMaxForce, poromechanicsMaxForce ); } - else if( m_timeIntegrationOption == TimeIntegrationOption::ImplicitDynamic ) + else { - assemblyLaunch< constitutive::SolidBase, - solidMechanicsLagrangianFEMKernels::ImplicitNewmarkFactory >( domain, - dofManager, - localMatrix, - localRhs, - dt, - m_newmarkGamma, - m_newmarkBeta, - m_massDamping, - m_stiffnessDamping ); + if( m_timeIntegrationOption == TimeIntegrationOption::QuasiStatic ) + { + m_maxForce = assemblyLaunch< constitutive::SolidBase, + solidMechanicsLagrangianFEMKernels::QuasiStaticFactory >( mesh, + dofManager, + regionNames, + viewKeyStruct::solidMaterialNamesString(), + localMatrix, + localRhs, + dt ); + } + else if( m_timeIntegrationOption == TimeIntegrationOption::ImplicitDynamic ) + { + m_maxForce = assemblyLaunch< constitutive::SolidBase, + solidMechanicsLagrangianFEMKernels::ImplicitNewmarkFactory >( mesh, + dofManager, + regionNames, + viewKeyStruct::solidMaterialNamesString(), + localMatrix, + localRhs, + dt, + m_newmarkGamma, + m_newmarkBeta, + m_massDamping, + m_stiffnessDamping ); + } } - } + } ); + + applyContactConstraint( dofManager, domain, localMatrix, localRhs ); + } void @@ -1157,7 +1212,7 @@ SolidMechanicsLagrangianFEM:: } } } ); - real64 const localResidualNorm[2] = { localSum.get(), this->m_maxForce }; + real64 const localResidualNorm[2] = { localSum.get(), m_maxForce }; // globalResidualNorm[0]: the sum of all the local sum(rhs^2). // globalResidualNorm[1]: max of max force of each rank. Basically max force globally @@ -1393,7 +1448,7 @@ void SolidMechanicsLagrangianFEM::enableFixedStressPoromechanicsUpdate() m_isFixedStressPoromechanicsUpdate = true; } -void SolidMechanicsLagrangianFEM::saveSequentialIterationState( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) const +void SolidMechanicsLagrangianFEM::saveSequentialIterationState( DomainPartition & GEOS_UNUSED_PARAM( domain ) ) { // nothing to save } diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp index b2b9e676b1f..d7bf9af216b 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp @@ -172,12 +172,14 @@ class SolidMechanicsLagrangianFEM : public SolverBase template< typename CONSTITUTIVE_BASE, typename KERNEL_WRAPPER, typename ... PARAMS > - void assemblyLaunch( DomainPartition & domain, - DofManager const & dofManager, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs, - real64 const dt, - PARAMS && ... params ); + real64 assemblyLaunch( MeshLevel & mesh, + DofManager const & dofManager, + arrayView1d< string const > const & regionNames, + string const & materialNamesString, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs, + real64 const dt, + PARAMS && ... params ); template< typename ... PARAMS > @@ -224,7 +226,7 @@ class SolidMechanicsLagrangianFEM : public SolverBase void enableFixedStressPoromechanicsUpdate(); - virtual void saveSequentialIterationState( DomainPartition & domain ) const override; + virtual void saveSequentialIterationState( DomainPartition & domain ) override; struct viewKeyStruct : SolverBase::viewKeyStruct { @@ -293,7 +295,6 @@ class SolidMechanicsLagrangianFEM : public SolverBase array1d< ParallelVector > m_rigidBodyModes; private: - virtual void setConstitutiveNames( ElementSubRegionBase & subRegion ) const override; string m_contactRelationName; @@ -314,59 +315,41 @@ ENUM_STRINGS( SolidMechanicsLagrangianFEM::TimeIntegrationOption, template< typename CONSTITUTIVE_BASE, typename KERNEL_WRAPPER, typename ... PARAMS > -void SolidMechanicsLagrangianFEM::assemblyLaunch( DomainPartition & domain, - DofManager const & dofManager, - CRSMatrixView< real64, globalIndex const > const & localMatrix, - arrayView1d< real64 > const & localRhs, - real64 const dt, - PARAMS && ... params ) +real64 SolidMechanicsLagrangianFEM::assemblyLaunch( MeshLevel & mesh, + DofManager const & dofManager, + arrayView1d< string const > const & regionNames, + string const & materialNamesString, + CRSMatrixView< real64, globalIndex const > const & localMatrix, + arrayView1d< real64 > const & localRhs, + real64 const dt, + PARAMS && ... params ) { GEOS_MARK_FUNCTION; - forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, - MeshLevel & mesh, - arrayView1d< string const > const & regionNames ) - { - NodeManager const & nodeManager = mesh.getNodeManager(); - - string const dofKey = dofManager.getKey( fields::solidMechanics::totalDisplacement::key() ); - arrayView1d< globalIndex const > const & dofNumber = nodeManager.getReference< globalIndex_array >( dofKey ); - - real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); - - KERNEL_WRAPPER kernelWrapper( dofNumber, - dofManager.rankOffset(), - localMatrix, - localRhs, - dt, - gravityVectorData, - std::forward< PARAMS >( params )... ); - - if( m_isFixedStressPoromechanicsUpdate ) - { - m_maxForce = finiteElement:: - regionBasedKernelApplication< parallelDevicePolicy< >, - CONSTITUTIVE_BASE, - CellElementSubRegion >( mesh, - regionNames, - this->getDiscretizationName(), - FlowSolverBase::viewKeyStruct::solidNamesString(), - kernelWrapper ); - } - else - { - m_maxForce = finiteElement:: - regionBasedKernelApplication< parallelDevicePolicy< >, - CONSTITUTIVE_BASE, - CellElementSubRegion >( mesh, - regionNames, - this->getDiscretizationName(), - viewKeyStruct::solidMaterialNamesString(), - kernelWrapper ); - } - } ); - - applyContactConstraint( dofManager, domain, localMatrix, localRhs ); + NodeManager const & nodeManager = mesh.getNodeManager(); + + string const dofKey = dofManager.getKey( fields::solidMechanics::totalDisplacement::key() ); + arrayView1d< globalIndex const > const & dofNumber = nodeManager.getReference< globalIndex_array >( dofKey ); + + real64 const gravityVectorData[3] = LVARRAY_TENSOROPS_INIT_LOCAL_3( gravityVector() ); + + KERNEL_WRAPPER kernelWrapper( dofNumber, + dofManager.rankOffset(), + localMatrix, + localRhs, + dt, + gravityVectorData, + std::forward< PARAMS >( params )... ); + + return finiteElement:: + regionBasedKernelApplication< parallelDevicePolicy< >, + CONSTITUTIVE_BASE, + CellElementSubRegion >( mesh, + regionNames, + this->getDiscretizationName(), + materialNamesString, + kernelWrapper ); + } } /* namespace geos */ diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp index 96179dd8a5c..f77dd4fd535 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp @@ -21,6 +21,7 @@ #include "physicsSolvers/PhysicsSolverManager.hpp" #include "physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp" #include "mainInterface/ProblemManager.hpp" +#include "mesh/DomainPartition.hpp" namespace geos { diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp index ec97b4bc55d..855fb547a3f 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.cpp @@ -23,6 +23,7 @@ #include "physicsSolvers/PhysicsSolverManager.hpp" #include "physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp" #include "fileIO/Outputs/OutputBase.hpp" +#include "mesh/DomainPartition.hpp" namespace geos { diff --git a/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics.hpp b/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics.hpp index 769352f8dce..2153171412c 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics.hpp @@ -188,19 +188,19 @@ class FixedStressThermoPoromechanics : /// The gravity vector. real64 const m_gravityVector[3]; - /// The rank global bulk densities + /// The rank global bulk density arrayView2d< real64 const > const m_bulkDensity; /// The rank-global fluid pressure arrays. - arrayView1d< real64 const > const m_pressure_n; arrayView1d< real64 const > const m_pressure; + arrayView1d< real64 const > const m_pressure_n; /// The rank-global initial temperature array arrayView1d< real64 const > const m_initialTemperature; /// The rank-global temperature arrays. - arrayView1d< real64 const > const m_temperature_n; arrayView1d< real64 const > const m_temperature; + arrayView1d< real64 const > const m_temperature_n; /** * @brief Get a parameter representative of the stiffness, used as physical scaling for the diff --git a/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics_impl.hpp b/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics_impl.hpp index ac62e023320..52d876b2af0 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics_impl.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/kernels/FixedStressThermoPoromechanics_impl.hpp @@ -65,11 +65,11 @@ FixedStressThermoPoromechanics( NodeManager const & nodeManager, m_uhat( nodeManager.getField< fields::solidMechanics::incrementalDisplacement >() ), m_gravityVector{ inputGravityVector[0], inputGravityVector[1], inputGravityVector[2] }, m_bulkDensity( elementSubRegion.template getField< fields::poromechanics::bulkDensity >() ), - m_pressure_n( elementSubRegion.template getField< fields::flow::pressure_n >() ), m_pressure( elementSubRegion.template getField< fields::flow::pressure >() ), + m_pressure_n( elementSubRegion.template getField< fields::flow::pressure_n >() ), m_initialTemperature( elementSubRegion.template getField< fields::flow::initialTemperature >() ), - m_temperature_n( elementSubRegion.template getField< fields::flow::temperature_n >() ), - m_temperature( elementSubRegion.template getField< fields::flow::temperature >() ) + m_temperature( elementSubRegion.template getField< fields::flow::temperature >() ), + m_temperature_n( elementSubRegion.template getField< fields::flow::temperature_n >() ) {} template< typename SUBREGION_TYPE, @@ -136,13 +136,12 @@ quadraturePointKernel( localIndex const k, // Evaluate total stress and its derivatives // TODO: allow for a customization of the kernel to pass the average pressure to the small strain update (to account for cap pressure // later) - m_constitutiveUpdate.smallStrainUpdatePoromechanicsFixedStress( k, - q, - m_pressure_n[k], - m_pressure[k], + m_constitutiveUpdate.smallStrainUpdatePoromechanicsFixedStress( k, q, m_dt, - m_temperature_n[k], + m_pressure[k], + m_pressure_n[k], m_temperature[k], + m_temperature_n[k], strainInc, totalStress, stiffness ); diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index 42e8639eab7..cae283b4241 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -453,7 +453,7 @@ void SurfaceGenerator::postRestartInitialization() FluxApproximationBase * const fluxApprox = fvManager.getGroupPointer< FluxApproximationBase >( a ); if( fluxApprox!=nullptr ) { - fluxApprox->addToFractureStencil( meshLevel, this->m_fractureRegionName, false ); + fluxApprox->addToFractureStencil( meshLevel, this->m_fractureRegionName ); } } @@ -508,13 +508,11 @@ real64 SurfaceGenerator::solverStep( real64 const & time_n, FluxApproximationBase * const fluxApprox = fvManager.getGroupPointer< FluxApproximationBase >( a ); if( fluxApprox!=nullptr ) { - fluxApprox->addToFractureStencil( meshLevel, this->m_fractureRegionName, true ); + fluxApprox->addToFractureStencil( meshLevel, this->m_fractureRegionName ); } } FaceElementSubRegion & fractureSubRegion = fractureRegion.getUniqueSubRegion< FaceElementSubRegion >(); - fractureSubRegion.m_recalculateConnectionsFor2dFaces.clear(); - fractureSubRegion.m_newFaceElements.clear(); // Recreate geometric sets meshLevel.getNodeManager().buildGeometricSets( GeometricObjectManager::getInstance() ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.cpp index 590cfd0f084..3686bc52d71 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.cpp @@ -18,7 +18,9 @@ #include "AcousticElasticWaveEquationSEM.hpp" #include "AcousticElasticWaveEquationSEMKernel.hpp" +#include "AcoustoElasticTimeSchemeSEMKernel.hpp" #include "dataRepository/Group.hpp" +#include "mesh/DomainPartition.hpp" #include #include @@ -67,7 +69,7 @@ void AcousticElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, - arrayView1d< string const > const & GEOS_UNUSED_PARAM( regionNames ) ) + arrayView1d< string const > const & ) { NodeManager & nodeManager = mesh.getNodeManager(); FaceManager & faceManager = mesh.getFaceManager(); @@ -76,6 +78,7 @@ void AcousticElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords = nodeManager.getField< fields::referencePosition32 >().toViewConst(); arrayView2d< real64 const > const faceNormals = faceManager.faceNormal().toViewConst(); + arrayView2d< real64 const > const faceCenters = faceManager.faceCenter().toViewConst(); ArrayOfArraysView< localIndex const > const faceToNode = faceManager.nodeList().toViewConst(); arrayView2d< localIndex const > const faceToSubRegion = faceManager.elementSubRegionList(); arrayView2d< localIndex const > const faceToRegion = faceManager.elementRegionList(); @@ -96,6 +99,7 @@ void AcousticElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups { finiteElement::FiniteElementBase const & fe = elementSubRegion.getReference< finiteElement::FiniteElementBase >( getDiscretizationName() ); + arrayView2d< real64 const > const elemCenters = elementSubRegion.getElementCenter().toViewConst(); finiteElement::FiniteElementDispatchHandler< SEM_FE_TYPES >::dispatch3D( fe, [&] ( auto const finiteElement ) { @@ -111,6 +115,8 @@ void AcousticElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups faceToElement, faceToNode, faceNormals, + faceCenters, + elemCenters, couplingVectorx, couplingVectory, couplingVectorz ); @@ -134,7 +140,7 @@ real64 AcousticElasticWaveEquationSEM::solverStep( real64 const & time_n, forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, - arrayView1d< string const > const & GEOS_UNUSED_PARAM( regionNames ) ) + arrayView1d< string const > const & ) { NodeManager & nodeManager = mesh.getNodeManager(); @@ -150,6 +156,7 @@ real64 AcousticElasticWaveEquationSEM::solverStep( real64 const & time_n, arrayView1d< real32 const > const ux_n = nodeManager.getField< elasticfields::Displacementx_n >(); arrayView1d< real32 const > const uy_n = nodeManager.getField< elasticfields::Displacementy_n >(); arrayView1d< real32 const > const uz_n = nodeManager.getField< elasticfields::Displacementz_n >(); + // acoutic -> elastic coupling vectors arrayView1d< real32 const > const atoex = nodeManager.getField< acoustoelasticfields::CouplingVectorx >(); arrayView1d< real32 const > const atoey = nodeManager.getField< acoustoelasticfields::CouplingVectory >(); arrayView1d< real32 const > const atoez = nodeManager.getField< acoustoelasticfields::CouplingVectorz >(); @@ -159,43 +166,28 @@ real64 AcousticElasticWaveEquationSEM::solverStep( real64 const & time_n, arrayView1d< real32 > const uy_np1 = nodeManager.getField< elasticfields::Displacementy_np1 >(); arrayView1d< real32 > const uz_np1 = nodeManager.getField< elasticfields::Displacementz_np1 >(); - real32 const dt2 = pow( dt, 2 ); - elasSolver->computeUnknowns( time_n, dt, cycleNumber, domain, mesh, m_elasRegions ); - forAll< EXEC_POLICY >( interfaceNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) - { - localIndex const a = interfaceNodesSet[n]; - if( elasticFSNodeIndicator[a] == 1 ) - return; - - real32 const aux = -p_n[a] / elasticMass[a]; - real32 const localIncrementx = dt2 * atoex[a] * aux; - real32 const localIncrementy = dt2 * atoey[a] * aux; - real32 const localIncrementz = dt2 * atoez[a] * aux; - - RAJA::atomicAdd< ATOMIC_POLICY >( &ux_np1[a], localIncrementx ); - RAJA::atomicAdd< ATOMIC_POLICY >( &uy_np1[a], localIncrementy ); - RAJA::atomicAdd< ATOMIC_POLICY >( &uz_np1[a], localIncrementz ); - } ); + AcoustoElasticTimeSchemeSEM::LeapFrog( dt, ux_np1, uy_np1, uz_np1, p_n, elasticMass, atoex, atoey, atoez, + elasticFSNodeIndicator, interfaceNodesSet ); elasSolver->synchronizeUnknowns( time_n, dt, cycleNumber, domain, mesh, m_elasRegions ); acousSolver->computeUnknowns( time_n, dt, cycleNumber, domain, mesh, m_acousRegions ); - forAll< EXEC_POLICY >( interfaceNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) + forAll< EXEC_POLICY >( interfaceNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const in ) { - localIndex const a = interfaceNodesSet[n]; - if( acousticFSNodeIndicator[a] == 1 ) + localIndex const n = interfaceNodesSet[in]; + if( acousticFSNodeIndicator[n] == 1 ) return; real32 const localIncrement = ( - atoex[a] * ( ux_np1[a] - 2.0 * ux_n[a] + ux_nm1[a] ) + - atoey[a] * ( uy_np1[a] - 2.0 * uy_n[a] + uy_nm1[a] ) + - atoez[a] * ( uz_np1[a] - 2.0 * uz_n[a] + uz_nm1[a] ) - ) / acousticMass[a]; + atoex[n] * ( ux_np1[n] - 2.0 * ux_n[n] + ux_nm1[n] ) + + atoey[n] * ( uy_np1[n] - 2.0 * uy_n[n] + uy_nm1[n] ) + + atoez[n] * ( uz_np1[n] - 2.0 * uz_n[n] + uz_nm1[n] ) + ) / acousticMass[n]; - RAJA::atomicAdd< ATOMIC_POLICY >( &p_np1[a], localIncrement ); + RAJA::atomicAdd< ATOMIC_POLICY >( &p_np1[n], localIncrement ); } ); acousSolver->synchronizeUnknowns( time_n, dt, cycleNumber, domain, mesh, m_acousRegions ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.hpp index ea72af060af..54e8a22a352 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEM.hpp @@ -140,8 +140,8 @@ class AcousticElasticWaveEquationSEM : public CoupledWaveSolver< AcousticWaveEqu string getCatalogName() const override { return catalogName(); } /** - * @brief accessor for the pointer to the solid mechanics solver - * @return a pointer to the solid mechanics solver + * @brief accessor for the pointer to the acoustic solver + * @return a pointer to the acoustic solver */ AcousticWaveEquationSEM * acousticSolver() const { @@ -149,8 +149,8 @@ class AcousticElasticWaveEquationSEM : public CoupledWaveSolver< AcousticWaveEqu } /** - * @brief accessor for the pointer to the flow solver - * @return a pointer to the flow solver + * @brief accessor for the pointer to the elastic solver + * @return a pointer to the elastic solver */ ElasticWaveEquationSEM * elasticSolver() const { diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEMKernel.hpp index 9c3e9f5fbdc..91c9ed8a99b 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEMKernel.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticElasticWaveEquationSEMKernel.hpp @@ -42,27 +42,32 @@ struct CouplingKernel launch( localIndex const size, arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - localIndex const regionIndex, - localIndex const subRegionIndex, + localIndex const fluidRegionIndex, + localIndex const fluidSubRegionIndex, arrayView2d< localIndex const > const faceToSubRegion, arrayView2d< localIndex const > const faceToRegion, arrayView2d< localIndex const > const faceToElement, ArrayOfArraysView< localIndex const > const facesToNodes, arrayView2d< real64 const > const faceNormals, + arrayView2d< real64 const > const faceCenters, + arrayView2d< real64 const > const elemCenters, arrayView1d< real32 > const couplingVectorx, arrayView1d< real32 > const couplingVectory, arrayView1d< real32 > const couplingVectorz ) { forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const f ) { - localIndex e0 = faceToElement( f, 0 ), e1 = faceToElement( f, 1 ); - localIndex er0 = faceToRegion( f, 0 ), er1 = faceToRegion( f, 1 ); - localIndex esr0 = faceToSubRegion( f, 0 ), esr1 = faceToSubRegion( f, 1 ); + localIndex const e0 = faceToElement( f, 0 ), e1 = faceToElement( f, 1 ); + localIndex const er0 = faceToRegion( f, 0 ), er1 = faceToRegion( f, 1 ); + localIndex const esr0 = faceToSubRegion( f, 0 ), esr1 = faceToSubRegion( f, 1 ); if( e0 != -1 && e1 != -1 && er0 != er1 ) // an interface is defined as a transition between regions { // check that one of the region is the fluid subregion for the fluid -> solid coupling term - if((er0 == regionIndex && esr0 == subRegionIndex) || (er1 == regionIndex && esr1 == subRegionIndex)) + bool const e0IsFluid = er0 == fluidRegionIndex && esr0 == fluidSubRegionIndex; + bool const e1IsFluid = er1 == fluidRegionIndex && esr1 == fluidSubRegionIndex; + + if( e0IsFluid != e1IsFluid ) // xor: a single element must be fluid { // only the four corners of the mesh face are needed to compute the Jacobian real64 xLocal[ 4 ][ 3 ]; @@ -75,16 +80,23 @@ struct CouplingKernel } } - // determine normal sign for fluid -> solid coupling - localIndex sgn = er0 == regionIndex ? 1 : (er1 == regionIndex ? -1 : 0); + real64 const nx = faceNormals( f, 0 ), ny = faceNormals( f, 1 ), nz = faceNormals( f, 2 ); + + // determine sign to get an outward pointing normal for the fluid -> solid coupling + localIndex const e = e0IsFluid ? e0 : (e1IsFluid ? e1 : -1); // fluid element + localIndex const sgn = ( + (faceCenters( f, 0 ) - elemCenters( e, 0 )) * nx + + (faceCenters( f, 1 ) - elemCenters( e, 1 )) * ny + + (faceCenters( f, 2 ) - elemCenters( e, 2 )) * nz + ) < 0 ? 1 : -1; for( localIndex q = 0; q < numNodesPerFace; ++q ) { real64 const aux = FE_TYPE::computeDampingTerm( q, xLocal ); - real32 const localIncrementx = aux * (sgn * faceNormals( f, 0 )); - real32 const localIncrementy = aux * (sgn * faceNormals( f, 1 )); - real32 const localIncrementz = aux * (sgn * faceNormals( f, 2 )); + real32 const localIncrementx = aux * (sgn * nx); + real32 const localIncrementy = aux * (sgn * ny); + real32 const localIncrementz = aux * (sgn * nz); RAJA::atomicAdd< ATOMIC_POLICY >( &couplingVectorx[facesToNodes( f, q )], localIncrementx ); RAJA::atomicAdd< ATOMIC_POLICY >( &couplingVectory[facesToNodes( f, q )], localIncrementy ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEM.cpp index 1ede25c9b42..39c8fdfad81 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEM.cpp @@ -26,6 +26,9 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/ElementType.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" +#include "events/EventManager.hpp" +#include "AcousticMatricesSEMKernel.hpp" +#include "PrecomputeSourcesAndReceiversKernel.hpp" namespace geos { @@ -211,9 +214,9 @@ void AcousticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLev localIndex const numFacesPerElem = elementSubRegion.numFacesPerElement(); - acousticFirstOrderWaveEquationSEMKernels:: - PrecomputeSourceAndReceiverKernel:: - launch< EXEC_POLICY, FE_TYPE > + PreComputeSourcesAndReceivers:: + Compute1DSourceAndReceiverConstantsWithElementsAndRegionStorage + < EXEC_POLICY, FE_TYPE > ( elementSubRegion.size(), regionIndex, numFacesPerElem, @@ -265,7 +268,7 @@ void AcousticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGro /// get the array of indicators: 1 if the face is on the boundary; 0 otherwise arrayView1d< integer const > const & facesDomainBoundaryIndicator = faceManager.getDomainBoundaryIndicator(); - arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const X = nodeManager.getField< fields::referencePosition32 >().toViewConst(); + arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords = nodeManager.getField< fields::referencePosition32 >().toViewConst(); /// get table containing face to nodes map ArrayOfArraysView< localIndex const > const facesToNodes = faceManager.nodeList().toViewConst(); @@ -295,25 +298,26 @@ void AcousticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGro { using FE_TYPE = TYPEOFREF( finiteElement ); - acousticFirstOrderWaveEquationSEMKernels::MassMatrixKernel< FE_TYPE > kernelM( finiteElement ); - - kernelM.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - X, - elemsToNodes, - velocity, - density, - mass ); - - acousticFirstOrderWaveEquationSEMKernels::DampingMatrixKernel< FE_TYPE > kernelD( finiteElement ); - - kernelD.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - X, - elemsToFaces, - facesToNodes, - facesDomainBoundaryIndicator, - freeSurfaceFaceIndicator, - velocity, - damping ); + AcousticMatricesSEM::MassMatrix< FE_TYPE > kernelM( finiteElement ); + kernelM.template computeMassMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToNodes, + velocity, + density, + mass ); + + AcousticMatricesSEM::DampingMatrix< FE_TYPE > kernelD( finiteElement ); + kernelD.template computeDampingMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToFaces, + facesToNodes, + facesDomainBoundaryIndicator, + freeSurfaceFaceIndicator, + velocity, + density, + damping ); + + } ); } ); } ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEMKernel.hpp index 97eddf54faf..3688f49df86 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEMKernel.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticFirstOrderWaveEquationSEMKernel.hpp @@ -31,301 +31,6 @@ namespace geos namespace acousticFirstOrderWaveEquationSEMKernels { -struct PrecomputeSourceAndReceiverKernel -{ - - /** - * @brief Launches the precomputation of the source and receiver terms - * @tparam EXEC_POLICY execution policy - * @tparam FE_TYPE finite element type - * @param[in] size the number of cells in the subRegion - * @param[in] numFacesPerElem number of faces per element - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemGhostRank rank of the ghost element - * @param[in] elemsToNodes map from element to nodes - * @param[in] elemsToFaces map from element to faces - * @param[in] elemCenter coordinates of the element centers - * @param[in] faceNormal normal of each faces - * @param[in] faceCenter coordinates of the center of a face - * @param[in] sourceCoordinates coordinates of the source terms - * @param[out] sourceIsAccessible flag indicating whether the source is accessible or not - * @param[out] sourceElem element where a source is located - * @param[out] sourceNodeIds indices of the nodes of the element where the source is located - * @param[out] sourceConstants constant part of the source terms - * @param[in] receiverCoordinates coordinates of the receiver terms - * @param[out] receiverIsLocal flag indicating whether the receiver is local or not - * @param[out] rcvElem element where a receiver is located - * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located - * @param[out] receiverConstants constant part of the receiver term - * @param[out] sourceValue value of the temporal source (eg. Ricker) - * @param[in] dt time-step - * @param[in] timeSourceFrequency the central frequency of the source - * @param[in] timeSourceDelay the time delay of the source - * @param[in] rickerOrder order of the Ricker wavelet - */ - template< typename EXEC_POLICY, typename FE_TYPE > - static void - launch( localIndex const size, - localIndex const regionIndex, - localIndex const numFacesPerElem, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView1d< integer const > const elemGhostRank, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, - arrayView2d< localIndex const > const elemsToFaces, - arrayView2d< real64 const > const & elemCenter, - arrayView2d< real64 const > const faceNormal, - arrayView2d< real64 const > const faceCenter, - arrayView2d< real64 const > const sourceCoordinates, - arrayView1d< localIndex > const sourceIsAccessible, - arrayView1d< localIndex > const sourceElem, - arrayView2d< localIndex > const sourceNodeIds, - arrayView2d< real64 > const sourceConstants, - arrayView1d< localIndex > const sourceRegion, - arrayView2d< real64 const > const receiverCoordinates, - arrayView1d< localIndex > const receiverIsLocal, - arrayView1d< localIndex > const rcvElem, - arrayView2d< localIndex > const receiverNodeIds, - arrayView2d< real64 > const receiverConstants, - arrayView1d< localIndex > const receiverRegion, - arrayView2d< real32 > const sourceValue, - real64 const dt, - real32 const timeSourceFrequency, - real32 const timeSourceDelay, - localIndex const rickerOrder ) - { - constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; - - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) - { - real64 const center[3] = { elemCenter[k][0], - elemCenter[k][1], - elemCenter[k][2] }; - - // Step 1: locate the sources, and precompute the source term - - /// loop over all the source that haven't been found yet - for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) - { - if( sourceIsAccessible[isrc] == 0 ) - { - real64 const coords[3] = { sourceCoordinates[isrc][0], - sourceCoordinates[isrc][1], - sourceCoordinates[isrc][2] }; - - bool const sourceFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - - if( sourceFound ) - { - real64 coordsOnRefElem[3]{}; - - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - - sourceIsAccessible[isrc] = 1; - sourceElem[isrc] = k; - sourceRegion[isrc] = regionIndex; - real64 Ntest[numNodesPerElem]; - FE_TYPE::calcN( coordsOnRefElem, Ntest ); - - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - sourceNodeIds[isrc][a] = elemsToNodes[k][a]; - sourceConstants[isrc][a] = Ntest[a]; - } - - for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) - { - sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); - } - } - } - } // end loop over all sources - - - // Step 2: locate the receivers, and precompute the receiver term - - /// loop over all the receivers that haven't been found yet - for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) - { - if( receiverIsLocal[ircv] == 0 ) - { - real64 const coords[3] = { receiverCoordinates[ircv][0], - receiverCoordinates[ircv][1], - receiverCoordinates[ircv][2] }; - - real64 coordsOnRefElem[3]{}; - bool const receiverFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - - if( receiverFound && elemGhostRank[k] < 0 ) - { - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - receiverIsLocal[ircv] = 1; - rcvElem[ircv] = k; - receiverRegion[ircv] = regionIndex; - - real64 Ntest[numNodesPerElem]; - FE_TYPE::calcN( coordsOnRefElem, Ntest ); - - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - receiverNodeIds[ircv][a] = elemsToNodes[k][a]; - receiverConstants[ircv][a] = Ntest[a]; - } - } - } - } // end loop over receivers - - } ); - - } -}; - -template< typename FE_TYPE > -struct MassMatrixKernel -{ - - MassMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the mass matrix - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToNodes map from element to nodes - * @param[in] velocity cell-wise velocity - * @param[in] density cell-wise density - * @param[out] mass diagonal of the mass matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes, - arrayView1d< real32 const > const velocity, - arrayView1d< real32 const > const density, - arrayView1d< real32 > const mass ) - - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - - - real32 const invC2 = 1.0 / ( density[e] * pow( velocity[e], 2 ) ); - // only the eight corners of the mesh cell are needed to compute the Jacobian - real64 xLocal[ 8 ][ 3 ]; - for( localIndex a = 0; a < 8; ++a ) - { - localIndex const nodeIndex = elemsToNodes( e, FE_TYPE::meshIndexToLinearIndex3D( a ) ); - for( localIndex i = 0; i < 3; ++i ) - { - xLocal[a][i] = nodeCoords( nodeIndex, i ); - } - } - - constexpr localIndex numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; - for( localIndex q = 0; q < numQuadraturePointsPerElem; ++q ) - { - real32 const localIncrement = invC2 * m_finiteElement.computeMassTerm( q, xLocal ); - RAJA::atomicAdd< ATOMIC_POLICY >( &mass[elemsToNodes( e, q )], localIncrement ); - } - } ); // end loop over element - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - -template< typename FE_TYPE > -struct DampingMatrixKernel -{ - - DampingMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the damping matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToFaces map from elements to faces - * @param[in] facesToNodes map from face to nodes - * @param[in] facesDomainBoundaryIndicator flag equal to 1 if the face is on the boundary, and to 0 otherwise - * @param[in] freeSurfaceFaceIndicator flag equal to 1 if the face is on the free surface, and to 0 otherwise - * @param[in] velocity cell-wise velocity - * @param[out] damping diagonal of the damping matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const > const elemsToFaces, - ArrayOfArraysView< localIndex const > const facesToNodes, - arrayView1d< integer const > const facesDomainBoundaryIndicator, - arrayView1d< localIndex const > const freeSurfaceFaceIndicator, - arrayView1d< real32 const > const velocity, - arrayView1d< real32 > const damping ) - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - for( localIndex i = 0; i < elemsToFaces.size( 1 ); ++i ) - { - localIndex const f = elemsToFaces( e, i ); - // face on the domain boundary and not on free surface - if( facesDomainBoundaryIndicator[f] == 1 && freeSurfaceFaceIndicator[f] != 1 ) - { - // only the four corners of the mesh face are needed to compute the Jacobian - real64 xLocal[ 4 ][ 3 ]; - for( localIndex a = 0; a < 4; ++a ) - { - localIndex const nodeIndex = facesToNodes( f, FE_TYPE::meshIndexToLinearIndex2D( a ) ); - for( localIndex d = 0; d < 3; ++d ) - { - xLocal[a][d] = nodeCoords( nodeIndex, d ); - } - } - - real32 const alpha = 1.0 / velocity[e]; - constexpr localIndex numNodesPerFace = FE_TYPE::numNodesPerFace; - for( localIndex q = 0; q < numNodesPerFace; ++q ) - { - real32 const localIncrement = alpha * m_finiteElement.computeDampingTerm( q, xLocal ); - RAJA::atomicAdd< ATOMIC_POLICY >( &damping[facesToNodes( f, q )], localIncrement ); - } - } - } - } ); - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - - - template< typename FE_TYPE > struct VelocityComputation { diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticMatricesSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticMatricesSEMKernel.hpp new file mode 100644 index 00000000000..811fcef0f3f --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticMatricesSEMKernel.hpp @@ -0,0 +1,160 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file AcousticMatricesSEMKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICMATRICESSEMKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICMATRICESSEMKERNEL_HPP_ + +namespace geos +{ + +struct AcousticMatricesSEM +{ + + template< typename FE_TYPE > + struct MassMatrix + { + + MassMatrix( FE_TYPE const & finiteElement ) + : m_finiteElement( finiteElement ) + {} + /** + * @brief Launches the precomputation of the mass matrices + * @tparam EXEC_POLICY the execution policy + * @tparam ATOMIC_POLICY the atomic policy + * @tparam FE_TYPE the type of discretization + * @param[in] finiteElement The finite element discretization used + * @param[in] size the number of cells in the subRegion + * @param[in] numFacesPerElem number of faces per element + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemsToNodes map from element to nodes + * @param[in] velocity cell-wise velocity + * @param[in] density cell-wise density + * @param[out] mass diagonal of the mass matrix + */ + template< typename EXEC_POLICY, typename ATOMIC_POLICY > + void + computeMassMatrix( localIndex const size, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes, + arrayView1d< real32 const > const velocity, + arrayView1d< real32 const > const density, + arrayView1d< real32 > const mass ) + + { + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) + { + + real32 const invC2 = 1.0 / ( density[e] * pow( velocity[e], 2 ) ); + // only the eight corners of the mesh cell are needed to compute the Jacobian + real64 xLocal[ 8 ][ 3 ]; + for( localIndex a = 0; a < 8; ++a ) + { + localIndex const nodeIndex = elemsToNodes( e, FE_TYPE::meshIndexToLinearIndex3D( a ) ); + for( localIndex i = 0; i < 3; ++i ) + { + xLocal[a][i] = nodeCoords( nodeIndex, i ); + } + } + constexpr localIndex numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; + for( localIndex q = 0; q < numQuadraturePointsPerElem; ++q ) + { + real32 const localIncrement = invC2 * m_finiteElement.computeMassTerm( q, xLocal ); + RAJA::atomicAdd< ATOMIC_POLICY >( &mass[elemsToNodes( e, q )], localIncrement ); + } + } ); // end loop over element + } + + FE_TYPE const & m_finiteElement; + + }; + template< typename FE_TYPE > + struct DampingMatrix + { + + DampingMatrix( FE_TYPE const & finiteElement ) + : m_finiteElement( finiteElement ) + {} + + /** + * @brief Launches the precomputation of the damping matrices + * @tparam EXEC_POLICY the execution policy + * @tparam ATOMIC_POLICY the atomic policy + * @param[in] size the number of cells in the subRegion + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemsToFaces map from elements to faces + * @param[in] facesToNodes map from face to nodes + * @param[in] facesDomainBoundaryIndicator flag equal to 1 if the face is on the boundary, and to 0 otherwise + * @param[in] freeSurfaceFaceIndicator flag equal to 1 if the face is on the free surface, and to 0 otherwise + * @param[in] velocity cell-wise velocity + * @param[in] density cell-wise density + * @param[out] damping diagonal of the damping matrix + */ + template< typename EXEC_POLICY, typename ATOMIC_POLICY > + void + computeDampingMatrix( localIndex const size, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView2d< localIndex const > const elemsToFaces, + ArrayOfArraysView< localIndex const > const facesToNodes, + arrayView1d< integer const > const facesDomainBoundaryIndicator, + arrayView1d< localIndex const > const freeSurfaceFaceIndicator, + arrayView1d< real32 const > const velocity, + arrayView1d< real32 const > const density, + arrayView1d< real32 > const damping ) + { + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) + { + for( localIndex i = 0; i < elemsToFaces.size( 1 ); ++i ) + { + localIndex const f = elemsToFaces( e, i ); + // face on the domain boundary and not on free surface + if( facesDomainBoundaryIndicator[f] == 1 && freeSurfaceFaceIndicator[f] != 1 ) + { + // only the four corners of the mesh face are needed to compute the Jacobian + real64 xLocal[ 4 ][ 3 ]; + for( localIndex a = 0; a < 4; ++a ) + { + localIndex const nodeIndex = facesToNodes( f, FE_TYPE::meshIndexToLinearIndex2D( a ) ); + for( localIndex d = 0; d < 3; ++d ) + { + xLocal[a][d] = nodeCoords( nodeIndex, d ); + } + } + real32 const alpha = 1.0 / (density[e] * velocity[e]); + constexpr localIndex numNodesPerFace = FE_TYPE::numNodesPerFace; + for( localIndex q = 0; q < numNodesPerFace; ++q ) + { + real32 const localIncrement = alpha * m_finiteElement.computeDampingTerm( q, xLocal ); + RAJA::atomicAdd< ATOMIC_POLICY >( &damping[facesToNodes( f, q )], localIncrement ); + } + } + } + } ); + } + + /// The finite element space/discretization object for the element type in the subRegion + FE_TYPE const & m_finiteElement; + + }; + + + +}; + +} // namespace geos + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICMATRICESSEMKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticPMLSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticPMLSEMKernel.hpp new file mode 100644 index 00000000000..c6f2f54586c --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticPMLSEMKernel.hpp @@ -0,0 +1,389 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file AcousticPMLSEMKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICPMLSEMKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICPMLSEMKERNEL_HPP_ + +namespace geos +{ + +struct AcousticPMLSEM +{ + struct ComputeDamping + { + /** + * @brief Compute the damping profile for the Perfectly Matched Layer (PML) + * @param xLocal a given x-y-z coordinates (3-components array) + * @param xMin coordinate limits of the inner PML boundaries, left-front-top + * @param xMax coordinate limits of the inner PML boundaries, right-back-bottom + * @param dMin PML thickness, left-front-top + * @param dMax PML thickness, right-back-bottom + * @param cMin PML wave speed, left-front-top + * @param cMax PML wave speed, right-back-bottom + * @param r desired reflectivity of the PML + * @param sigma 3-components array to hold the damping profile in each direction + */ + GEOS_HOST_DEVICE + inline + static void computeDampingProfile( real32 const (&xLocal)[3], + real32 const (&xMin)[3], + real32 const (&xMax)[3], + real32 const (&dMin)[3], + real32 const (&dMax)[3], + real32 const (&cMin)[3], + real32 const (&cMax)[3], + real32 const r, + real32 (& sigma)[3] ) + { + + sigma[0] = 0; + sigma[1] = 0; + sigma[2] = 0; + + if( xLocal[0] < xMin[0] ) + { + real32 const factor = -3.0/2.0*cMin[0]*log( r )/(dMin[0]*dMin[0]*dMin[0]); + sigma[0] = factor*(xLocal[0]-xMin[0])*(xLocal[0]-xMin[0]); + } + else if( xLocal[0] > xMax[0] ) + { + real32 const factor = -3.0/2.0*cMax[0]*log( r )/(dMax[0]*dMax[0]*dMax[0]); + sigma[0] = factor*(xLocal[0]-xMax[0])*(xLocal[0]-xMax[0]); + } + if( xLocal[1] < xMin[1] ) + { + real32 const factor = -3.0/2.0*cMin[1]*log( r )/(dMin[1]*dMin[1]*dMin[1]); + sigma[1] = factor*(xLocal[1]-xMin[1])*(xLocal[1]-xMin[1]); + } + else if( xLocal[1] > xMax[1] ) + { + real32 const factor = -3.0/2.0*cMax[1]*log( r )/(dMax[1]*dMax[1]*dMax[1]); + sigma[1] = factor*(xLocal[1]-xMax[1])*(xLocal[1]-xMax[1]); + } + if( xLocal[2] < xMin[2] ) + { + real32 const factor = -3.0/2.0*cMin[2]*log( r )/(dMin[2]*dMin[2]*dMin[2]); + sigma[2] = factor*(xLocal[2]-xMin[2])*(xLocal[2]-xMin[2]); + } + else if( xLocal[2] > xMax[2] ) + { + real32 const factor = -3.0/2.0*cMax[2]*log( r )/(dMax[2]*dMax[2]*dMax[2]); + sigma[2] = factor*(xLocal[2]-xMax[2])*(xLocal[2]-xMax[2]); + } + } + }; + + template< typename FE_TYPE > + struct PMLKernel + { + + PMLKernel( FE_TYPE const & finiteElement ) + : m_finiteElement( finiteElement ) + {} + + /** + * @brief Launches the computation of field gradients and divergence for PML region + * @tparam EXEC_POLICY the execution policy + * @tparam ATOMIC_POLICY the atomic policy + * @param[in] targetSet list of cells in the target set + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemToNodes constant array view of map from element to nodes + * @param[in] velocity cell-wise velocity + * @param[in] p_n pressure field at time n + * @param[in] v_n PML auxiliary field at time n + * @param[in] u_n PML auxiliary field at time n + * @param[in] xMin coordinate limits of the inner PML boundaries, left-front-top + * @param[in] xMax coordinate limits of the inner PML boundaries, right-back-bottom + * @param[in] dMin PML thickness, left-front-top + * @param[in] dMax PML thickness, right-back-bottom + * @param[in] cMin PML wave speed, left-front-top + * @param[in] cMax PML wave speed, right-back-bottom + * @param[in] r desired reflectivity of the PML + * @param[out] grad_n array holding the gradients at time n + * @param[out] divV_n array holding the divergence at time n + */ + template< typename EXEC_POLICY, typename ATOMIC_POLICY > + void + launch( SortedArrayView< localIndex const > const targetSet, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + traits::ViewTypeConst< CellElementSubRegion::NodeMapType > const elemToNodes, + arrayView1d< real32 const > const velocity, + arrayView1d< real32 const > const p_n, + arrayView2d< real32 const > const v_n, + arrayView1d< real32 const > const u_n, + real32 const (&xMin)[3], + real32 const (&xMax)[3], + real32 const (&dMin)[3], + real32 const (&dMax)[3], + real32 const (&cMin)[3], + real32 const (&cMax)[3], + real32 const r, + arrayView2d< real32 > const grad_n, + arrayView1d< real32 > const divV_n ) + { + /// Loop over elements in the subregion, 'l' is the element index within the target set + forAll< EXEC_POLICY >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const l ) + { + constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; + + /// global element index + localIndex const k = targetSet[l]; + + /// wave speed at the element + real32 const c = velocity[k]; + + /// coordinates of the element nodes + real64 xLocal[ numNodesPerElem ][ 3 ]; + real32 xLocal32[ numNodesPerElem ][ 3 ]; + + /// local arrays to store the pressure at all nodes and its gradient at a given node + real64 pressure[ numNodesPerElem ]; + real64 pressureGrad[ 3 ]; + + /// local arrays to store the PML vectorial auxiliary variable at all nodes and its gradient at a given node + real64 auxV[3][ numNodesPerElem ]; + real64 auxVGrad[3][3]; + + /// local arrays to store the PML scalar auxiliary variable at all nodes and its gradient at a given node + real64 auxU[ numNodesPerElem ]; + real64 auxUGrad[3]; + + /// local array to store the PML damping profile + real32 sigma[ 3 ]; + + /// copy from global to local arrays + for( localIndex i=0; i( k, i, xLocal, gradN ); + GEOS_UNUSED_VAR ( detJ ); + + /// compute the gradient of the pressure and the PML auxiliary variables at the node + m_finiteElement.template gradient< numNodesPerElem, GRADIENT_TYPE >( gradN, pressure, pressureGrad ); + m_finiteElement.template gradient< numNodesPerElem, GRADIENT_TYPE >( gradN, auxU, auxUGrad ); + for( int j=0; j<3; ++j ) + { + m_finiteElement.template gradient< numNodesPerElem, GRADIENT_TYPE >( gradN, auxV[j], auxVGrad[j] ); + } + + /// compute the PML damping profile + ComputeDamping::computeDampingProfile( + xLocal32[i], + xMin, + xMax, + dMin, + dMax, + cMin, + cMax, + r, + sigma ); + + /// compute B.pressureGrad - C.auxUGrad where B and C are functions of the damping profile + /// WARNING: the division by 'numNodesPerElem' below is needed because the average of + /// gradient and divergence at the nodes are sought. It is the number of cells contributing + /// to each node that is needed. In this case, it is equal to 'numNodesPerElem'. For high-order + /// SEM, this approach won't work and the average needs to be computed differently (maybe using counters). + real32 localIncrementArray[3]; + localIncrementArray[0] = (sigma[0]-sigma[1]-sigma[2])*pressureGrad[0] - (sigma[1]*sigma[2])*auxUGrad[0]; + localIncrementArray[1] = (sigma[1]-sigma[0]-sigma[2])*pressureGrad[1] - (sigma[0]*sigma[2])*auxUGrad[1]; + localIncrementArray[2] = (sigma[2]-sigma[0]-sigma[1])*pressureGrad[2] - (sigma[0]*sigma[1])*auxUGrad[2]; + for( int j=0; j<3; ++j ) + { + RAJA::atomicAdd< ATOMIC_POLICY >( &grad_n[elemToNodes( k, i )][j], localIncrementArray[j]/numNodesPerElem ); + } + /// compute beta.pressure + gamma.u - c^2 * divV where beta and gamma are functions of the damping profile + real32 const beta = sigma[0]*sigma[1]+sigma[0]*sigma[2]+sigma[1]*sigma[2]; + real32 const gamma = sigma[0]*sigma[1]*sigma[2]; + real32 const localIncrement = beta*p_n[elemToNodes( k, i )] + + gamma*u_n[elemToNodes( k, i )] + - c*c*( auxVGrad[0][0] + auxVGrad[1][1] + auxVGrad[2][2] ); + + RAJA::atomicAdd< ATOMIC_POLICY >( &divV_n[elemToNodes( k, i )], localIncrement/numNodesPerElem ); + } + } ); + } + + /// The finite element space/discretization object for the element type in the subRegion + FE_TYPE const & m_finiteElement; + }; + + + template< typename FE_TYPE > + struct waveSpeedPMLKernel + { + + waveSpeedPMLKernel( FE_TYPE const & finiteElement ) + : m_finiteElement( finiteElement ) + {} + + /** + * @brief Launches the computation of average wave speeds in the PML region + * @tparam EXEC_POLICY the execution policy + * @tparam ATOMIC_POLICY the atomic policy + * @param[in] targetSet list of cells in the target set + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemToNodes constant array view of map from element to nodes + * @param[in] velocity cell-wise velocity + * @param[in] xMin coordinate limits of the inner PML boundaries, left-front-top + * @param[in] xMax coordinate limits of the inner PML boundaries, right-back-bottom + * @param[out] cMin PML wave speed, left-front-top + * @param[out] cMax PML wave speed, right-back-bottom + * @param[out] counterMin PML wave speed counter, left-front-top + * @param[out] counterMax PML wave speed counter, left-front-top + */ + template< typename EXEC_POLICY, typename ATOMIC_POLICY > + void + launch( SortedArrayView< localIndex const > const targetSet, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + traits::ViewTypeConst< CellElementSubRegion::NodeMapType > const elemToNodes, + arrayView1d< real32 const > const velocity, + real32 const (&xMin)[3], + real32 const (&xMax)[3], + real32 (& cMin)[3], + real32 (& cMax)[3], + int (& counterMin)[3], + int (& counterMax)[3] ) + { + + RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedLeft( 0.0 ); + RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedRight( 0.0 ); + RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedFront( 0.0 ); + RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedBack( 0.0 ); + RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedTop( 0.0 ); + RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedBottom( 0.0 ); + RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterLeft( 0 ); + RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterRight( 0 ); + RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterFront( 0 ); + RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterBack( 0 ); + RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterTop( 0 ); + RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterBottom( 0 ); + + /// Loop over elements in the subregion, 'l' is the element index within the target set + forAll< EXEC_POLICY >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const l ) + { + constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; + + /// global element index + localIndex const k = targetSet[l]; + + /// wave speed at the element + real32 const c = velocity[k]; + + /// coordinates of the element center + real64 xLocal[ 3 ] = {0.0, 0.0, 0.0}; + + /// compute the coordinates of the element center + for( int j=0; j<3; ++j ) + { + for( localIndex i=0; i= xMin[1] && xLocal[1] <= xMax[1] + && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) + { + subRegionAvgWaveSpeedLeft += c; + subRegionAvgWaveSpeedCounterLeft += 1; + } + else if( xLocal[0] > xMax[0] + && xLocal[1] >= xMin[1] && xLocal[1] <= xMax[1] + && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) + { + subRegionAvgWaveSpeedRight += c; + subRegionAvgWaveSpeedCounterRight += 1; + } + if( xLocal[1] < xMin[1] + && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] + && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) + { + subRegionAvgWaveSpeedFront += c; + subRegionAvgWaveSpeedCounterFront += 1; + } + else if( xLocal[1] > xMax[1] + && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] + && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) + { + subRegionAvgWaveSpeedBack += c; + subRegionAvgWaveSpeedCounterBack += 1; + } + if( xLocal[2] < xMin[2] + && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] + && xLocal[1] >= xMin[1] && xLocal[1] <= xMax[1] ) + { + subRegionAvgWaveSpeedTop += c; + subRegionAvgWaveSpeedCounterTop += 1; + } + else if( xLocal[2] > xMax[2] + && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] + && xLocal[1] >= xMin[1] && xLocal[1] <= xMax[1] ) + { + subRegionAvgWaveSpeedBottom += c; + subRegionAvgWaveSpeedCounterBottom += 1; + } + } ); + + /// transfer local results to global variables + cMin[0]+=subRegionAvgWaveSpeedLeft.get(); + cMin[1]+=subRegionAvgWaveSpeedFront.get(); + cMin[2]+=subRegionAvgWaveSpeedTop.get(); + cMax[0]+=subRegionAvgWaveSpeedRight.get(); + cMax[1]+=subRegionAvgWaveSpeedBack.get(); + cMax[2]+=subRegionAvgWaveSpeedBottom.get(); + counterMin[0]+=subRegionAvgWaveSpeedCounterLeft.get(); + counterMin[1]+=subRegionAvgWaveSpeedCounterFront.get(); + counterMin[2]+=subRegionAvgWaveSpeedCounterTop.get(); + counterMax[0]+=subRegionAvgWaveSpeedCounterRight.get(); + counterMax[1]+=subRegionAvgWaveSpeedCounterBack.get(); + counterMax[2]+=subRegionAvgWaveSpeedCounterBottom.get(); + } + + /// The finite element space/discretization object for the element type in the subRegion + FE_TYPE const & m_finiteElement; + }; + + +}; + +} // namespace geos + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICPMLSEMKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticTimeSchemeSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticTimeSchemeSEMKernel.hpp new file mode 100644 index 00000000000..d656fbaa803 --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticTimeSchemeSEMKernel.hpp @@ -0,0 +1,168 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file AcousticTimeSchemeSEMKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICTIMESCHEMESEMKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICTIMESCHEMESEMKERNEL_HPP_ + +namespace geos +{ + +struct AcousticTimeSchemeSEM +{ + + using EXEC_POLICY = parallelDevicePolicy< >; + + + /** + * @brief Apply second order Leap-Frog time scheme for isotropic case without PML + * @param[in] dt time-step + * @param[out] p_np1 pressure array at time n+1 (updated here) + * @param[in] p_n pressure array at time n + * @param[in] p_nm1 pressure array at time n-1 + * @param[in] mass the mass matrix + * @param[in] stiffnessVector array containing the product of the stiffness matrix R and the pressure at time n + * @param[in] damping the damping matrix + * @param[in] rhs the right-hand-side + * @param[in] freeSurfaceNodeIndicator array which contains indicators to tell if we are on a free-surface boundary or not + * @param[in] solverTargetNodesSet the targetted nodeset (useful in particular when we do elasto-acoustic simulation ) + */ + static void LeapFrogWithoutPML( real64 const dt, + arrayView1d< real32 > const p_np1, + arrayView1d< real32 > const p_n, + arrayView1d< real32 > const p_nm1, + arrayView1d< real32 const > const mass, + arrayView1d< real32 > const stiffnessVector, + arrayView1d< real32 const > const damping, + arrayView1d< real32 > const rhs, + arrayView1d< localIndex const > const freeSurfaceNodeIndicator, + SortedArrayView< localIndex const > const solverTargetNodesSet ) + { + real64 const dt2 = pow( dt, 2 ); + forAll< EXEC_POLICY >( solverTargetNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) + { + localIndex const a = solverTargetNodesSet[n]; + if( freeSurfaceNodeIndicator[a] != 1 ) + { + p_np1[a] = p_n[a]; + p_np1[a] *= 2.0 * mass[a]; + p_np1[a] -= (mass[a] - 0.5 * dt * damping[a]) * p_nm1[a]; + p_np1[a] += dt2 * (rhs[a] - stiffnessVector[a]); + p_np1[a] /= mass[a] + 0.5 * dt * damping[a]; + } + } ); + + }; + + /** + * @brief Apply second order Leap-Frog time scheme for VTI case without PML + * @param[in] size The number of nodes in the nodeManager + * @param[in] dt time-step + * @param[out] p_np1 pressure array at time n+1 (updated here) + * @param[in] p_n pressure array at time n + * @param[in] p_nm1 pressure array at time n-1 + * @param[out] q_np1 auxiliary pressure array at time n+1 (updated here) + * @param[in] q_n auxiliary pressure array at time n + * @param[in] q_nm1 auxiliary pressure array at time n-1 + * @param[in] mass the mass matrix + * @param[in] stiffnessVector_p array containing the product of the stiffness matrix R and the pressure at time n + * @param[in] stiffnessVector_q array containing the product of the stiffness matrix R and the auxiliary pressure at time n + * @param[in] damping_p the damping matrix + * @param[in] damping_pq the damping matrix + * @param[in] damping_q the damping matrix + * @param[in] damping_qp the damping matrix + * @param[in] rhs the right-hand-side + * @param[in] freeSurfaceNodeIndicator array which contains indicators to tell if we are on a free-surface boundary or not + * @param[in] lateralSurfaceNodeIndicator array which contains indicators to tell if we are on a lateral boundary or not + * @param[in] bottomSurfaceNodeIndicator array which contains indicators to telle if we are on the bottom boundary or not + */ + static void LeapFrogforVTI( localIndex const size, + real64 const dt, + arrayView1d< real32 > const p_np1, + arrayView1d< real32 > const p_n, + arrayView1d< real32 > const p_nm1, + arrayView1d< real32 > const q_np1, + arrayView1d< real32 > const q_n, + arrayView1d< real32 > const q_nm1, + arrayView1d< real32 const > const mass, + arrayView1d< real32 > const stiffnessVector_p, + arrayView1d< real32 > const stiffnessVector_q, + arrayView1d< real32 const > const damping_p, + arrayView1d< real32 const > const damping_pq, + arrayView1d< real32 const > const damping_q, + arrayView1d< real32 const > const damping_qp, + arrayView1d< real32 > const rhs, + arrayView1d< localIndex const > const freeSurfaceNodeIndicator, + arrayView1d< localIndex const > const lateralSurfaceNodeIndicator, + arrayView1d< localIndex const > const bottomSurfaceNodeIndicator ) + + { + real64 const dt2 = pow( dt, 2 ); + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const a ) + { + if( freeSurfaceNodeIndicator[a] != 1 ) + { + p_np1[a] = 2.0*mass[a]*p_n[a]/dt2; + p_np1[a] -= mass[a]*p_nm1[a]/dt2; + p_np1[a] += stiffnessVector_p[a]; + p_np1[a] += rhs[a]; + + q_np1[a] = 2.0*mass[a]*q_n[a]/dt2; + q_np1[a] -= mass[a]*q_nm1[a]/dt2; + q_np1[a] += stiffnessVector_q[a]; + q_np1[a] += rhs[a]; + + if( lateralSurfaceNodeIndicator[a] != 1 && bottomSurfaceNodeIndicator[a] != 1 ) + { + // Interior node, no boundary terms + p_np1[a] /= mass[a]/dt2; + q_np1[a] /= mass[a]/dt2; + } + else + { + // Boundary node + p_np1[a] += damping_p[a]*p_nm1[a]/dt/2; + p_np1[a] += damping_pq[a]*q_nm1[a]/dt/2; + + q_np1[a] += damping_q[a]*q_nm1[a]/dt/2; + q_np1[a] += damping_qp[a]*p_nm1[a]/dt/2; + // Hand-made Inversion of 2x2 matrix + real32 coef_pp = mass[a]/dt2; + coef_pp += damping_p[a]/dt/2; + real32 coef_pq = damping_pq[a]/dt/2; + + real32 coef_qq = mass[a]/dt2; + coef_qq += damping_q[a]/2/dt; + real32 coef_qp = damping_qp[a]/dt/2; + + real32 det_pq = 1/(coef_pp * coef_qq - coef_pq*coef_qp); + + real32 aux_p_np1 = p_np1[a]; + p_np1[a] = det_pq*(coef_qq*p_np1[a] - coef_pq*q_np1[a]); + q_np1[a] = det_pq*(coef_pp*q_np1[a] - coef_qp*aux_p_np1); + } + } + } ); + }; + + + +}; + +} // namespace geos + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTICTIMESCHEMESEMKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticVTIWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticVTIWaveEquationSEM.cpp index 967327730a6..b036542b61d 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticVTIWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticVTIWaveEquationSEM.cpp @@ -26,7 +26,9 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/ElementType.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" +#include "events/EventManager.hpp" #include "WaveSolverUtils.hpp" +#include "AcousticTimeSchemeSEMKernel.hpp" namespace geos { @@ -586,54 +588,13 @@ real64 AcousticVTIWaveEquationSEM::explicitStepInternal( real64 const & time_n, addSourceToRightHandSide( cycleNumber, rhs ); /// calculate your time integrators - real64 const dt2 = dt*dt; GEOS_MARK_SCOPE ( updateP ); - forAll< EXEC_POLICY >( nodeManager.size(), [=] GEOS_HOST_DEVICE ( localIndex const a ) - { - if( freeSurfaceNodeIndicator[a] != 1 ) - { - p_np1[a] = 2.0*mass[a]*p_n[a]/dt2; - p_np1[a] -= mass[a]*p_nm1[a]/dt2; - p_np1[a] += stiffnessVector_p[a]; - p_np1[a] += rhs[a]; - q_np1[a] = 2.0*mass[a]*q_n[a]/dt2; - q_np1[a] -= mass[a]*q_nm1[a]/dt2; - q_np1[a] += stiffnessVector_q[a]; - q_np1[a] += rhs[a]; - - if( lateralSurfaceNodeIndicator[a] != 1 && bottomSurfaceNodeIndicator[a] != 1 ) - { - // Interior node, no boundary terms - p_np1[a] /= mass[a]/dt2; - q_np1[a] /= mass[a]/dt2; - } - else - { - // Boundary node - p_np1[a] += damping_p[a]*p_nm1[a]/dt/2; - p_np1[a] += damping_pq[a]*q_nm1[a]/dt/2; - - q_np1[a] += damping_q[a]*q_nm1[a]/dt/2; - q_np1[a] += damping_qp[a]*p_nm1[a]/dt/2; - // Hand-made Inversion of 2x2 matrix - real32 coef_pp = mass[a]/dt2; - coef_pp += damping_p[a]/dt/2; - real32 coef_pq = damping_pq[a]/dt/2; - - real32 coef_qq = mass[a]/dt2; - coef_qq += damping_q[a]/2/dt; - real32 coef_qp = damping_qp[a]/dt/2; - - real32 det_pq = 1/(coef_pp * coef_qq - coef_pq*coef_qp); - - real32 aux_p_np1 = p_np1[a]; - p_np1[a] = det_pq*(coef_qq*p_np1[a] - coef_pq*q_np1[a]); - q_np1[a] = det_pq*(coef_pp*q_np1[a] - coef_qp*aux_p_np1); - } - } - } ); + AcousticTimeSchemeSEM::LeapFrogforVTI( nodeManager.size(), dt, p_np1, p_n, p_nm1, q_np1, q_n, q_nm1, mass, stiffnessVector_p, + stiffnessVector_q, damping_p, damping_pq, damping_q, damping_qp, + rhs, freeSurfaceNodeIndicator, lateralSurfaceNodeIndicator, + bottomSurfaceNodeIndicator ); /// synchronize pressure fields FieldIdentifiers fieldsToBeSync; diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEM.cpp index 0dc0f3f97c7..f8404f01964 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEM.cpp @@ -26,7 +26,12 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/ElementType.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" +#include "events/EventManager.hpp" #include "WaveSolverUtils.hpp" +#include "AcousticTimeSchemeSEMKernel.hpp" +#include "AcousticMatricesSEMKernel.hpp" +#include "AcousticPMLSEMKernel.hpp" +#include "PrecomputeSourcesAndReceiversKernel.hpp" namespace geos { @@ -175,9 +180,9 @@ void AcousticWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & mesh, { GEOS_MARK_SCOPE( acousticWaveEquationSEMKernels::PrecomputeSourceAndReceiverKernel ); - acousticWaveEquationSEMKernels:: - PrecomputeSourceAndReceiverKernel:: - launch< EXEC_POLICY, FE_TYPE > + PreComputeSourcesAndReceivers:: + Compute1DSourceAndReceiverConstants + < EXEC_POLICY, FE_TYPE > ( elementSubRegion.size(), numFacesPerElem, nodeCoords32, @@ -294,24 +299,51 @@ void AcousticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() { using FE_TYPE = TYPEOFREF( finiteElement ); - acousticWaveEquationSEMKernels::MassMatrixKernel< FE_TYPE > kernelM( finiteElement ); - kernelM.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - nodeCoords, - elemsToNodes, - velocity, - density, - mass ); - - acousticWaveEquationSEMKernels::DampingMatrixKernel< FE_TYPE > kernelD( finiteElement ); - kernelD.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - nodeCoords, - elemsToFaces, - facesToNodes, - facesDomainBoundaryIndicator, - freeSurfaceFaceIndicator, - velocity, - density, - damping ); + // acousticWaveEquationSEMKernels::MassMatrixKernel< FE_TYPE > kernelM( finiteElement ); + // kernelM.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + // nodeCoords, + // elemsToNodes, + // velocity, + // density, + // mass ); + + AcousticMatricesSEM::MassMatrix< FE_TYPE > kernelM( finiteElement ); + kernelM.template computeMassMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToNodes, + velocity, + density, + mass ); + + AcousticMatricesSEM::DampingMatrix< FE_TYPE > kernelD( finiteElement ); + kernelD.template computeDampingMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToFaces, + facesToNodes, + facesDomainBoundaryIndicator, + freeSurfaceFaceIndicator, + velocity, + density, + damping ); + + //AcousticMatricesSEM::computeDampingMatrix(finiteElement, + // elementSubRegion.size(), + // + // + // + // + // + // + // nodeCoords, + // elemsToFaces, + // facesToNodes, + // facesDomainBoundaryIndicator, + // freeSurfaceFaceIndicator, + // velocity, + // density, + //damping ); + + } ); } ); @@ -565,7 +597,7 @@ void AcousticWaveEquationSEM::initializePML() { using FE_TYPE = TYPEOFREF( finiteElement ); - acousticWaveEquationSEMKernels:: + AcousticPMLSEM:: waveSpeedPMLKernel< FE_TYPE > kernel( finiteElement ); kernel.template launch< EXEC_POLICY, ATOMIC_POLICY > ( targetSet, @@ -713,7 +745,7 @@ void AcousticWaveEquationSEM::applyPML( real64 const time, DomainPartition & dom using FE_TYPE = TYPEOFREF( finiteElement ); /// apply the PML kernel - acousticWaveEquationSEMKernels:: + AcousticPMLSEM:: PMLKernel< FE_TYPE > kernel( finiteElement ); kernel.template launch< EXEC_POLICY, ATOMIC_POLICY > ( targetSet, @@ -965,18 +997,8 @@ void AcousticWaveEquationSEM::computeUnknowns( real64 const & time_n, if( !m_usePML ) { GEOS_MARK_SCOPE ( updateP ); - forAll< EXEC_POLICY >( solverTargetNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) - { - localIndex const a = solverTargetNodesSet[n]; - if( freeSurfaceNodeIndicator[a] != 1 ) - { - p_np1[a] = p_n[a]; - p_np1[a] *= 2.0 * mass[a]; - p_np1[a] -= (mass[a] - 0.5 * dt * damping[a]) * p_nm1[a]; - p_np1[a] += dt2 * (rhs[a] - stiffnessVector[a]); - p_np1[a] /= mass[a] + 0.5 * dt * damping[a]; - } - } ); + AcousticTimeSchemeSEM::LeapFrogWithoutPML( dt, p_np1, p_n, p_nm1, mass, stiffnessVector, damping, + rhs, freeSurfaceNodeIndicator, solverTargetNodesSet ); } else { @@ -1014,7 +1036,7 @@ void AcousticWaveEquationSEM::computeUnknowns( real64 const & time_n, xLocal[i] = nodeCoords32[a][i]; } - acousticWaveEquationSEMKernels::PMLKernelHelper::computeDampingProfilePML( + AcousticPMLSEM::ComputeDamping::computeDampingProfile( xLocal, xMin, xMax, diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEMKernel.hpp index a0179b278d9..ddf9b731f6f 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEMKernel.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcousticWaveEquationSEMKernel.hpp @@ -35,640 +35,6 @@ using namespace fields; namespace acousticWaveEquationSEMKernels { -struct PrecomputeSourceAndReceiverKernel -{ - - /** - * @brief Launches the precomputation of the source and receiver terms - * @tparam EXEC_POLICY execution policy - * @tparam FE_TYPE finite element type - * @param[in] size the number of cells in the subRegion - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToNodes map from element to nodes - * @param[in] elemsToFaces map from element to faces - * @param[in] facesToNodes map from faces to nodes - * @param[in] elemCenter coordinates of the element centers - * @param[in] sourceCoordinates coordinates of the source terms - * @param[out] sourceIsAccessible flag indicating whether the source is accessible or not - * @param[out] sourceNodeIds indices of the nodes of the element where the source is located - * @param[out] sourceNodeConstants constant part of the source terms - * @param[in] receiverCoordinates coordinates of the receiver terms - * @param[out] receiverIsLocal flag indicating whether the receiver is local or not - * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located - * @param[out] receiverNodeConstants constant part of the receiver term - */ - template< typename EXEC_POLICY, typename FE_TYPE > - static void - launch( localIndex const size, - localIndex const numFacesPerElem, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView1d< integer const > const elemGhostRank, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, - arrayView2d< localIndex const > const elemsToFaces, - arrayView2d< real64 const > const & elemCenter, - arrayView2d< real64 const > const faceNormal, - arrayView2d< real64 const > const faceCenter, - arrayView2d< real64 const > const sourceCoordinates, - arrayView1d< localIndex > const sourceIsAccessible, - arrayView2d< localIndex > const sourceNodeIds, - arrayView2d< real64 > const sourceConstants, - arrayView2d< real64 const > const receiverCoordinates, - arrayView1d< localIndex > const receiverIsLocal, - arrayView2d< localIndex > const receiverNodeIds, - arrayView2d< real64 > const receiverConstants, - arrayView2d< real32 > const sourceValue, - real64 const dt, - real32 const timeSourceFrequency, - real32 const timeSourceDelay, - localIndex const rickerOrder ) - { - constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; - - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) - { - real64 const center[3] = { elemCenter[k][0], - elemCenter[k][1], - elemCenter[k][2] }; - - // Step 1: locate the sources, and precompute the source term - - /// loop over all the source that haven't been found yet - for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) - { - if( sourceIsAccessible[isrc] == 0 ) - { - real64 const coords[3] = { sourceCoordinates[isrc][0], - sourceCoordinates[isrc][1], - sourceCoordinates[isrc][2] }; - - bool const sourceFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - if( sourceFound ) - { - real64 coordsOnRefElem[3]{}; - - - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - - sourceIsAccessible[isrc] = 1; - real64 Ntest[numNodesPerElem]; - FE_TYPE::calcN( coordsOnRefElem, Ntest ); - - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - sourceNodeIds[isrc][a] = elemsToNodes( k, a ); - sourceConstants[isrc][a] = Ntest[a]; - } - - for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) - { - sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); - } - } - } - } // end loop over all sources - - - // Step 2: locate the receivers, and precompute the receiver term - - /// loop over all the receivers that haven't been found yet - for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) - { - if( receiverIsLocal[ircv] == 0 ) - { - real64 const coords[3] = { receiverCoordinates[ircv][0], - receiverCoordinates[ircv][1], - receiverCoordinates[ircv][2] }; - - real64 coordsOnRefElem[3]{}; - bool const receiverFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - - if( receiverFound && elemGhostRank[k] < 0 ) - { - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - - receiverIsLocal[ircv] = 1; - - real64 Ntest[numNodesPerElem]; - FE_TYPE::calcN( coordsOnRefElem, Ntest ); - - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - receiverNodeIds[ircv][a] = elemsToNodes( k, a ); - receiverConstants[ircv][a] = Ntest[a]; - } - } - } - } // end loop over receivers - - } ); - - } -}; - -template< typename FE_TYPE > -struct MassMatrixKernel -{ - - MassMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the mass matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] numFacesPerElem number of faces per element - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToNodes map from element to nodes - * @param[in] velocity cell-wise velocity - * @param[in] density cell-wise density - * @param[out] mass diagonal of the mass matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes, - arrayView1d< real32 const > const velocity, - arrayView1d< real32 const > const density, - arrayView1d< real32 > const mass ) - - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - - real32 const invC2 = 1.0 / ( density[e] * pow( velocity[e], 2 ) ); - // only the eight corners of the mesh cell are needed to compute the Jacobian - real64 xLocal[ 8 ][ 3 ]; - for( localIndex a = 0; a < 8; ++a ) - { - localIndex const nodeIndex = elemsToNodes( e, FE_TYPE::meshIndexToLinearIndex3D( a ) ); - for( localIndex i = 0; i < 3; ++i ) - { - xLocal[a][i] = nodeCoords( nodeIndex, i ); - } - } - constexpr localIndex numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; - for( localIndex q = 0; q < numQuadraturePointsPerElem; ++q ) - { - real32 const localIncrement = invC2 * m_finiteElement.computeMassTerm( q, xLocal ); - RAJA::atomicAdd< ATOMIC_POLICY >( &mass[elemsToNodes( e, q )], localIncrement ); - } - } ); // end loop over element - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - -template< typename FE_TYPE > -struct DampingMatrixKernel -{ - - DampingMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the damping matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToFaces map from elements to faces - * @param[in] facesToNodes map from face to nodes - * @param[in] facesDomainBoundaryIndicator flag equal to 1 if the face is on the boundary, and to 0 otherwise - * @param[in] freeSurfaceFaceIndicator flag equal to 1 if the face is on the free surface, and to 0 otherwise - * @param[in] velocity cell-wise velocity - * @param[in] density cell-wise density - * @param[out] damping diagonal of the damping matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const > const elemsToFaces, - ArrayOfArraysView< localIndex const > const facesToNodes, - arrayView1d< integer const > const facesDomainBoundaryIndicator, - arrayView1d< localIndex const > const freeSurfaceFaceIndicator, - arrayView1d< real32 const > const velocity, - arrayView1d< real32 const > const density, - arrayView1d< real32 > const damping ) - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - for( localIndex i = 0; i < elemsToFaces.size( 1 ); ++i ) - { - localIndex const f = elemsToFaces( e, i ); - // face on the domain boundary and not on free surface - if( facesDomainBoundaryIndicator[f] == 1 && freeSurfaceFaceIndicator[f] != 1 ) - { - // only the four corners of the mesh face are needed to compute the Jacobian - real64 xLocal[ 4 ][ 3 ]; - for( localIndex a = 0; a < 4; ++a ) - { - localIndex const nodeIndex = facesToNodes( f, FE_TYPE::meshIndexToLinearIndex2D( a ) ); - for( localIndex d = 0; d < 3; ++d ) - { - xLocal[a][d] = nodeCoords( nodeIndex, d ); - } - } - real32 const alpha = 1.0 / (density[e] * velocity[e]); - constexpr localIndex numNodesPerFace = FE_TYPE::numNodesPerFace; - for( localIndex q = 0; q < numNodesPerFace; ++q ) - { - real32 const localIncrement = alpha * m_finiteElement.computeDampingTerm( q, xLocal ); - RAJA::atomicAdd< ATOMIC_POLICY >( &damping[facesToNodes( f, q )], localIncrement ); - } - } - } - } ); - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - -struct PMLKernelHelper -{ - /** - * @brief Compute the damping profile for the Perfectly Matched Layer (PML) - * @param xLocal a given x-y-z coordinates (3-components array) - * @param xMin coordinate limits of the inner PML boundaries, left-front-top - * @param xMax coordinate limits of the inner PML boundaries, right-back-bottom - * @param dMin PML thickness, left-front-top - * @param dMax PML thickness, right-back-bottom - * @param cMin PML wave speed, left-front-top - * @param cMax PML wave speed, right-back-bottom - * @param r desired reflectivity of the PML - * @param sigma 3-components array to hold the damping profile in each direction - */ - GEOS_HOST_DEVICE - inline - static void computeDampingProfilePML( real32 const (&xLocal)[3], - real32 const (&xMin)[3], - real32 const (&xMax)[3], - real32 const (&dMin)[3], - real32 const (&dMax)[3], - real32 const (&cMin)[3], - real32 const (&cMax)[3], - real32 const r, - real32 (& sigma)[3] ) - { - - sigma[0] = 0; - sigma[1] = 0; - sigma[2] = 0; - - if( xLocal[0] < xMin[0] ) - { - real32 const factor = -3.0/2.0*cMin[0]*log( r )/(dMin[0]*dMin[0]*dMin[0]); - sigma[0] = factor*(xLocal[0]-xMin[0])*(xLocal[0]-xMin[0]); - } - else if( xLocal[0] > xMax[0] ) - { - real32 const factor = -3.0/2.0*cMax[0]*log( r )/(dMax[0]*dMax[0]*dMax[0]); - sigma[0] = factor*(xLocal[0]-xMax[0])*(xLocal[0]-xMax[0]); - } - if( xLocal[1] < xMin[1] ) - { - real32 const factor = -3.0/2.0*cMin[1]*log( r )/(dMin[1]*dMin[1]*dMin[1]); - sigma[1] = factor*(xLocal[1]-xMin[1])*(xLocal[1]-xMin[1]); - } - else if( xLocal[1] > xMax[1] ) - { - real32 const factor = -3.0/2.0*cMax[1]*log( r )/(dMax[1]*dMax[1]*dMax[1]); - sigma[1] = factor*(xLocal[1]-xMax[1])*(xLocal[1]-xMax[1]); - } - if( xLocal[2] < xMin[2] ) - { - real32 const factor = -3.0/2.0*cMin[2]*log( r )/(dMin[2]*dMin[2]*dMin[2]); - sigma[2] = factor*(xLocal[2]-xMin[2])*(xLocal[2]-xMin[2]); - } - else if( xLocal[2] > xMax[2] ) - { - real32 const factor = -3.0/2.0*cMax[2]*log( r )/(dMax[2]*dMax[2]*dMax[2]); - sigma[2] = factor*(xLocal[2]-xMax[2])*(xLocal[2]-xMax[2]); - } - } -}; - -template< typename FE_TYPE > -struct PMLKernel -{ - - PMLKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the computation of field gradients and divergence for PML region - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] targetSet list of cells in the target set - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemToNodes constant array view of map from element to nodes - * @param[in] velocity cell-wise velocity - * @param[in] p_n pressure field at time n - * @param[in] v_n PML auxiliary field at time n - * @param[in] u_n PML auxiliary field at time n - * @param[in] xMin coordinate limits of the inner PML boundaries, left-front-top - * @param[in] xMax coordinate limits of the inner PML boundaries, right-back-bottom - * @param[in] dMin PML thickness, left-front-top - * @param[in] dMax PML thickness, right-back-bottom - * @param[in] cMin PML wave speed, left-front-top - * @param[in] cMax PML wave speed, right-back-bottom - * @param[in] r desired reflectivity of the PML - * @param[out] grad_n array holding the gradients at time n - * @param[out] divV_n array holding the divergence at time n - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( SortedArrayView< localIndex const > const targetSet, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - traits::ViewTypeConst< CellElementSubRegion::NodeMapType > const elemToNodes, - arrayView1d< real32 const > const velocity, - arrayView1d< real32 const > const p_n, - arrayView2d< real32 const > const v_n, - arrayView1d< real32 const > const u_n, - real32 const (&xMin)[3], - real32 const (&xMax)[3], - real32 const (&dMin)[3], - real32 const (&dMax)[3], - real32 const (&cMin)[3], - real32 const (&cMax)[3], - real32 const r, - arrayView2d< real32 > const grad_n, - arrayView1d< real32 > const divV_n ) - { - /// Loop over elements in the subregion, 'l' is the element index within the target set - forAll< EXEC_POLICY >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const l ) - { - constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; - - /// global element index - localIndex const k = targetSet[l]; - - /// wave speed at the element - real32 const c = velocity[k]; - - /// coordinates of the element nodes - real64 xLocal[ numNodesPerElem ][ 3 ]; - real32 xLocal32[ numNodesPerElem ][ 3 ]; - - /// local arrays to store the pressure at all nodes and its gradient at a given node - real64 pressure[ numNodesPerElem ]; - real64 pressureGrad[ 3 ]; - - /// local arrays to store the PML vectorial auxiliary variable at all nodes and its gradient at a given node - real64 auxV[3][ numNodesPerElem ]; - real64 auxVGrad[3][3]; - - /// local arrays to store the PML scalar auxiliary variable at all nodes and its gradient at a given node - real64 auxU[ numNodesPerElem ]; - real64 auxUGrad[3]; - - /// local array to store the PML damping profile - real32 sigma[ 3 ]; - - /// copy from global to local arrays - for( localIndex i=0; i( k, i, xLocal, gradN ); - GEOS_UNUSED_VAR ( detJ ); - - /// compute the gradient of the pressure and the PML auxiliary variables at the node - m_finiteElement.template gradient< numNodesPerElem, GRADIENT_TYPE >( gradN, pressure, pressureGrad ); - m_finiteElement.template gradient< numNodesPerElem, GRADIENT_TYPE >( gradN, auxU, auxUGrad ); - for( int j=0; j<3; ++j ) - { - m_finiteElement.template gradient< numNodesPerElem, GRADIENT_TYPE >( gradN, auxV[j], auxVGrad[j] ); - } - - /// compute the PML damping profile - PMLKernelHelper::computeDampingProfilePML( - xLocal32[i], - xMin, - xMax, - dMin, - dMax, - cMin, - cMax, - r, - sigma ); - - /// compute B.pressureGrad - C.auxUGrad where B and C are functions of the damping profile - /// WARNING: the division by 'numNodesPerElem' below is needed because the average of - /// gradient and divergence at the nodes are sought. It is the number of cells contributing - /// to each node that is needed. In this case, it is equal to 'numNodesPerElem'. For high-order - /// SEM, this approach won't work and the average needs to be computed differently (maybe using counters). - real32 localIncrementArray[3]; - localIncrementArray[0] = (sigma[0]-sigma[1]-sigma[2])*pressureGrad[0] - (sigma[1]*sigma[2])*auxUGrad[0]; - localIncrementArray[1] = (sigma[1]-sigma[0]-sigma[2])*pressureGrad[1] - (sigma[0]*sigma[2])*auxUGrad[1]; - localIncrementArray[2] = (sigma[2]-sigma[0]-sigma[1])*pressureGrad[2] - (sigma[0]*sigma[1])*auxUGrad[2]; - for( int j=0; j<3; ++j ) - { - RAJA::atomicAdd< ATOMIC_POLICY >( &grad_n[elemToNodes( k, i )][j], localIncrementArray[j]/numNodesPerElem ); - } - /// compute beta.pressure + gamma.u - c^2 * divV where beta and gamma are functions of the damping profile - real32 const beta = sigma[0]*sigma[1]+sigma[0]*sigma[2]+sigma[1]*sigma[2]; - real32 const gamma = sigma[0]*sigma[1]*sigma[2]; - real32 const localIncrement = beta*p_n[elemToNodes( k, i )] - + gamma*u_n[elemToNodes( k, i )] - - c*c*( auxVGrad[0][0] + auxVGrad[1][1] + auxVGrad[2][2] ); - - RAJA::atomicAdd< ATOMIC_POLICY >( &divV_n[elemToNodes( k, i )], localIncrement/numNodesPerElem ); - } - } ); - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; -}; - - -template< typename FE_TYPE > -struct waveSpeedPMLKernel -{ - - waveSpeedPMLKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the computation of average wave speeds in the PML region - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] targetSet list of cells in the target set - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemToNodes constant array view of map from element to nodes - * @param[in] velocity cell-wise velocity - * @param[in] xMin coordinate limits of the inner PML boundaries, left-front-top - * @param[in] xMax coordinate limits of the inner PML boundaries, right-back-bottom - * @param[out] cMin PML wave speed, left-front-top - * @param[out] cMax PML wave speed, right-back-bottom - * @param[out] counterMin PML wave speed counter, left-front-top - * @param[out] counterMax PML wave speed counter, left-front-top - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( SortedArrayView< localIndex const > const targetSet, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - traits::ViewTypeConst< CellElementSubRegion::NodeMapType > const elemToNodes, - arrayView1d< real32 const > const velocity, - real32 const (&xMin)[3], - real32 const (&xMax)[3], - real32 (& cMin)[3], - real32 (& cMax)[3], - int (& counterMin)[3], - int (& counterMax)[3] ) - { - - RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedLeft( 0.0 ); - RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedRight( 0.0 ); - RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedFront( 0.0 ); - RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedBack( 0.0 ); - RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedTop( 0.0 ); - RAJA::ReduceSum< parallelDeviceReduce, real32 > subRegionAvgWaveSpeedBottom( 0.0 ); - RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterLeft( 0 ); - RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterRight( 0 ); - RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterFront( 0 ); - RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterBack( 0 ); - RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterTop( 0 ); - RAJA::ReduceSum< parallelDeviceReduce, int > subRegionAvgWaveSpeedCounterBottom( 0 ); - - /// Loop over elements in the subregion, 'l' is the element index within the target set - forAll< EXEC_POLICY >( targetSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const l ) - { - constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; - - /// global element index - localIndex const k = targetSet[l]; - - /// wave speed at the element - real32 const c = velocity[k]; - - /// coordinates of the element center - real64 xLocal[ 3 ] = {0.0, 0.0, 0.0}; - - /// compute the coordinates of the element center - for( int j=0; j<3; ++j ) - { - for( localIndex i=0; i= xMin[1] && xLocal[1] <= xMax[1] - && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) - { - subRegionAvgWaveSpeedLeft += c; - subRegionAvgWaveSpeedCounterLeft += 1; - } - else if( xLocal[0] > xMax[0] - && xLocal[1] >= xMin[1] && xLocal[1] <= xMax[1] - && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) - { - subRegionAvgWaveSpeedRight += c; - subRegionAvgWaveSpeedCounterRight += 1; - } - if( xLocal[1] < xMin[1] - && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] - && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) - { - subRegionAvgWaveSpeedFront += c; - subRegionAvgWaveSpeedCounterFront += 1; - } - else if( xLocal[1] > xMax[1] - && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] - && xLocal[2] >= xMin[2] && xLocal[2] <= xMax[2] ) - { - subRegionAvgWaveSpeedBack += c; - subRegionAvgWaveSpeedCounterBack += 1; - } - if( xLocal[2] < xMin[2] - && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] - && xLocal[1] >= xMin[1] && xLocal[1] <= xMax[1] ) - { - subRegionAvgWaveSpeedTop += c; - subRegionAvgWaveSpeedCounterTop += 1; - } - else if( xLocal[2] > xMax[2] - && xLocal[0] >= xMin[0] && xLocal[0] <= xMax[0] - && xLocal[1] >= xMin[1] && xLocal[1] <= xMax[1] ) - { - subRegionAvgWaveSpeedBottom += c; - subRegionAvgWaveSpeedCounterBottom += 1; - } - } ); - - /// transfer local results to global variables - cMin[0]+=subRegionAvgWaveSpeedLeft.get(); - cMin[1]+=subRegionAvgWaveSpeedFront.get(); - cMin[2]+=subRegionAvgWaveSpeedTop.get(); - cMax[0]+=subRegionAvgWaveSpeedRight.get(); - cMax[1]+=subRegionAvgWaveSpeedBack.get(); - cMax[2]+=subRegionAvgWaveSpeedBottom.get(); - counterMin[0]+=subRegionAvgWaveSpeedCounterLeft.get(); - counterMin[1]+=subRegionAvgWaveSpeedCounterFront.get(); - counterMin[2]+=subRegionAvgWaveSpeedCounterTop.get(); - counterMax[0]+=subRegionAvgWaveSpeedCounterRight.get(); - counterMax[1]+=subRegionAvgWaveSpeedCounterBack.get(); - counterMax[2]+=subRegionAvgWaveSpeedCounterBottom.get(); - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; -}; - - - /** * @brief Implements kernels for solving the acoustic wave equations * explicit central FD method and SEM diff --git a/src/coreComponents/physicsSolvers/wavePropagation/AcoustoElasticTimeSchemeSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/AcoustoElasticTimeSchemeSEMKernel.hpp new file mode 100644 index 00000000000..4676d6174b9 --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/AcoustoElasticTimeSchemeSEMKernel.hpp @@ -0,0 +1,80 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file AcoustoElasticTimeSchemeSEMKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTOELASTICTIMESCHEMESEMKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTOELASTICTIMESCHEMESEMKERNEL_HPP_ + +namespace geos +{ + +struct AcoustoElasticTimeSchemeSEM +{ + + using EXEC_POLICY = parallelDevicePolicy< >; + using ATOMIC_POLICY = parallelDeviceAtomic; + /** + * @brief Apply second order Leap-Frog time scheme for the coupling condition of elasto-acoustic scheme + * @param[in] dt time-step + * @param[out] ux_np1 displacement in x-direction array at time n+1 (updated here) + * @param[out] uy_np1 displacement in y-direction array at time n+1 (updated here) + * @param[out] uz_np1 displacement in z-direction array at time n+1 (updated here) + * @param[in] p_n pressure at time n + * @param[in] elasticMass the mass matrix for the elastic equation + * @param[in] atoex the coupling matrix for x-component + * @param[in] atoey the coupling matrix for y-component + * @param[in] atoez the coupling matrix for z-component + * @param[in] elasticFSNodeIndicator array which contains indicators to tell if we are on a free-surface boundary or not (elastic region) + * @param[in] interfaceNodesSet the nodeset containing the nodes belonging to the interface + */ + + static void LeapFrog( real64 const dt, + arrayView1d< real32 > const ux_np1, + arrayView1d< real32 > const uy_np1, + arrayView1d< real32 > const uz_np1, + arrayView1d< real32 const > const p_n, + arrayView1d< real32 const > const elasticMass, + arrayView1d< real32 const > const atoex, + arrayView1d< real32 const > const atoey, + arrayView1d< real32 const > const atoez, + arrayView1d< localIndex const > const elasticFSNodeIndicator, + SortedArrayView< localIndex const > const interfaceNodesSet ) + { + real64 const dt2 = pow( dt, 2 ); + forAll< EXEC_POLICY >( interfaceNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) + { + localIndex const a = interfaceNodesSet[n]; + if( elasticFSNodeIndicator[a] == 1 ) + return; + + real32 const aux = -p_n[a] / elasticMass[a]; + real32 const localIncrementx = dt2 * atoex[a] * aux; + real32 const localIncrementy = dt2 * atoey[a] * aux; + real32 const localIncrementz = dt2 * atoez[a] * aux; + + RAJA::atomicAdd< ATOMIC_POLICY >( &ux_np1[a], localIncrementx ); + RAJA::atomicAdd< ATOMIC_POLICY >( &uy_np1[a], localIncrementy ); + RAJA::atomicAdd< ATOMIC_POLICY >( &uz_np1[a], localIncrementz ); + } ); + + }; + +}; + +} + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ACOUSTOELASTICTIMESCHEMESEMKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEM.cpp index 5a2c9e053b8..44ccacc6b9b 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEM.cpp @@ -25,6 +25,9 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/ElementType.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" +#include "events/EventManager.hpp" +#include "ElasticMatricesSEMKernel.hpp" +#include "PrecomputeSourcesAndReceiversKernel.hpp" namespace geos { @@ -262,9 +265,9 @@ void ElasticFirstOrderWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLeve localIndex const numFacesPerElem = elementSubRegion.numFacesPerElement(); - elasticFirstOrderWaveEquationSEMKernels:: - PrecomputeSourceAndReceiverKernel:: - launch< EXEC_POLICY, FE_TYPE > + PreComputeSourcesAndReceivers:: + Compute1DSourceAndReceiverConstantsWithElementsAndRegionStorage + < EXEC_POLICY, FE_TYPE > ( elementSubRegion.size(), regionIndex, numFacesPerElem, @@ -317,7 +320,7 @@ void ElasticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGrou /// get the array of indicators: 1 if the face is on the boundary; 0 otherwise arrayView1d< integer const > const & facesDomainBoundaryIndicator = faceManager.getDomainBoundaryIndicator(); - arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const X = nodeManager.getField< fields::referencePosition32 >().toViewConst(); + arrayView2d< wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords = nodeManager.getField< fields::referencePosition32 >().toViewConst(); arrayView2d< real64 const > const faceNormal = faceManager.faceNormal(); /// get face to node map @@ -356,29 +359,29 @@ void ElasticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGrou { using FE_TYPE = TYPEOFREF( finiteElement ); - elasticFirstOrderWaveEquationSEMKernels::MassMatrixKernel< FE_TYPE > kernelM( finiteElement ); - - kernelM.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - X, - elemsToNodes, - density, - mass ); - - elasticFirstOrderWaveEquationSEMKernels::DampingMatrixKernel< FE_TYPE > kernelD( finiteElement ); - - kernelD.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - X, - elemsToFaces, - facesToNodes, - facesDomainBoundaryIndicator, - freeSurfaceFaceIndicator, - faceNormal, - density, - velocityVp, - velocityVs, - dampingx, - dampingy, - dampingz ); + ElasticMatricesSEM::MassMatrix< FE_TYPE > kernelM( finiteElement ); + + kernelM.template computeMassMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToNodes, + density, + mass ); + + ElasticMatricesSEM::DampingMatrix< FE_TYPE > kernelD( finiteElement ); + + kernelD.template computeDampingMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToFaces, + facesToNodes, + facesDomainBoundaryIndicator, + freeSurfaceFaceIndicator, + faceNormal, + density, + velocityVp, + velocityVs, + dampingx, + dampingy, + dampingz ); } ); } ); } ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEMKernel.hpp index 8ab22a047d1..644b7650670 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEMKernel.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/ElasticFirstOrderWaveEquationSEMKernel.hpp @@ -30,300 +30,6 @@ namespace geos namespace elasticFirstOrderWaveEquationSEMKernels { -struct PrecomputeSourceAndReceiverKernel -{ - - /** - * @brief Launches the precomputation of the source and receiver terms - * @tparam EXEC_POLICY execution policy - * @tparam FE_TYPE finite element type - * @param[in] size the number of cells in the subRegion - * @param[in] numFacesPerElem number of face on an element - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemGhostRank array containing the ghost rank - * @param[in] elemsToNodes map from element to nodes - * @param[in] elemsToFaces map from element to faces - * @param[in] elemCenter coordinates of the element centers - * @param[in] faceNormal array containing the normal of all faces - * @param[in] faceCenter array containing the center of all faces - * @param[in] sourceCoordinates coordinates of the source terms - * @param[in] receiverCoordinates coordinates of the receiver terms - * @param[in] dt time-step - * @param[in] timeSourceFrequency Peak frequency of the source - * @param[in] timeSourceDelay the time delay of the source - * @param[in] rickerOrder Order of the Ricker wavelet - * @param[out] sourceNodeIds indices of the nodes of the element where the source is located - * @param[out] sourceConstants constant part of the source terms - * @param[out] receiverIsLocal flag indicating whether the receiver is local or not - * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located - * @param[out] sourceValue array containing the value of the time dependent source (Ricker for e.g) - */ - template< typename EXEC_POLICY, typename FE_TYPE > - static void - launch( localIndex const size, - localIndex const regionIndex, - localIndex const numFacesPerElem, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView1d< integer const > const elemGhostRank, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, - arrayView2d< localIndex const > const elemsToFaces, - arrayView2d< real64 const > const & elemCenter, - arrayView2d< real64 const > const faceNormal, - arrayView2d< real64 const > const faceCenter, - arrayView2d< real64 const > const sourceCoordinates, - arrayView1d< localIndex > const sourceIsAccessible, - arrayView1d< localIndex > const sourceElem, - arrayView2d< localIndex > const sourceNodeIds, - arrayView2d< real64 > const sourceConstants, - arrayView1d< localIndex > const sourceRegion, - arrayView2d< real64 const > const receiverCoordinates, - arrayView1d< localIndex > const receiverIsLocal, - arrayView1d< localIndex > const rcvElem, - arrayView2d< localIndex > const receiverNodeIds, - arrayView2d< real64 > const receiverConstants, - arrayView1d< localIndex > const receiverRegion, - arrayView2d< real32 > const sourceValue, - real64 const dt, - real32 const timeSourceFrequency, - real32 const timeSourceDelay, - localIndex const rickerOrder ) - { - constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; - - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) - { - real64 const center[3] = { elemCenter[k][0], - elemCenter[k][1], - elemCenter[k][2] }; - - // Step 1: locate the sources, and precompute the source term - - /// loop over all the source that haven't been found yet - for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) - { - if( sourceIsAccessible[isrc] == 0 ) - { - real64 const coords[3] = { sourceCoordinates[isrc][0], - sourceCoordinates[isrc][1], - sourceCoordinates[isrc][2] }; - - bool const sourceFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - - if( sourceFound ) - { - real64 coordsOnRefElem[3]{}; - - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - sourceIsAccessible[isrc] = 1; - sourceElem[isrc] = k; - sourceRegion[isrc] = regionIndex; - real64 Ntest[numNodesPerElem]; - FE_TYPE::calcN( coordsOnRefElem, Ntest ); - - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - sourceNodeIds[isrc][a] = elemsToNodes[k][a]; - sourceConstants[isrc][a] = Ntest[a]; - } - - for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) - { - sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); - } - - } - } - } // end loop over all sources - - - // Step 2: locate the receivers, and precompute the receiver term - - /// loop over all the receivers that haven't been found yet - for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) - { - if( receiverIsLocal[ircv] == 0 ) - { - real64 const coords[3] = { receiverCoordinates[ircv][0], - receiverCoordinates[ircv][1], - receiverCoordinates[ircv][2] }; - - real64 coordsOnRefElem[3]{}; - bool const receiverFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - if( receiverFound && elemGhostRank[k] < 0 ) - { - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - receiverIsLocal[ircv] = 1; - rcvElem[ircv] = k; - receiverRegion[ircv] = regionIndex; - - real64 Ntest[numNodesPerElem]; - FE_TYPE::calcN( coordsOnRefElem, Ntest ); - - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - receiverNodeIds[ircv][a] = elemsToNodes[k][a]; - receiverConstants[ircv][a] = Ntest[a]; - } - } - } - } // end loop over receivers - } ); - - } -}; - -template< typename FE_TYPE > -struct MassMatrixKernel -{ - - MassMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the mass matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] numFacesPerElem number of faces per element - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToNodes map from element to nodes - * @param[in] velocity cell-wise velocity - * @param[out] mass diagonal of the mass matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes, - arrayView1d< real32 const > const density, - arrayView1d< real32 > const mass ) - - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) - { - // only the eight corners of the mesh cell are needed to compute the Jacobian - real64 xLocal[ 8 ][ 3 ]; - for( localIndex a = 0; a < 8; ++a ) - { - localIndex const nodeIndex = elemsToNodes( k, FE_TYPE::meshIndexToLinearIndex3D( a ) ); - for( localIndex i = 0; i < 3; ++i ) - { - xLocal[a][i] = nodeCoords( nodeIndex, i ); - } - } - - constexpr localIndex numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; - for( localIndex q = 0; q < numQuadraturePointsPerElem; ++q ) - { - real32 const localIncrement = density[k] * m_finiteElement.computeMassTerm( q, xLocal ); - RAJA::atomicAdd< ATOMIC_POLICY >( &mass[elemsToNodes[k][q]], localIncrement ); - } - } ); // end loop over element - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - -template< typename FE_TYPE > -struct DampingMatrixKernel -{ - - DampingMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the damping matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToFaces map from elements to faces - * @param[in] facesToNodes map from face to nodes - * @param[in] facesDomainBoundaryIndicator flag equal to 1 if the face is on the boundary, and to 0 otherwise - * @param[in] freeSurfaceFaceIndicator flag equal to 1 if the face is on the free surface, and to 0 otherwise - * @param[in] velocity cell-wise velocity - * @param[out] damping diagonal of the damping matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const > const elemsToFaces, - ArrayOfArraysView< localIndex const > const facesToNodes, - arrayView1d< integer const > const facesDomainBoundaryIndicator, - arrayView1d< localIndex const > const freeSurfaceFaceIndicator, - arrayView2d< real64 const > const faceNormal, - arrayView1d< real32 const > const density, - arrayView1d< real32 const > const velocityVp, - arrayView1d< real32 const > const velocityVs, - arrayView1d< real32 > const dampingx, - arrayView1d< real32 > const dampingy, - arrayView1d< real32 > const dampingz ) - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - for( localIndex i = 0; i < elemsToFaces.size( 1 ); ++i ) - { - localIndex const f = elemsToFaces( e, i ); - // face on the domain boundary and not on free surface - if( facesDomainBoundaryIndicator[f] == 1 && freeSurfaceFaceIndicator[f] != 1 ) - { - // only the four corners of the mesh face are needed to compute the Jacobian - real64 xLocal[ 4 ][ 3 ]; - for( localIndex a = 0; a < 4; ++a ) - { - localIndex const nodeIndex = facesToNodes( f, FE_TYPE::meshIndexToLinearIndex2D( a ) ); - for( localIndex d = 0; d < 3; ++d ) - { - xLocal[a][d] = nodeCoords( nodeIndex, d ); - } - } - - real32 const nx = faceNormal( f, 0 ), ny = faceNormal( f, 1 ), nz = faceNormal( f, 2 ); - constexpr localIndex numNodesPerFace = FE_TYPE::numNodesPerFace; - for( localIndex q = 0; q < numNodesPerFace; ++q ) - { - real32 const aux = density[e] * m_finiteElement.computeDampingTerm( q, xLocal ); - real32 const localIncrementx = density[e] * (velocityVp[e] * LvArray::math::abs( nx ) + velocityVs[e] * LvArray::math::sqrt( pow( ny, 2 ) + pow( nz, 2 ) ) ) * aux; - real32 const localIncrementy = density[e] * (velocityVp[e] * LvArray::math::abs( ny ) + velocityVs[e] * LvArray::math::sqrt( pow( nx, 2 ) + pow( nz, 2 ) ) ) * aux; - real32 const localIncrementz = density[e] * (velocityVp[e] * LvArray::math::abs( nz ) + velocityVs[e] * LvArray::math::sqrt( pow( nx, 2 ) + pow( ny, 2 ) ) ) * aux; - - RAJA::atomicAdd< ATOMIC_POLICY >( &dampingx[facesToNodes( f, q )], localIncrementx ); - RAJA::atomicAdd< ATOMIC_POLICY >( &dampingy[facesToNodes( f, q )], localIncrementy ); - RAJA::atomicAdd< ATOMIC_POLICY >( &dampingz[facesToNodes( f, q )], localIncrementz ); - } - } - } - } ); - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - template< typename FE_TYPE > struct StressComputation { diff --git a/src/coreComponents/physicsSolvers/wavePropagation/ElasticMatricesSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/ElasticMatricesSEMKernel.hpp new file mode 100644 index 00000000000..8d52ac2dafb --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/ElasticMatricesSEMKernel.hpp @@ -0,0 +1,168 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ElasticMatricesSEMKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ELASTICMATRICESSEMKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ELASTICMATRICESSEMKERNEL_HPP_ + +namespace geos +{ + +struct ElasticMatricesSEM +{ + template< typename FE_TYPE > + struct MassMatrix + { + + MassMatrix( FE_TYPE const & finiteElement ) + : m_finiteElement( finiteElement ) + {} + + /** + * @brief Launches the precomputation of the mass matrices + * @tparam EXEC_POLICY the execution policy + * @tparam ATOMIC_POLICY the atomic policy + * @param[in] size the number of cells in the subRegion + * @param[in] numFacesPerElem number of faces per element + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemsToNodes map from element to nodes + * @param[in] velocity cell-wise velocity + * @param[out] mass diagonal of the mass matrix + */ + template< typename EXEC_POLICY, typename ATOMIC_POLICY > + void + computeMassMatrix( localIndex const size, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes, + arrayView1d< real32 const > const density, + arrayView1d< real32 > const mass ) + + { + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) + { + + // only the eight corners of the mesh cell are needed to compute the Jacobian + real64 xLocal[ 8 ][ 3 ]; + for( localIndex a = 0; a < 8; ++a ) + { + localIndex const nodeIndex = elemsToNodes( e, FE_TYPE::meshIndexToLinearIndex3D( a ) ); + for( localIndex i = 0; i < 3; ++i ) + { + xLocal[a][i] = nodeCoords( nodeIndex, i ); + } + } + + constexpr localIndex numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; + for( localIndex q = 0; q < numQuadraturePointsPerElem; ++q ) + { + real32 const localIncrement = density[e] * m_finiteElement.computeMassTerm( q, xLocal ); + RAJA::atomicAdd< ATOMIC_POLICY >( &mass[elemsToNodes( e, q )], localIncrement ); + } + } ); // end loop over element + } + + /// The finite element space/discretization object for the element type in the subRegion + FE_TYPE const & m_finiteElement; + + }; + + template< typename FE_TYPE > + struct DampingMatrix + { + + DampingMatrix( FE_TYPE const & finiteElement ) + : m_finiteElement( finiteElement ) + {} + + /** + * @brief Launches the precomputation of the damping matrices + * @tparam EXEC_POLICY the execution policy + * @tparam ATOMIC_POLICY the atomic policy + * @param[in] size the number of cells in the subRegion + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemsToFaces map from elements to faces + * @param[in] facesToNodes map from face to nodes + * @param[in] facesDomainBoundaryIndicator flag equal to 1 if the face is on the boundary, and to 0 otherwise + * @param[in] freeSurfaceFaceIndicator flag equal to 1 if the face is on the free surface, and to 0 otherwise + * @param[in] velocity cell-wise velocity + * @param[out] damping diagonal of the damping matrix + */ + template< typename EXEC_POLICY, typename ATOMIC_POLICY > + void + computeDampingMatrix( localIndex const size, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView2d< localIndex const > const elemsToFaces, + ArrayOfArraysView< localIndex const > const facesToNodes, + arrayView1d< integer const > const facesDomainBoundaryIndicator, + arrayView1d< localIndex const > const freeSurfaceFaceIndicator, + arrayView2d< real64 const > const faceNormal, + arrayView1d< real32 const > const density, + arrayView1d< real32 const > const velocityVp, + arrayView1d< real32 const > const velocityVs, + arrayView1d< real32 > const dampingx, + arrayView1d< real32 > const dampingy, + arrayView1d< real32 > const dampingz ) + { + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) + { + for( localIndex i = 0; i < elemsToFaces.size( 1 ); ++i ) + { + localIndex const f = elemsToFaces( e, i ); + // face on the domain boundary and not on free surface + if( facesDomainBoundaryIndicator[f] == 1 && freeSurfaceFaceIndicator[f] != 1 ) + { + // only the four corners of the mesh face are needed to compute the Jacobian + real64 xLocal[ 4 ][ 3 ]; + for( localIndex a = 0; a < 4; ++a ) + { + localIndex const nodeIndex = facesToNodes( f, FE_TYPE::meshIndexToLinearIndex2D( a ) ); + for( localIndex d = 0; d < 3; ++d ) + { + xLocal[a][d] = nodeCoords( nodeIndex, d ); + } + } + + real32 const nx = faceNormal( f, 0 ), ny = faceNormal( f, 1 ), nz = faceNormal( f, 2 ); + constexpr localIndex numNodesPerFace = FE_TYPE::numNodesPerFace; + for( localIndex q = 0; q < numNodesPerFace; ++q ) + { + real32 const aux = density[e] * m_finiteElement.computeDampingTerm( q, xLocal ); + real32 const localIncrementx = aux * ( velocityVp[e] * LvArray::math::abs( nx ) + velocityVs[e] * LvArray::math::sqrt( pow( ny, 2 ) + pow( nz, 2 ) ) ); + real32 const localIncrementy = aux * ( velocityVp[e] * LvArray::math::abs( ny ) + velocityVs[e] * LvArray::math::sqrt( pow( nx, 2 ) + pow( nz, 2 ) ) ); + real32 const localIncrementz = aux * ( velocityVp[e] * LvArray::math::abs( nz ) + velocityVs[e] * LvArray::math::sqrt( pow( nx, 2 ) + pow( ny, 2 ) ) ); + + RAJA::atomicAdd< ATOMIC_POLICY >( &dampingx[facesToNodes( f, q )], localIncrementx ); + RAJA::atomicAdd< ATOMIC_POLICY >( &dampingy[facesToNodes( f, q )], localIncrementy ); + RAJA::atomicAdd< ATOMIC_POLICY >( &dampingz[facesToNodes( f, q )], localIncrementz ); + } + } + } + } ); + } + + /// The finite element space/discretization object for the element type in the subRegion + FE_TYPE const & m_finiteElement; + + }; + + + +}; + +} // namespace geos + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ELASTICMATRICESSEMKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/ElasticTimeSchemeSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/ElasticTimeSchemeSEMKernel.hpp new file mode 100644 index 00000000000..b2df78e5c2d --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/ElasticTimeSchemeSEMKernel.hpp @@ -0,0 +1,102 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ElasticTimeSchemeSEMKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ELASTICTIMESCHEMESEMKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ELASTICTIMESCHEMESEMKERNEL_HPP_ + +namespace geos +{ + +struct ElasticTimeSchemeSEM +{ + + using EXEC_POLICY = parallelDevicePolicy< >; + /** + * @brief Apply second order Leap-Frog time scheme for isotropic case without PML + * @param[in] dt time-step + * @param[out] ux_np1 displacement in x-direction array at time n+1 (updated here) + * @param[in] ux_n displacement in x-direction array at time n + * @param[in] ux_nm1 displacement in x-direction array at time n-1 + * @param[out] uy_np1 displacement in y-direction array at time n+1 (updated here) + * @param[in] uy_n displacement in y-direction array at time n + * @param[in] uy_nm1 displacement in y-direction array at time n-1 + * @param[out] uz_np1 displacement in z-direction array at time n+1 (updated here) + * @param[in] uz_n displacement in z-direction array at time n + * @param[in] uz_nm1 displacement in z-direction array at time n-1 + * @param[in] mass the mass matrix + * @param[in] dampingx the damping matrix for x-component + * @param[in] dampingy the damping matrix for y-component + * @param[in] dampingz the damping matrix for z-component + * @param[in] stiffnessVectorx array containing the product of the stiffness matrix R and the displacement in x-direction at time n + * @param[in] stiffnessVectory array containing the product of the stiffness matrix R and the displacement in y-direction at time n + * @param[in] stiffnessVectorz array containing the product of the stiffness matrix R and the displacement in z-direction at time n + * @param[in] rhsx the right-hand-side for displacement in x-direction + * @param[in] rhsy the right-hand-side for displacement in y-direction + * @param[in] rhsz the right-hand-side for displacement in z-direction + * @param[in] solverTargetNodesSet the targetted nodeset (useful in particular when we do elasto-acoustic simulation ) + */ + static void LeapFrog( real64 const dt, + arrayView1d< real32 > const ux_np1, + arrayView1d< real32 > const ux_n, + arrayView1d< real32 > const ux_nm1, + arrayView1d< real32 > const uy_np1, + arrayView1d< real32 > const uy_n, + arrayView1d< real32 > const uy_nm1, + arrayView1d< real32 > const uz_np1, + arrayView1d< real32 > const uz_n, + arrayView1d< real32 > const uz_nm1, + arrayView1d< real32 const > const mass, + arrayView1d< real32 const > const dampingx, + arrayView1d< real32 const > const dampingy, + arrayView1d< real32 const > const dampingz, + arrayView1d< real32 > const stiffnessVectorx, + arrayView1d< real32 > const stiffnessVectory, + arrayView1d< real32 > const stiffnessVectorz, + arrayView1d< real32 > const rhsx, + arrayView1d< real32 > const rhsy, + arrayView1d< real32 > const rhsz, + SortedArrayView< localIndex const > const solverTargetNodesSet ) + { + real64 const dt2 = pow( dt, 2 ); + forAll< EXEC_POLICY >( solverTargetNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) + { + localIndex const a = solverTargetNodesSet[n]; + ux_np1[a] = ux_n[a]; + ux_np1[a] *= 2.0*mass[a]; + ux_np1[a] -= (mass[a]-0.5*dt*dampingx[a])*ux_nm1[a]; + ux_np1[a] += dt2*(rhsx[a]-stiffnessVectorx[a]); + ux_np1[a] /= mass[a]+0.5*dt*dampingx[a]; + uy_np1[a] = uy_n[a]; + uy_np1[a] *= 2.0*mass[a]; + uy_np1[a] -= (mass[a]-0.5*dt*dampingy[a])*uy_nm1[a]; + uy_np1[a] += dt2*(rhsy[a]-stiffnessVectory[a]); + uy_np1[a] /= mass[a]+0.5*dt*dampingy[a]; + uz_np1[a] = uz_n[a]; + uz_np1[a] *= 2.0*mass[a]; + uz_np1[a] -= (mass[a]-0.5*dt*dampingz[a])*uz_nm1[a]; + uz_np1[a] += dt2*(rhsz[a]-stiffnessVectorz[a]); + uz_np1[a] /= mass[a]+0.5*dt*dampingz[a]; + } ); + + }; + +}; + +} + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_ELASTICTIMESCHEMESEMKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEM.cpp index 1d9e8fed402..85b409ccfa1 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEM.cpp @@ -25,7 +25,11 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/ElementType.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" +#include "events/EventManager.hpp" #include "WaveSolverUtils.hpp" +#include "ElasticTimeSchemeSEMKernel.hpp" +#include "ElasticMatricesSEMKernel.hpp" +#include "PrecomputeSourcesAndReceiversKernel.hpp" namespace geos { @@ -276,9 +280,9 @@ void ElasticWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & mesh, using FE_TYPE = TYPEOFREF( finiteElement ); localIndex const numFacesPerElem = elementSubRegion.numFacesPerElement(); - elasticWaveEquationSEMKernels:: - PrecomputeSourceAndReceiverKernel:: - launch< EXEC_POLICY, FE_TYPE > + PreComputeSourcesAndReceivers:: + Compute3DSourceAndReceiverConstantsWithDAS + < EXEC_POLICY, FE_TYPE > ( elementSubRegion.size(), numFacesPerElem, X, @@ -400,27 +404,27 @@ void ElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() { using FE_TYPE = TYPEOFREF( finiteElement ); - elasticWaveEquationSEMKernels::MassMatrixKernel< FE_TYPE > kernelM( finiteElement ); - kernelM.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - nodeCoords, - elemsToNodes, - density, - mass ); - - elasticWaveEquationSEMKernels::DampingMatrixKernel< FE_TYPE > kernelD( finiteElement ); - kernelD.template launch< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), - nodeCoords, - elemsToFaces, - facesToNodes, - facesDomainBoundaryIndicator, - freeSurfaceFaceIndicator, - faceNormal, - density, - velocityVp, - velocityVs, - dampingx, - dampingy, - dampingz ); + ElasticMatricesSEM::MassMatrix< FE_TYPE > kernelM( finiteElement ); + kernelM.template computeMassMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToNodes, + density, + mass ); + + ElasticMatricesSEM::DampingMatrix< FE_TYPE > kernelD( finiteElement ); + kernelD.template computeDampingMatrix< EXEC_POLICY, ATOMIC_POLICY >( elementSubRegion.size(), + nodeCoords, + elemsToFaces, + facesToNodes, + facesDomainBoundaryIndicator, + freeSurfaceFaceIndicator, + faceNormal, + density, + velocityVp, + velocityVs, + dampingx, + dampingy, + dampingz ); } ); } ); } ); @@ -554,9 +558,6 @@ void ElasticWaveEquationSEM::computeUnknowns( real64 const &, arrayView1d< real32 > const uy_np1 = nodeManager.getField< elasticfields::Displacementy_np1 >(); arrayView1d< real32 > const uz_np1 = nodeManager.getField< elasticfields::Displacementz_np1 >(); - /// get array of indicators: 1 if node on free surface; 0 otherwise - arrayView1d< localIndex const > const freeSurfaceNodeIndicator = nodeManager.getField< elasticfields::ElasticFreeSurfaceNodeIndicator >(); - arrayView1d< real32 > const rhsx = nodeManager.getField< elasticfields::ForcingRHSx >(); arrayView1d< real32 > const rhsy = nodeManager.getField< elasticfields::ForcingRHSy >(); arrayView1d< real32 > const rhsz = nodeManager.getField< elasticfields::ForcingRHSz >(); @@ -575,30 +576,10 @@ void ElasticWaveEquationSEM::computeUnknowns( real64 const &, addSourceToRightHandSide( cycleNumber, rhsx, rhsy, rhsz ); - real64 const dt2 = pow( dt, 2 ); SortedArrayView< localIndex const > const solverTargetNodesSet = m_solverTargetNodesSet.toViewConst(); - forAll< EXEC_POLICY >( solverTargetNodesSet.size(), [=] GEOS_HOST_DEVICE ( localIndex const n ) - { - localIndex const a = solverTargetNodesSet[n]; - if( freeSurfaceNodeIndicator[a] != 1 ) - { - ux_np1[a] = ux_n[a]; - ux_np1[a] *= 2.0*mass[a]; - ux_np1[a] -= (mass[a]-0.5*dt*dampingx[a])*ux_nm1[a]; - ux_np1[a] += dt2*(rhsx[a]-stiffnessVectorx[a]); - ux_np1[a] /= mass[a]+0.5*dt*dampingx[a]; - uy_np1[a] = uy_n[a]; - uy_np1[a] *= 2.0*mass[a]; - uy_np1[a] -= (mass[a]-0.5*dt*dampingy[a])*uy_nm1[a]; - uy_np1[a] += dt2*(rhsy[a]-stiffnessVectory[a]); - uy_np1[a] /= mass[a]+0.5*dt*dampingy[a]; - uz_np1[a] = uz_n[a]; - uz_np1[a] *= 2.0*mass[a]; - uz_np1[a] -= (mass[a]-0.5*dt*dampingz[a])*uz_nm1[a]; - uz_np1[a] += dt2*(rhsz[a]-stiffnessVectorz[a]); - uz_np1[a] /= mass[a]+0.5*dt*dampingz[a]; - } - } ); + ElasticTimeSchemeSEM::LeapFrog( dt, ux_np1, ux_n, ux_nm1, uy_np1, uy_n, uy_nm1, uz_np1, uz_n, uz_nm1, + mass, dampingx, dampingy, dampingz, stiffnessVectorx, stiffnessVectory, + stiffnessVectorz, rhsx, rhsy, rhsz, solverTargetNodesSet ); } void ElasticWaveEquationSEM::synchronizeUnknowns( real64 const & time_n, diff --git a/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEMKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEMKernel.hpp index 78b7292eda7..8518444a746 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEMKernel.hpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/ElasticWaveEquationSEMKernel.hpp @@ -30,417 +30,6 @@ using namespace fields; namespace elasticWaveEquationSEMKernels { -struct PrecomputeSourceAndReceiverKernel -{ - - /** - * @brief Launches the precomputation of the source and receiver terms - * @tparam EXEC_POLICY execution policy - * @tparam FE_TYPE finite element type - * @param[in] size the number of cells in the subRegion - * @param[in] numFacesPerElem number of face on an element - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemGhostRank array containing the ghost rank - * @param[in] elemsToNodes map from element to nodes - * @param[in] elemsToFaces map from element to faces - * @param[in] elemCenter coordinates of the element centers - * @param[in] faceNormal array containing the normal of all faces - * @param[in] faceCenter array containing the center of all faces - * @param[in] sourceCoordinates coordinates of the source terms - * @param[in] receiverCoordinates coordinates of the receiver terms - * @param[in] dt time-step - * @param[in] timeSourceFrequency Peak frequency of the source - * @param[in] sourceForce force vector of the source - * @param[in] sourceMoment moment (symmetric rank-2 tensor) of the source - * @param[in] useDAS parameter that determines which kind of receiver needs to be modeled (DAS or not, and which type) - * @param[in] linearDASSamples parameter that gives the number of integration points to be used when computing the DAS signal via strain - * integration - * @param[in] linearDASGeometry geometry of the linear DAS receivers, if needed - * @param[in] rickerOrder Order of the Ricker wavelet - * @param[out] sourceIsAccessible flag indicating whether the source is accessible or not - * @param[out] sourceNodeIds indices of the nodes of the element where the source is located - * @param[out] sourceConstantsx constant part of the source terms in x-direction - * @param[out] sourceConstantsy constant part of the source terms in y-direction - * @param[out] sourceConstantsz constant part of the source terms in z-direction - * @param[out] receiverIsLocal flag indicating whether the receiver is local or not - * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located - * @param[out] receiverNodeConstants constant part of the receiver term - * @param[out] sourceValue array containing the value of the time dependent source (Ricker for e.g) - */ - template< typename EXEC_POLICY, typename FE_TYPE > - static void - launch( localIndex const size, - localIndex const numFacesPerElem, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView1d< integer const > const elemGhostRank, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, - arrayView2d< localIndex const > const elemsToFaces, - arrayView2d< real64 const > const & elemCenter, - arrayView2d< real64 const > const faceNormal, - arrayView2d< real64 const > const faceCenter, - arrayView2d< real64 const > const sourceCoordinates, - arrayView1d< localIndex > const sourceIsAccessible, - arrayView2d< localIndex > const sourceNodeIds, - arrayView2d< real64 > const sourceConstantsx, - arrayView2d< real64 > const sourceConstantsy, - arrayView2d< real64 > const sourceConstantsz, - arrayView2d< real64 const > const receiverCoordinates, - arrayView1d< localIndex > const receiverIsLocal, - arrayView2d< localIndex > const receiverNodeIds, - arrayView2d< real64 > const receiverConstants, - arrayView2d< real32 > const sourceValue, - real64 const dt, - real32 const timeSourceFrequency, - real32 const timeSourceDelay, - localIndex const rickerOrder, - WaveSolverUtils::DASType useDAS, - integer linearDASSamples, - arrayView2d< real64 const > const linearDASGeometry, - R1Tensor const sourceForce, - R2SymTensor const sourceMoment ) - { - constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; - integer nSamples = useDAS == WaveSolverUtils::DASType::none ? 1 : linearDASSamples; - array1d< real64 > const samplePointLocationsA( nSamples ); - arrayView1d< real64 > const samplePointLocations = samplePointLocationsA.toView(); - array1d< real64 > const sampleIntegrationConstantsA( nSamples ); - arrayView1d< real64 > const sampleIntegrationConstants = sampleIntegrationConstantsA.toView(); - - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) - { - real64 const center[3] = { elemCenter[k][0], - elemCenter[k][1], - elemCenter[k][2] }; - - // Step 1: locate the sources, and precompute the source term - - /// loop over all the source that haven't been found yet - for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) - { - if( sourceIsAccessible[isrc] == 0 ) - { - real64 const coords[3] = { sourceCoordinates[isrc][0], - sourceCoordinates[isrc][1], - sourceCoordinates[isrc][2] }; - - real64 xLocal[numNodesPerElem][3]; - - for( localIndex a=0; a< numNodesPerElem; ++a ) - { - for( localIndex i=0; i<3; ++i ) - { - xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i ); - } - } - - - bool const sourceFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - - if( sourceFound ) - { - real64 coordsOnRefElem[3]{}; - - - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - sourceIsAccessible[isrc] = 1; - - real64 N[numNodesPerElem]; - real64 gradN[numNodesPerElem][3]; - FE_TYPE::calcN( coordsOnRefElem, N ); - FE_TYPE::calcGradN( coordsOnRefElem, xLocal, gradN ); - R2SymTensor moment = sourceMoment; - for( localIndex q=0; q< numNodesPerElem; ++q ) - { - real64 inc[3] = { 0, 0, 0 }; - sourceNodeIds[isrc][q] = elemsToNodes( k, q ); - inc[0] += sourceForce[0] * N[q]; - inc[1] += sourceForce[1] * N[q]; - inc[2] += sourceForce[2] * N[q]; - - LvArray::tensorOps::Ri_add_symAijBj< 3 >( inc, moment.data, gradN[q] ); - sourceConstantsx[isrc][q] += inc[0]; - sourceConstantsy[isrc][q] += inc[1]; - sourceConstantsz[isrc][q] += inc[2]; - } - - for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) - { - sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); - } - - } - } - } // end loop over all sources - - // Step 2: locate the receivers, and precompute the receiver term - - // for geophones, we need only a point per receiver. - // for DAS, we need multiple points - - /// compute locations of samples along receiver - if( nSamples == 1 ) - { - samplePointLocations[ 0 ] = 0; - } - else - { - for( integer i = 0; i < nSamples; ++i ) - { - samplePointLocations[ i ] = -0.5 + (real64) i / ( linearDASSamples - 1 ); - } - } - - /// compute integration constants of samples - /// for displacement difference (dipole) DAS, take the discrete derivative of the pair of geophones - if( useDAS == WaveSolverUtils::DASType::dipole ) - { - sampleIntegrationConstants[ 0 ] = -1.0; - sampleIntegrationConstants[ 1 ] = 1.0; - } - /// for strain integration DAS, take the average of strains to average strain data - else if( nSamples == 1 ) - { - sampleIntegrationConstants[ 0 ] = 1.0; - } - else - { - for( integer i = 0; i < linearDASSamples; i++ ) - { - sampleIntegrationConstants[ i ] = 1.0 / nSamples; - } - } - - /// loop over all the receivers - for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) - { - R1Tensor receiverCenter = { receiverCoordinates[ ircv ][ 0 ], receiverCoordinates[ ircv ][ 1 ], receiverCoordinates[ ircv ][ 2 ] }; - R1Tensor receiverVector; - if( useDAS == WaveSolverUtils::DASType::none ) - { - receiverVector = { 0, 0, 0 }; - } - else - { - receiverVector = WaveSolverUtils::computeDASVector( linearDASGeometry[ ircv ][ 0 ], linearDASGeometry[ ircv ][ 1 ] ); - } - real64 receiverLength = useDAS == WaveSolverUtils::DASType::none ? 0 : linearDASGeometry[ ircv ][ 2 ]; - /// loop over samples - for( integer iSample = 0; iSample < nSamples; ++iSample ) - { - /// compute sample coordinates and locate the element containing it - real64 const coords[3] = { receiverCenter[ 0 ] + receiverVector[ 0 ] * receiverLength * samplePointLocations[ iSample ], - receiverCenter[ 1 ] + receiverVector[ 1 ] * receiverLength * samplePointLocations[ iSample ], - receiverCenter[ 2 ] + receiverVector[ 2 ] * receiverLength * samplePointLocations[ iSample ] }; - bool const sampleFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - if( sampleFound && elemGhostRank[k] < 0 ) - { - real64 coordsOnRefElem[3]{}; - real64 xLocal[numNodesPerElem][3]; - - for( localIndex a=0; a< numNodesPerElem; ++a ) - { - for( localIndex i=0; i<3; ++i ) - { - xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i ); - } - } - - WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, - elemsToNodes[k], - nodeCoords, - coordsOnRefElem ); - real64 N[numNodesPerElem]; - real64 gradN[numNodesPerElem][3]; - FE_TYPE::calcN( coordsOnRefElem, N ); - FE_TYPE::calcGradN( coordsOnRefElem, xLocal, gradN ); - for( localIndex a = 0; a < numNodesPerElem; ++a ) - { - receiverNodeIds[ircv][iSample * numNodesPerElem + a] = elemsToNodes( k, - a ); - if( useDAS == WaveSolverUtils::DASType::strainIntegration ) - { - receiverConstants[ircv][iSample * numNodesPerElem + a] += ( gradN[a][0] * receiverVector[0] + gradN[a][1] * receiverVector[1] + gradN[a][2] * receiverVector[2] ) * - sampleIntegrationConstants[ iSample ]; - } - else - { - receiverConstants[ircv][iSample * numNodesPerElem + a] += N[a] * sampleIntegrationConstants[ iSample ]; - } - } - receiverIsLocal[ ircv ] = 2; - } - } // end loop over samples - // determine if the current rank is the owner of this receiver - real64 const coords[3] = { receiverCenter[ 0 ], receiverCenter[ 1 ], receiverCenter[ 2 ] }; - bool const receiverFound = - WaveSolverUtils::locateSourceElement( numFacesPerElem, - center, - faceNormal, - faceCenter, - elemsToFaces[k], - coords ); - if( receiverFound && elemGhostRank[k] < 0 ) - { - receiverIsLocal[ ircv ] = 1; - } - } // end loop over receivers - } ); - - } -}; - -template< typename FE_TYPE > -struct MassMatrixKernel -{ - - MassMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the mass matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] numFacesPerElem number of faces per element - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToNodes map from element to nodes - * @param[in] velocity cell-wise velocity - * @param[out] mass diagonal of the mass matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - //std::enable_if_t< geos::is_sem_formulation< std::remove_cv_t< FE_TYPE_ > >::value, void > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const, cells::NODE_MAP_USD > const elemsToNodes, - arrayView1d< real32 const > const density, - arrayView1d< real32 > const mass ) - - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - - // only the eight corners of the mesh cell are needed to compute the Jacobian - real64 xLocal[ 8 ][ 3 ]; - for( localIndex a = 0; a < 8; ++a ) - { - localIndex const nodeIndex = elemsToNodes( e, FE_TYPE::meshIndexToLinearIndex3D( a ) ); - for( localIndex i = 0; i < 3; ++i ) - { - xLocal[a][i] = nodeCoords( nodeIndex, i ); - } - } - - constexpr localIndex numQuadraturePointsPerElem = FE_TYPE::numQuadraturePoints; - for( localIndex q = 0; q < numQuadraturePointsPerElem; ++q ) - { - real32 const localIncrement = density[e] * m_finiteElement.computeMassTerm( q, xLocal ); - RAJA::atomicAdd< ATOMIC_POLICY >( &mass[elemsToNodes( e, q )], localIncrement ); - } - } ); // end loop over element - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - -template< typename FE_TYPE > -struct DampingMatrixKernel -{ - - DampingMatrixKernel( FE_TYPE const & finiteElement ) - : m_finiteElement( finiteElement ) - {} - - /** - * @brief Launches the precomputation of the damping matrices - * @tparam EXEC_POLICY the execution policy - * @tparam ATOMIC_POLICY the atomic policy - * @param[in] size the number of cells in the subRegion - * @param[in] nodeCoords coordinates of the nodes - * @param[in] elemsToFaces map from elements to faces - * @param[in] facesToNodes map from face to nodes - * @param[in] facesDomainBoundaryIndicator flag equal to 1 if the face is on the boundary, and to 0 otherwise - * @param[in] freeSurfaceFaceIndicator flag equal to 1 if the face is on the free surface, and to 0 otherwise - * @param[in] velocity cell-wise velocity - * @param[out] damping diagonal of the damping matrix - */ - template< typename EXEC_POLICY, typename ATOMIC_POLICY > - //std::enable_if_t< geos::is_sem_formulation< std::remove_cv_t< FE_TYPE_ > >::value, void > - void - launch( localIndex const size, - arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, - arrayView2d< localIndex const > const elemsToFaces, - ArrayOfArraysView< localIndex const > const facesToNodes, - arrayView1d< integer const > const facesDomainBoundaryIndicator, - arrayView1d< localIndex const > const freeSurfaceFaceIndicator, - arrayView2d< real64 const > const faceNormal, - arrayView1d< real32 const > const density, - arrayView1d< real32 const > const velocityVp, - arrayView1d< real32 const > const velocityVs, - arrayView1d< real32 > const dampingx, - arrayView1d< real32 > const dampingy, - arrayView1d< real32 > const dampingz ) - { - forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const e ) - { - for( localIndex i = 0; i < elemsToFaces.size( 1 ); ++i ) - { - localIndex const f = elemsToFaces( e, i ); - // face on the domain boundary and not on free surface - if( facesDomainBoundaryIndicator[f] == 1 && freeSurfaceFaceIndicator[f] != 1 ) - { - // only the four corners of the mesh face are needed to compute the Jacobian - real64 xLocal[ 4 ][ 3 ]; - for( localIndex a = 0; a < 4; ++a ) - { - localIndex const nodeIndex = facesToNodes( f, FE_TYPE::meshIndexToLinearIndex2D( a ) ); - for( localIndex d = 0; d < 3; ++d ) - { - xLocal[a][d] = nodeCoords( nodeIndex, d ); - } - } - - real32 const nx = faceNormal( f, 0 ), ny = faceNormal( f, 1 ), nz = faceNormal( f, 2 ); - constexpr localIndex numNodesPerFace = FE_TYPE::numNodesPerFace; - for( localIndex q = 0; q < numNodesPerFace; ++q ) - { - real32 const aux = density[e] * m_finiteElement.computeDampingTerm( q, xLocal ); - real32 const localIncrementx = aux * ( velocityVp[e] * LvArray::math::abs( nx ) + velocityVs[e] * LvArray::math::sqrt( pow( ny, 2 ) + pow( nz, 2 ) ) ); - real32 const localIncrementy = aux * ( velocityVp[e] * LvArray::math::abs( ny ) + velocityVs[e] * LvArray::math::sqrt( pow( nx, 2 ) + pow( nz, 2 ) ) ); - real32 const localIncrementz = aux * ( velocityVp[e] * LvArray::math::abs( nz ) + velocityVs[e] * LvArray::math::sqrt( pow( nx, 2 ) + pow( ny, 2 ) ) ); - - RAJA::atomicAdd< ATOMIC_POLICY >( &dampingx[facesToNodes( f, q )], localIncrementx ); - RAJA::atomicAdd< ATOMIC_POLICY >( &dampingy[facesToNodes( f, q )], localIncrementy ); - RAJA::atomicAdd< ATOMIC_POLICY >( &dampingz[facesToNodes( f, q )], localIncrementz ); - } - } - } - } ); - } - - /// The finite element space/discretization object for the element type in the subRegion - FE_TYPE const & m_finiteElement; - -}; - /** * @brief Implements kernels for solving the elastic wave equations * explicit central FD method and SEM diff --git a/src/coreComponents/physicsSolvers/wavePropagation/PrecomputeSourcesAndReceiversKernel.hpp b/src/coreComponents/physicsSolvers/wavePropagation/PrecomputeSourcesAndReceiversKernel.hpp new file mode 100644 index 00000000000..aebc8b92761 --- /dev/null +++ b/src/coreComponents/physicsSolvers/wavePropagation/PrecomputeSourcesAndReceiversKernel.hpp @@ -0,0 +1,623 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file PrecomputeSourcesAndReceiversKernel.hpp + */ + +#ifndef GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_PRECOMPUTESOURCESANDRECEIVERSKERNEL_HPP_ +#define GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_PRECOMPUTESOURCESANDRECEIVERSKERNEL_HPP_ + +namespace geos +{ + +struct PreComputeSourcesAndReceivers +{ + + using EXEC_POLICY = parallelDevicePolicy< >; + + /** + * @brief Launches the precomputation of the source and receiver terms for 1D solution (2nd order acoustic) + * @tparam EXEC_POLICY execution policy + * @tparam FE_TYPE finite element type + * @param[in] size the number of cells in the subRegion + * @param[in] numFacesPerElem number of faces per element + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemGhostRank rank of the ghost element + * @param[in] elemsToNodes map from element to nodes + * @param[in] elemsToFaces map from element to faces + * @param[in] elemCenter coordinates of the element centers + * @param[in] faceNormal normal of each faces + * @param[in] faceCenter coordinates of the center of a face + * @param[in] sourceCoordinates coordinates of the source terms + * @param[out] sourceIsAccessible flag indicating whether the source is accessible or not + * @param[out] sourceNodeIds indices of the nodes of the element where the source is located + * @param[out] sourceConstants constant part of the source terms + * @param[in] receiverCoordinates coordinates of the receiver terms + * @param[out] receiverIsLocal flag indicating whether the receiver is local or not + * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located + * @param[out] receiverConstants constant part of the receiver term + * @param[out] sourceValue value of the temporal source (eg. Ricker) + * @param[in] dt time-step + * @param[in] timeSourceFrequency the central frequency of the source + * @param[in] timeSourceDelay the time delay of the source + * @param[in] rickerOrder order of the Ricker wavelet + */ + template< typename EXEC_POLICY, typename FE_TYPE > + static void + Compute1DSourceAndReceiverConstants( localIndex const size, + localIndex const numFacesPerElem, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView1d< integer const > const elemGhostRank, + arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, + arrayView2d< localIndex const > const elemsToFaces, + arrayView2d< real64 const > const & elemCenter, + arrayView2d< real64 const > const faceNormal, + arrayView2d< real64 const > const faceCenter, + arrayView2d< real64 const > const sourceCoordinates, + arrayView1d< localIndex > const sourceIsAccessible, + arrayView2d< localIndex > const sourceNodeIds, + arrayView2d< real64 > const sourceConstants, + arrayView2d< real64 const > const receiverCoordinates, + arrayView1d< localIndex > const receiverIsLocal, + arrayView2d< localIndex > const receiverNodeIds, + arrayView2d< real64 > const receiverConstants, + arrayView2d< real32 > const sourceValue, + real64 const dt, + real32 const timeSourceFrequency, + real32 const timeSourceDelay, + localIndex const rickerOrder ) + { + constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; + + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + real64 const center[3] = { elemCenter[k][0], + elemCenter[k][1], + elemCenter[k][2] }; + + // Step 1: locate the sources, and precompute the source term + + /// loop over all the source that haven't been found yet + for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) + { + if( sourceIsAccessible[isrc] == 0 ) + { + real64 const coords[3] = { sourceCoordinates[isrc][0], + sourceCoordinates[isrc][1], + sourceCoordinates[isrc][2] }; + + bool const sourceFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + if( sourceFound ) + { + real64 coordsOnRefElem[3]{}; + + + WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, + elemsToNodes[k], + nodeCoords, + coordsOnRefElem ); + + sourceIsAccessible[isrc] = 1; + real64 Ntest[numNodesPerElem]; + FE_TYPE::calcN( coordsOnRefElem, Ntest ); + + for( localIndex a = 0; a < numNodesPerElem; ++a ) + { + sourceNodeIds[isrc][a] = elemsToNodes( k, a ); + sourceConstants[isrc][a] = Ntest[a]; + } + + for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) + { + sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); + } + } + } + } // end loop over all sources + + + // Step 2: locate the receivers, and precompute the receiver term + + /// loop over all the receivers that haven't been found yet + for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) + { + if( receiverIsLocal[ircv] == 0 ) + { + real64 const coords[3] = { receiverCoordinates[ircv][0], + receiverCoordinates[ircv][1], + receiverCoordinates[ircv][2] }; + + real64 coordsOnRefElem[3]{}; + bool const receiverFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + + if( receiverFound && elemGhostRank[k] < 0 ) + { + WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, + elemsToNodes[k], + nodeCoords, + coordsOnRefElem ); + + receiverIsLocal[ircv] = 1; + + real64 Ntest[numNodesPerElem]; + FE_TYPE::calcN( coordsOnRefElem, Ntest ); + + for( localIndex a = 0; a < numNodesPerElem; ++a ) + { + receiverNodeIds[ircv][a] = elemsToNodes( k, a ); + receiverConstants[ircv][a] = Ntest[a]; + } + } + } + } // end loop over receivers + + } ); + + } + + + /** + * @brief Launches the precomputation of the source and receiver terms with storage of elements and region + * in which the receivers and sources are located + * @tparam EXEC_POLICY execution policy + * @tparam FE_TYPE finite element type + * @param[in] size the number of cells in the subRegion + * @param[in] numFacesPerElem number of faces per element + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemGhostRank rank of the ghost element + * @param[in] elemsToNodes map from element to nodes + * @param[in] elemsToFaces map from element to faces + * @param[in] elemCenter coordinates of the element centers + * @param[in] faceNormal normal of each faces + * @param[in] faceCenter coordinates of the center of a face + * @param[in] sourceCoordinates coordinates of the source terms + * @param[out] sourceIsAccessible flag indicating whether the source is accessible or not + * @param[out] sourceElem element where a source is located + * @param[out] sourceNodeIds indices of the nodes of the element where the source is located + * @param[out] sourceConstants constant part of the source terms + * @param[in] receiverCoordinates coordinates of the receiver terms + * @param[out] receiverIsLocal flag indicating whether the receiver is local or not + * @param[out] rcvElem element where a receiver is located + * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located + * @param[out] receiverConstants constant part of the receiver term + * @param[out] sourceValue value of the temporal source (eg. Ricker) + * @param[in] dt time-step + * @param[in] timeSourceFrequency the central frequency of the source + * @param[in] timeSourceDelay the time delay of the source + * @param[in] rickerOrder order of the Ricker wavelet + */ + template< typename EXEC_POLICY, typename FE_TYPE > + static void + Compute1DSourceAndReceiverConstantsWithElementsAndRegionStorage( localIndex const size, + localIndex const regionIndex, + localIndex const numFacesPerElem, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView1d< integer const > const elemGhostRank, + arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, + arrayView2d< localIndex const > const elemsToFaces, + arrayView2d< real64 const > const & elemCenter, + arrayView2d< real64 const > const faceNormal, + arrayView2d< real64 const > const faceCenter, + arrayView2d< real64 const > const sourceCoordinates, + arrayView1d< localIndex > const sourceIsAccessible, + arrayView1d< localIndex > const sourceElem, + arrayView2d< localIndex > const sourceNodeIds, + arrayView2d< real64 > const sourceConstants, + arrayView1d< localIndex > const sourceRegion, + arrayView2d< real64 const > const receiverCoordinates, + arrayView1d< localIndex > const receiverIsLocal, + arrayView1d< localIndex > const rcvElem, + arrayView2d< localIndex > const receiverNodeIds, + arrayView2d< real64 > const receiverConstants, + arrayView1d< localIndex > const receiverRegion, + arrayView2d< real32 > const sourceValue, + real64 const dt, + real32 const timeSourceFrequency, + real32 const timeSourceDelay, + localIndex const rickerOrder ) + { + constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; + + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + real64 const center[3] = { elemCenter[k][0], + elemCenter[k][1], + elemCenter[k][2] }; + + // Step 1: locate the sources, and precompute the source term + + /// loop over all the source that haven't been found yet + for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) + { + if( sourceIsAccessible[isrc] == 0 ) + { + real64 const coords[3] = { sourceCoordinates[isrc][0], + sourceCoordinates[isrc][1], + sourceCoordinates[isrc][2] }; + + bool const sourceFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + + if( sourceFound ) + { + real64 coordsOnRefElem[3]{}; + + WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, + elemsToNodes[k], + nodeCoords, + coordsOnRefElem ); + + sourceIsAccessible[isrc] = 1; + sourceElem[isrc] = k; + sourceRegion[isrc] = regionIndex; + real64 Ntest[numNodesPerElem]; + FE_TYPE::calcN( coordsOnRefElem, Ntest ); + + for( localIndex a = 0; a < numNodesPerElem; ++a ) + { + sourceNodeIds[isrc][a] = elemsToNodes[k][a]; + sourceConstants[isrc][a] = Ntest[a]; + } + + for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) + { + sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); + } + } + } + } // end loop over all sources + + + // Step 2: locate the receivers, and precompute the receiver term + + /// loop over all the receivers that haven't been found yet + for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) + { + if( receiverIsLocal[ircv] == 0 ) + { + real64 const coords[3] = { receiverCoordinates[ircv][0], + receiverCoordinates[ircv][1], + receiverCoordinates[ircv][2] }; + + real64 coordsOnRefElem[3]{}; + bool const receiverFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + + if( receiverFound && elemGhostRank[k] < 0 ) + { + WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, + elemsToNodes[k], + nodeCoords, + coordsOnRefElem ); + receiverIsLocal[ircv] = 1; + rcvElem[ircv] = k; + receiverRegion[ircv] = regionIndex; + + real64 Ntest[numNodesPerElem]; + FE_TYPE::calcN( coordsOnRefElem, Ntest ); + + for( localIndex a = 0; a < numNodesPerElem; ++a ) + { + receiverNodeIds[ircv][a] = elemsToNodes[k][a]; + receiverConstants[ircv][a] = Ntest[a]; + } + } + } + } // end loop over receivers + + } ); + + } + + + + /** + * @brief Launches the precomputation of the source and receiver terms for 3D arrays solution and DAS receiver constants + * computation + * @tparam EXEC_POLICY execution policy + * @tparam FE_TYPE finite element type + * @param[in] size the number of cells in the subRegion + * @param[in] numFacesPerElem number of face on an element + * @param[in] nodeCoords coordinates of the nodes + * @param[in] elemGhostRank array containing the ghost rank + * @param[in] elemsToNodes map from element to nodes + * @param[in] elemsToFaces map from element to faces + * @param[in] elemCenter coordinates of the element centers + * @param[in] faceNormal array containing the normal of all faces + * @param[in] faceCenter array containing the center of all faces + * @param[in] sourceCoordinates coordinates of the source terms + * @param[in] receiverCoordinates coordinates of the receiver terms + * @param[in] dt time-step + * @param[in] timeSourceFrequency Peak frequency of the source + * @param[in] sourceForce force vector of the source + * @param[in] sourceMoment moment (symmetric rank-2 tensor) of the source + * @param[in] useDAS parameter that determines which kind of receiver needs to be modeled (DAS or not, and which type) + * @param[in] linearDASSamples parameter that gives the number of integration points to be used when computing the DAS signal via strain + * integration + * @param[in] linearDASGeometry geometry of the linear DAS receivers, if needed + * @param[in] rickerOrder Order of the Ricker wavelet + * @param[out] sourceIsAccessible flag indicating whether the source is accessible or not + * @param[out] sourceNodeIds indices of the nodes of the element where the source is located + * @param[out] sourceConstantsx constant part of the source terms in x-direction + * @param[out] sourceConstantsy constant part of the source terms in y-direction + * @param[out] sourceConstantsz constant part of the source terms in z-direction + * @param[out] receiverIsLocal flag indicating whether the receiver is local or not + * @param[out] receiverNodeIds indices of the nodes of the element where the receiver is located + * @param[out] receiverNodeConstants constant part of the receiver term + * @param[out] sourceValue array containing the value of the time dependent source (Ricker for e.g) + */ + template< typename EXEC_POLICY, typename FE_TYPE > + static void + Compute3DSourceAndReceiverConstantsWithDAS( localIndex const size, + localIndex const numFacesPerElem, + arrayView2d< WaveSolverBase::wsCoordType const, nodes::REFERENCE_POSITION_USD > const nodeCoords, + arrayView1d< integer const > const elemGhostRank, + arrayView2d< localIndex const, cells::NODE_MAP_USD > const & elemsToNodes, + arrayView2d< localIndex const > const elemsToFaces, + arrayView2d< real64 const > const & elemCenter, + arrayView2d< real64 const > const faceNormal, + arrayView2d< real64 const > const faceCenter, + arrayView2d< real64 const > const sourceCoordinates, + arrayView1d< localIndex > const sourceIsAccessible, + arrayView2d< localIndex > const sourceNodeIds, + arrayView2d< real64 > const sourceConstantsx, + arrayView2d< real64 > const sourceConstantsy, + arrayView2d< real64 > const sourceConstantsz, + arrayView2d< real64 const > const receiverCoordinates, + arrayView1d< localIndex > const receiverIsLocal, + arrayView2d< localIndex > const receiverNodeIds, + arrayView2d< real64 > const receiverConstants, + arrayView2d< real32 > const sourceValue, + real64 const dt, + real32 const timeSourceFrequency, + real32 const timeSourceDelay, + localIndex const rickerOrder, + WaveSolverUtils::DASType useDAS, + integer linearDASSamples, + arrayView2d< real64 const > const linearDASGeometry, + R1Tensor const sourceForce, + R2SymTensor const sourceMoment ) + { + constexpr localIndex numNodesPerElem = FE_TYPE::numNodes; + integer nSamples = useDAS == WaveSolverUtils::DASType::none ? 1 : linearDASSamples; + array1d< real64 > const samplePointLocationsA( nSamples ); + arrayView1d< real64 > const samplePointLocations = samplePointLocationsA.toView(); + array1d< real64 > const sampleIntegrationConstantsA( nSamples ); + arrayView1d< real64 > const sampleIntegrationConstants = sampleIntegrationConstantsA.toView(); + + forAll< EXEC_POLICY >( size, [=] GEOS_HOST_DEVICE ( localIndex const k ) + { + real64 const center[3] = { elemCenter[k][0], + elemCenter[k][1], + elemCenter[k][2] }; + + // Step 1: locate the sources, and precompute the source term + + /// loop over all the source that haven't been found yet + for( localIndex isrc = 0; isrc < sourceCoordinates.size( 0 ); ++isrc ) + { + if( sourceIsAccessible[isrc] == 0 ) + { + real64 const coords[3] = { sourceCoordinates[isrc][0], + sourceCoordinates[isrc][1], + sourceCoordinates[isrc][2] }; + + real64 xLocal[numNodesPerElem][3]; + + for( localIndex a=0; a< numNodesPerElem; ++a ) + { + for( localIndex i=0; i<3; ++i ) + { + xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i ); + } + } + + + bool const sourceFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + + if( sourceFound ) + { + real64 coordsOnRefElem[3]{}; + + + WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, + elemsToNodes[k], + nodeCoords, + coordsOnRefElem ); + sourceIsAccessible[isrc] = 1; + + real64 N[numNodesPerElem]; + real64 gradN[numNodesPerElem][3]; + FE_TYPE::calcN( coordsOnRefElem, N ); + FE_TYPE::calcGradN( coordsOnRefElem, xLocal, gradN ); + R2SymTensor moment = sourceMoment; + for( localIndex q=0; q< numNodesPerElem; ++q ) + { + real64 inc[3] = { 0, 0, 0 }; + sourceNodeIds[isrc][q] = elemsToNodes( k, q ); + inc[0] += sourceForce[0] * N[q]; + inc[1] += sourceForce[1] * N[q]; + inc[2] += sourceForce[2] * N[q]; + + LvArray::tensorOps::Ri_add_symAijBj< 3 >( inc, moment.data, gradN[q] ); + sourceConstantsx[isrc][q] += inc[0]; + sourceConstantsy[isrc][q] += inc[1]; + sourceConstantsz[isrc][q] += inc[2]; + } + + for( localIndex cycle = 0; cycle < sourceValue.size( 0 ); ++cycle ) + { + sourceValue[cycle][isrc] = WaveSolverUtils::evaluateRicker( cycle * dt, timeSourceFrequency, timeSourceDelay, rickerOrder ); + } + + } + } + } // end loop over all sources + + // Step 2: locate the receivers, and precompute the receiver term + + // for geophones, we need only a point per receiver. + // for DAS, we need multiple points + + /// compute locations of samples along receiver + if( nSamples == 1 ) + { + samplePointLocations[ 0 ] = 0; + } + else + { + for( integer i = 0; i < nSamples; ++i ) + { + samplePointLocations[ i ] = -0.5 + (real64) i / ( linearDASSamples - 1 ); + } + } + + /// compute integration constants of samples + /// for displacement difference (dipole) DAS, take the discrete derivative of the pair of geophones + if( useDAS == WaveSolverUtils::DASType::dipole ) + { + sampleIntegrationConstants[ 0 ] = -1.0; + sampleIntegrationConstants[ 1 ] = 1.0; + } + /// for strain integration DAS, take the average of strains to average strain data + else if( nSamples == 1 ) + { + sampleIntegrationConstants[ 0 ] = 1.0; + } + else + { + for( integer i = 0; i < linearDASSamples; i++ ) + { + sampleIntegrationConstants[ i ] = 1.0 / nSamples; + } + } + + /// loop over all the receivers + for( localIndex ircv = 0; ircv < receiverCoordinates.size( 0 ); ++ircv ) + { + R1Tensor receiverCenter = { receiverCoordinates[ ircv ][ 0 ], receiverCoordinates[ ircv ][ 1 ], receiverCoordinates[ ircv ][ 2 ] }; + R1Tensor receiverVector; + if( useDAS == WaveSolverUtils::DASType::none ) + { + receiverVector = { 0, 0, 0 }; + } + else + { + receiverVector = WaveSolverUtils::computeDASVector( linearDASGeometry[ ircv ][ 0 ], linearDASGeometry[ ircv ][ 1 ] ); + } + real64 receiverLength = useDAS == WaveSolverUtils::DASType::none ? 0 : linearDASGeometry[ ircv ][ 2 ]; + /// loop over samples + for( integer iSample = 0; iSample < nSamples; ++iSample ) + { + /// compute sample coordinates and locate the element containing it + real64 const coords[3] = { receiverCenter[ 0 ] + receiverVector[ 0 ] * receiverLength * samplePointLocations[ iSample ], + receiverCenter[ 1 ] + receiverVector[ 1 ] * receiverLength * samplePointLocations[ iSample ], + receiverCenter[ 2 ] + receiverVector[ 2 ] * receiverLength * samplePointLocations[ iSample ] }; + bool const sampleFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + if( sampleFound && elemGhostRank[k] < 0 ) + { + real64 coordsOnRefElem[3]{}; + real64 xLocal[numNodesPerElem][3]; + + for( localIndex a=0; a< numNodesPerElem; ++a ) + { + for( localIndex i=0; i<3; ++i ) + { + xLocal[a][i] = nodeCoords( elemsToNodes( k, a ), i ); + } + } + + WaveSolverUtils::computeCoordinatesOnReferenceElement< FE_TYPE >( coords, + elemsToNodes[k], + nodeCoords, + coordsOnRefElem ); + real64 N[numNodesPerElem]; + real64 gradN[numNodesPerElem][3]; + FE_TYPE::calcN( coordsOnRefElem, N ); + FE_TYPE::calcGradN( coordsOnRefElem, xLocal, gradN ); + for( localIndex a = 0; a < numNodesPerElem; ++a ) + { + receiverNodeIds[ircv][iSample * numNodesPerElem + a] = elemsToNodes( k, + a ); + if( useDAS == WaveSolverUtils::DASType::strainIntegration ) + { + receiverConstants[ircv][iSample * numNodesPerElem + a] += ( gradN[a][0] * receiverVector[0] + gradN[a][1] * receiverVector[1] + gradN[a][2] * receiverVector[2] ) * + sampleIntegrationConstants[ iSample ]; + } + else + { + receiverConstants[ircv][iSample * numNodesPerElem + a] += N[a] * sampleIntegrationConstants[ iSample ]; + } + } + receiverIsLocal[ ircv ] = 2; + } + } // end loop over samples + // determine if the current rank is the owner of this receiver + real64 const coords[3] = { receiverCenter[ 0 ], receiverCenter[ 1 ], receiverCenter[ 2 ] }; + bool const receiverFound = + WaveSolverUtils::locateSourceElement( numFacesPerElem, + center, + faceNormal, + faceCenter, + elemsToFaces[k], + coords ); + if( receiverFound && elemGhostRank[k] < 0 ) + { + receiverIsLocal[ ircv ] = 1; + } + } // end loop over receivers + } ); + + } + +}; + +} // namespace geos + +#endif //GEOS_PHYSICSSOLVERS_WAVEPROPAGATION_PRECOMPUTESOURCESANDRECEIVERSKERNEL_HPP_ diff --git a/src/coreComponents/physicsSolvers/wavePropagation/WaveSolverBase.cpp b/src/coreComponents/physicsSolvers/wavePropagation/WaveSolverBase.cpp index 3278086f9e4..4081681f62f 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/WaveSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/WaveSolverBase.cpp @@ -27,6 +27,7 @@ #include "mainInterface/ProblemManager.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" #include "WaveSolverUtils.hpp" +#include "events/EventManager.hpp" #include diff --git a/src/coreComponents/schema/docs/AcousticElasticSEM_other.rst b/src/coreComponents/schema/docs/AcousticElasticSEM_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/AcousticElasticSEM_other.rst +++ b/src/coreComponents/schema/docs/AcousticElasticSEM_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/AcousticFirstOrderSEM_other.rst b/src/coreComponents/schema/docs/AcousticFirstOrderSEM_other.rst index 955f1c1ca6d..44522b87d49 100644 --- a/src/coreComponents/schema/docs/AcousticFirstOrderSEM_other.rst +++ b/src/coreComponents/schema/docs/AcousticFirstOrderSEM_other.rst @@ -1,33 +1,33 @@ -========================= ============================================================================================================================================================== ======================================================================= -Name Type Description -========================= ============================================================================================================================================================== ======================================================================= -indexSeismoTrace integer Count for output pressure at receivers -linearDASVectorX real32_array X component of the linear DAS direction vector -linearDASVectorY real32_array Y component of the linear DAS direction vector -linearDASVectorZ real32_array Z component of the linear DAS direction vector -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -pressureNp1AtReceivers real32_array2d Pressure value at each receiver for each timestep -rcvElem integer_array Element containing the receivers -receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds -receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank -receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point -receiverRegion integer_array Region containing the receivers -sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds -sourceElem integer_array Element containing the sources -sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank -sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point -sourceRegion integer_array Region containing the sources -sourceValue real32_array2d Source Value of the sources -usePML integer Flag to apply PML -uxNp1AtReceivers real32_array2d Ux value at each receiver for each timestep -uyNp1AtReceivers real32_array2d Uy value at each receiver for each timestep -uzNp1AtReceivers real32_array2d Uz value at each receiver for each timestep -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================= +========================= ====================================================================================================================================================== ======================================================================= +Name Type Description +========================= ====================================================================================================================================================== ======================================================================= +indexSeismoTrace integer Count for output pressure at receivers +linearDASVectorX real32_array X component of the linear DAS direction vector +linearDASVectorY real32_array Y component of the linear DAS direction vector +linearDASVectorZ real32_array Z component of the linear DAS direction vector +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +pressureNp1AtReceivers real32_array2d Pressure value at each receiver for each timestep +rcvElem integer_array Element containing the receivers +receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds +receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank +receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point +receiverRegion integer_array Region containing the receivers +sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds +sourceElem integer_array Element containing the sources +sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank +sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point +sourceRegion integer_array Region containing the sources +sourceValue real32_array2d Source Value of the sources +usePML integer Flag to apply PML +uxNp1AtReceivers real32_array2d Ux value at each receiver for each timestep +uyNp1AtReceivers real32_array2d Uy value at each receiver for each timestep +uzNp1AtReceivers real32_array2d Uz value at each receiver for each timestep +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================= diff --git a/src/coreComponents/schema/docs/AcousticSEM_other.rst b/src/coreComponents/schema/docs/AcousticSEM_other.rst index 280974da35a..80dd4136b81 100644 --- a/src/coreComponents/schema/docs/AcousticSEM_other.rst +++ b/src/coreComponents/schema/docs/AcousticSEM_other.rst @@ -1,28 +1,28 @@ -========================= ============================================================================================================================================================== ======================================================================= -Name Type Description -========================= ============================================================================================================================================================== ======================================================================= -indexSeismoTrace integer Count for output pressure at receivers -linearDASVectorX real32_array X component of the linear DAS direction vector -linearDASVectorY real32_array Y component of the linear DAS direction vector -linearDASVectorZ real32_array Z component of the linear DAS direction vector -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -pressureNp1AtReceivers real32_array2d Pressure value at each receiver for each timestep -rcvElem integer_array Element containing the receivers -receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds -receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank -receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point -receiverRegion integer_array Region containing the receivers -sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds -sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank -sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point -sourceValue real32_array2d Source Value of the sources -usePML integer Flag to apply PML -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================= +========================= ====================================================================================================================================================== ======================================================================= +Name Type Description +========================= ====================================================================================================================================================== ======================================================================= +indexSeismoTrace integer Count for output pressure at receivers +linearDASVectorX real32_array X component of the linear DAS direction vector +linearDASVectorY real32_array Y component of the linear DAS direction vector +linearDASVectorZ real32_array Z component of the linear DAS direction vector +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +pressureNp1AtReceivers real32_array2d Pressure value at each receiver for each timestep +rcvElem integer_array Element containing the receivers +receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds +receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank +receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point +receiverRegion integer_array Region containing the receivers +sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds +sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank +sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point +sourceValue real32_array2d Source Value of the sources +usePML integer Flag to apply PML +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================= diff --git a/src/coreComponents/schema/docs/AcousticVTISEM_other.rst b/src/coreComponents/schema/docs/AcousticVTISEM_other.rst index 280974da35a..80dd4136b81 100644 --- a/src/coreComponents/schema/docs/AcousticVTISEM_other.rst +++ b/src/coreComponents/schema/docs/AcousticVTISEM_other.rst @@ -1,28 +1,28 @@ -========================= ============================================================================================================================================================== ======================================================================= -Name Type Description -========================= ============================================================================================================================================================== ======================================================================= -indexSeismoTrace integer Count for output pressure at receivers -linearDASVectorX real32_array X component of the linear DAS direction vector -linearDASVectorY real32_array Y component of the linear DAS direction vector -linearDASVectorZ real32_array Z component of the linear DAS direction vector -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -pressureNp1AtReceivers real32_array2d Pressure value at each receiver for each timestep -rcvElem integer_array Element containing the receivers -receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds -receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank -receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point -receiverRegion integer_array Region containing the receivers -sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds -sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank -sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point -sourceValue real32_array2d Source Value of the sources -usePML integer Flag to apply PML -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================= +========================= ====================================================================================================================================================== ======================================================================= +Name Type Description +========================= ====================================================================================================================================================== ======================================================================= +indexSeismoTrace integer Count for output pressure at receivers +linearDASVectorX real32_array X component of the linear DAS direction vector +linearDASVectorY real32_array Y component of the linear DAS direction vector +linearDASVectorZ real32_array Z component of the linear DAS direction vector +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +pressureNp1AtReceivers real32_array2d Pressure value at each receiver for each timestep +rcvElem integer_array Element containing the receivers +receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds +receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank +receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point +receiverRegion integer_array Region containing the receivers +sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds +sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank +sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point +sourceValue real32_array2d Source Value of the sources +usePML integer Flag to apply PML +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================= diff --git a/src/coreComponents/schema/docs/BiotPorosity.rst b/src/coreComponents/schema/docs/BiotPorosity.rst index 2bc5c5f2678..1045d74ae9e 100644 --- a/src/coreComponents/schema/docs/BiotPorosity.rst +++ b/src/coreComponents/schema/docs/BiotPorosity.rst @@ -1,12 +1,13 @@ -======================== ========= ======== =========================================== -Name Type Default Description -======================== ========= ======== =========================================== -defaultPorosityTEC real64 0 Default thermal expansion coefficient -defaultReferencePorosity real64 required Default value of the reference porosity -grainBulkModulus real64 required Grain bulk modulus -name groupName required A name is required for any non-unique nodes -======================== ========= ======== =========================================== +======================== ========= ======== =========================================================== +Name Type Default Description +======================== ========= ======== =========================================================== +defaultPorosityTEC real64 0 Default thermal expansion coefficient +defaultReferencePorosity real64 required Default value of the reference porosity +grainBulkModulus real64 required Grain bulk modulus +name groupName required A name is required for any non-unique nodes +useUniaxialFixedStress integer 0 Flag enabling uniaxial approximation in fixed stress update +======================== ========= ======== =========================================================== diff --git a/src/coreComponents/schema/docs/BiotPorosity_other.rst b/src/coreComponents/schema/docs/BiotPorosity_other.rst index 49c9bd3d373..d5bd2487301 100644 --- a/src/coreComponents/schema/docs/BiotPorosity_other.rst +++ b/src/coreComponents/schema/docs/BiotPorosity_other.rst @@ -13,6 +13,7 @@ porosity real64_array2d Rock porosity porosity_n real64_array2d Rock porosity at the previous converged time step referencePorosity real64_array Reference porosity solidBulkModulus real64_array Solid bulk modulus +solidShearModulus real64_array Solid shear modulus thermalExpansionCoefficient real64_array Thermal expansion coefficient ================================= ============== ================================================================================================ diff --git a/src/coreComponents/schema/docs/BlackOilFluid_other.rst b/src/coreComponents/schema/docs/BlackOilFluid_other.rst index 60b6325d615..0ceddaa556f 100644 --- a/src/coreComponents/schema/docs/BlackOilFluid_other.rst +++ b/src/coreComponents/schema/docs/BlackOilFluid_other.rst @@ -1,36 +1,36 @@ -=============================== ======================================================================================================= ============================================================================================================ -Name Type Description -=============================== ======================================================================================================= ============================================================================================================ -PVTO geos_constitutive_PVTOData (no description available) -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -formationVolFactorTableWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -hydrocarbonPhaseOrder integer_array (no description available) -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -viscosityTableWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -=============================== ======================================================================================================= ============================================================================================================ +=============================== =================================================================================================== ============================================================================================================ +Name Type Description +=============================== =================================================================================================== ============================================================================================================ +PVTO geos_constitutive_PVTOData (no description available) +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +formationVolFactorTableWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +hydrocarbonPhaseOrder integer_array (no description available) +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +viscosityTableWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +=============================== =================================================================================================== ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CO2BrineEzrokhiFluid_other.rst b/src/coreComponents/schema/docs/CO2BrineEzrokhiFluid_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CO2BrineEzrokhiFluid_other.rst +++ b/src/coreComponents/schema/docs/CO2BrineEzrokhiFluid_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CO2BrineEzrokhiThermalFluid_other.rst b/src/coreComponents/schema/docs/CO2BrineEzrokhiThermalFluid_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CO2BrineEzrokhiThermalFluid_other.rst +++ b/src/coreComponents/schema/docs/CO2BrineEzrokhiThermalFluid_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CO2BrinePhillipsFluid_other.rst b/src/coreComponents/schema/docs/CO2BrinePhillipsFluid_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CO2BrinePhillipsFluid_other.rst +++ b/src/coreComponents/schema/docs/CO2BrinePhillipsFluid_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CO2BrinePhillipsThermalFluid_other.rst b/src/coreComponents/schema/docs/CO2BrinePhillipsThermalFluid_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CO2BrinePhillipsThermalFluid_other.rst +++ b/src/coreComponents/schema/docs/CO2BrinePhillipsThermalFluid_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CellElementRegion_other.rst b/src/coreComponents/schema/docs/CellElementRegion_other.rst index a65968b0105..bb012ac8ff4 100644 --- a/src/coreComponents/schema/docs/CellElementRegion_other.rst +++ b/src/coreComponents/schema/docs/CellElementRegion_other.rst @@ -1,16 +1,16 @@ -======================= ==================================================================== ========================================================= -Name Type Description -======================= ==================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -elementSubRegions node :ref:`DATASTRUCTURE_elementSubRegions` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ==================================================================== ========================================================= +======================= ================================================================= ========================================================= +Name Type Description +======================= ================================================================= ========================================================= +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +elementSubRegions node :ref:`DATASTRUCTURE_elementSubRegions` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ================================================================= ========================================================= diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseFVM_other.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseFVM_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseFVM_other.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseFVM_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseFluid_other.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseFluid_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseFluid_other.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseFluid_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseHybridFVM_other.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseHybridFVM_other.rst index c69ff8f4e38..2944d71993d 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseHybridFVM_other.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseHybridFVM_other.rst @@ -1,15 +1,15 @@ -========================= ============================================================================================================================================================== ================================ ================================================================ -Name Type Registered On Description -========================= ============================================================================================================================================================== ================================ ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -facePressure_n real64_array :ref:`DATASTRUCTURE_faceManager` Face pressure at the previous converged time step -mimGravityCoefficient real64_array :ref:`DATASTRUCTURE_faceManager` Mimetic gravity coefficient -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================ ================================================================ +========================= ====================================================================================================================================================== ================================ ================================================================ +Name Type Registered On Description +========================= ====================================================================================================================================================== ================================ ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +facePressure_n real64_array :ref:`DATASTRUCTURE_faceManager` Face pressure at the previous converged time step +mimGravityCoefficient real64_array :ref:`DATASTRUCTURE_faceManager` Mimetic gravity coefficient +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================ ================================================================ diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanicsInitialization.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanicsInitialization.rst index 27129634c0b..18e3a0dd9e7 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanicsInitialization.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanicsInitialization.rst @@ -1,12 +1,12 @@ -=========================== ============ ======== ========================================================================== -Name Type Default Description -=========================== ============ ======== ========================================================================== -logLevel integer 0 Log level -name groupName required A name is required for any non-unique nodes -performStressInitialization integer required Flag to indicate that the solver is going to perform stress initialization -poromechanicsSolverName groupNameRef required Name of the poromechanics solver -=========================== ============ ======== ========================================================================== +============================ ============ ======== =========================================== +Name Type Default Description +============================ ============ ======== =========================================== +logLevel integer 0 Log level +name groupName required A name is required for any non-unique nodes +poromechanicsSolverName groupNameRef required Name of the poromechanics solver +solidMechanicsStatisticsName groupNameRef Name of the solid mechanics statistics +============================ ============ ======== =========================================== diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanics_other.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanics_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanics_other.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseReservoirPoromechanics_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseReservoir_other.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseReservoir_other.rst index 45d9a187f0a..cccf4603c70 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseReservoir_other.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseReservoir_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/CompositionalMultiphaseWell_other.rst b/src/coreComponents/schema/docs/CompositionalMultiphaseWell_other.rst index 3f16a155d2b..f2c739b92d8 100644 --- a/src/coreComponents/schema/docs/CompositionalMultiphaseWell_other.rst +++ b/src/coreComponents/schema/docs/CompositionalMultiphaseWell_other.rst @@ -1,15 +1,15 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -WellControls node :ref:`DATASTRUCTURE_WellControls` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +WellControls node :ref:`DATASTRUCTURE_WellControls` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidPengRobinson_other.rst b/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidPengRobinson_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidPengRobinson_other.rst +++ b/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidPengRobinson_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidSoaveRedlichKwong_other.rst b/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidSoaveRedlichKwong_other.rst index 476b50195e5..28636011f61 100644 --- a/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidSoaveRedlichKwong_other.rst +++ b/src/coreComponents/schema/docs/CompositonalTwoPhaseFluidSoaveRedlichKwong_other.rst @@ -1,30 +1,30 @@ -===================== ============================================================================================= ============================================================================================================ -Name Type Description -===================== ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -===================== ============================================================================================= ============================================================================================================ +===================== ========================================================================================= ============================================================================================================ +Name Type Description +===================== ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +===================== ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/DeadOilFluid_other.rst b/src/coreComponents/schema/docs/DeadOilFluid_other.rst index 139d0708316..de90cbaf87f 100644 --- a/src/coreComponents/schema/docs/DeadOilFluid_other.rst +++ b/src/coreComponents/schema/docs/DeadOilFluid_other.rst @@ -1,35 +1,35 @@ -=============================== ======================================================================================================= ============================================================================================================ -Name Type Description -=============================== ======================================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -formationVolFactorTableWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -hydrocarbonPhaseOrder integer_array (no description available) -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -phaseViscosity real64_array3d Phase viscosity -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -viscosityTableWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -=============================== ======================================================================================================= ============================================================================================================ +=============================== =================================================================================================== ============================================================================================================ +Name Type Description +=============================== =================================================================================================== ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +formationVolFactorTableWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +hydrocarbonPhaseOrder integer_array (no description available) +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +phaseViscosity real64_array3d Phase viscosity +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +viscosityTableWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +=============================== =================================================================================================== ============================================================================================================ diff --git a/src/coreComponents/schema/docs/ElasticFirstOrderSEM_other.rst b/src/coreComponents/schema/docs/ElasticFirstOrderSEM_other.rst index a5e6f05623a..67c4b18bc7c 100644 --- a/src/coreComponents/schema/docs/ElasticFirstOrderSEM_other.rst +++ b/src/coreComponents/schema/docs/ElasticFirstOrderSEM_other.rst @@ -1,38 +1,38 @@ -=========================== ============================================================================================================================================================== ======================================================================= -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================= -displacementxNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (x-components) -displacementyNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (y-components) -displacementzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -indexSeismoTrace integer Count for output pressure at receivers -linearDASVectorX real32_array X component of the linear DAS direction vector -linearDASVectorY real32_array Y component of the linear DAS direction vector -linearDASVectorZ real32_array Z component of the linear DAS direction vector -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -rcvElem integer_array Element containing the receivers -receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds -receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank -receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point -receiverRegion integer_array Region containing the receivers -sigmaxxNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -sigmaxyNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -sigmaxzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -sigmayyNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -sigmayzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -sigmazzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) -sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds -sourceElem integer_array Element containing the sources -sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank -sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point -sourceRegion integer_array Region containing the sources -sourceValue real32_array2d Source Value of the sources -usePML integer Flag to apply PML -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================= +=========================== ====================================================================================================================================================== ======================================================================= +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================= +displacementxNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (x-components) +displacementyNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (y-components) +displacementzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +indexSeismoTrace integer Count for output pressure at receivers +linearDASVectorX real32_array X component of the linear DAS direction vector +linearDASVectorY real32_array Y component of the linear DAS direction vector +linearDASVectorZ real32_array Z component of the linear DAS direction vector +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +rcvElem integer_array Element containing the receivers +receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds +receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank +receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point +receiverRegion integer_array Region containing the receivers +sigmaxxNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +sigmaxyNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +sigmaxzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +sigmayyNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +sigmayzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +sigmazzNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-components) +sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds +sourceElem integer_array Element containing the sources +sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank +sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point +sourceRegion integer_array Region containing the sources +sourceValue real32_array2d Source Value of the sources +usePML integer Flag to apply PML +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================= diff --git a/src/coreComponents/schema/docs/ElasticSEM_other.rst b/src/coreComponents/schema/docs/ElasticSEM_other.rst index 06969fee16a..dbe0ac40e7a 100644 --- a/src/coreComponents/schema/docs/ElasticSEM_other.rst +++ b/src/coreComponents/schema/docs/ElasticSEM_other.rst @@ -1,31 +1,31 @@ -=========================== ============================================================================================================================================================== ================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ================================================================================== -dasSignalNp1AtReceivers real32_array2d DAS signal value at each receiver for each timestep -displacementXNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (x-component) -displacementYNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (y-component) -displacementZNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-component) -indexSeismoTrace integer Count for output pressure at receivers -linearDASVectorX real32_array X component of the linear DAS direction vector -linearDASVectorY real32_array Y component of the linear DAS direction vector -linearDASVectorZ real32_array Z component of the linear DAS direction vector -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -rcvElem integer_array Element containing the receivers -receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds -receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank -receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point -receiverRegion integer_array Region containing the receivers -sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds in z-direction -sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank -sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point -sourceValue real32_array2d Source Value of the sources -usePML integer Flag to apply PML -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ================================================================================== +=========================== ====================================================================================================================================================== ================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ================================================================================== +dasSignalNp1AtReceivers real32_array2d DAS signal value at each receiver for each timestep +displacementXNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (x-component) +displacementYNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (y-component) +displacementZNp1AtReceivers real32_array2d Displacement value at each receiver for each timestep (z-component) +indexSeismoTrace integer Count for output pressure at receivers +linearDASVectorX real32_array X component of the linear DAS direction vector +linearDASVectorY real32_array Y component of the linear DAS direction vector +linearDASVectorZ real32_array Z component of the linear DAS direction vector +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +rcvElem integer_array Element containing the receivers +receiverConstants real64_array2d Constant part of the receiver for the nodes listed in m_receiverNodeIds +receiverIsLocal integer_array Flag that indicates whether the receiver is local to this MPI rank +receiverNodeIds integer_array2d Indices of the nodes (in the right order) for each receiver point +receiverRegion integer_array Region containing the receivers +sourceConstants real64_array2d Constant part of the source for the nodes listed in m_sourceNodeIds in z-direction +sourceIsAccessible integer_array Flag that indicates whether the source is local to this MPI rank +sourceNodeIds integer_array2d Indices of the nodes (in the right order) for each source point +sourceValue real32_array2d Source Value of the sources +usePML integer Flag to apply PML +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ================================================================================== diff --git a/src/coreComponents/schema/docs/ElementRegions_other.rst b/src/coreComponents/schema/docs/ElementRegions_other.rst index 17af822cdb0..f62357429ae 100644 --- a/src/coreComponents/schema/docs/ElementRegions_other.rst +++ b/src/coreComponents/schema/docs/ElementRegions_other.rst @@ -1,19 +1,19 @@ -======================= ==================================================================== ========================================================= -Name Type Description -======================= ==================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -CellElementRegion node :ref:`DATASTRUCTURE_CellElementRegion` -SurfaceElementRegion node :ref:`DATASTRUCTURE_SurfaceElementRegion` -WellElementRegion node :ref:`DATASTRUCTURE_WellElementRegion` -elementRegionsGroup node :ref:`DATASTRUCTURE_elementRegionsGroup` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ==================================================================== ========================================================= +======================= ================================================================= ========================================================= +Name Type Description +======================= ================================================================= ========================================================= +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +CellElementRegion node :ref:`DATASTRUCTURE_CellElementRegion` +SurfaceElementRegion node :ref:`DATASTRUCTURE_SurfaceElementRegion` +WellElementRegion node :ref:`DATASTRUCTURE_WellElementRegion` +elementRegionsGroup node :ref:`DATASTRUCTURE_elementRegionsGroup` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ================================================================= ========================================================= diff --git a/src/coreComponents/schema/docs/EmbeddedSurfaceGenerator_other.rst b/src/coreComponents/schema/docs/EmbeddedSurfaceGenerator_other.rst index 46c029f2c1a..f2590daca7c 100644 --- a/src/coreComponents/schema/docs/EmbeddedSurfaceGenerator_other.rst +++ b/src/coreComponents/schema/docs/EmbeddedSurfaceGenerator_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ================================================ ================================================================ -Name Type Registered On Description -========================= ============================================================================================================================================================== ================================================ ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -parentEdgeIndex integer_array :ref:`DATASTRUCTURE_embeddedSurfacesNodeManager` Index of parent edge within the mesh object it is registered on. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================ ================================================================ +========================= ====================================================================================================================================================== ================================================ ================================================================ +Name Type Registered On Description +========================= ====================================================================================================================================================== ================================================ ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +parentEdgeIndex integer_array :ref:`DATASTRUCTURE_embeddedSurfacesNodeManager` Index of parent edge within the mesh object it is registered on. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================ ================================================================ diff --git a/src/coreComponents/schema/docs/FlowProppantTransport_other.rst b/src/coreComponents/schema/docs/FlowProppantTransport_other.rst index 45d9a187f0a..cccf4603c70 100644 --- a/src/coreComponents/schema/docs/FlowProppantTransport_other.rst +++ b/src/coreComponents/schema/docs/FlowProppantTransport_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/Hydrofracture.rst b/src/coreComponents/schema/docs/Hydrofracture.rst index c65d103f356..2c63529e0c0 100644 --- a/src/coreComponents/schema/docs/Hydrofracture.rst +++ b/src/coreComponents/schema/docs/Hydrofracture.rst @@ -1,23 +1,24 @@ -========================= ================== ======== ====================================================================================================================================================================================================================================================================================================================== -Name Type Default Description -========================= ================== ======== ====================================================================================================================================================================================================================================================================================================================== -cflFactor real64 0.5 Factor to apply to the `CFL condition `_ when calculating the maximum allowable time step. Values should be in the interval (0,1] -contactRelationName groupNameRef required Name of contact relation to enforce constraints on fracture boundary. -flowSolverName groupNameRef required Name of the flow solver used by the coupled solver -initialDt real64 1e+99 Initial time-step value required by the solver to the event manager. -isMatrixPoroelastic integer 0 (no description available) -isThermal integer 0 Flag indicating whether the problem is thermal or not. Set isThermal="1" to enable the thermal coupling -logLevel integer 0 Log level -maxNumResolves integer 10 Value to indicate how many resolves may be executed to perform surface generation after the execution of flow and mechanics solver. -name groupName required A name is required for any non-unique nodes -solidSolverName groupNameRef required Name of the solid solver used by the coupled solver -surfaceGeneratorName groupNameRef required Name of the surface generator to use in the hydrofracture solver -targetRegions groupNameRef_array required Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager. -useQuasiNewton integer 0 (no description available) -LinearSolverParameters node unique :ref:`XML_LinearSolverParameters` -NonlinearSolverParameters node unique :ref:`XML_NonlinearSolverParameters` -========================= ================== ======== ====================================================================================================================================================================================================================================================================================================================== +============================= =================================================================================================================================== ======== ====================================================================================================================================================================================================================================================================================================================== +Name Type Default Description +============================= =================================================================================================================================== ======== ====================================================================================================================================================================================================================================================================================================================== +cflFactor real64 0.5 Factor to apply to the `CFL condition `_ when calculating the maximum allowable time step. Values should be in the interval (0,1] +contactRelationName groupNameRef required Name of contact relation to enforce constraints on fracture boundary. +flowSolverName groupNameRef required Name of the flow solver used by the coupled solver +initialDt real64 1e+99 Initial time-step value required by the solver to the event manager. +isMatrixPoroelastic integer 0 (no description available) +isThermal integer 0 Flag indicating whether the problem is thermal or not. Set isThermal="1" to enable the thermal coupling +logLevel integer 0 Log level +maxNumResolves integer 10 Value to indicate how many resolves may be executed to perform surface generation after the execution of flow and mechanics solver. +name groupName required A name is required for any non-unique nodes +newFractureInitializationType geos_HydrofractureSolver >_InitializationType Pressure Type of new fracture element initialization. Can be Pressure or Displacement. +solidSolverName groupNameRef required Name of the solid solver used by the coupled solver +surfaceGeneratorName groupNameRef required Name of the surface generator to use in the hydrofracture solver +targetRegions groupNameRef_array required Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager. +useQuasiNewton integer 0 (no description available) +LinearSolverParameters node unique :ref:`XML_LinearSolverParameters` +NonlinearSolverParameters node unique :ref:`XML_NonlinearSolverParameters` +============================= =================================================================================================================================== ======== ====================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/Hydrofracture_other.rst b/src/coreComponents/schema/docs/Hydrofracture_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/Hydrofracture_other.rst +++ b/src/coreComponents/schema/docs/Hydrofracture_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/JFunctionCapillaryPressure_other.rst b/src/coreComponents/schema/docs/JFunctionCapillaryPressure_other.rst index 68708936927..a9cd8c30fda 100644 --- a/src/coreComponents/schema/docs/JFunctionCapillaryPressure_other.rst +++ b/src/coreComponents/schema/docs/JFunctionCapillaryPressure_other.rst @@ -1,14 +1,14 @@ -=================================== ======================================================================================================= ============================================================================ -Name Type Description -=================================== ======================================================================================================= ============================================================================ -dPhaseCapPressure_dPhaseVolFraction real64_array4d Derivative of phase capillary pressure with respect to phase volume fraction -jFuncMultiplier real64_array2d Multiplier for the Leverett J-function -jFunctionWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -phaseCapPressure real64_array3d Phase capillary pressure -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -=================================== ======================================================================================================= ============================================================================ +=================================== =================================================================================================== ============================================================================ +Name Type Description +=================================== =================================================================================================== ============================================================================ +dPhaseCapPressure_dPhaseVolFraction real64_array4d Derivative of phase capillary pressure with respect to phase volume fraction +jFuncMultiplier real64_array2d Multiplier for the Leverett J-function +jFunctionWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +phaseCapPressure real64_array3d Phase capillary pressure +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +=================================== =================================================================================================== ============================================================================ diff --git a/src/coreComponents/schema/docs/LaplaceFEM_other.rst b/src/coreComponents/schema/docs/LaplaceFEM_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/LaplaceFEM_other.rst +++ b/src/coreComponents/schema/docs/LaplaceFEM_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/MultiphasePoromechanicsInitialization.rst b/src/coreComponents/schema/docs/MultiphasePoromechanicsInitialization.rst index 27129634c0b..18e3a0dd9e7 100644 --- a/src/coreComponents/schema/docs/MultiphasePoromechanicsInitialization.rst +++ b/src/coreComponents/schema/docs/MultiphasePoromechanicsInitialization.rst @@ -1,12 +1,12 @@ -=========================== ============ ======== ========================================================================== -Name Type Default Description -=========================== ============ ======== ========================================================================== -logLevel integer 0 Log level -name groupName required A name is required for any non-unique nodes -performStressInitialization integer required Flag to indicate that the solver is going to perform stress initialization -poromechanicsSolverName groupNameRef required Name of the poromechanics solver -=========================== ============ ======== ========================================================================== +============================ ============ ======== =========================================== +Name Type Default Description +============================ ============ ======== =========================================== +logLevel integer 0 Log level +name groupName required A name is required for any non-unique nodes +poromechanicsSolverName groupNameRef required Name of the poromechanics solver +solidMechanicsStatisticsName groupNameRef Name of the solid mechanics statistics +============================ ============ ======== =========================================== diff --git a/src/coreComponents/schema/docs/MultiphasePoromechanicsReservoir_other.rst b/src/coreComponents/schema/docs/MultiphasePoromechanicsReservoir_other.rst index 45d9a187f0a..cccf4603c70 100644 --- a/src/coreComponents/schema/docs/MultiphasePoromechanicsReservoir_other.rst +++ b/src/coreComponents/schema/docs/MultiphasePoromechanicsReservoir_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/MultiphasePoromechanics_other.rst b/src/coreComponents/schema/docs/MultiphasePoromechanics_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/MultiphasePoromechanics_other.rst +++ b/src/coreComponents/schema/docs/MultiphasePoromechanics_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/ParticleRegion_other.rst b/src/coreComponents/schema/docs/ParticleRegion_other.rst index fbfc33ebf7f..f57cca08d6b 100644 --- a/src/coreComponents/schema/docs/ParticleRegion_other.rst +++ b/src/coreComponents/schema/docs/ParticleRegion_other.rst @@ -1,16 +1,16 @@ -======================= ==================================================================== ========================================================= -Name Type Description -======================= ==================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -neighborData node :ref:`DATASTRUCTURE_neighborData` -particleSubRegions node :ref:`DATASTRUCTURE_particleSubRegions` -sets node :ref:`DATASTRUCTURE_sets` -======================= ==================================================================== ========================================================= +======================= ================================================================= ========================================================= +Name Type Description +======================= ================================================================= ========================================================= +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +neighborData node :ref:`DATASTRUCTURE_neighborData` +particleSubRegions node :ref:`DATASTRUCTURE_particleSubRegions` +sets node :ref:`DATASTRUCTURE_sets` +======================= ================================================================= ========================================================= diff --git a/src/coreComponents/schema/docs/ParticleRegions_other.rst b/src/coreComponents/schema/docs/ParticleRegions_other.rst index 48075ebfe05..94022d14540 100644 --- a/src/coreComponents/schema/docs/ParticleRegions_other.rst +++ b/src/coreComponents/schema/docs/ParticleRegions_other.rst @@ -1,17 +1,17 @@ -======================= ==================================================================== ========================================================= -Name Type Description -======================= ==================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -ParticleRegion node :ref:`DATASTRUCTURE_ParticleRegion` -neighborData node :ref:`DATASTRUCTURE_neighborData` -particleRegionsGroup node :ref:`DATASTRUCTURE_particleRegionsGroup` -sets node :ref:`DATASTRUCTURE_sets` -======================= ==================================================================== ========================================================= +======================= ================================================================= ========================================================= +Name Type Description +======================= ================================================================= ========================================================= +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +ParticleRegion node :ref:`DATASTRUCTURE_ParticleRegion` +neighborData node :ref:`DATASTRUCTURE_neighborData` +particleRegionsGroup node :ref:`DATASTRUCTURE_particleRegionsGroup` +sets node :ref:`DATASTRUCTURE_sets` +======================= ================================================================= ========================================================= diff --git a/src/coreComponents/schema/docs/PhaseFieldDamageFEM_other.rst b/src/coreComponents/schema/docs/PhaseFieldDamageFEM_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/PhaseFieldDamageFEM_other.rst +++ b/src/coreComponents/schema/docs/PhaseFieldDamageFEM_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/PhaseFieldFracture_other.rst b/src/coreComponents/schema/docs/PhaseFieldFracture_other.rst index 45d9a187f0a..cccf4603c70 100644 --- a/src/coreComponents/schema/docs/PhaseFieldFracture_other.rst +++ b/src/coreComponents/schema/docs/PhaseFieldFracture_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/ProppantTransport_other.rst b/src/coreComponents/schema/docs/ProppantTransport_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/ProppantTransport_other.rst +++ b/src/coreComponents/schema/docs/ProppantTransport_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/ReactiveBrineThermal_other.rst b/src/coreComponents/schema/docs/ReactiveBrineThermal_other.rst index 74f30d53b77..05bd31c0020 100644 --- a/src/coreComponents/schema/docs/ReactiveBrineThermal_other.rst +++ b/src/coreComponents/schema/docs/ReactiveBrineThermal_other.rst @@ -1,34 +1,34 @@ -================================ ============================================================================================= ============================================================================================================ -Name Type Description -================================ ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -kineticReactionRates real64_array2d kineticReactionRates -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -primarySpeciesConcentration real64_array2d primarySpeciesConcentration -primarySpeciesTotalConcentration real64_array2d primarySpeciesTotalConcentration -secondarySpeciesConcentration real64_array2d secondarySpeciesConcentration -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -================================ ============================================================================================= ============================================================================================================ +================================ ========================================================================================= ============================================================================================================ +Name Type Description +================================ ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +kineticReactionRates real64_array2d kineticReactionRates +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +primarySpeciesConcentration real64_array2d primarySpeciesConcentration +primarySpeciesTotalConcentration real64_array2d primarySpeciesTotalConcentration +secondarySpeciesConcentration real64_array2d secondarySpeciesConcentration +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +================================ ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/ReactiveBrine_other.rst b/src/coreComponents/schema/docs/ReactiveBrine_other.rst index 74f30d53b77..05bd31c0020 100644 --- a/src/coreComponents/schema/docs/ReactiveBrine_other.rst +++ b/src/coreComponents/schema/docs/ReactiveBrine_other.rst @@ -1,34 +1,34 @@ -================================ ============================================================================================= ============================================================================================================ -Name Type Description -================================ ============================================================================================= ============================================================================================================ -dPhaseCompFraction LvArray_Array< double, 5, camp_int_seq< long, 0l, 1l, 2l, 3l, 4l >, int, LvArray_ChaiBuffer > Derivative of phase component fraction with respect to pressure, temperature, and global component fractions -dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions -dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions -dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions -dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions -dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions -dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions -dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions -kineticReactionRates real64_array2d kineticReactionRates -phaseCompFraction real64_array4d Phase component fraction -phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step -phaseDensity real64_array3d Phase density -phaseDensity_n real64_array3d Phase density at the previous converged time step -phaseEnthalpy real64_array3d Phase enthalpy -phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step -phaseFraction real64_array3d Phase fraction -phaseInternalEnergy real64_array3d Phase internal energy -phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step -phaseMassDensity real64_array3d Phase mass density -phaseViscosity real64_array3d Phase viscosity -primarySpeciesConcentration real64_array2d primarySpeciesConcentration -primarySpeciesTotalConcentration real64_array2d primarySpeciesTotalConcentration -secondarySpeciesConcentration real64_array2d secondarySpeciesConcentration -totalDensity real64_array2d Total density -totalDensity_n real64_array2d Total density at the previous converged time step -useMass integer (no description available) -================================ ============================================================================================= ============================================================================================================ +================================ ========================================================================================= ============================================================================================================ +Name Type Description +================================ ========================================================================================= ============================================================================================================ +dPhaseCompFraction LvArray_Array, int, LvArray_ChaiBuffer> Derivative of phase component fraction with respect to pressure, temperature, and global component fractions +dPhaseDensity real64_array4d Derivative of phase density with respect to pressure, temperature, and global component fractions +dPhaseEnthalpy real64_array4d Derivative of phase enthalpy with respect to pressure, temperature, and global component fractions +dPhaseFraction real64_array4d Derivative of phase fraction with respect to pressure, temperature, and global component fractions +dPhaseInternalEnergy real64_array4d Derivative of phase internal energy with respect to pressure, temperature, and global component fractions +dPhaseMassDensity real64_array4d Derivative of phase mass density with respect to pressure, temperature, and global component fractions +dPhaseViscosity real64_array4d Derivative of phase viscosity with respect to pressure, temperature, and global component fractions +dTotalDensity real64_array3d Derivative of total density with respect to pressure, temperature, and global component fractions +kineticReactionRates real64_array2d kineticReactionRates +phaseCompFraction real64_array4d Phase component fraction +phaseCompFraction_n real64_array4d Phase component fraction at the previous converged time step +phaseDensity real64_array3d Phase density +phaseDensity_n real64_array3d Phase density at the previous converged time step +phaseEnthalpy real64_array3d Phase enthalpy +phaseEnthalpy_n real64_array3d Phase enthalpy at the previous converged time step +phaseFraction real64_array3d Phase fraction +phaseInternalEnergy real64_array3d Phase internal energy +phaseInternalEnergy_n real64_array3d Phase internal energy at the previous converged time step +phaseMassDensity real64_array3d Phase mass density +phaseViscosity real64_array3d Phase viscosity +primarySpeciesConcentration real64_array2d primarySpeciesConcentration +primarySpeciesTotalConcentration real64_array2d primarySpeciesTotalConcentration +secondarySpeciesConcentration real64_array2d secondarySpeciesConcentration +totalDensity real64_array2d Total density +totalDensity_n real64_array2d Total density at the previous converged time step +useMass integer (no description available) +================================ ========================================================================================= ============================================================================================================ diff --git a/src/coreComponents/schema/docs/ReactiveCompositionalMultiphaseOBL_other.rst b/src/coreComponents/schema/docs/ReactiveCompositionalMultiphaseOBL_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/ReactiveCompositionalMultiphaseOBL_other.rst +++ b/src/coreComponents/schema/docs/ReactiveCompositionalMultiphaseOBL_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/SinglePhaseFVM_other.rst b/src/coreComponents/schema/docs/SinglePhaseFVM_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/SinglePhaseFVM_other.rst +++ b/src/coreComponents/schema/docs/SinglePhaseFVM_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/SinglePhaseHybridFVM_other.rst b/src/coreComponents/schema/docs/SinglePhaseHybridFVM_other.rst index d1627f7fba7..f0cca96f3a1 100644 --- a/src/coreComponents/schema/docs/SinglePhaseHybridFVM_other.rst +++ b/src/coreComponents/schema/docs/SinglePhaseHybridFVM_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ================================ ================================================================ -Name Type Registered On Description -========================= ============================================================================================================================================================== ================================ ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -facePressure_n real64_array :ref:`DATASTRUCTURE_faceManager` Face pressure at the previous converged time step -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================ ================================================================ +========================= ====================================================================================================================================================== ================================ ================================================================ +Name Type Registered On Description +========================= ====================================================================================================================================================== ================================ ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +facePressure_n real64_array :ref:`DATASTRUCTURE_faceManager` Face pressure at the previous converged time step +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================ ================================================================ diff --git a/src/coreComponents/schema/docs/SinglePhasePoromechanicsConformingFractures_other.rst b/src/coreComponents/schema/docs/SinglePhasePoromechanicsConformingFractures_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/SinglePhasePoromechanicsConformingFractures_other.rst +++ b/src/coreComponents/schema/docs/SinglePhasePoromechanicsConformingFractures_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SinglePhasePoromechanicsEmbeddedFractures_other.rst b/src/coreComponents/schema/docs/SinglePhasePoromechanicsEmbeddedFractures_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/SinglePhasePoromechanicsEmbeddedFractures_other.rst +++ b/src/coreComponents/schema/docs/SinglePhasePoromechanicsEmbeddedFractures_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SinglePhasePoromechanicsInitialization.rst b/src/coreComponents/schema/docs/SinglePhasePoromechanicsInitialization.rst index 27129634c0b..18e3a0dd9e7 100644 --- a/src/coreComponents/schema/docs/SinglePhasePoromechanicsInitialization.rst +++ b/src/coreComponents/schema/docs/SinglePhasePoromechanicsInitialization.rst @@ -1,12 +1,12 @@ -=========================== ============ ======== ========================================================================== -Name Type Default Description -=========================== ============ ======== ========================================================================== -logLevel integer 0 Log level -name groupName required A name is required for any non-unique nodes -performStressInitialization integer required Flag to indicate that the solver is going to perform stress initialization -poromechanicsSolverName groupNameRef required Name of the poromechanics solver -=========================== ============ ======== ========================================================================== +============================ ============ ======== =========================================== +Name Type Default Description +============================ ============ ======== =========================================== +logLevel integer 0 Log level +name groupName required A name is required for any non-unique nodes +poromechanicsSolverName groupNameRef required Name of the poromechanics solver +solidMechanicsStatisticsName groupNameRef Name of the solid mechanics statistics +============================ ============ ======== =========================================== diff --git a/src/coreComponents/schema/docs/SinglePhasePoromechanicsReservoir_other.rst b/src/coreComponents/schema/docs/SinglePhasePoromechanicsReservoir_other.rst index 45d9a187f0a..cccf4603c70 100644 --- a/src/coreComponents/schema/docs/SinglePhasePoromechanicsReservoir_other.rst +++ b/src/coreComponents/schema/docs/SinglePhasePoromechanicsReservoir_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SinglePhasePoromechanics_other.rst b/src/coreComponents/schema/docs/SinglePhasePoromechanics_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/SinglePhasePoromechanics_other.rst +++ b/src/coreComponents/schema/docs/SinglePhasePoromechanics_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SinglePhaseProppantFVM_other.rst b/src/coreComponents/schema/docs/SinglePhaseProppantFVM_other.rst index 3f1b37c3d6c..f296d4de732 100644 --- a/src/coreComponents/schema/docs/SinglePhaseProppantFVM_other.rst +++ b/src/coreComponents/schema/docs/SinglePhaseProppantFVM_other.rst @@ -1,13 +1,13 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanicsInitialization.rst b/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanicsInitialization.rst index 27129634c0b..18e3a0dd9e7 100644 --- a/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanicsInitialization.rst +++ b/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanicsInitialization.rst @@ -1,12 +1,12 @@ -=========================== ============ ======== ========================================================================== -Name Type Default Description -=========================== ============ ======== ========================================================================== -logLevel integer 0 Log level -name groupName required A name is required for any non-unique nodes -performStressInitialization integer required Flag to indicate that the solver is going to perform stress initialization -poromechanicsSolverName groupNameRef required Name of the poromechanics solver -=========================== ============ ======== ========================================================================== +============================ ============ ======== =========================================== +Name Type Default Description +============================ ============ ======== =========================================== +logLevel integer 0 Log level +name groupName required A name is required for any non-unique nodes +poromechanicsSolverName groupNameRef required Name of the poromechanics solver +solidMechanicsStatisticsName groupNameRef Name of the solid mechanics statistics +============================ ============ ======== =========================================== diff --git a/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanics_other.rst b/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanics_other.rst index 80b71ab722d..dc33be0a036 100644 --- a/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanics_other.rst +++ b/src/coreComponents/schema/docs/SinglePhaseReservoirPoromechanics_other.rst @@ -1,15 +1,15 @@ -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -=========================== ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +performStressInitialization integer Flag to indicate that the solver is going to perform stress initialization +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +=========================== ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SinglePhaseReservoir_other.rst b/src/coreComponents/schema/docs/SinglePhaseReservoir_other.rst index 45d9a187f0a..cccf4603c70 100644 --- a/src/coreComponents/schema/docs/SinglePhaseReservoir_other.rst +++ b/src/coreComponents/schema/docs/SinglePhaseReservoir_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SinglePhaseWell_other.rst b/src/coreComponents/schema/docs/SinglePhaseWell_other.rst index 3f16a155d2b..f2c739b92d8 100644 --- a/src/coreComponents/schema/docs/SinglePhaseWell_other.rst +++ b/src/coreComponents/schema/docs/SinglePhaseWell_other.rst @@ -1,15 +1,15 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -WellControls node :ref:`DATASTRUCTURE_WellControls` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +WellControls node :ref:`DATASTRUCTURE_WellControls` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/SolidMechanicsEmbeddedFractures_other.rst b/src/coreComponents/schema/docs/SolidMechanicsEmbeddedFractures_other.rst index 17da1cb5b33..1a9ad823675 100644 --- a/src/coreComponents/schema/docs/SolidMechanicsEmbeddedFractures_other.rst +++ b/src/coreComponents/schema/docs/SolidMechanicsEmbeddedFractures_other.rst @@ -1,16 +1,16 @@ -========================= ============================================================================================================================================================== ===================================================================== -Name Type Description -========================= ============================================================================================================================================================== ===================================================================== -contactRelationName groupNameRef Name of contact relation to enforce constraints on fracture boundary. -maxForce real64 The maximum force contribution in the problem domain. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -surfaceGeneratorName string Name of the surface generator to use -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ===================================================================== +========================= ====================================================================================================================================================== ===================================================================== +Name Type Description +========================= ====================================================================================================================================================== ===================================================================== +contactRelationName groupNameRef Name of contact relation to enforce constraints on fracture boundary. +maxForce real64 The maximum force contribution in the problem domain. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +surfaceGeneratorName string Name of the surface generator to use +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ===================================================================== diff --git a/src/coreComponents/schema/docs/SolidMechanicsLagrangeContact_other.rst b/src/coreComponents/schema/docs/SolidMechanicsLagrangeContact_other.rst index 17da1cb5b33..1a9ad823675 100644 --- a/src/coreComponents/schema/docs/SolidMechanicsLagrangeContact_other.rst +++ b/src/coreComponents/schema/docs/SolidMechanicsLagrangeContact_other.rst @@ -1,16 +1,16 @@ -========================= ============================================================================================================================================================== ===================================================================== -Name Type Description -========================= ============================================================================================================================================================== ===================================================================== -contactRelationName groupNameRef Name of contact relation to enforce constraints on fracture boundary. -maxForce real64 The maximum force contribution in the problem domain. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -surfaceGeneratorName string Name of the surface generator to use -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ===================================================================== +========================= ====================================================================================================================================================== ===================================================================== +Name Type Description +========================= ====================================================================================================================================================== ===================================================================== +contactRelationName groupNameRef Name of contact relation to enforce constraints on fracture boundary. +maxForce real64 The maximum force contribution in the problem domain. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +surfaceGeneratorName string Name of the surface generator to use +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ===================================================================== diff --git a/src/coreComponents/schema/docs/SolidMechanicsLagrangianSSLE_other.rst b/src/coreComponents/schema/docs/SolidMechanicsLagrangianSSLE_other.rst index a4018f48d74..e458a0e69b3 100644 --- a/src/coreComponents/schema/docs/SolidMechanicsLagrangianSSLE_other.rst +++ b/src/coreComponents/schema/docs/SolidMechanicsLagrangianSSLE_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxForce real64 The maximum force contribution in the problem domain. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxForce real64 The maximum force contribution in the problem domain. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/SolidMechanics_LagrangianFEM_other.rst b/src/coreComponents/schema/docs/SolidMechanics_LagrangianFEM_other.rst index a4018f48d74..e458a0e69b3 100644 --- a/src/coreComponents/schema/docs/SolidMechanics_LagrangianFEM_other.rst +++ b/src/coreComponents/schema/docs/SolidMechanics_LagrangianFEM_other.rst @@ -1,14 +1,14 @@ -========================= ============================================================================================================================================================== ================================================================ -Name Type Description -========================= ============================================================================================================================================================== ================================================================ -maxForce real64 The maximum force contribution in the problem domain. -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================ +========================= ====================================================================================================================================================== ================================================================ +Name Type Description +========================= ====================================================================================================================================================== ================================================================ +maxForce real64 The maximum force contribution in the problem domain. +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================ diff --git a/src/coreComponents/schema/docs/SolidMechanics_MPM_other.rst b/src/coreComponents/schema/docs/SolidMechanics_MPM_other.rst index 4cd129ff504..e0b8502fb7f 100644 --- a/src/coreComponents/schema/docs/SolidMechanics_MPM_other.rst +++ b/src/coreComponents/schema/docs/SolidMechanics_MPM_other.rst @@ -1,34 +1,34 @@ -========================= ============================================================================================================================================================== ================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ================================================================================================== -bcTable real64_array2d Array that stores time-dependent bc types on x-, x+, y-, y+, z- and z+ faces. -binSizeMultiplier integer Multiplier for setting bin size, used to speed up particle neighbor sorting -domainExtent real64_array domain extent -domainF real64_array domain deformation gradient -domainL real64_array domain L -elementSize real64_array Minimum element size in x, y and z -fTable real64_array2d Array that stores time-dependent grid-aligned stretches interpreted as a global background grid F. -globalMaximum real64_array global maximum -globalMinimum real64_array global minimum -localMaximum real64_array local maximum -localMaximumNoGhost real64_array local maximum without ghost cells -localMinimum real64_array local minimum -localMinimumNoGhost real64_array local minimum without ghost cells -m_ijkMap integer_array3d Map from indices in each spatial dimension to local node ID -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -numContactFlags integer Number of contact flags that can appear due to damage -numContactGroups integer Number of prescribed contact groups -numDims integer The number of active spatial dimensions, 2 for plane strain, 3 otherwise -numElements integer_array number of elements along partition directions -numVelocityFields integer Number of velocity fields -partitionExtent real64_array parititon extent -smallMass real64 The small mass threshold for ignoring extremely low-mass nodes. -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ================================================================================================== +========================= ====================================================================================================================================================== ================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ================================================================================================== +bcTable real64_array2d Array that stores time-dependent bc types on x-, x+, y-, y+, z- and z+ faces. +binSizeMultiplier integer Multiplier for setting bin size, used to speed up particle neighbor sorting +domainExtent real64_array domain extent +domainF real64_array domain deformation gradient +domainL real64_array domain L +elementSize real64_array Minimum element size in x, y and z +fTable real64_array2d Array that stores time-dependent grid-aligned stretches interpreted as a global background grid F. +globalMaximum real64_array global maximum +globalMinimum real64_array global minimum +localMaximum real64_array local maximum +localMaximumNoGhost real64_array local maximum without ghost cells +localMinimum real64_array local minimum +localMinimumNoGhost real64_array local minimum without ghost cells +m_ijkMap integer_array3d Map from indices in each spatial dimension to local node ID +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +numContactFlags integer Number of contact flags that can appear due to damage +numContactGroups integer Number of prescribed contact groups +numDims integer The number of active spatial dimensions, 2 for plane strain, 3 otherwise +numElements integer_array number of elements along partition directions +numVelocityFields integer Number of velocity fields +partitionExtent real64_array parititon extent +smallMass real64 The small mass threshold for ignoring extremely low-mass nodes. +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ================================================================================================== diff --git a/src/coreComponents/schema/docs/SurfaceElementRegion_other.rst b/src/coreComponents/schema/docs/SurfaceElementRegion_other.rst index a65968b0105..bb012ac8ff4 100644 --- a/src/coreComponents/schema/docs/SurfaceElementRegion_other.rst +++ b/src/coreComponents/schema/docs/SurfaceElementRegion_other.rst @@ -1,16 +1,16 @@ -======================= ==================================================================== ========================================================= -Name Type Description -======================= ==================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -elementSubRegions node :ref:`DATASTRUCTURE_elementSubRegions` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ==================================================================== ========================================================= +======================= ================================================================= ========================================================= +Name Type Description +======================= ================================================================= ========================================================= +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +elementSubRegions node :ref:`DATASTRUCTURE_elementSubRegions` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ================================================================= ========================================================= diff --git a/src/coreComponents/schema/docs/SurfaceGenerator_other.rst b/src/coreComponents/schema/docs/SurfaceGenerator_other.rst index d9e8cac2e2d..644325ed6a9 100644 --- a/src/coreComponents/schema/docs/SurfaceGenerator_other.rst +++ b/src/coreComponents/schema/docs/SurfaceGenerator_other.rst @@ -1,19 +1,19 @@ -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -Name Type Description -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== -discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. -failCriterion integer (no description available) -maxStableDt real64 Value of the Maximum Stable Timestep for this solver. -meshTargets geos_mapBase< std_pair< string, string >, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > MeshBody/Region combinations that the solver will be applied to. -tipEdges LvArray_SortedArray< int, int, LvArray_ChaiBuffer > Set containing all the tip edges -tipFaces LvArray_SortedArray< int, int, LvArray_ChaiBuffer > Set containing all the tip faces -tipNodes LvArray_SortedArray< int, int, LvArray_ChaiBuffer > Set containing all the nodes at the fracture tip -trailingFaces LvArray_SortedArray< int, int, LvArray_ChaiBuffer > Set containing all the trailing faces -LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` -NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` -SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` -========================= ============================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +Name Type Description +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== +discretization groupNameRef Name of discretization object (defined in the :ref:`NumericalMethodsManager`) to use for this solver. For instance, if this is a Finite Element Solver, the name of a :ref:`FiniteElement` should be specified. If this is a Finite Volume Method, the name of a :ref:`FiniteVolume` discretization should be specified. +failCriterion integer (no description available) +maxStableDt real64 Value of the Maximum Stable Timestep for this solver. +meshTargets geos_mapBase, LvArray_Array, int, LvArray_ChaiBuffer>, std_integral_constant > MeshBody/Region combinations that the solver will be applied to. +tipEdges LvArray_SortedArray Set containing all the tip edges +tipFaces LvArray_SortedArray Set containing all the tip faces +tipNodes LvArray_SortedArray Set containing all the nodes at the fracture tip +trailingFaces LvArray_SortedArray Set containing all the trailing faces +LinearSolverParameters node :ref:`DATASTRUCTURE_LinearSolverParameters` +NonlinearSolverParameters node :ref:`DATASTRUCTURE_NonlinearSolverParameters` +SolverStatistics node :ref:`DATASTRUCTURE_SolverStatistics` +========================= ====================================================================================================================================================== ======================================================================================================================================================================================================================================================================================================================== diff --git a/src/coreComponents/schema/docs/TableCapillaryPressure_other.rst b/src/coreComponents/schema/docs/TableCapillaryPressure_other.rst index d8e9f22248c..d4c775cae61 100644 --- a/src/coreComponents/schema/docs/TableCapillaryPressure_other.rst +++ b/src/coreComponents/schema/docs/TableCapillaryPressure_other.rst @@ -1,13 +1,13 @@ -=================================== ======================================================================================================= ============================================================================ -Name Type Description -=================================== ======================================================================================================= ============================================================================ -capPresWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -dPhaseCapPressure_dPhaseVolFraction real64_array4d Derivative of phase capillary pressure with respect to phase volume fraction -phaseCapPressure real64_array3d Phase capillary pressure -phaseOrder integer_array (no description available) -phaseTypes integer_array (no description available) -=================================== ======================================================================================================= ============================================================================ +=================================== =================================================================================================== ============================================================================ +Name Type Description +=================================== =================================================================================================== ============================================================================ +capPresWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +dPhaseCapPressure_dPhaseVolFraction real64_array4d Derivative of phase capillary pressure with respect to phase volume fraction +phaseCapPressure real64_array3d Phase capillary pressure +phaseOrder integer_array (no description available) +phaseTypes integer_array (no description available) +=================================== =================================================================================================== ============================================================================ diff --git a/src/coreComponents/schema/docs/TableRelativePermeabilityHysteresis_other.rst b/src/coreComponents/schema/docs/TableRelativePermeabilityHysteresis_other.rst index 1952771c2e9..f8e13266217 100644 --- a/src/coreComponents/schema/docs/TableRelativePermeabilityHysteresis_other.rst +++ b/src/coreComponents/schema/docs/TableRelativePermeabilityHysteresis_other.rst @@ -1,27 +1,27 @@ -================================ ======================================================================================================= =============================================================================== -Name Type Description -================================ ======================================================================================================= =============================================================================== -dPhaseRelPerm_dPhaseVolFraction real64_array4d Derivative of phase relative permeability with respect to phase volume fraction -drainagePhaseMaxVolumeFraction real64_array (no description available) -drainagePhaseMinVolumeFraction real64_array (no description available) -drainagePhaseRelPermEndPoint real64_array (no description available) -drainageRelPermWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -imbibitionPhaseMaxVolumeFraction real64_array (no description available) -imbibitionPhaseMinVolumeFraction real64_array (no description available) -imbibitionPhaseRelPermEndPoint real64_array (no description available) -imbibitionRelPermWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -landParameter real64_array (no description available) -phaseHasHysteresis integer_array (no description available) -phaseMaxHistoricalVolFraction real64_array2d Phase max historical phase volume fraction -phaseMinHistoricalVolFraction real64_array2d Phase min historical phase volume fraction -phaseOrder integer_array (no description available) -phaseRelPerm real64_array3d Phase relative permeability -phaseRelPerm_n real64_array3d Phase relative permeability at previous time -phaseTrappedVolFraction real64_array3d Phase trapped volume fraction -phaseTypes integer_array (no description available) -waterOilMaxRelPerm real64 (no description available) -================================ ======================================================================================================= =============================================================================== +================================ =================================================================================================== =============================================================================== +Name Type Description +================================ =================================================================================================== =============================================================================== +dPhaseRelPerm_dPhaseVolFraction real64_array4d Derivative of phase relative permeability with respect to phase volume fraction +drainagePhaseMaxVolumeFraction real64_array (no description available) +drainagePhaseMinVolumeFraction real64_array (no description available) +drainagePhaseRelPermEndPoint real64_array (no description available) +drainageRelPermWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +imbibitionPhaseMaxVolumeFraction real64_array (no description available) +imbibitionPhaseMinVolumeFraction real64_array (no description available) +imbibitionPhaseRelPermEndPoint real64_array (no description available) +imbibitionRelPermWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +landParameter real64_array (no description available) +phaseHasHysteresis integer_array (no description available) +phaseMaxHistoricalVolFraction real64_array2d Phase max historical phase volume fraction +phaseMinHistoricalVolFraction real64_array2d Phase min historical phase volume fraction +phaseOrder integer_array (no description available) +phaseRelPerm real64_array3d Phase relative permeability +phaseRelPerm_n real64_array3d Phase relative permeability at previous time +phaseTrappedVolFraction real64_array3d Phase trapped volume fraction +phaseTypes integer_array (no description available) +waterOilMaxRelPerm real64 (no description available) +================================ =================================================================================================== =============================================================================== diff --git a/src/coreComponents/schema/docs/TableRelativePermeability_other.rst b/src/coreComponents/schema/docs/TableRelativePermeability_other.rst index d71522f8a7a..4d6a2f00651 100644 --- a/src/coreComponents/schema/docs/TableRelativePermeability_other.rst +++ b/src/coreComponents/schema/docs/TableRelativePermeability_other.rst @@ -1,17 +1,17 @@ -=============================== ======================================================================================================= =============================================================================== -Name Type Description -=============================== ======================================================================================================= =============================================================================== -dPhaseRelPerm_dPhaseVolFraction real64_array4d Derivative of phase relative permeability with respect to phase volume fraction -phaseMinVolumeFraction real64_array (no description available) -phaseOrder integer_array (no description available) -phaseRelPerm real64_array3d Phase relative permeability -phaseRelPerm_n real64_array3d Phase relative permeability at previous time -phaseTrappedVolFraction real64_array3d Phase trapped volume fraction -phaseTypes integer_array (no description available) -relPermWrappers LvArray_Array< geos_TableFunction_KernelWrapper, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer > (no description available) -waterOilMaxRelPerm real64 (no description available) -=============================== ======================================================================================================= =============================================================================== +=============================== =================================================================================================== =============================================================================== +Name Type Description +=============================== =================================================================================================== =============================================================================== +dPhaseRelPerm_dPhaseVolFraction real64_array4d Derivative of phase relative permeability with respect to phase volume fraction +phaseMinVolumeFraction real64_array (no description available) +phaseOrder integer_array (no description available) +phaseRelPerm real64_array3d Phase relative permeability +phaseRelPerm_n real64_array3d Phase relative permeability at previous time +phaseTrappedVolFraction real64_array3d Phase trapped volume fraction +phaseTypes integer_array (no description available) +relPermWrappers LvArray_Array, int, LvArray_ChaiBuffer> (no description available) +waterOilMaxRelPerm real64 (no description available) +=============================== =================================================================================================== =============================================================================== diff --git a/src/coreComponents/schema/docs/TwoPointFluxApproximation.rst b/src/coreComponents/schema/docs/TwoPointFluxApproximation.rst index 57ec23d2f8a..30fa4827360 100644 --- a/src/coreComponents/schema/docs/TwoPointFluxApproximation.rst +++ b/src/coreComponents/schema/docs/TwoPointFluxApproximation.rst @@ -1,15 +1,16 @@ -=================== ==================== ======== ======================================================== -Name Type Default Description -=================== ==================== ======== ======================================================== -areaRelTol real64 1e-08 Relative tolerance for area calculations. -meanPermCoefficient real64 1 (no description available) -name groupName required A name is required for any non-unique nodes -upwindingScheme geos_UpwindingScheme PPU | Type of upwinding scheme. Valid options: - | * PPU - | * C1PPU -usePEDFM integer 0 (no description available) -=================== ==================== ======== ======================================================== +=================== ==================== ======== =============================================================== +Name Type Default Description +=================== ==================== ======== =============================================================== +areaRelTol real64 1e-08 Relative tolerance for area calculations. +meanPermCoefficient real64 1 (no description available) +name groupName required A name is required for any non-unique nodes +upwindingScheme geos_UpwindingScheme PPU | Type of upwinding scheme. Valid options: + | * PPU + | * C1PPU + | * IHU +usePEDFM integer 0 (no description available) +=================== ==================== ======== =============================================================== diff --git a/src/coreComponents/schema/docs/TwoPointFluxApproximation_other.rst b/src/coreComponents/schema/docs/TwoPointFluxApproximation_other.rst index 9194c2431f9..a21d5757d0f 100644 --- a/src/coreComponents/schema/docs/TwoPointFluxApproximation_other.rst +++ b/src/coreComponents/schema/docs/TwoPointFluxApproximation_other.rst @@ -1,15 +1,15 @@ -======================== ========================================================================================================================================== ======================================== -Name Type Description -======================== ========================================================================================================================================== ======================================== -cellStencil geos_CellElementStencilTPFA (no description available) -coefficientName groupNameRef Name of coefficient field -edfmStencil geos_EmbeddedSurfaceToCellStencil (no description available) -faceElementToCellStencil geos_FaceElementToCellStencil (no description available) -fieldName groupNameRef_array Name of primary solution field -fractureStencil geos_SurfaceElementStencil (no description available) -targetRegions geos_mapBase< string, LvArray_Array< string, 1, camp_int_seq< long, 0l >, int, LvArray_ChaiBuffer >, std_integral_constant< bool, true > > List of regions to build the stencil for -======================== ========================================================================================================================================== ======================================== +======================== =================================================================================================================================== ======================================== +Name Type Description +======================== =================================================================================================================================== ======================================== +cellStencil geos_CellElementStencilTPFA (no description available) +coefficientName groupNameRef Name of coefficient field +edfmStencil geos_EmbeddedSurfaceToCellStencil (no description available) +faceElementToCellStencil geos_FaceElementToCellStencil (no description available) +fieldName groupNameRef_array Name of primary solution field +fractureStencil geos_SurfaceElementStencil (no description available) +targetRegions geos_mapBase, int, LvArray_ChaiBuffer>, std_integral_constant > List of regions to build the stencil for +======================== =================================================================================================================================== ======================================== diff --git a/src/coreComponents/schema/docs/WellElementRegionUniqueSubRegion_other.rst b/src/coreComponents/schema/docs/WellElementRegionUniqueSubRegion_other.rst index 3a4675201c0..eca5644ac14 100644 --- a/src/coreComponents/schema/docs/WellElementRegionUniqueSubRegion_other.rst +++ b/src/coreComponents/schema/docs/WellElementRegionUniqueSubRegion_other.rst @@ -1,29 +1,29 @@ -========================== ========================================================================================================== ========================================================= -Name Type Description -========================== ========================================================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -elementCenter real64_array2d (no description available) -elementVolume real64_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nextWellElementIndex integer_array (no description available) -nextWellElementIndexGlobal integer_array (no description available) -nodeList geos_InterObjectRelation< LvArray_Array< int, 2, camp_int_seq< long, 0l, 1l >, int, LvArray_ChaiBuffer > > (no description available) -numEdgesPerElement integer (no description available) -numFacesPerElement integer (no description available) -numNodesPerElement integer (no description available) -radius real64_array (no description available) -topRank integer (no description available) -topWellElementIndex integer (no description available) -wellControlsName groupNameRef (no description available) -ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -wellElementSubRegion node :ref:`DATASTRUCTURE_wellElementSubRegion` -========================== ========================================================================================================== ========================================================= +========================== ===================================================================================================== ========================================================= +Name Type Description +========================== ===================================================================================================== ========================================================= +domainBoundaryIndicator integer_array (no description available) +elementCenter real64_array2d (no description available) +elementVolume real64_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nextWellElementIndex integer_array (no description available) +nextWellElementIndexGlobal integer_array (no description available) +nodeList geos_InterObjectRelation, int, LvArray_ChaiBuffer> > (no description available) +numEdgesPerElement integer (no description available) +numFacesPerElement integer (no description available) +numNodesPerElement integer (no description available) +radius real64_array (no description available) +topRank integer (no description available) +topWellElementIndex integer (no description available) +wellControlsName groupNameRef (no description available) +ConstitutiveModels node :ref:`DATASTRUCTURE_ConstitutiveModels` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +wellElementSubRegion node :ref:`DATASTRUCTURE_wellElementSubRegion` +========================== ===================================================================================================== ========================================================= diff --git a/src/coreComponents/schema/docs/WellElementRegion_other.rst b/src/coreComponents/schema/docs/WellElementRegion_other.rst index 7235a663f6d..bb655ec67d1 100644 --- a/src/coreComponents/schema/docs/WellElementRegion_other.rst +++ b/src/coreComponents/schema/docs/WellElementRegion_other.rst @@ -1,18 +1,18 @@ -======================= ==================================================================== ========================================================= -Name Type Description -======================= ==================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -wellControlsName groupNameRef (no description available) -wellGeneratorName groupNameRef (no description available) -elementSubRegions node :ref:`DATASTRUCTURE_elementSubRegions` -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ==================================================================== ========================================================= +======================= ================================================================= ========================================================= +Name Type Description +======================= ================================================================= ========================================================= +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +wellControlsName groupNameRef (no description available) +wellGeneratorName groupNameRef (no description available) +elementSubRegions node :ref:`DATASTRUCTURE_elementSubRegions` +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ================================================================= ========================================================= diff --git a/src/coreComponents/schema/docs/domain_other.rst b/src/coreComponents/schema/docs/domain_other.rst index 18e678dae42..4cbdf6ffbda 100644 --- a/src/coreComponents/schema/docs/domain_other.rst +++ b/src/coreComponents/schema/docs/domain_other.rst @@ -1,12 +1,12 @@ -================ =================================================================================== ================================= -Name Type Description -================ =================================================================================== ================================= -Neighbors std_vector< geos_NeighborCommunicator, std_allocator< geos_NeighborCommunicator > > (no description available) -partitionManager geos_PartitionBase (no description available) -Constitutive node :ref:`DATASTRUCTURE_Constitutive` -MeshBodies node :ref:`DATASTRUCTURE_MeshBodies` -================ =================================================================================== ================================= +================ ================================================================================ ================================= +Name Type Description +================ ================================================================================ ================================= +Neighbors std_vector > (no description available) +partitionManager geos_PartitionBase (no description available) +Constitutive node :ref:`DATASTRUCTURE_Constitutive` +MeshBodies node :ref:`DATASTRUCTURE_MeshBodies` +================ ================================================================================ ================================= diff --git a/src/coreComponents/schema/docs/edgeManager_other.rst b/src/coreComponents/schema/docs/edgeManager_other.rst index 597da5bf9b8..0d02ec6d8c8 100644 --- a/src/coreComponents/schema/docs/edgeManager_other.rst +++ b/src/coreComponents/schema/docs/edgeManager_other.rst @@ -1,17 +1,17 @@ -======================= ========================================================================================================== ========================================================= -Name Type Description -======================= ========================================================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -faceList geos_InterObjectRelation< LvArray_ArrayOfSets< int, int, LvArray_ChaiBuffer > > (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList geos_InterObjectRelation< LvArray_Array< int, 2, camp_int_seq< long, 0l, 1l >, int, LvArray_ChaiBuffer > > (no description available) -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ========================================================================================================== ========================================================= +======================= ===================================================================================================== ========================================================= +Name Type Description +======================= ===================================================================================================== ========================================================= +domainBoundaryIndicator integer_array (no description available) +faceList geos_InterObjectRelation > (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList geos_InterObjectRelation, int, LvArray_ChaiBuffer> > (no description available) +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ===================================================================================================== ========================================================= diff --git a/src/coreComponents/schema/docs/elementRegionsGroup_other.rst b/src/coreComponents/schema/docs/elementRegionsGroup_other.rst index adf1c1b8aec..4fd505d0214 100644 --- a/src/coreComponents/schema/docs/elementRegionsGroup_other.rst +++ b/src/coreComponents/schema/docs/elementRegionsGroup_other.rst @@ -1,9 +1,11 @@ -==== ==== ============================ -Name Type Description -==== ==== ============================ - (no documentation available) -==== ==== ============================ +==================== ==== ========================================= +Name Type Description +==================== ==== ========================================= +CellElementRegion node :ref:`DATASTRUCTURE_CellElementRegion` +SurfaceElementRegion node :ref:`DATASTRUCTURE_SurfaceElementRegion` +WellElementRegion node :ref:`DATASTRUCTURE_WellElementRegion` +==================== ==== ========================================= diff --git a/src/coreComponents/schema/docs/embeddedSurfacesEdgeManager_other.rst b/src/coreComponents/schema/docs/embeddedSurfacesEdgeManager_other.rst index 597da5bf9b8..0d02ec6d8c8 100644 --- a/src/coreComponents/schema/docs/embeddedSurfacesEdgeManager_other.rst +++ b/src/coreComponents/schema/docs/embeddedSurfacesEdgeManager_other.rst @@ -1,17 +1,17 @@ -======================= ========================================================================================================== ========================================================= -Name Type Description -======================= ========================================================================================================== ========================================================= -domainBoundaryIndicator integer_array (no description available) -faceList geos_InterObjectRelation< LvArray_ArrayOfSets< int, int, LvArray_ChaiBuffer > > (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList geos_InterObjectRelation< LvArray_Array< int, 2, camp_int_seq< long, 0l, 1l >, int, LvArray_ChaiBuffer > > (no description available) -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ========================================================================================================== ========================================================= +======================= ===================================================================================================== ========================================================= +Name Type Description +======================= ===================================================================================================== ========================================================= +domainBoundaryIndicator integer_array (no description available) +faceList geos_InterObjectRelation > (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList geos_InterObjectRelation, int, LvArray_ChaiBuffer> > (no description available) +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ===================================================================================================== ========================================================= diff --git a/src/coreComponents/schema/docs/embeddedSurfacesNodeManager_other.rst b/src/coreComponents/schema/docs/embeddedSurfacesNodeManager_other.rst index 7c14a19c09a..3a3c4f725f8 100644 --- a/src/coreComponents/schema/docs/embeddedSurfacesNodeManager_other.rst +++ b/src/coreComponents/schema/docs/embeddedSurfacesNodeManager_other.rst @@ -1,22 +1,22 @@ -======================= =============================================================================== ============================================= ================================================================ -Name Type Registered By Description -======================= =============================================================================== ============================================= ================================================================ -domainBoundaryIndicator integer_array (no description available) -edgeList geos_InterObjectRelation< LvArray_ArrayOfSets< int, int, LvArray_ChaiBuffer > > (no description available) -elemList LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > (no description available) -elemRegionList LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > (no description available) -elemSubRegionList LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -parentEdgeGlobalIndex globalIndex_array (no description available) -referencePosition real64_array2d (no description available) -parentEdgeIndex integer_array :ref:`DATASTRUCTURE_EmbeddedSurfaceGenerator` Index of parent edge within the mesh object it is registered on. -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= =============================================================================== ============================================= ================================================================ +======================= ============================================================================ ============================================= ================================================================ +Name Type Registered By Description +======================= ============================================================================ ============================================= ================================================================ +domainBoundaryIndicator integer_array (no description available) +edgeList geos_InterObjectRelation > (no description available) +elemList LvArray_ArrayOfArrays (no description available) +elemRegionList LvArray_ArrayOfArrays (no description available) +elemSubRegionList LvArray_ArrayOfArrays (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +parentEdgeGlobalIndex globalIndex_array (no description available) +referencePosition real64_array2d (no description available) +parentEdgeIndex integer_array :ref:`DATASTRUCTURE_EmbeddedSurfaceGenerator` Index of parent edge within the mesh object it is registered on. +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ============================================================================ ============================================= ================================================================ diff --git a/src/coreComponents/schema/docs/faceManager_other.rst b/src/coreComponents/schema/docs/faceManager_other.rst index f821f295cfd..7f1730f0304 100644 --- a/src/coreComponents/schema/docs/faceManager_other.rst +++ b/src/coreComponents/schema/docs/faceManager_other.rst @@ -1,25 +1,25 @@ -======================= ================================================================================= ================================================================================================ ========================================================= -Name Type Registered By Description -======================= ================================================================================= ================================================================================================ ========================================================= -domainBoundaryIndicator integer_array (no description available) -edgeList geos_InterObjectRelation< LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > > (no description available) -elemList integer_array2d (no description available) -elemRegionList integer_array2d (no description available) -elemSubRegionList integer_array2d (no description available) -faceArea real64_array (no description available) -faceCenter real64_array2d (no description available) -faceNormal real64_array2d (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -nodeList geos_InterObjectRelation< LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > > (no description available) -facePressure_n real64_array :ref:`DATASTRUCTURE_CompositionalMultiphaseHybridFVM`, :ref:`DATASTRUCTURE_SinglePhaseHybridFVM` Face pressure at the previous converged time step -mimGravityCoefficient real64_array :ref:`DATASTRUCTURE_CompositionalMultiphaseHybridFVM` Mimetic gravity coefficient -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= ================================================================================= ================================================================================================ ========================================================= +======================= ============================================================================== ================================================================================================ ========================================================= +Name Type Registered By Description +======================= ============================================================================== ================================================================================================ ========================================================= +domainBoundaryIndicator integer_array (no description available) +edgeList geos_InterObjectRelation > (no description available) +elemList integer_array2d (no description available) +elemRegionList integer_array2d (no description available) +elemSubRegionList integer_array2d (no description available) +faceArea real64_array (no description available) +faceCenter real64_array2d (no description available) +faceNormal real64_array2d (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +nodeList geos_InterObjectRelation > (no description available) +facePressure_n real64_array :ref:`DATASTRUCTURE_CompositionalMultiphaseHybridFVM`, :ref:`DATASTRUCTURE_SinglePhaseHybridFVM` Face pressure at the previous converged time step +mimGravityCoefficient real64_array :ref:`DATASTRUCTURE_CompositionalMultiphaseHybridFVM` Mimetic gravity coefficient +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ============================================================================== ================================================================================================ ========================================================= diff --git a/src/coreComponents/schema/docs/nodeManager_other.rst b/src/coreComponents/schema/docs/nodeManager_other.rst index e4fa1245fee..cde3077884e 100644 --- a/src/coreComponents/schema/docs/nodeManager_other.rst +++ b/src/coreComponents/schema/docs/nodeManager_other.rst @@ -1,22 +1,22 @@ -======================= =============================================================================== ========================================================= -Name Type Description -======================= =============================================================================== ========================================================= -ReferencePosition real64_array2d (no description available) -domainBoundaryIndicator integer_array (no description available) -edgeList geos_InterObjectRelation< LvArray_ArrayOfSets< int, int, LvArray_ChaiBuffer > > (no description available) -elemList LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > (no description available) -elemRegionList LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > (no description available) -elemSubRegionList LvArray_ArrayOfArrays< int, int, LvArray_ChaiBuffer > (no description available) -faceList geos_InterObjectRelation< LvArray_ArrayOfSets< int, int, LvArray_ChaiBuffer > > (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -primaryField real64_array Primary field variable -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -======================= =============================================================================== ========================================================= +======================= ============================================================================ ========================================================= +Name Type Description +======================= ============================================================================ ========================================================= +ReferencePosition real64_array2d (no description available) +domainBoundaryIndicator integer_array (no description available) +edgeList geos_InterObjectRelation > (no description available) +elemList LvArray_ArrayOfArrays (no description available) +elemRegionList LvArray_ArrayOfArrays (no description available) +elemSubRegionList LvArray_ArrayOfArrays (no description available) +faceList geos_InterObjectRelation > (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +primaryField real64_array Primary field variable +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +======================= ============================================================================ ========================================================= diff --git a/src/coreComponents/schema/docs/particleRegionsGroup_other.rst b/src/coreComponents/schema/docs/particleRegionsGroup_other.rst index adf1c1b8aec..4a1517c2a56 100644 --- a/src/coreComponents/schema/docs/particleRegionsGroup_other.rst +++ b/src/coreComponents/schema/docs/particleRegionsGroup_other.rst @@ -1,9 +1,9 @@ -==== ==== ============================ -Name Type Description -==== ==== ============================ - (no documentation available) -==== ==== ============================ +============== ==== =================================== +Name Type Description +============== ==== =================================== +ParticleRegion node :ref:`DATASTRUCTURE_ParticleRegion` +============== ==== =================================== diff --git a/src/coreComponents/schema/docs/sets_other.rst b/src/coreComponents/schema/docs/sets_other.rst index 07baf6428bc..59e718c41f8 100644 --- a/src/coreComponents/schema/docs/sets_other.rst +++ b/src/coreComponents/schema/docs/sets_other.rst @@ -1,9 +1,9 @@ -=========== =================================================== ========================== -Name Type Description -=========== =================================================== ========================== -externalSet LvArray_SortedArray< int, int, LvArray_ChaiBuffer > (no description available) -=========== =================================================== ========================== +=========== ================================================= ========================== +Name Type Description +=========== ================================================= ========================== +externalSet LvArray_SortedArray (no description available) +=========== ================================================= ========================== diff --git a/src/coreComponents/schema/docs/wellElementSubRegion_other.rst b/src/coreComponents/schema/docs/wellElementSubRegion_other.rst index 13799ea3e78..6ceeee5546c 100644 --- a/src/coreComponents/schema/docs/wellElementSubRegion_other.rst +++ b/src/coreComponents/schema/docs/wellElementSubRegion_other.rst @@ -1,23 +1,23 @@ -========================= ==================================================================== ====================================================================== -Name Type Description -========================= ==================================================================== ====================================================================== -domainBoundaryIndicator integer_array (no description available) -ghostRank integer_array (no description available) -globalToLocalMap geos_mapBase< long long, int, std_integral_constant< bool, false > > (no description available) -isExternal integer_array (no description available) -localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. -location real64_array2d For each perforation, physical location (x,y,z coordinates) -numPerforationsGlobal globalIndex (no description available) -reservoirElementIndex integer_array For each perforation, element index of the perforated element -reservoirElementRegion integer_array For each perforation, elementRegion index of the perforated element -reservoirElementSubregion integer_array For each perforation, elementSubRegion index of the perforated element -wellElementIndex integer_array For each perforation, index of the well element -wellSkinFactor real64_array For each perforation, well skin factor -wellTransmissibility real64_array For each perforation, well transmissibility -neighborData node :ref:`DATASTRUCTURE_neighborData` -sets node :ref:`DATASTRUCTURE_sets` -========================= ==================================================================== ====================================================================== +========================= ================================================================= ====================================================================== +Name Type Description +========================= ================================================================= ====================================================================== +domainBoundaryIndicator integer_array (no description available) +ghostRank integer_array (no description available) +globalToLocalMap geos_mapBase > (no description available) +isExternal integer_array (no description available) +localToGlobalMap globalIndex_array Array that contains a map from localIndex to globalIndex. +location real64_array2d For each perforation, physical location (x,y,z coordinates) +numPerforationsGlobal globalIndex (no description available) +reservoirElementIndex integer_array For each perforation, element index of the perforated element +reservoirElementRegion integer_array For each perforation, elementRegion index of the perforated element +reservoirElementSubregion integer_array For each perforation, elementSubRegion index of the perforated element +wellElementIndex integer_array For each perforation, index of the well element +wellSkinFactor real64_array For each perforation, well skin factor +wellTransmissibility real64_array For each perforation, well transmissibility +neighborData node :ref:`DATASTRUCTURE_neighborData` +sets node :ref:`DATASTRUCTURE_sets` +========================= ================================================================= ====================================================================== diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index bb9ab1cbbdf..c814c8b81ca 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -1956,7 +1956,8 @@ the relative residual norm satisfies: +* C1PPU +* IHU--> @@ -1965,7 +1966,7 @@ the relative residual norm satisfies: - + @@ -2801,6 +2802,8 @@ Equal to 1 for surface conditions, and to 0 for reservoir conditions--> + + @@ -2812,6 +2815,11 @@ Equal to 1 for surface conditions, and to 0 for reservoir conditions--> + + + + + @@ -3556,10 +3564,10 @@ Local - Add stabilization only to interiors of macro elements.--> - - + + @@ -3582,10 +3590,10 @@ Local - Add stabilization only to interiors of macro elements.--> - - + + @@ -3664,20 +3672,20 @@ Local - Add stabilization only to interiors of macro elements.--> - - + + - - + + @@ -3833,6 +3841,8 @@ Local - Add stabilization only to interiors of macro elements.--> + + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index c81efef7141..1e0a54c1348 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -471,7 +471,7 @@ - + @@ -550,7 +550,7 @@ - + @@ -587,7 +587,7 @@ - + @@ -638,7 +638,7 @@ - + @@ -679,7 +679,7 @@ - + @@ -712,7 +712,7 @@ - + @@ -723,7 +723,7 @@ - + @@ -736,7 +736,7 @@ - + @@ -749,7 +749,7 @@ - + @@ -765,7 +765,7 @@ - + @@ -799,7 +799,7 @@ - + @@ -862,7 +862,7 @@ - + @@ -893,7 +893,7 @@ - + @@ -906,7 +906,7 @@ - + @@ -919,7 +919,7 @@ - + @@ -932,7 +932,7 @@ - + @@ -945,7 +945,7 @@ - + @@ -960,7 +960,7 @@ - + @@ -971,7 +971,7 @@ - + @@ -984,7 +984,7 @@ - + @@ -995,7 +995,7 @@ - + @@ -1006,7 +1006,7 @@ - + @@ -1017,7 +1017,7 @@ - + @@ -1028,7 +1028,7 @@ - + @@ -1041,7 +1041,7 @@ - + @@ -1056,7 +1056,7 @@ - + @@ -1071,7 +1071,7 @@ - + @@ -1086,7 +1086,7 @@ - + @@ -1097,7 +1097,7 @@ - + @@ -1110,7 +1110,7 @@ - + @@ -1123,7 +1123,7 @@ - + @@ -1139,7 +1139,7 @@ - + @@ -1154,7 +1154,7 @@ - + @@ -1171,7 +1171,7 @@ - + @@ -1186,7 +1186,7 @@ - + @@ -1199,7 +1199,7 @@ - + @@ -1238,7 +1238,7 @@ - + @@ -1267,15 +1267,15 @@ - + - + - + - + - + @@ -1339,7 +1339,7 @@ - + @@ -1450,6 +1450,8 @@ + + @@ -1457,7 +1459,7 @@ - + @@ -1473,7 +1475,7 @@ - + @@ -1509,7 +1511,7 @@ - + @@ -1573,7 +1575,7 @@ - + @@ -1619,7 +1621,7 @@ - + @@ -1665,7 +1667,7 @@ - + @@ -1711,7 +1713,7 @@ - + @@ -1785,7 +1787,7 @@ - + @@ -1831,7 +1833,7 @@ - + @@ -1877,7 +1879,7 @@ - + @@ -2037,7 +2039,7 @@ - + @@ -2053,7 +2055,7 @@ - + @@ -2089,7 +2091,7 @@ - + @@ -2266,7 +2268,7 @@ - + @@ -2477,7 +2479,7 @@ - + @@ -2531,7 +2533,7 @@ - + @@ -2605,7 +2607,7 @@ - + @@ -2631,7 +2633,7 @@ - + @@ -2645,7 +2647,7 @@ - + @@ -2653,7 +2655,7 @@ - + @@ -2877,177 +2879,186 @@ - + - - - - - + + + + + + - + + - - - + - - + + + + + + + + + + + + - - - + - - - + + - - - + - - + + + + - + + + - - - - - - - - + + + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + + + + - + + + - - - - - - - - - - - - - + - - - + + + + + + - + @@ -3055,146 +3066,147 @@ - + - - - - - - + + - + + - + + + - + - + + - + - - - - + + - + - - - - - - + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - + + + + + + - - + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - + + + + - + - + + + + + + + + + + + + - + + + - diff --git a/src/coreComponents/schema/schemaUtilities.cpp b/src/coreComponents/schema/schemaUtilities.cpp index 93eb8ce0f7e..4bf19a4541d 100644 --- a/src/coreComponents/schema/schemaUtilities.cpp +++ b/src/coreComponents/schema/schemaUtilities.cpp @@ -76,9 +76,15 @@ string getSchemaTypeName( string_view rtTypeName ) // Note: Some type names involving strings can vary on compiler and be ugly. Convert these to "string" auto constexpr typeMergingRegex = "std_(__cxx11_basic_)?string(<\\s*char,\\s*std_char_traits,\\s*std_allocator\\s*>)?"; - string const xmlSafeName = std::regex_replace( sanitizedName, - std::regex( typeMergingRegex ), - "string" ); + string xmlSafeName = std::regex_replace( sanitizedName, + std::regex( typeMergingRegex ), + "string" ); + + // Replace '<', '>', spaces and ',' because the schema does not like them + xmlSafeName = std::regex_replace( xmlSafeName, std::regex( "<" ), "_lt_" ); + xmlSafeName = std::regex_replace( xmlSafeName, std::regex( ">" ), "_gt_" ); + xmlSafeName = std::regex_replace( xmlSafeName, std::regex( "," ), "_cm_" ); + xmlSafeName = std::regex_replace( xmlSafeName, std::regex( " " ), "-" ); return xmlSafeName; } diff --git a/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt b/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt index e8b27218b8f..5f03cf2eaaa 100644 --- a/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt @@ -1,9 +1,11 @@ # Specify list of tests set( gtest_geosx_tests + testCapillaryPressure.cpp + testCO2BrinePVTModels.cpp + testCO2SpycherPruessModels.cpp testDamage.cpp testRelPerm.cpp - testRelPermHysteresis.cpp - testCapillaryPressure.cpp ) + testRelPermHysteresis.cpp ) set( gtest_triaxial_xmls testTriaxial_druckerPragerExtended.xml @@ -37,8 +39,7 @@ endif() if( ENABLE_PVTPackage ) list( APPEND gtest_geosx_tests - testMultiFluid.cpp - testCO2BrinePVTModels.cpp ) + testMultiFluid.cpp ) list( APPEND dependencyList PVTPackage ) endif() diff --git a/src/coreComponents/unitTests/constitutiveTests/testCO2SpycherPruessModels.cpp b/src/coreComponents/unitTests/constitutiveTests/testCO2SpycherPruessModels.cpp new file mode 100644 index 00000000000..7a248a4007b --- /dev/null +++ b/src/coreComponents/unitTests/constitutiveTests/testCO2SpycherPruessModels.cpp @@ -0,0 +1,374 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 TotalEnergies + * Copyright (c) 2019- GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +// Source includes +#include "codingUtilities/UnitTestUtilities.hpp" +#include "constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.hpp" +#include "constitutive/fluid/multifluid/MultiFluidUtils.hpp" +#include "mainInterface/GeosxState.hpp" +#include "mainInterface/initialization.hpp" +#include "functions/FunctionManager.hpp" + +// TPL includes +#include + +using namespace geos; +using namespace geos::testing; +using namespace geos::stringutilities; +using namespace geos::constitutive; +using namespace geos::constitutive::multifluid; +using namespace geos::constitutive::PVTProps; + +// Test parameter +using TestParam = std::tuple< + real64 const, // Pressure [Pa] + real64 const, // Temperature [C] + real64 const, // Total co2 mole fraction (z_co2 = 1-z_wat) + real64 const, // Expected vapour fraction (V) + real64 const, // Expected dissolved CO2 fraction (x_co2) + real64 const // Expected vapourised water fraction (y_wat) + >; + +class CO2SolubilitySpycherPruessTestFixture : public ::testing::TestWithParam< TestParam > +{ +protected: + static integer constexpr numPhase = 2; + static integer constexpr numComp = 2; + static integer constexpr numDof = numComp + 2; + static real64 constexpr relTol = 1.0e-5; + static real64 constexpr absTol = 1.0e-7; + static real64 constexpr pertubation = 1.0e-6; + static constexpr char const * flashContent = "FlashModel CO2Solubility 1.0e5 1.0e7 9.9e5 283.15 383.15 10.0 0.15 1.0e-8 SpycherPruess"; + +public: + CO2SolubilitySpycherPruessTestFixture() = default; + ~CO2SolubilitySpycherPruessTestFixture() override = default; + +protected: + static std::unique_ptr< CO2Solubility > makeFlashModel( string const & fileContent ); +}; + +std::unique_ptr< CO2Solubility > +CO2SolubilitySpycherPruessTestFixture::makeFlashModel( string const & fileContent ) +{ + // Define phase names + string_array phaseNames; + phaseNames.resize( 2 ); + phaseNames[0] = "gas"; + phaseNames[1] = "liquid"; + + // Define component names and molar weight + string_array componentNames; + componentNames.resize( 2 ); + componentNames[0] = "co2"; + componentNames[1] = "water"; + + array1d< real64 > componentMolarWeight; + componentMolarWeight.resize( 2 ); + componentMolarWeight[0] = 44.0e-3; + componentMolarWeight[1] = 18.0e-3; + + // Read file parameters + array1d< string > const strs = stringutilities::tokenizeBySpaces< array1d >( fileContent ); + + return std::make_unique< CO2Solubility >( strs[1], + strs, + phaseNames, + componentNames, + componentMolarWeight, + false ); +} + +TEST_P( CO2SolubilitySpycherPruessTestFixture, testExpectedValues ) +{ + auto flashModel = makeFlashModel( CO2SolubilitySpycherPruessTestFixture::flashContent ); + + auto [pressure, temperature, z_co2, expected_V, expected_x_co2, expected_y_wat] = GetParam(); + + StackArray< real64, 1, numComp > composition( 2 ); + composition[0] = z_co2; + composition[1] = 1.0 - z_co2; + + StackArray< real64, 3, numPhase, LAYOUT_PHASE > phaseFrac( 1, 1, numPhase ); + StackArray< real64, 4, numDof *numPhase, LAYOUT_PHASE_DC > dPhaseFrac( 1, 1, numPhase, numDof ); + MultiFluidVarSlice< real64, 1, USD_PHASE - 2, USD_PHASE_DC - 2 > + phaseFracAndDeriv { phaseFrac[0][0], dPhaseFrac[0][0] }; + + StackArray< real64, 4, numComp *numPhase, LAYOUT_PHASE_COMP > phaseCompFrac( 1, 1, numPhase, numComp ); + StackArray< real64, 5, numDof *numComp *numPhase, LAYOUT_PHASE_COMP_DC > dPhaseCompFrac( 1, 1, numPhase, numComp, numDof ); + MultiFluidVarSlice< real64, 2, USD_PHASE_COMP - 2, USD_PHASE_COMP_DC - 2 > + phaseCompFracAndDeriv { phaseCompFrac[0][0], dPhaseCompFrac[0][0] }; + + auto flashModelWrapper = flashModel->createKernelWrapper(); + + flashModelWrapper.compute( pressure, + temperature, + composition.toSliceConst(), + phaseFracAndDeriv, + phaseCompFracAndDeriv ); + + real64 const V = phaseFracAndDeriv.value[0]; + real64 const x_co2 = phaseCompFracAndDeriv.value[1][0]; + real64 const y_wat = phaseCompFracAndDeriv.value[0][1]; + + checkRelativeError( V, expected_V, relTol, absTol ); + checkRelativeError( x_co2, expected_x_co2, relTol, absTol ); + checkRelativeError( y_wat, expected_y_wat, relTol, absTol ); +} + +TEST_P( CO2SolubilitySpycherPruessTestFixture, testNumericalDerivatives ) +{ + using Deriv = multifluid::DerivativeOffset; + + auto flashModel = makeFlashModel( CO2SolubilitySpycherPruessTestFixture::flashContent ); + + auto [pressure, temperature, z_co2, expected_V, expected_x_co2, expected_y_wat] = GetParam(); + GEOS_UNUSED_VAR( expected_V, expected_x_co2, expected_y_wat ); + + StackArray< real64, 1, numComp > composition( numComp ); + composition[0] = z_co2; + composition[1] = 1.0 - z_co2; + StackArray< real64, 1, numComp > perturbedComposition( numComp ); + + StackArray< real64, 3, numPhase, LAYOUT_PHASE > phaseFrac( 1, 1, numPhase ); + StackArray< real64, 4, numDof *numPhase, LAYOUT_PHASE_DC > dPhaseFrac( 1, 1, numPhase, numDof ); + MultiFluidVarSlice< real64, 1, USD_PHASE - 2, USD_PHASE_DC - 2 > + phaseFracAndDeriv { phaseFrac[0][0], dPhaseFrac[0][0] }; + + StackArray< real64, 4, numComp *numPhase, LAYOUT_PHASE_COMP > phaseCompFrac( 1, 1, numPhase, numComp ); + StackArray< real64, 5, numDof *numComp *numPhase, LAYOUT_PHASE_COMP_DC > dPhaseCompFrac( 1, 1, numPhase, numComp, numDof ); + MultiFluidVarSlice< real64, 2, USD_PHASE_COMP - 2, USD_PHASE_COMP_DC - 2 > + phaseCompFracAndDeriv { phaseCompFrac[0][0], dPhaseCompFrac[0][0] }; + + // 1) First compute the unperturbed parameters + + auto flashModelWrapper = flashModel->createKernelWrapper(); + + flashModelWrapper.compute( pressure, + temperature, + composition.toSliceConst(), + phaseFracAndDeriv, + phaseCompFracAndDeriv ); + + StackArray< real64, 3, numPhase, LAYOUT_PHASE > perturbedPhaseFrac( 1, 1, numPhase ); + StackArray< real64, 4, numDof *numPhase, LAYOUT_PHASE_DC > dPerturbedPhaseFrac( 1, 1, numPhase, numDof ); + MultiFluidVarSlice< real64, 1, USD_PHASE - 2, USD_PHASE_DC - 2 > + perturbedPhaseFracAndDeriv { perturbedPhaseFrac[0][0], dPerturbedPhaseFrac[0][0] }; + + StackArray< real64, 4, numComp *numPhase, LAYOUT_PHASE_COMP > perturbedPhaseCompFrac( 1, 1, numPhase, numComp ); + StackArray< real64, 5, numDof *numComp *numPhase, LAYOUT_PHASE_COMP_DC > dPerturbedPhaseCompFrac( 1, 1, numPhase, numComp, numDof ); + MultiFluidVarSlice< real64, 2, USD_PHASE_COMP - 2, USD_PHASE_COMP_DC - 2 > + perturbedPhaseCompFracAndDeriv { perturbedPhaseCompFrac[0][0], dPerturbedPhaseCompFrac[0][0] }; + + real64 numericalDerivative = 0.0; + real64 analyticalDerivative = 0.0; + + // 2) Check derivative with respect to pressure + real64 const dP = pertubation * pressure; + flashModelWrapper.compute( pressure + dP, + temperature, + composition.toSliceConst(), + perturbedPhaseFracAndDeriv, + perturbedPhaseCompFracAndDeriv ); + + for( integer i = 0; i < numPhase; ++i ) + { + numericalDerivative = (perturbedPhaseFracAndDeriv.value[i]-phaseFracAndDeriv.value[i])/dP; + analyticalDerivative = perturbedPhaseFracAndDeriv.derivs[i][Deriv::dP]; + checkRelativeError( numericalDerivative, analyticalDerivative, relTol, absTol ); + for( integer j = 0; j < numComp; ++j ) + { + numericalDerivative = (perturbedPhaseCompFracAndDeriv.value[i][j]-phaseCompFracAndDeriv.value[i][j])/dP; + analyticalDerivative = perturbedPhaseCompFracAndDeriv.derivs[i][j][Deriv::dP]; + checkRelativeError( numericalDerivative, analyticalDerivative, relTol, absTol ); + } + } + + // 3) Check derivative with respect to temperature + real64 const dT = pertubation * temperature; + flashModelWrapper.compute( pressure, + temperature + dT, + composition.toSliceConst(), + perturbedPhaseFracAndDeriv, + perturbedPhaseCompFracAndDeriv ); + + for( integer i = 0; i < numPhase; ++i ) + { + numericalDerivative = (perturbedPhaseFracAndDeriv.value[i]-phaseFracAndDeriv.value[i])/dT; + analyticalDerivative = perturbedPhaseFracAndDeriv.derivs[i][Deriv::dT]; + checkRelativeError( numericalDerivative, analyticalDerivative, relTol, absTol ); + + for( integer j = 0; j < numComp; ++j ) + { + numericalDerivative = (perturbedPhaseCompFracAndDeriv.value[i][j]-phaseCompFracAndDeriv.value[i][j])/dT; + analyticalDerivative = perturbedPhaseCompFracAndDeriv.derivs[i][j][Deriv::dT]; + checkRelativeError( numericalDerivative, analyticalDerivative, relTol, absTol ); + } + } + + // 4) Check derivative with respect to composition + for( integer ic=0; ic < numComp; ++ic ) + { + real64 const dC = pertubation; + for( integer k=0; k < numComp; ++k ) + perturbedComposition[k] = composition[k]; + perturbedComposition[ic] += dC; + + flashModelWrapper.compute( pressure, + temperature, + perturbedComposition.toSliceConst(), + perturbedPhaseFracAndDeriv, + perturbedPhaseCompFracAndDeriv ); + + for( integer i = 0; i < numPhase; ++i ) + { + numericalDerivative = (perturbedPhaseFracAndDeriv.value[i]-phaseFracAndDeriv.value[i])/dC; + analyticalDerivative = perturbedPhaseFracAndDeriv.derivs[i][Deriv::dC+ic]; + checkRelativeError( numericalDerivative, analyticalDerivative, relTol, absTol ); + + for( integer j = 0; j < numComp; ++j ) + { + numericalDerivative = (perturbedPhaseCompFracAndDeriv.value[i][j]-phaseCompFracAndDeriv.value[i][j])/dC; + analyticalDerivative = perturbedPhaseCompFracAndDeriv.derivs[i][j][Deriv::dC+ic]; + checkRelativeError( numericalDerivative, analyticalDerivative, relTol, absTol ); + } + } + } +} + +// Test data +std::vector< TestParam > generateTestData() +{ + return { + {1.00000000e+05, 1.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 5.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 8.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 1.10000000e+02, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 5.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 8.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.10000000e+02, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 1.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 5.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 8.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 1.10000000e+02, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 1.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 5.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 8.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 1.10000000e+02, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 1.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 5.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 8.00000000e+01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 1.10000000e+02, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 1.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+05, 5.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+05, 8.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+05, 1.10000000e+02, 1.00000000e-05, 1.00000000e-05, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+06, 5.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+06, 8.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+06, 1.10000000e+02, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {5.00000000e+06, 1.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {5.00000000e+06, 5.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {5.00000000e+06, 8.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {5.00000000e+06, 1.10000000e+02, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+07, 1.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+07, 5.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+07, 8.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+07, 1.10000000e+02, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+08, 1.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+08, 5.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+08, 8.00000000e+01, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+08, 1.10000000e+02, 1.00000000e-05, 0.00000000e+00, 1.00000000e-05, 0.00000000e+00}, + {1.00000000e+05, 1.00000000e+01, 3.00000000e-01, 3.03161030e-01, 8.58355906e-04, 1.23998968e-02}, + {1.00000000e+05, 5.00000000e+01, 3.00000000e-01, 3.42216891e-01, 3.10066097e-04, 1.23958952e-01}, + {1.00000000e+05, 8.00000000e+01, 3.00000000e-01, 5.66944658e-01, 1.24160030e-04, 4.70942662e-01}, + {1.00000000e+05, 1.10000000e+02, 3.00000000e-01, 3.00000000e-01, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.00000000e+01, 3.00000000e-01, 2.94948990e-01, 8.11504677e-03, 2.27331474e-03}, + {1.00000000e+06, 5.00000000e+01, 3.00000000e-01, 3.04861076e-01, 3.32772200e-03, 2.35330303e-02}, + {1.00000000e+06, 8.00000000e+01, 3.00000000e-01, 3.35758987e-01, 2.14620607e-03, 1.10747849e-01}, + {1.00000000e+06, 1.10000000e+02, 3.00000000e-01, 3.40957999e-01, 1.62203194e-03, 1.23261476e-01}, + {5.00000000e+06, 1.00000000e+01, 3.00000000e-01, 2.79742151e-01, 2.89079228e-02, 2.01367187e-03}, + {5.00000000e+06, 5.00000000e+01, 3.00000000e-01, 2.91378214e-01, 1.36880088e-02, 3.69909366e-03}, + {5.00000000e+06, 8.00000000e+01, 3.00000000e-01, 2.97134400e-01, 9.51668603e-03, 1.28674138e-02}, + {5.00000000e+06, 1.10000000e+02, 3.00000000e-01, 3.05337535e-01, 8.04059852e-03, 3.57736478e-02}, + {1.00000000e+07, 1.00000000e+01, 3.00000000e-01, 2.78859111e-01, 3.01769401e-02, 2.22670319e-03}, + {1.00000000e+07, 5.00000000e+01, 3.00000000e-01, 2.86981820e-01, 1.98935606e-02, 4.06398711e-03}, + {1.00000000e+07, 8.00000000e+01, 3.00000000e-01, 2.91881746e-01, 1.54455782e-02, 9.65816584e-03}, + {1.00000000e+07, 1.10000000e+02, 3.00000000e-01, 2.97372350e-01, 1.38649677e-02, 2.39237441e-02}, + {1.00000000e+08, 1.00000000e+01, 3.00000000e-01, 2.78859111e-01, 3.01769401e-02, 2.22670319e-03}, + {1.00000000e+08, 5.00000000e+01, 3.00000000e-01, 2.86981820e-01, 1.98935606e-02, 4.06398711e-03}, + {1.00000000e+08, 8.00000000e+01, 3.00000000e-01, 2.91881746e-01, 1.54455782e-02, 9.65816584e-03}, + {1.00000000e+08, 1.10000000e+02, 3.00000000e-01, 2.97372350e-01, 1.38649677e-02, 2.39237441e-02}, + {1.00000000e+05, 1.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+05, 5.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+05, 8.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+05, 1.10000000e+02, 9.99990000e-01, 9.99990000e-01, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+06, 5.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+06, 8.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+06, 1.10000000e+02, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {5.00000000e+06, 1.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {5.00000000e+06, 5.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {5.00000000e+06, 8.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {5.00000000e+06, 1.10000000e+02, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+07, 1.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+07, 5.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+07, 8.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+07, 1.10000000e+02, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+08, 1.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+08, 5.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+08, 8.00000000e+01, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+08, 1.10000000e+02, 9.99990000e-01, 1.00000000e+00, 0.00000000e+00, 1.00000000e-05}, + {1.00000000e+05, 1.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 5.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 8.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+05, 1.10000000e+02, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 5.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 8.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+06, 1.10000000e+02, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 1.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 5.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 8.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {5.00000000e+06, 1.10000000e+02, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 1.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 5.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 8.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+07, 1.10000000e+02, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 1.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 5.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 8.00000000e+01, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00}, + {1.00000000e+08, 1.10000000e+02, 1.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00} + }; +} + +INSTANTIATE_TEST_SUITE_P( + CO2SolubilitySpycherPruessTest, + CO2SolubilitySpycherPruessTestFixture, + ::testing::ValuesIn( generateTestData() ) + ); + +int main( int argc, char * * argv ) +{ + ::testing::InitGoogleTest( &argc, argv ); + + geos::GeosxState state( geos::basicSetup( argc, argv ) ); + + int const result = RUN_ALL_TESTS(); + + geos::basicCleanup(); + + return result; +} diff --git a/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine.xml b/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine.xml index 7363117393c..12ec4e62d8d 100644 --- a/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine.xml +++ b/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine.xml @@ -46,6 +46,28 @@ outputPhaseComposition="1" baseline="testPVT_CO2Brine_testCo2BrineEzrokhiMixtureB.txt" logLevel="1" /> + + + + @@ -79,6 +107,13 @@ componentMolarWeight="{ 44e-3, 18e-3 }" phasePVTParaFiles="{ testPVT_data/carbonDioxidePVT.txt, testPVT_data/brinePVTEzrokhi.txt }" flashModelParaFile="testPVT_data/carbonDioxideFlash.txt" /> + diff --git a/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine_testCo2SpycherPruessBrinePhillipsMixtureA.txt b/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine_testCo2SpycherPruessBrinePhillipsMixtureA.txt new file mode 100644 index 00000000000..0a33d6dc22e --- /dev/null +++ b/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine_testCo2SpycherPruessBrinePhillipsMixtureA.txt @@ -0,0 +1,31 @@ +# column 1 = time +# column 2 = pressure +# column 3 = temperature +# column 4 = density +# column 5 = total compressibility +# columns 6-7 = phase fractions +# columns 8-9 = phase densities +# columns 10-11 = phase viscosities +# columns 12-13 = gas phase fractions [co2, water] +# columns 14-15 = water phase fractions [co2, water] +0.0000e+00 1.0000e+06 3.5000e+02 6.7780e+01 2.1337e-08 2.1773e-01 7.8227e-01 1.5581e+01 1.0033e+03 1.7476e-05 4.1330e-04 9.5589e-01 4.4112e-02 2.2320e-03 9.9777e-01 +5.0000e-02 6.4444e+06 3.5000e+02 4.2328e+02 1.3988e-07 1.9253e-01 8.0747e-01 1.2309e+02 1.0114e+03 1.8998e-05 4.1330e-04 9.8984e-01 1.0158e-02 1.1731e-02 9.8827e-01 +1.0000e-01 1.1889e+07 3.5000e+02 7.1407e+02 6.1644e-08 1.8180e-01 8.1820e-01 3.0497e+02 1.0173e+03 2.5353e-05 4.1330e-04 9.9079e-01 9.2115e-03 1.7035e-02 9.8297e-01 +1.5000e-01 1.7333e+07 3.5000e+02 8.8262e+02 1.8484e-08 1.7661e-01 8.2339e-01 5.3970e+02 1.0219e+03 4.0932e-05 4.1330e-04 9.8874e-01 1.1255e-02 1.9789e-02 9.8021e-01 +2.0000e-01 2.2778e+07 3.5000e+02 9.3903e+02 7.0636e-09 1.7314e-01 8.2686e-01 6.6850e+02 1.0260e+03 5.3806e-05 4.1330e-04 9.8725e-01 1.2749e-02 2.1623e-02 9.7838e-01 +2.5000e-01 2.8222e+07 3.5000e+02 9.6553e+02 3.7969e-09 1.7065e-01 8.2935e-01 7.4098e+02 1.0297e+03 6.3051e-05 4.1330e-04 9.8650e-01 1.3500e-02 2.2909e-02 9.7709e-01 +3.0000e-01 3.3667e+07 3.5000e+02 9.8236e+02 2.6667e-09 1.6883e-01 8.3117e-01 7.9054e+02 1.0333e+03 7.0528e-05 4.1330e-04 9.8604e-01 1.3961e-02 2.3841e-02 9.7616e-01 +3.5000e-01 3.9111e+07 3.5000e+02 9.9478e+02 2.0090e-09 1.6746e-01 8.3254e-01 8.2831e+02 1.0367e+03 7.7028e-05 4.1330e-04 9.8571e-01 1.4290e-02 2.4538e-02 9.7546e-01 +4.0000e-01 4.4556e+07 3.5000e+02 1.0047e+03 1.6650e-09 1.6641e-01 8.3359e-01 8.5890e+02 1.0400e+03 8.2914e-05 4.1330e-04 9.8545e-01 1.4547e-02 2.5069e-02 9.7493e-01 +4.5000e-01 5.0000e+07 3.5000e+02 1.0131e+03 5.1360e-11 1.6561e-01 8.3439e-01 8.8476e+02 1.0432e+03 8.8389e-05 4.1330e-04 9.8524e-01 1.4761e-02 2.5477e-02 9.7452e-01 +5.0000e-01 3.0000e+07 3.0400e+02 9.8816e+02 2.6607e-09 1.6844e-01 8.3156e-01 8.0121e+02 1.0372e+03 7.1971e-05 8.6631e-04 9.8918e-01 1.0819e-02 2.3786e-02 9.7621e-01 +5.5000e-01 1.0000e+07 2.5800e+02 6.6430e+02 8.2527e-08 1.8156e-01 8.1844e-01 2.5862e+02 1.0189e+03 2.2796e-05 1.9511e-03 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +6.0000e-01 1.0000e+07 2.7156e+02 6.6481e+02 8.2643e-08 1.8156e-01 8.1844e-01 2.5862e+02 1.0203e+03 2.2796e-05 1.9588e-03 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +6.5000e-01 1.0000e+07 2.8511e+02 6.6522e+02 8.2733e-08 1.8156e-01 8.1844e-01 2.5862e+02 1.0215e+03 2.2796e-05 1.3681e-03 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +7.0000e-01 1.0000e+07 2.9867e+02 6.6551e+02 8.2800e-08 1.8156e-01 8.1844e-01 2.5862e+02 1.0223e+03 2.2796e-05 9.7022e-04 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +7.5000e-01 1.0000e+07 3.1222e+02 6.6570e+02 8.2842e-08 1.8156e-01 8.1844e-01 2.5862e+02 1.0229e+03 2.2796e-05 7.3691e-04 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +8.0000e-01 1.0000e+07 3.2578e+02 6.6579e+02 8.2862e-08 1.8156e-01 8.1844e-01 2.5862e+02 1.0231e+03 2.2796e-05 5.8345e-04 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +8.5000e-01 1.0000e+07 3.3933e+02 6.6563e+02 8.2888e-08 1.8167e-01 8.1833e-01 2.5862e+02 1.0231e+03 2.2796e-05 4.7645e-04 9.9353e-01 6.4726e-03 1.6875e-02 9.8313e-01 +9.0000e-01 1.0000e+07 3.5289e+02 6.1186e+02 7.9623e-08 1.8498e-01 8.1502e-01 2.2287e+02 1.0133e+03 2.2020e-05 3.9764e-04 9.9066e-01 9.3377e-03 1.5456e-02 9.8454e-01 +9.5000e-01 1.0000e+07 3.6644e+02 5.8928e+02 7.7989e-08 1.8498e-01 8.1502e-01 2.0825e+02 1.0078e+03 2.1800e-05 3.4093e-04 9.9066e-01 9.3377e-03 1.5456e-02 9.8454e-01 +1.0000e+00 1.0000e+07 3.8000e+02 5.8907e+02 7.7935e-08 1.8498e-01 8.1502e-01 2.0825e+02 1.0070e+03 2.1860e-05 2.9672e-04 9.9066e-01 9.3377e-03 1.5456e-02 9.8454e-01 diff --git a/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine_testCo2SpycherPruessBrinePhillipsMixtureB.txt b/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine_testCo2SpycherPruessBrinePhillipsMixtureB.txt new file mode 100644 index 00000000000..762ffae5a75 --- /dev/null +++ b/src/coreComponents/unitTests/constitutiveTests/testPVT_CO2Brine_testCo2SpycherPruessBrinePhillipsMixtureB.txt @@ -0,0 +1,31 @@ +# column 1 = time +# column 2 = pressure +# column 3 = temperature +# column 4 = density +# column 5 = total compressibility +# columns 6-7 = phase fractions +# columns 8-9 = phase densities +# columns 10-11 = phase viscosities +# columns 12-13 = gas phase fractions [co2, water] +# columns 14-15 = water phase fractions [co2, water] +0.0000e+00 1.0000e+06 3.5000e+02 2.9256e+01 8.7493e-09 5.2521e-01 4.7479e-01 1.5581e+01 1.0033e+03 1.7476e-05 4.1330e-04 9.5589e-01 4.4112e-02 2.2320e-03 9.9777e-01 +5.0000e-02 6.4444e+06 3.5000e+02 2.1910e+02 1.8135e-07 5.0111e-01 4.9889e-01 1.2309e+02 1.0114e+03 1.8998e-05 4.1330e-04 9.8984e-01 1.0158e-02 1.1731e-02 9.8827e-01 +1.0000e-01 1.1889e+07 3.5000e+02 4.7218e+02 1.0761e-07 4.9425e-01 5.0575e-01 3.0497e+02 1.0173e+03 2.5353e-05 4.1330e-04 9.9079e-01 9.2115e-03 1.7035e-02 9.8297e-01 +1.5000e-01 1.7333e+07 3.5000e+02 7.1004e+02 3.9438e-08 4.9158e-01 5.0842e-01 5.3970e+02 1.0219e+03 4.0932e-05 4.1330e-04 9.8874e-01 1.1255e-02 1.9789e-02 9.8021e-01 +2.0000e-01 2.2778e+07 3.5000e+02 8.1301e+02 1.5784e-08 4.8984e-01 5.1016e-01 6.6850e+02 1.0260e+03 5.3806e-05 4.1330e-04 9.8725e-01 1.2749e-02 2.1623e-02 9.7838e-01 +2.5000e-01 2.8222e+07 3.5000e+02 8.6506e+02 8.4258e-09 4.8850e-01 5.1150e-01 7.4098e+02 1.0297e+03 6.3051e-05 4.1330e-04 9.8650e-01 1.3500e-02 2.2909e-02 9.7709e-01 +3.0000e-01 3.3667e+07 3.5000e+02 8.9875e+02 5.8443e-09 4.8750e-01 5.1250e-01 7.9054e+02 1.0333e+03 7.0528e-05 4.1330e-04 9.8604e-01 1.3961e-02 2.3841e-02 9.7616e-01 +3.5000e-01 3.9111e+07 3.5000e+02 9.2359e+02 4.2911e-09 4.8675e-01 5.1325e-01 8.2831e+02 1.0367e+03 7.7028e-05 4.1330e-04 9.8571e-01 1.4290e-02 2.4538e-02 9.7546e-01 +4.0000e-01 4.4556e+07 3.5000e+02 9.4329e+02 3.4823e-09 4.8618e-01 5.1382e-01 8.5890e+02 1.0400e+03 8.2914e-05 4.1330e-04 9.8545e-01 1.4547e-02 2.5069e-02 9.7493e-01 +4.5000e-01 5.0000e+07 3.5000e+02 9.5970e+02 2.8240e-11 4.8574e-01 5.1426e-01 8.8476e+02 1.0432e+03 8.8389e-05 4.1330e-04 9.8524e-01 1.4761e-02 2.5477e-02 9.7452e-01 +5.0000e-01 3.0000e+07 3.0400e+02 9.0721e+02 5.8529e-09 4.8643e-01 5.1357e-01 8.0121e+02 1.0372e+03 7.1971e-05 8.6631e-04 9.8918e-01 1.0819e-02 2.3786e-02 9.7621e-01 +5.5000e-01 1.0000e+07 2.5800e+02 4.1580e+02 1.3435e-07 4.9338e-01 5.0662e-01 2.5862e+02 1.0189e+03 2.2796e-05 1.9511e-03 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +6.0000e-01 1.0000e+07 2.7156e+02 4.1592e+02 1.3441e-07 4.9338e-01 5.0662e-01 2.5862e+02 1.0203e+03 2.2796e-05 1.9588e-03 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +6.5000e-01 1.0000e+07 2.8511e+02 4.1602e+02 1.3446e-07 4.9338e-01 5.0662e-01 2.5862e+02 1.0215e+03 2.2796e-05 1.3681e-03 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +7.0000e-01 1.0000e+07 2.9867e+02 4.1609e+02 1.3449e-07 4.9338e-01 5.0662e-01 2.5862e+02 1.0223e+03 2.2796e-05 9.7022e-04 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +7.5000e-01 1.0000e+07 3.1222e+02 4.1614e+02 1.3452e-07 4.9338e-01 5.0662e-01 2.5862e+02 1.0229e+03 2.2796e-05 7.3691e-04 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +8.0000e-01 1.0000e+07 3.2578e+02 4.1616e+02 1.3453e-07 4.9338e-01 5.0662e-01 2.5862e+02 1.0231e+03 2.2796e-05 5.8345e-04 9.9359e-01 6.4066e-03 1.6921e-02 9.8308e-01 +8.5000e-01 1.0000e+07 3.3933e+02 4.1611e+02 1.3454e-07 4.9346e-01 5.0654e-01 2.5862e+02 1.0231e+03 2.2796e-05 4.7645e-04 9.9353e-01 6.4726e-03 1.6875e-02 9.8313e-01 +9.0000e-01 1.0000e+07 3.5289e+02 3.6713e+02 1.2176e-07 4.9624e-01 5.0376e-01 2.2287e+02 1.0133e+03 2.2020e-05 3.9764e-04 9.9066e-01 9.3377e-03 1.5456e-02 9.8454e-01 +9.5000e-01 1.0000e+07 3.6644e+02 3.4688e+02 1.1663e-07 4.9624e-01 5.0376e-01 2.0825e+02 1.0078e+03 2.1800e-05 3.4093e-04 9.9066e-01 9.3377e-03 1.5456e-02 9.8454e-01 +1.0000e+00 1.0000e+07 3.8000e+02 3.4684e+02 1.1661e-07 4.9624e-01 5.0376e-01 2.0825e+02 1.0070e+03 2.1860e-05 2.9672e-04 9.9066e-01 9.3377e-03 1.5456e-02 9.8454e-01 diff --git a/src/coreComponents/unitTests/constitutiveTests/testPVT_data/carbonDioxideSpycherPruessFlash.txt b/src/coreComponents/unitTests/constitutiveTests/testPVT_data/carbonDioxideSpycherPruessFlash.txt new file mode 100644 index 00000000000..98f2cb18927 --- /dev/null +++ b/src/coreComponents/unitTests/constitutiveTests/testPVT_data/carbonDioxideSpycherPruessFlash.txt @@ -0,0 +1 @@ +FlashModel CO2Solubility 0.99e6 5.01e7 4.911e6 339 351 1 0 1.0e-10 SpycherPruess diff --git a/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt b/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt index 597d97dff87..7abc6ca2de1 100644 --- a/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt @@ -1,8 +1,10 @@ # Specify list of tests -set( gtest_geosx_tests - testSinglePhaseBaseKernels.cpp - testThermalCompMultiphaseFlow.cpp - testThermalSinglePhaseFlow.cpp ) + +set(gtest_geosx_tests + testSinglePhaseBaseKernels.cpp + testThermalCompMultiphaseFlow.cpp + testThermalSinglePhaseFlow.cpp + ) set( dependencyList ${parallelDeps} gtest ) diff --git a/src/coreComponents/unitTests/meshTests/testMeshGeneration.cpp b/src/coreComponents/unitTests/meshTests/testMeshGeneration.cpp index ab91b136ee2..e2891e9eb96 100644 --- a/src/coreComponents/unitTests/meshTests/testMeshGeneration.cpp +++ b/src/coreComponents/unitTests/meshTests/testMeshGeneration.cpp @@ -43,11 +43,14 @@ constexpr double dx = maxCoordInX / numElemsInX; constexpr double dy = maxCoordInY / numElemsInY; constexpr double dz = maxCoordInZ / numElemsInZ; -constexpr localIndex node_dI = numNodesInY * numNodesInZ; -constexpr localIndex node_dJ = numNodesInZ; +constexpr localIndex node_dJ = numNodesInX; +constexpr localIndex node_dK = numNodesInX * numNodesInY; -constexpr localIndex elem_dI = numElemsInY * numElemsInZ; -constexpr localIndex elem_dJ = numElemsInZ; +constexpr localIndex elem_dJ = numElemsInX; +constexpr localIndex elem_dK = numElemsInX * numElemsInY; + +constexpr localIndex minOrder = 1; +constexpr localIndex maxOrder = 5; class MeshGenerationTest : public ::testing::Test { @@ -148,11 +151,11 @@ TEST_F( MeshGenerationTest, nodePositions ) arrayView2d< real64 const, nodes::REFERENCE_POSITION_USD > const & X = m_nodeManager->referencePosition(); localIndex nodeIndex = 0; - for( localIndex i = 0; i < numNodesInX; ++i ) + for( localIndex k = 0; k < numNodesInZ; ++k ) { for( localIndex j = 0; j < numNodesInY; ++j ) { - for( localIndex k = 0; k < numNodesInZ; ++k ) + for( localIndex i = 0; i < numNodesInX; ++i ) { EXPECT_DOUBLE_EQ( X( nodeIndex, 0 ), i * dx ); EXPECT_DOUBLE_EQ( X( nodeIndex, 1 ), j * dy ); @@ -171,11 +174,11 @@ TEST_F( MeshGenerationTest, elementCentersAndVolumes ) constexpr double VOLUME = dx * dy * dz; localIndex elemID = 0; - for( localIndex i = 0; i < numElemsInX; ++i ) + for( localIndex k = 0; k < numElemsInZ; ++k ) { for( localIndex j = 0; j < numElemsInY; ++j ) { - for( localIndex k = 0; k < numElemsInZ; ++k ) + for( localIndex i = 0; i < numElemsInX; ++i ) { EXPECT_DOUBLE_EQ( centers[ elemID ][ 0 ], i * dx + dx / 2.0 ); EXPECT_DOUBLE_EQ( centers[ elemID ][ 1 ], j * dy + dy / 2.0 ); @@ -193,23 +196,23 @@ TEST_F( MeshGenerationTest, elemToNodeMap ) GEOS_ERROR_IF_NE( nodeMap.size( 1 ), 8 ); localIndex elemID = 0; - for( localIndex i = 0; i < numElemsInX; ++i ) + for( localIndex k = 0; k < numElemsInZ; ++k ) { for( localIndex j = 0; j < numElemsInY; ++j ) { - for( localIndex k = 0; k < numElemsInZ; ++k ) + for( localIndex i = 0; i < numElemsInX; ++i ) { - localIndex const firstNodeID = i * node_dI + j * node_dJ + k; + localIndex const firstNodeID = i + j * node_dJ + k * node_dK; EXPECT_EQ( firstNodeID, nodeMap( elemID, 0 ) ); - EXPECT_EQ( firstNodeID + node_dI, nodeMap( elemID, 1 ) ); - EXPECT_EQ( firstNodeID + node_dI + node_dJ, nodeMap( elemID, 3 ) ); + EXPECT_EQ( firstNodeID + 1, nodeMap( elemID, 1 ) ); + EXPECT_EQ( firstNodeID + 1 + node_dJ, nodeMap( elemID, 3 ) ); EXPECT_EQ( firstNodeID + node_dJ, nodeMap( elemID, 2 ) ); - EXPECT_EQ( firstNodeID + 1, nodeMap( elemID, 4 ) ); - EXPECT_EQ( firstNodeID + 1 + node_dI, nodeMap( elemID, 5 ) ); - EXPECT_EQ( firstNodeID + 1 + node_dI + node_dJ, nodeMap( elemID, 7 ) ); - EXPECT_EQ( firstNodeID + 1 + node_dJ, nodeMap( elemID, 6 ) ); + EXPECT_EQ( firstNodeID + node_dK, nodeMap( elemID, 4 ) ); + EXPECT_EQ( firstNodeID + node_dK + 1, nodeMap( elemID, 5 ) ); + EXPECT_EQ( firstNodeID + node_dK + 1 + node_dJ, nodeMap( elemID, 7 ) ); + EXPECT_EQ( firstNodeID + node_dK + node_dJ, nodeMap( elemID, 6 ) ); ++elemID; } } @@ -221,13 +224,13 @@ TEST_F( MeshGenerationTest, nodeToElemMap ) ArrayOfArraysView< localIndex const > const & nodeToElemMap = m_nodeManager->elementList().toViewConst(); localIndex nodeIndex = 0; - for( localIndex i = 0; i < numNodesInX; ++i ) + for( localIndex k = 0; k < numNodesInZ; ++k ) { for( localIndex j = 0; j < numNodesInY; ++j ) { - for( localIndex k = 0; k < numNodesInZ; ++k ) + for( localIndex i = 0; i < numNodesInX; ++i ) { - localIndex const elemID = i * elem_dI + j * elem_dJ + k; + localIndex const elemID = i + j * elem_dJ + k * elem_dK; std::vector< localIndex > expectedElems; if( k < numElemsInZ ) @@ -235,9 +238,9 @@ TEST_F( MeshGenerationTest, nodeToElemMap ) if( i < numElemsInX && j < numElemsInY ) expectedElems.push_back( elemID ); if( i > 0 && j < numElemsInY ) - expectedElems.push_back( elemID - elem_dI ); + expectedElems.push_back( elemID - 1 ); if( i > 0 && j > 0 ) - expectedElems.push_back( elemID - elem_dI - elem_dJ ); + expectedElems.push_back( elemID - 1 - elem_dJ ); if( i < numElemsInX && j > 0 ) expectedElems.push_back( elemID - elem_dJ ); } @@ -245,13 +248,13 @@ TEST_F( MeshGenerationTest, nodeToElemMap ) if( k > 0 ) { if( i < numElemsInX && j < numElemsInY ) - expectedElems.push_back( elemID - 1 ); + expectedElems.push_back( elemID - elem_dK ); if( i > 0 && j < numElemsInY ) - expectedElems.push_back( elemID - elem_dI - 1 ); + expectedElems.push_back( elemID - elem_dK - 1 ); if( i > 0 && j > 0 ) - expectedElems.push_back( elemID - elem_dI - elem_dJ - 1 ); + expectedElems.push_back( elemID - 1 - elem_dJ - elem_dK ); if( i < numElemsInX && j > 0 ) - expectedElems.push_back( elemID - elem_dJ - 1 ); + expectedElems.push_back( elemID - elem_dJ - elem_dK ); } localIndex const numElems = expectedElems.size(); @@ -287,11 +290,11 @@ TEST_F( MeshGenerationTest, faceNodeMaps ) array1d< localIndex > faceNodesFromFace( 4 ); localIndex elemID = 0; - for( localIndex i = 0; i < numElemsInX; ++i ) + for( localIndex k = 0; k < numElemsInZ; ++k ) { for( localIndex j = 0; j < numElemsInY; ++j ) { - for( localIndex k = 0; k < numElemsInZ; ++k ) + for( localIndex i = 0; i < numElemsInX; ++i ) { for( localIndex f = 0; f < 6; ++f ) { @@ -337,14 +340,14 @@ TEST_F( MeshGenerationTest, faceElementMaps ) GEOS_ERROR_IF_NE( elementToFaceMap.size( 1 ), 6 ); - localIndex const elemIDOffset[6] = { -elem_dJ, -1, -elem_dI, elem_dI, elem_dJ, 1 }; + localIndex const elemIDOffset[6] = { -elem_dJ, -elem_dK, -1, 1, elem_dJ, elem_dK }; localIndex elemID = 0; - for( localIndex i = 0; i < numElemsInX; ++i ) + for( localIndex k = 0; k < numElemsInZ; ++k ) { for( localIndex j = 0; j < numElemsInY; ++j ) { - for( localIndex k = 0; k < numElemsInZ; ++k ) + for( localIndex i = 0; i < numElemsInX; ++i ) { for( localIndex f = 0; f < 6; ++f ) { @@ -418,21 +421,21 @@ TEST_F( MeshGenerationTest, edgeNodeMaps ) GEOS_ERROR_IF_NE( edgeToNodeMap.size( 1 ), 2 ); localIndex nodeIndex = 0; - for( localIndex i = 0; i < numNodesInX; ++i ) + for( localIndex k = 0; k < numNodesInZ; ++k ) { for( localIndex j = 0; j < numNodesInY; ++j ) { - for( localIndex k = 0; k < numNodesInZ; ++k ) + for( localIndex i = 0; i < numNodesInX; ++i ) { localIndex numEdges = 0; if( i != 0 ) { - EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex - node_dI, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); + EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex - 1, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); ++numEdges; } if( i != numNodesInX - 1 ) { - EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex + node_dI, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); + EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex + 1, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); ++numEdges; } if( j != 0 ) @@ -447,12 +450,12 @@ TEST_F( MeshGenerationTest, edgeNodeMaps ) } if( k != 0 ) { - EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex - 1, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); + EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex - node_dK, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); ++numEdges; } if( k != numNodesInZ - 1 ) { - EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex + 1, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); + EXPECT_TRUE( walkEdgesToFindNeighbor( nodeIndex, nodeIndex + node_dK, nodeToEdgeMap[ nodeIndex ], edgeToNodeMap ) ); ++numEdges; } @@ -474,11 +477,11 @@ TEST_F( MeshGenerationTest, edgeFaceMaps ) GEOS_ERROR_IF_NE( elementToFaceMap.size( 1 ), 6 ); localIndex elemID = 0; - for( localIndex i = 0; i < numElemsInX; ++i ) + for( localIndex k = 0; k < numElemsInZ; ++k ) { for( localIndex j = 0; j < numElemsInY; ++j ) { - for( localIndex k = 0; k < numElemsInZ; ++k ) + for( localIndex i = 0; i < numElemsInX; ++i ) { for( localIndex f = 0; f < 6; ++f ) { @@ -514,6 +517,54 @@ TEST_F( MeshGenerationTest, edgeFaceMaps ) } } +TEST_F( MeshGenerationTest, highOrderMapsSizes ) +{ + ProblemManager & problemManager = getGlobalState().getProblemManager(); + DomainPartition & domain = problemManager.getDomainPartition(); + MeshBody & meshBody = domain.getMeshBody( 0 ); + MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys.meshManager ); + meshManager.generateMeshes( domain ); + for( int order = minOrder; order < maxOrder; order++ ) + { + MeshLevel & meshLevel = meshBody.createMeshLevel( MeshBody::groupStructKeys::baseDiscretizationString(), GEOS_FMT( "TestLevel{}", order ), order ); + ElementRegionManager & elemManager = meshLevel.getElemManager(); + NodeManager & nodeManager = meshLevel.getNodeManager(); + FaceManager & faceManager = meshLevel.getFaceManager(); + EdgeManager & edgeManager = meshLevel.getEdgeManager(); + CellBlockManagerABC const & cellBlockManager = meshBody.getCellBlockManager(); + nodeManager.setGeometricalRelations( cellBlockManager, elemManager, false ); + edgeManager.setGeometricalRelations( cellBlockManager, false ); + faceManager.setGeometricalRelations( cellBlockManager, elemManager, nodeManager, false ); + + ASSERT_EQ( elemManager.numRegions(), 1 ); + + ElementRegionBase & elemRegion = elemManager.getRegion( 0 ); + ASSERT_EQ( elemRegion.numSubRegions(), 1 ); + + CellElementSubRegion & subRegion = elemRegion.getSubRegion< CellElementSubRegion >( 0 ); + + EXPECT_EQ( subRegion.numNodesPerElement(), pow( order + 1, 3 ) ); + + localIndex const numVertices = numNodesInX * numNodesInY * numNodesInZ; + localIndex const numEdges = numNodesInX * numNodesInY * numElemsInZ + numNodesInX * numElemsInY * numNodesInZ + numElemsInX * numNodesInY *numNodesInZ; + localIndex const numFaces = numNodesInX * numElemsInY * numElemsInZ + numElemsInX * numElemsInY * numNodesInZ + numElemsInX * numNodesInY *numElemsInZ; + localIndex const numElems = numElemsInX * numElemsInY * numElemsInZ; + localIndex const numNodes = numVertices + numEdges * (order-1) + numFaces * pow((order-1), 2 ) + numElems * pow((order-1), 3 ); + + EXPECT_EQ( numNodes, nodeManager.size() ); + + arrayView2d< localIndex const, cells::NODE_MAP_USD > const & nodeMap = subRegion.nodeList(); + EXPECT_EQ( nodeMap.size( 1 ), pow( order+1, 3 ) ); + arrayView2d< localIndex const > const & edgeToNodeMap = edgeManager.nodeList(); + EXPECT_EQ( edgeToNodeMap.size( 1 ), order+1 ); + ArrayOfArraysView< localIndex const > const & faceToNodeMap = faceManager.nodeList().toViewConst(); + for( localIndex f = 0; f < faceManager.size(); ++f ) + { + EXPECT_EQ( faceToNodeMap.sizeOfArray( f ), pow( order+1, 2 ) ); + } + } +} + int main( int argc, char * * argv ) { ::testing::InitGoogleTest( &argc, argv ); diff --git a/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt b/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt index a555936aeaf..18d6ecf1757 100644 --- a/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt @@ -1,6 +1,7 @@ # Specify list of tests set( gtest_geosx_tests testWavePropagation.cpp + testWavePropagationQ2.cpp testWavePropagationElasticFirstOrder.cpp testWavePropagationDAS.cpp testWavePropagationAcousticFirstOrder.cpp ) diff --git a/src/coreComponents/unitTests/wavePropagationTests/testWavePropagationQ2.cpp b/src/coreComponents/unitTests/wavePropagationTests/testWavePropagationQ2.cpp new file mode 100644 index 00000000000..576be10cd46 --- /dev/null +++ b/src/coreComponents/unitTests/wavePropagationTests/testWavePropagationQ2.cpp @@ -0,0 +1,242 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 Total, S.A + * Copyright (c) 2020- GEOSX Contributors + * All right reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +// using some utility classes from the following unit test +#include "unitTests/fluidFlowTests/testCompFlowUtils.hpp" + +#include "common/DataTypes.hpp" +#include "mainInterface/initialization.hpp" +#include "mainInterface/ProblemManager.hpp" +#include "mesh/DomainPartition.hpp" +#include "mainInterface/GeosxState.hpp" +#include "physicsSolvers/PhysicsSolverManager.hpp" +#include "physicsSolvers/wavePropagation/WaveSolverBase.hpp" +#include "physicsSolvers/wavePropagation/AcousticWaveEquationSEM.hpp" + +#include + +using namespace geos; +using namespace geos::dataRepository; +using namespace geos::testing; + +CommandLineOptions g_commandLineOptions; + +// This unit test checks the interpolation done to extract seismic traces from a wavefield. +// It computes a seismogram at a receiver co-located with the source and compares it to the surrounding receivers. +char const * xmlInput = + R"xml( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + )xml"; + +class AcousticWaveEquationSEMTest : public ::testing::Test +{ +public: + + AcousticWaveEquationSEMTest(): + state( std::make_unique< CommandLineOptions >( g_commandLineOptions ) ) + {} + +protected: + + void SetUp() override + { + setupProblemFromXML( state.getProblemManager(), xmlInput ); + } + + static real64 constexpr time = 0.0; + static real64 constexpr dt = 5e-4; + static real64 constexpr eps = std::numeric_limits< real64 >::epsilon(); + + GeosxState state; + AcousticWaveEquationSEM * propagator; +}; + +real64 constexpr AcousticWaveEquationSEMTest::time; +real64 constexpr AcousticWaveEquationSEMTest::dt; +real64 constexpr AcousticWaveEquationSEMTest::eps; + +TEST_F( AcousticWaveEquationSEMTest, SeismoTrace ) +{ + + DomainPartition & domain = state.getProblemManager().getDomainPartition(); + propagator = &state.getProblemManager().getPhysicsSolverManager().getGroup< AcousticWaveEquationSEM >( "acousticSolver" ); + real64 time_n = time; + // run for 1s (10 steps) + for( int i=0; i<10; i++ ) + { + propagator->explicitStepForward( time_n, dt, i, domain, false ); + time_n += dt; + } + // cleanup (triggers calculation of the remaining seismograms data points) + propagator->cleanup( 1.0, 10, 0, 0, domain ); + + // retrieve seismo + arrayView2d< real32 > const pReceivers = propagator->getReference< array2d< real32 > >( AcousticWaveEquationSEM::viewKeyStruct::pressureNp1AtReceiversString() ).toView(); + + // move it to CPU, if needed + pReceivers.move( hostMemorySpace, false ); + + // check number of seismos and trace length + ASSERT_EQ( pReceivers.size( 1 ), 10 ); + ASSERT_EQ( pReceivers.size( 0 ), 11 ); + + // check seismo content. The pressure values cannot be directly checked as the problem is too small. + // Since the basis is linear, check that the seismograms are nonzero (for t>0) and the seismogram at the center is equal + // to the average of the others. + for( int i = 0; i < 11; i++ ) + { + if( i > 0 ) + { + ASSERT_TRUE( std::abs( pReceivers[i][8] ) > 0 ); + } + double avg = 0; + for( int r=0; r<8; r++ ) + { + avg += pReceivers[i][r]; + } + avg /= 8.0; + std::cout << "p= "<< pReceivers[i][8] << std::endl; + std::cout << "avg= "<explicitStepBackward( time_n, dt, i, domain, false ); + time_n += dt; + } + // check again the seismo content. + for( int i = 0; i < 11; i++ ) + { + if( i > 0 ) + { + ASSERT_TRUE( std::abs( pReceivers[i][8] ) > 0 ); + } + double avg = 0; + for( int r=0; r<8; r++ ) + { + avg += pReceivers[i][r]; + } + avg /= 8.0; + ASSERT_TRUE( std::abs( pReceivers[i][8] - avg ) < 0.00001 ); + } +} + +int main( int argc, char * * argv ) +{ + ::testing::InitGoogleTest( &argc, argv ); + g_commandLineOptions = *geos::basicSetup( argc, argv ); + int const result = RUN_ALL_TESTS(); + geos::basicCleanup(); + return result; +} diff --git a/src/docs/sphinx/basicExamples/co2Injection/Example.rst b/src/docs/sphinx/basicExamples/co2Injection/Example.rst index cec5f2b464c..3076ae46b68 100644 --- a/src/docs/sphinx/basicExamples/co2Injection/Example.rst +++ b/src/docs/sphinx/basicExamples/co2Injection/Example.rst @@ -181,12 +181,12 @@ The *pvtgas.txt* and *pvtliquid.txt* files define the models used to compute the .. code:: - DensityFun SpanWagnerCO2Density 1e6 1.5e7 5e4 94 96 1 - ViscosityFun FenghourCO2Viscosity 1e6 1.5e7 5e4 94 96 + DensityFun SpanWagnerCO2Density 1.0e5 7.5e7 1e5 285.15 395.15 5 + ViscosityFun FenghourCO2Viscosity 1.0e5 7.5e7 1e5 285.15 395.15 5 .. code:: - DensityFun PhillipsBrineDensity 1e6 1.5e7 5e4 94 96 1 0 + DensityFun PhillipsBrineDensity 1.0e5 7.5e7 1e5 285.15 395.15 5 0 ViscosityFun PhillipsBrineViscosity 0 In these files, the first keyword of each line is an identifier for the model type (either a density or a viscosity model). @@ -218,6 +218,10 @@ Here, these fields are homogeneous, except for the permeability field that is ta .. _Outputs_tag_co2_field_case: +.. warning:: + This XML file example does not take into account elevation when imposing the intial pressure with ``initialPressure``. + Consider using a "HydrostraticEquilibrium" for a closer answer to modeled physical processes. + ------ Output ------ diff --git a/src/docs/sphinx/basicExamples/multiphaseFlowWithWells/Example.rst b/src/docs/sphinx/basicExamples/multiphaseFlowWithWells/Example.rst index 0c1d7be2a45..1afb1185816 100644 --- a/src/docs/sphinx/basicExamples/multiphaseFlowWithWells/Example.rst +++ b/src/docs/sphinx/basicExamples/multiphaseFlowWithWells/Example.rst @@ -119,48 +119,71 @@ Mesh definition and well geometry In the presence of wells, the **Mesh** block of the XML input file includes two parts: - a sub-block **VTKMesh** defining the reservoir mesh (see :ref:`TutorialSinglePhaseFlowExternalMesh` for more on this), - - a collection of sub-blocks **InternalWell** defining the geometry of the wells. + - a collection of sub-blocks defining the geometry of the wells. The reservoir mesh is imported from a ``.vtu`` file that contains the mesh geometry and also includes the permeability values in the x, y, and z directions. These quantities must be specified using the metric unit system, i.e., in meters for the well geometry and square meters for the permeability field. -We note that the mesh file only contains the active cells, so there is no keyword -needed in the XML file to define them. +We note that the mesh file only contains active cells, so there is no keyword +needed in the XML file to define them. + +.. image:: egg_model.png + :width: 400px + :align: center + +.. literalinclude:: ../../../../../inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEgg_benchmark.xml + :language: xml + :start-after: + :end-before: + + +.. _Events_tag_dead_oil_egg_model: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +**InternalWell** sub-blocks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Each well is defined internally (i.e., not imported from a file) in a separate **InternalWell** -XML sub-block. An **InternalWell** sub-block must point to the reservoir mesh that the well perforates -using the attribute ``meshName``, to the region corresponding to this well using the attribute +XML sub-block. An **InternalWell** sub-block must point to the region corresponding to this well using the attribute ``wellRegionName``, and to the control of this well using the attribute ``wellControl``. -Each block **InternalWell** must point to the reservoir mesh -(using the attribute ``meshName``), the corresponding well region (using -the attribute ``wellRegionName``), and the corresponding well control -(using the attribute ``wellControlName``). Each well is defined using a vertical polyline going through the seven layers of the -mesh, with a perforation in each layer. +mesh with a perforation in each layer. The well placement implemented here follows the pattern of the original test case. The well geometry must be specified in meters. The location of the perforations is found internally using the linear distance along the wellbore -from the top of the well, specified by the attribute ``distanceFromHead``. +from the top of the well specified by the attribute ``distanceFromHead``. It is the responsibility of the user to make sure that there is a perforation in the bottom cell of the well mesh otherwise an error will be thrown and the simulation will terminate. For each perforation, the well transmissibility factors employed to compute the perforation rates are calculated internally using the Peaceman formulation. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +**VTKWell** sub-blocks +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. image:: egg_model.png - :width: 400px - :align: center +Each well is loaded from a file in a separate **VTKWell** +XML sub-block. A **VTKWell** sub-block must point to the region corresponding to this well using the attribute +``wellRegionName``, and to the control of this well using the attribute ``wellControl``. -.. literalinclude:: ../../../../../inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEgg_benchmark.xml - :language: xml - :start-after: - :end-before: +Each well is defined using a vertical VTK polyline going through the seven layers of the +mesh with a perforation in each layer. +The well placement implemented here follows the pattern of the original test case. +The well geometry must be specified in meters. +The location of perforations is found internally using the linear distance along the wellbore +from the top of the well specified by the attribute ``distanceFromHead``. +It is the responsibility of the user to make sure that there is a perforation in the bottom cell +of the well mesh otherwise an error will be thrown and the simulation will terminate. +For each perforation, the well transmissibility factors employed to compute the perforation rates are calculated +internally using the Peaceman formulation. -.. _Events_tag_dead_oil_egg_model: +.. literalinclude:: ../../../../../inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEggVTK_benchmark.xml + :language: xml + :start-after: + :end-before: ------------------------ Events @@ -181,11 +204,11 @@ by the attribute ``timeFrequency``. Here, we choose to output the results using the VTK format (see :ref:`TutorialSinglePhaseFlowExternalMesh` for a example that uses the Silo output file format). The ``target`` attribute must point to the **VTK** sub-block of the **Outputs** -block (defined at the end of the XML file) by name (here, ``vtkOutput``). +block defined at the end of the XML file by its user-specified name (here, ``vtkOutput``). -We define the events involved in the collection and output of the well production rates following the procedure defined in :ref:`TasksManager`. -The time history collection events trigger the collection of the well rates at the desired frequency, while the time history output events trigger the output of the HDF5 files containing the time series. -These events point by name to the corresponding blocks of the **Tasks** and **Outputs** XML blocks, respectively. Here, these names are ``wellRateCollection1`` and ``timeHistoryOutput1``. +We define the events involved in the collection and output of well production rates following the procedure defined in :ref:`TasksManager`. +The time-history collection events trigger the collection of well rates at the desired frequency, while the time-history output events trigger the output of HDF5 files containing the time series. +These events point by name to the corresponding blocks of the **Tasks** and **Outputs** XML blocks. Here, these names are ``wellRateCollection1`` and ``timeHistoryOutput1``. .. literalinclude:: ../../../../../inputFiles/compositionalMultiphaseWell/benchmarks/Egg/deadOilEgg_base_iterative.xml :language: xml @@ -199,7 +222,7 @@ These events point by name to the corresponding blocks of the **Tasks** and **Ou Numerical methods ---------------------------------- -In the ``NumericalMethods`` XML block, we instruct GEOS to use a TPFA finite-volume +In the ``NumericalMethods`` XML block, we instruct GEOS to use a TPFA (Two-Point Flux Approximation) finite-volume numerical scheme. This part is similar to the corresponding section of :ref:`TutorialDeadOilBottomLayersSPE10`, and has been adapted to match the specifications of the Egg model. @@ -215,7 +238,7 @@ This part is similar to the corresponding section of :ref:`TutorialDeadOilBottom Reservoir and well regions ----------------------------------- -In this section of the input file, we follow the procedure already described in +In this section of the input file, we follow the procedure described in :ref:`TutorialDeadOilBottomLayersSPE10` for the definition of the reservoir region with multiphase constitutive models. We associate a **CellElementRegion** named ``reservoir`` to the reservoir mesh. @@ -421,7 +444,7 @@ We can load this file into Paraview directly and visualize results: :width: 45% We have instructed GEOS to output the time series of rates for each producer. -The data contained in the corresponding hdf5 files can be extracted and plotted +The data contained in the corresponding HDF5 files can be extracted and plotted as shown below. .. plot:: docs/sphinx/basicExamples/multiphaseFlowWithWells/multiphaseFlowWithWellsFigure.py diff --git a/src/docs/sphinx/developerGuide/Contributing/Dockerfile-remote-dev.example b/src/docs/sphinx/developerGuide/Contributing/Dockerfile-remote-dev.example index 15e46a7cf90..edf71ed717f 100644 --- a/src/docs/sphinx/developerGuide/Contributing/Dockerfile-remote-dev.example +++ b/src/docs/sphinx/developerGuide/Contributing/Dockerfile-remote-dev.example @@ -53,6 +53,14 @@ RUN touch /root/.ssh/environment &&\ # to your environment. This will prevent you from adding the `--allow-run-as-root` option # when you run mpi. Of course, weigh the benefits and risks and make your own decision. +# In case you want to use `sccache` (https://github.com/mozilla/sccache) to make your builds faster, +# you may configure the `sccache` config file at your convenience. +# Meanwhile, we provide here a simple local configuration. +RUN mkdir -p ${HOME}/.config/sccache +RUN printf '[cache.disk]\n\ +dir = "/tmp/.cache/sccache"\n\ +size = 3221225472 # 3GB\n' > ${HOME}/.config/sccache/config + # Default ssh port 22 is exposed. For _development_ purposes, # it can be useful to expose other ports for remote tools. EXPOSE 22 11111 64010-64020 diff --git a/src/docs/sphinx/developerGuide/Contributing/InstallWin.rst b/src/docs/sphinx/developerGuide/Contributing/InstallWin.rst index 6fa4b1d6d55..0b9275a9584 100644 --- a/src/docs/sphinx/developerGuide/Contributing/InstallWin.rst +++ b/src/docs/sphinx/developerGuide/Contributing/InstallWin.rst @@ -1,6 +1,6 @@ .. _InstallWin: -[Unsupported] Installing GEOS on Windows machines using Docker +[Best effort] Installing GEOS on Windows machines using Docker ================================================================= In this section, we will install GEOS on a Windows machine using a ``Docker`` container with a precompiled version of diff --git a/src/docs/sphinx/developerGuide/Contributing/IntegratedTests.rst b/src/docs/sphinx/developerGuide/Contributing/IntegratedTests.rst index f2e355372c2..e8a97841ac2 100644 --- a/src/docs/sphinx/developerGuide/Contributing/IntegratedTests.rst +++ b/src/docs/sphinx/developerGuide/Contributing/IntegratedTests.rst @@ -542,11 +542,11 @@ To do this you can run this command in the build directory: make ats_rebaseline_failed -Otherwise, you can run the following command, and select whether tests should be rebaselined one at a time via a ``[y/n]`` prompt. +Otherwise, you can run the following command, and select whether tests should be rebaselined one at a time via a ``[y/n]`` prompt: .. code-block:: sh - make ats_rebaseline_failed + make ats_rebaseline Make sure to only answer ``y`` to the tests that you actually want to rebaseline, otherwise correct baselines for already passing tests will still be updated and bloat your pull request and repository size. diff --git a/src/docs/sphinx/developerGuide/Contributing/UsingDocker.rst b/src/docs/sphinx/developerGuide/Contributing/UsingDocker.rst index 46bbf885b50..5600e7fef3f 100644 --- a/src/docs/sphinx/developerGuide/Contributing/UsingDocker.rst +++ b/src/docs/sphinx/developerGuide/Contributing/UsingDocker.rst @@ -1,6 +1,6 @@ .. _UsingDocker: -[Unsupported] Developing inside Docker with precompiled TPL binaries +[Best effort] Developing inside Docker with precompiled TPL binaries ==================================================================== For development purposes, you may want to use the publicly available docker images instead of compiling them yourself.