Skip to content

Commit

Permalink
add imported opm-models code to buildsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
akva2 committed May 4, 2023
1 parent f95ce7d commit 1fe7d8c
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 13 deletions.
25 changes: 22 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,15 @@ endif()


macro (config_hook)
opm_need_version_of ("dune-common")
opm_need_version_of ("dune-istl")
opm_need_version_of("dune-alugrid")
opm_need_version_of("dune-common")
opm_need_version_of("dune-geometry")
opm_need_version_of("dune-grid")
opm_need_version_of("dune-istl")
opm_need_version_of("dune-localfunctions")
if(dune-fem_FOUND)
opm_need_version_of ("dune-fem")
endif()
opm_need_version_of ("opm-models")

if(NOT fmt_FOUND)
add_definitions(-DFMT_HEADER_ONLY)
Expand Down Expand Up @@ -519,6 +522,8 @@ if(dune-alugrid_FOUND)
target_compile_definitions(flow_alugrid PRIVATE USE_ALUGRID)
endif()

include(modelTests.cmake)

if (BUILD_FLOW)
install(TARGETS flow DESTINATION bin)
opm_add_bash_completion(flow)
Expand All @@ -529,6 +534,20 @@ if (BUILD_FLOW)
PASS_REGULAR_EXPRESSION "${${project}_LABEL}")
endif()

if(QuadMath_FOUND)
foreach(tapp co2injection_flash_ni_ecfv
co2injection_flash_ni_vcfv
co2injection_flash_ecfv
co2injection_flash_vcfv)
opm_add_test(${tapp}_quad
ONLY_COMPILE
EXE_NAME ${tapp}_quad
SOURCES
examples/${tapp}.cc)
target_link_libraries(${tapp}_quad QuadMath::QuadMath)
endforeach()
endif()

if (OPM_ENABLE_PYTHON)
add_subdirectory(python)
endif()
Expand Down
73 changes: 73 additions & 0 deletions CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,27 @@ list (APPEND TEST_DATA_FILES
tests/options_flexiblesolver.json
tests/options_flexiblesolver_simple.json
tests/GLIFT1.DATA
tests/data/co2injection.dgf
tests/data/cuvette_11x4.dgf
tests/data/cuvette_44x24.dgf
tests/data/fracture.art.dgf
tests/data/fracture-raw.art
tests/data/groundwater_1d.dgf
tests/data/groundwater_2d.dgf
tests/data/groundwater_3d.dgf
tests/data/infiltration_250x20.dgf
tests/data/infiltration_50x3.dgf
tests/data/obstacle_24x16.dgf
tests/data/obstacle_48x32.dgf
tests/data/outflow.dgf
tests/data/reservoir.dgf
tests/data/richardslens_24x16.dgf
tests/data/richardslens_48x32.dgf
tests/data/richardslens_96x64.dgf
tests/data/test_stokes2c.dgf
tests/data/test_stokes2cni.dgf
tests/data/test_stokes.dgf
tests/data/waterair.dgf
tests/include/flowl_b_vfp.ecl
tests/include/flowl_c_vfp.ecl
tests/include/permx_model5.grdecl
Expand Down Expand Up @@ -459,10 +480,62 @@ if(HDF5_FOUND)
endif()

list (APPEND EXAMPLE_SOURCE_FILES
examples/art2dgf.cc
examples/co2injection_flash_ni_vcfv.cc
examples/co2injection_flash_ni_ecfv.cc
examples/co2injection_flash_vcfv.cc
examples/co2injection_flash_ecfv.cc
examples/co2injection_ncp_ni_vcfv.cc
examples/co2injection_pvs_ni_vcfv.cc
examples/co2injection_ncp_vcfv.cc
examples/co2injection_pvs_vcfv.cc
examples/co2injection_immiscible_ni_vcfv.cc
examples/co2injection_immiscible_vcfv.cc
examples/co2injection_immiscible_ecfv.cc
examples/co2injection_ncp_ecfv.cc
examples/co2injection_pvs_ecfv.cc
examples/co2injection_immiscible_ni_ecfv.cc
examples/co2injection_ncp_ni_ecfv.cc
examples/co2injection_pvs_ni_ecfv.cc
examples/cuvette_pvs.cc
examples/diffusion_flash.cc
examples/diffusion_ncp.cc
examples/diffusion_pvs.cc
examples/groundwater_immiscible.cc
examples/infiltration_pvs.cc
examples/lens_immiscible_vcfv_ad.cc
examples/lens_immiscible_vcfv_fd.cc
examples/lens_immiscible_ecfv_ad.cc
examples/lens_immiscible_ecfv_ad_23.cc
examples/lens_immiscible_ecfv_ad_trans.cc
examples/lens_richards_vcfv.cc
examples/lens_richards_ecfv.cc
examples/obstacle_immiscible.cc
examples/obstacle_ncp.cc
examples/obstacle_pvs.cc
examples/outflow_pvs.cc
examples/powerinjection_forchheimer_fd.cc
examples/powerinjection_forchheimer_ad.cc
examples/powerinjection_darcy_fd.cc
examples/powerinjection_darcy_ad.cc
examples/reservoir_blackoil_ecfv.cc
examples/reservoir_blackoil_vcfv.cc
examples/reservoir_ncp_ecfv.cc
examples/reservoir_ncp_vcfv.cc
examples/printvfp.cpp
examples/tutorial1.cc
examples/waterair_pvs_ni.cc
)
if(HDF5_FOUND)
list (APPEND EXAMPLE_SOURCE_FILES
examples/opmrst_inspect.cpp
)
endif()

if(DUNE_ALUGRID_FOUND)
list(APPEND EXAMPLE_SOURCE_FILES
examples/finger_immiscible_ecfv.cc
examples/finger_immiscible_vcfv.cc
examples/fracture_discretefracture.cc
)
endif()
3 changes: 2 additions & 1 deletion dune.module
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Label: 2023.10-pre
Maintainer: [email protected]
MaintainerName: Atgeirr F. Rasmussen
Url: http://opm-project.org
Depends: dune-istl (>= 2.7) opm-common opm-grid opm-models
Depends: dune-istl (>= 2.7) opm-common opm-grid
Suggests: dune-localfunctions (>= 2.7) dune-fem (>= 2.7) dune-alugrid (>= 2.7)
4 changes: 1 addition & 3 deletions jenkins/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@

declare -a upstreams
upstreams=(opm-common
opm-grid
opm-models)
opm-grid)

declare -A upstreamRev
upstreamRev[opm-common]=master
upstreamRev[opm-grid]=master
upstreamRev[opm-models]=master

if grep -q "opm-common=" <<< $ghprbCommentBody
then
Expand Down
152 changes: 152 additions & 0 deletions modelTests.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
opm_set_test_driver(${CMAKE_CURRENT_SOURCE_DIR}/tests/run-vtu-test.sh --simulation)
opm_set_test_default_working_directory(${PROJECT_BINARY_DIR}/tests)

opm_add_test(art2dgf
NO_COMPILE
DRIVER_ARGS --plain
TEST_ARGS "data/fracture-raw.art")

opm_add_test(waterair_pvs_ni
NO_COMPILE
TEST_ARGS --grid-global-refinements=1)

opm_add_test(lens_immiscible_vcfv_ad
NO_COMPILE
TEST_ARGS --end-time=3000)

opm_add_test(lens_immiscible_vcfv_fd
NO_COMPILE
TEST_ARGS --end-time=3000)

opm_add_test(lens_immiscible_ecfv_ad
NO_COMPILE
TEST_ARGS --end-time=3000)

opm_add_test(lens_immiscible_ecfv_ad_23
NO_COMPILE
TEST_ARGS --end-time=3000)

opm_add_test(lens_immiscible_ecfv_ad_trans
NO_COMPILE
TEST_ARGS --end-time=3000)

# this test is identical to the simulation of the lens problem that
# uses the element centered finite volume discretization in
# conjunction with automatic differentiation
# (lens_immiscible_ecfv_ad). The only difference is that it uses
# multiple compile units in order to ensure that eWoms code can be
# used within libraries that use the same type tag within multiple
# compile units.
opm_add_test(lens_immiscible_ecfv_ad_mcu
ONLY_COMPILE
SOURCES
examples/lens_immiscible_ecfv_ad_cu1.cc
examples/lens_immiscible_ecfv_ad_cu2.cc
examples/lens_immiscible_ecfv_ad_main.cc
LIBRARIES opmsimulators)


opm_add_test(finger_immiscible_ecfv
NO_COMPILE
CONDITION ${DUNE_ALUGRID_FOUND})

opm_add_test(finger_immiscible_vcfv
NO_COMPILE
CONDITION ${DUNE_ALUGRID_FOUND})

opm_add_test(finger_immiscible_ecfv_adaptive
EXE_NAME finger_immiscible_ecfv
CONDITION ${DUNE_ALUGRID_FOUND} AND ${DUNE_FEM_FOUND}
NO_COMPILE
TEST_ARGS --enable-grid-adaptation=true --end-time=25e3)

opm_add_test(reservoir_blackoil_vcfv
NO_COMPILE
TEST_ARGS --end-time=8750000)
opm_add_test(reservoir_blackoil_ecfv
NO_COMPILE
TEST_ARGS --end-time=8750000)
opm_add_test(reservoir_ncp_vcfv
NO_COMPILE
TEST_ARGS --end-time=8750000)
opm_add_test(reservoir_ncp_ecfv
NO_COMPILE
TEST_ARGS --end-time=8750000)

opm_add_test(fracture_discretefracture
NO_COMPILE
CONDITION ${DUNE_ALUGRID_FOUND}
TEST_ARGS --end-time=400)

opm_add_test(test_propertysystem
DRIVER_ARGS --plain)

opm_add_test(test_quadrature
DRIVER_ARGS --plain)

# test for the parallelization of the element centered finite volume
# discretization (using the non-isothermal NCP model and the parallel
# AMG linear solver)
opm_add_test(co2injection_ncp_ni_ecfv_parallel
EXE_NAME co2injection_ncp_ni_ecfv
NO_COMPILE
PROCESSORS 4
CONDITION ${MPI_FOUND}
DRIVER_ARGS --parallel-simulation=4)

# test for the parallelization of the vertex centered finite volume
# discretization (using BiCGSTAB + ILU0)
opm_add_test(obstacle_immiscible_parallel
EXE_NAME obstacle_immiscible
NO_COMPILE
PROCESSORS 4
CONDITION ${MPI_FOUND}
DRIVER_ARGS --parallel-simulation=4
TEST_ARGS --end-time=1 --initial-time-step-size=1)

# test for the parallel AMG linear solver using the vertex centered
# finite volume discretization
opm_add_test(lens_immiscible_vcfv_fd_parallel
EXE_NAME lens_immiscible_vcfv_fd
NO_COMPILE
PROCESSORS 4
CONDITION ${MPI_FOUND}
DRIVER_ARGS --parallel-simulation=4
TEST_ARGS --end-time=250 --initial-time-step-size=250)

opm_add_test(lens_immiscible_vcfv_ad_parallel
EXE_NAME lens_immiscible_vcfv_ad
NO_COMPILE
PROCESSORS 4
CONDITION ${MPI_FOUND}
DRIVER_ARGS --parallel-simulation=4
TEST_ARGS --end-time=250 --initial-time-step-size=250)

opm_add_test(lens_immiscible_ecfv_ad_parallel
EXE_NAME lens_immiscible_ecfv_ad
NO_COMPILE
PROCESSORS 4
CONDITION ${MPI_FOUND}
DRIVER_ARGS --parallel-simulation=4
TEST_ARGS --end-time=250 --initial-time-step-size=250)

opm_add_test(obstacle_immiscible_parameters
EXE_NAME obstacle_immiscible
NO_COMPILE
DEPENDS obstacle_immiscible
DRIVER_ARGS --parameters)

opm_add_test(obstacle_pvs_restart
EXE_NAME obstacle_pvs
NO_COMPILE
DEPENDS obstacle_pvs
DRIVER_ARGS --restart
TEST_ARGS --pvs-verbosity=2 --end-time=30000)

opm_add_test(test_tasklets
DRIVER_ARGS --plain)

opm_add_test(test_mpiutil
PROCESSORS 4
CONDITION ${MPI_FOUND} AND Boost_UNIT_TEST_FRAMEWORK_FOUND
DRIVER_ARGS --parallel-program=4)
18 changes: 16 additions & 2 deletions opm-simulators-prereqs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
set (opm-simulators_CONFIG_VAR
HAVE_OPM_GRID
HAVE_PTHREAD
HAVE_EWOMS
HAVE_MPI
HAVE_PETSC
COMPILE_BDA_BRIDGE
Expand All @@ -14,6 +13,12 @@ set (opm-simulators_CONFIG_VAR
HAVE_ROCALUTION
HAVE_ROCSPARSE
HAVE_SUITESPARSE_UMFPACK_H
HAVE_ECL_INPUT
HAVE_ECL_OUTPUT
HAVE_DUNE_ALUGRID
HAVE_DUNE_COMMON
HAVE_DUNE_GEOMETRY
HAVE_DUNE_GRID
HAVE_DUNE_ISTL
DUNE_ISTL_WITH_CHECKING
DUNE_ISTL_VERSION_MAJOR
Expand All @@ -22,6 +27,7 @@ set (opm-simulators_CONFIG_VAR
HAVE_SUITESPARSE_UMFPACK
HAVE_DAMARIS
HAVE_HDF5
HAVE_VALGRIND
)

# dependencies
Expand All @@ -32,8 +38,13 @@ set (opm-simulators_DEPS
"Boost 1.44.0
COMPONENTS date_time system unit_test_framework REQUIRED"
# DUNE prerequisites
"dune-alugrid"
"dune-common REQUIRED"
"dune-fem"
"dune-geometry REQUIRED"
"dune-grid REQUIRED"
"dune-istl REQUIRED"
"dune-localfunctions"
# matrix library
"BLAS REQUIRED"
"LAPACK REQUIRED"
Expand All @@ -51,9 +62,12 @@ set (opm-simulators_DEPS
# OPM dependency
"opm-common REQUIRED"
"opm-grid REQUIRED"
"opm-models REQUIRED"
"Damaris 1.7"
"HDF5"
# valgrind client requests
"Valgrind"
# quadruple precision floating point calculations
"QuadMath"
)

find_package_deps(opm-simulators)
Expand Down
2 changes: 1 addition & 1 deletion opm/models/parallel/mpibuffer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public:
0, // tag
MPI_COMM_WORLD,
&mpiStatus_);
assert(!mpiStatus_.MPI_ERROR);
//assert(!mpiStatus_.MPI_ERROR);
#endif // HAVE_MPI
}

Expand Down
Loading

0 comments on commit 1fe7d8c

Please sign in to comment.