Commit 858591c3 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[2p] further develop 2p test

parent 29cd2506
dune_symlink_to_source_files(FILES "test_2pincompressible.input")
dune_symlink_to_source_files(FILES "test_2p.input")
# incompressible
add_dumux_test(test_2pincompressible test_2pincompressible test_2pincompressible.cc
${CMAKE_CURRENT_BINARY_DIR}/test_2pincompressible)
# using tpfa
dune_add_test(NAME test_2p_incompressible_tpfa
SOURCES test_2p.cc
COMPILE_DEFINITIONS TYPETAG=TwoPIncompressibleTpfa
CMD_ARGS test_2p.input -Problem.Name 2p_tpfa)
set(CMAKE_BUILD_TYPE Release)
\ No newline at end of file
# using box
dune_add_test(NAME test_2p_incompressible_box
SOURCES test_2p.cc
COMPILE_DEFINITIONS TYPETAG=TwoPIncompressibleBox
CMD_ARGS test_2p.input -Problem.Name 2p_box)
set(CMAKE_BUILD_TYPE Release)
......@@ -26,6 +26,7 @@
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/components/dnapl.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/implicit/box/properties.hh>
#include <dumux/implicit/cellcentered/tpfa/properties.hh>
#include <dumux/porousmediumflow/2p/implicit/propertydefaults.hh>
#include <dumux/porousmediumflow/2p/implicit/incompressiblelocalresidual.hh>
......@@ -43,19 +44,21 @@ namespace Properties
NEW_PROP_TAG(EnableFVGridGeometryCache);
NEW_PROP_TAG(FVGridGeometry);
NEW_TYPE_TAG(IncompressibleTestProblem, INHERITS_FROM(CCTpfaModel, TwoP, SpatialParams));
NEW_TYPE_TAG(TwoPIncompressible, INHERITS_FROM(TwoP));
NEW_TYPE_TAG(TwoPIncompressibleTpfa, INHERITS_FROM(CCTpfaModel, TwoPIncompressible, SpatialParams));
NEW_TYPE_TAG(TwoPIncompressibleBox, INHERITS_FROM(BoxModel, TwoPIncompressible, SpatialParams));
// Set the grid type
SET_TYPE_PROP(IncompressibleTestProblem, Grid, Dune::YaspGrid<2>);
SET_TYPE_PROP(TwoPIncompressible, Grid, Dune::YaspGrid<2>);
// Set the problem type
SET_TYPE_PROP(IncompressibleTestProblem, Problem, TwoPTestProblem<TypeTag>);
SET_TYPE_PROP(TwoPIncompressible, Problem, TwoPTestProblem<TypeTag>);
// the local residual containing the analytic derivative methods
SET_TYPE_PROP(IncompressibleTestProblem, LocalResidual, TwoPIncompressibleLocalResidual<TypeTag>);
SET_TYPE_PROP(TwoPIncompressible, LocalResidual, TwoPIncompressibleLocalResidual<TypeTag>);
// Set the wetting phase
SET_PROP(IncompressibleTestProblem, WettingPhase)
SET_PROP(TwoPIncompressible, WettingPhase)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
......@@ -64,7 +67,7 @@ public:
};
// Set the non-wetting phase
SET_PROP(IncompressibleTestProblem, NonwettingPhase)
SET_PROP(TwoPIncompressible, NonwettingPhase)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
......@@ -73,9 +76,9 @@ public:
};
// Enable caching
SET_BOOL_PROP(IncompressibleTestProblem, EnableGlobalVolumeVariablesCache, false);
SET_BOOL_PROP(IncompressibleTestProblem, EnableGlobalFluxVariablesCache, false);
SET_BOOL_PROP(IncompressibleTestProblem, EnableFVGridGeometryCache, false);
SET_BOOL_PROP(TwoPIncompressible, EnableGlobalVolumeVariablesCache, false);
SET_BOOL_PROP(TwoPIncompressible, EnableGlobalFluxVariablesCache, false);
SET_BOOL_PROP(TwoPIncompressible, EnableFVGridGeometryCache, false);
} // end namespace Properties
template<class TypeTag>
......
......@@ -45,21 +45,22 @@
#include <dumux/nonlinear/newtonmethod.hh>
#include <dumux/nonlinear/newtoncontroller.hh>
#include <dumux/assembly/ccassembler.hh>
#include <dumux/assembly/fvassembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/io/vtkoutputmodule.hh>
int main(int argc, char** argv)
int main(int argc, char** argv) try
{
using namespace Dumux;
// define the type tag for this problem
using TypeTag = TTAG(IncompressibleTestProblem);
using TypeTag = TTAG(TYPETAG);
// some aliases for better readability
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using ParameterTree = typename GET_PROP(TypeTag, ParameterTree);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
......@@ -115,7 +116,9 @@ int main(int argc, char** argv)
auto problem = std::make_shared<Problem>(fvGridGeometry);
// the solution vector
SolutionVector x(leafGridView.size(0));
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox);
static constexpr int dofCodim = isBox ? GridView::dimension : 0;
SolutionVector x(leafGridView.size(dofCodim));
problem->applyInitialSolution(x);
auto xOld = x;
......@@ -144,7 +147,7 @@ int main(int argc, char** argv)
timeLoop->setMaxTimeStepSize(maxDt);
// the assembler with time loop for instationary problem
using Assembler = CCAssembler<TypeTag, DiffMethod::analytic>;
using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>;
auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop);
// the linear solver
......@@ -213,3 +216,27 @@ int main(int argc, char** argv)
return 0;
} // end main
catch (Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
catch (...)
{
std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl;
return 4;
}
......@@ -12,8 +12,5 @@ LensLowerLeft = 1.0 2.0 # [m] coordinates of the lower left lens corner
LensUpperRight = 4.0 3.0 # [m] coordinates of the upper right lens corner
[Problem]
Name = 2pcc
Name = 2p
EnableGravity = true
[Implicit]
UpwindWeight = 1.0
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