Commit c40c6e69 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

Merge branch 'feature/parallel-co2-tests' into 'master'

Feature/parallel co2 tests

Closes #819

See merge request !1875
parents ee367334 71393a77
......@@ -5,51 +5,111 @@ dune_symlink_to_source_files(FILES grids)
# Ignore the porosity for all box models since it is defined element-wise in these test
# but the default 2p2c implementation outputs porosity per vertex.
# Depending on the order of the elements, the porosity would differ in these cases.
dumux_add_test(NAME test_co2_box
add_executable(test_co2_box EXCLUDE_FROM_ALL main.cc)
target_compile_definitions(test_co2_box PUBLIC TYPETAG=HeterogeneousBox )
add_executable(test_co2_tpfa EXCLUDE_FROM_ALL main.cc)
target_compile_definitions(test_co2_tpfa PUBLIC TYPETAG=HeterogeneousCCTpfa )
# sequential box
dumux_add_test(NAME test_co2_box_sequential
TARGET test_co2_box
LABELS porousmediumflow co2
SOURCES main.cc
COMPILE_DEFINITIONS TYPETAG=HeterogeneousBox
CMAKE_GUARD "( dune-alugrid_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2_box-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2_box-00019.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2_box-00028.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_co2_box params.input -Problem.Name test_co2_box"
--zeroThreshold {"porosity":1})
dumux_add_test(NAME test_co2_tpfa
# sequential tpfa
dumux_add_test(NAME test_co2_tpfa_sequential
LABELS porousmediumflow co2
SOURCES main.cc
TARGET test_co2_tpfa
COMPILE_DEFINITIONS TYPETAG=HeterogeneousCCTpfa
CMAKE_GUARD "( dune-alugrid_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2_tpfa-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2_tpfa-00018.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2_tpfa-00028.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_co2_tpfa params.input -Problem.Name test_co2_tpfa")
# parallel box
dumux_add_test(NAME test_co2_box_parallel
TARGET test_co2_box
LABELS porousmediumflow co2 parallel
CMAKE_GUARD "( dune-alugrid_FOUND AND MPI_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy --zeroThreshold {"process rank":100,"porosity":1}
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2_box_parallel-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/s0002-p0000-test_co2_box_parallel-00028.vtu
${CMAKE_SOURCE_DIR}/test/references/test_co2_box-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/s0002-test_co2_box_parallel-00028.pvtu
--command "${MPIEXEC} -np 2 ${CMAKE_CURRENT_BINARY_DIR}/test_co2_box params.input -Problem.Name test_co2_box_parallel")
# parallel tpfa
dumux_add_test(NAME test_co2_tpfa_parallel
TARGET test_co2_tpfa
LABELS porousmediumflow co2 parallel
CMAKE_GUARD "( dune-alugrid_FOUND AND MPI_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy --zeroThreshold {"process rank":100}
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2_tpfa-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/s0002-test_co2_tpfa_parallel-00028.pvtu
--command "${MPIEXEC} -np 2 ${CMAKE_CURRENT_BINARY_DIR}/test_co2_tpfa params.input -Problem.Name test_co2_tpfa_parallel")
# build target for the CO2 non-isothermal test problem
dumux_add_test(NAME test_co2ni_box
add_executable(test_co2ni_box EXCLUDE_FROM_ALL main.cc)
target_compile_definitions(test_co2ni_box PUBLIC TYPETAG=HeterogeneousNIBox PUBLIC ISOTHERMAL=0 )
add_executable(test_co2ni_tpfa EXCLUDE_FROM_ALL main.cc)
target_compile_definitions(test_co2ni_tpfa PUBLIC TYPETAG=HeterogeneousNICCTpfa PUBLIC ISOTHERMAL=0 )
# sequential box
dumux_add_test(NAME test_co2ni_box_sequential
TARGET test_co2ni_box
LABELS porousmediumflow co2 co2ni
SOURCES main.cc
COMPILE_DEFINITIONS TYPETAG=HeterogeneousNIBox
ISOTHERMAL=0
COMPILE_DEFINITIONS TYPETAG=HeterogeneousNIBox ISOTHERMAL=0
CMAKE_GUARD "( dune-alugrid_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2ni_box-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_box-00019.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_box-00028.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_box paramsni.input -Problem.Name test_co2ni_box"
--zeroThreshold {"porosity":1})
dumux_add_test(NAME test_co2ni_tpfa
# sequential tpfa
dumux_add_test(NAME test_co2ni_tpfa_sequential
TARGET test_co2ni_tpfa
LABELS porousmediumflow co2 co2ni
SOURCES main.cc
COMPILE_DEFINITIONS TYPETAG=HeterogeneousNICCTpfa
ISOTHERMAL=0
CMAKE_GUARD "( dune-alugrid_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2ni_tpfa-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_tpfa-00018.vtu
${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_tpfa-00028.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_tpfa paramsni.input -Problem.Name test_co2ni_tpfa")
# parallel box
dumux_add_test(NAME test_co2ni_box_parallel
TARGET test_co2ni_box
LABELS porousmediumflow co2 co2ni parallel
CMAKE_GUARD "( dune-alugrid_FOUND AND MPI_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy --zeroThreshold {"process rank":100,"porosity":1}
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2ni_box-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/s0002-test_co2ni_box_parallel-00028.pvtu
--command "${MPIEXEC} -np 2 ${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_box paramsni.input -Problem.Name test_co2ni_box_parallel")
# parallel tpfa
dumux_add_test(NAME test_co2ni_tpfa_parallel
TARGET test_co2ni_tpfa
LABELS porousmediumflow co2 co2ni parallel
CMAKE_GUARD "( dune-alugrid_FOUND AND MPI_FOUND )"
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy --zeroThreshold {"process rank":100}
--files ${CMAKE_SOURCE_DIR}/test/references/test_co2ni_tpfa_parallel-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/s0002-p0000-test_co2ni_tpfa_parallel-00028.vtu
${CMAKE_SOURCE_DIR}/test/references/test_co2ni_tpfa-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/s0002-test_co2ni_tpfa_parallel-00028.pvtu
--command "${MPIEXEC} -np 2 ${CMAKE_CURRENT_BINARY_DIR}/test_co2ni_tpfa paramsni.input -Problem.Name test_co2ni_tpfa_parallel")
......@@ -150,8 +150,8 @@ int main(int argc, char** argv) try
// report statistics of this time step
timeLoop->reportTimeStep();
// set new dt as suggested by the newton solver
timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize()));
// double the timestep each time (it is still limited by maximum time step size)
timeLoop->setTimeStepSize(timeLoop->timeStepSize()*2.0);
// write vtk output
vtkWriter.write(timeLoop->time());
......
[TimeLoop]
DtInitial = 250# [s]
TEnd = 1e6# [s]
DtInitial = 5e3 # [s]
TEnd = 1e6 # [s]
MaxTimeStepSize = 4e4 # [s]
[Grid]
File = ./grids/heterogeneousSmall.dgf # relative path to the grid file
......@@ -17,10 +18,7 @@ TemperatureHigh = 331.00 # [Pa] high end for tabularization of fluid properties
Name = co2 # [-] the name of the output files
EnableGravity = true
DepthBOR = 1200# [m] depth below ground surface
InjectionRate = 1e-4 # [kg/sq/s]
InjectionRate = 3e-3 # [kg/sq/s]
[Brine]
Salinity = 1e-1
[LinearSolver]
ResidualReduction = 1e-10
[TimeLoop]
DtInitial = 250 # [s]
DtInitial = 5e3 # [s]
TEnd = 1e6 # [s]
MaxTimeStepSize = 4e4 # [s]
[Grid]
File = ./grids/heterogeneousSmall.dgf # relative path to the grid file
......@@ -20,13 +21,10 @@ Salinity = 0.1 # [-] salinity of brine
Name = co2ni # [-] the name of the output files
EnableGravity = true
DepthBOR = 1200 # [m] depth below ground surface
InjectionRate = 1e-4 # always given as [kg/(m^2/s)]
InjectionRate = 3e-3 # always given as [kg/(m^2/s)]
InjectionPressure = 16e6 #[Pa]
InjectionTemperature = 305 # [K]
[LinearSolver]
ResidualReduction = 1e-10
[Component]
SolidDensity = 2700
SolidThermalConductivity = 2.8
......
......@@ -31,6 +31,7 @@
#include <dumux/discretization/cctpfa.hh>
#include <dumux/discretization/box.hh>
#include <dumux/parallel/vectorcommdatahandle.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/co2/model.hh>
......@@ -217,6 +218,7 @@ class HeterogeneousProblem : public PorousMediumFlowProblem<TypeTag>
// the discretization method we are using
static constexpr auto discMethod = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethod::box;
// world dimension to access gravity vector
static constexpr int dimWorld = GridView::dimensionworld;
......@@ -257,10 +259,13 @@ public:
/*np=*/nPressure_);
// stating in the console whether mole or mass fractions are used
if(useMoles)
std::cout<<"problem uses mole fractions"<<std::endl;
if (gridGeometry->gridView().comm().rank() == 0)
{
if (useMoles)
std::cout << "-- Problem uses mole fractions." << std::endl;
else
std::cout<<"problem uses mass fractions"<<std::endl;
std::cout << "-- Problem uses mass fractions." << std::endl;
}
// precompute the boundary types for the box method from the cell-centered boundary types
scvfToScvBoundaryTypes_.computeBoundaryTypes(*this);
......@@ -294,7 +299,7 @@ public:
#endif
const auto& gridView = this->gridGeometry().gridView();
for (const auto& element : elements(gridView))
for (const auto& element : elements(gridView, Dune::Partitions::interior))
{
const auto eIdx = this->gridGeometry().elementMapper().index(element);
auto fvGeometry = localView(this->gridGeometry());
......@@ -312,6 +317,19 @@ public:
vtkKxx_[eIdx] = this->spatialParams().permeability(eIdx);
vtkPorosity_[eIdx] = 1- this->spatialParams().inertVolumeFraction(eIdx);
}
// communicate box volume at process boundaries for vertex-centered scheme (box)
if constexpr (isBox)
{
if (gridView.comm().size() > 1)
{
VectorCommDataHandleSum<typename GridGeometry::VertexMapper, std::vector<Scalar>, GridView::dimension>
sumVolumeHandle(this->gridGeometry().vertexMapper(), vtkBoxVolume_);
gridView.communicate(sumVolumeHandle,
Dune::InteriorBorder_InteriorBorder_Interface,
Dune::ForwardCommunication);
}
}
}
/*!
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment