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

[2p] add test using interface solver

parent 8c8fa38f
......@@ -20,6 +20,19 @@ dune_add_test(NAME test_2p_incompressible_box
${CMAKE_CURRENT_BINARY_DIR}/2p_box-00007.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2p_incompressible_box test_2p.input -Problem.Name 2p_box")
# using box with interface solver
dune_add_test(NAME test_2p_incompressible_box_ifsolver
SOURCES test_2p_fv.cc
COMPILE_DEFINITIONS TYPETAG=TwoPIncompressibleBox
COMPILE_DEFINITIONS ENABLEINTERFACESOLVER=true
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/lensbox_ifsolver-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2p_box_ifsolver-00018.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2p_incompressible_box_ifsolver test_2p.input
-Problem.Name 2p_box_ifsolver
-Box.UseInterfaceSolver true")
# using mpfa
dune_add_test(NAME test_2p_incompressible_mpfa
SOURCES test_2p_fv.cc
......
......@@ -38,6 +38,10 @@
#include "spatialparams.hh"
#ifndef ENABLEINTERFACESOLVER
#define ENABLEINTERFACESOLVER 0
#endif
namespace Dumux
{
// forward declarations
......@@ -72,6 +76,9 @@ SET_PROP(TwoPIncompressible, FluidSystem)
SET_BOOL_PROP(TwoPIncompressible, EnableGridVolumeVariablesCache, false);
SET_BOOL_PROP(TwoPIncompressible, EnableGridFluxVariablesCache, false);
SET_BOOL_PROP(TwoPIncompressible, EnableFVGridGeometryCache, false);
// Maybe enable the box-interface solver
SET_BOOL_PROP(TwoPIncompressible, EnableBoxInterfaceSolver, ENABLEINTERFACESOLVER);
} // end namespace Properties
/*!
......
......@@ -23,11 +23,14 @@
#ifndef DUMUX_COMPRESSIBLE_ONEP_TEST_SPATIAL_PARAMS_HH
#define DUMUX_COMPRESSIBLE_ONEP_TEST_SPATIAL_PARAMS_HH
#include <dumux/material/spatialparams/fv.hh>
#include <dumux/discretization/methods.hh>
#include <dumux/material/spatialparams/fv.hh>
#include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh>
#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
#include <dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh>
namespace Dumux {
//forward declaration
......@@ -63,12 +66,14 @@ public:
template<class TypeTag>
class TwoPTestSpatialParams : public FVSpatialParams<TypeTag>
{
using ThisType = TwoPTestSpatialParams<TypeTag>;
using ParentType = FVSpatialParams<TypeTag>;
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename FVGridGeometry::LocalView;
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
static constexpr int dimWorld = GridView::dimensionworld;
......@@ -158,6 +163,18 @@ public:
int wettingPhaseAtPos(const GlobalPosition& globalPos) const
{ return FluidSystem::phase0Idx; }
//! Updates the map of which material parameters are associated with a nodal dof.
template<class SolutionVector>
void updateMaterialInterfaceParams(const SolutionVector& x)
{
if (FVGridGeometry::discMethod == DiscretizationMethod::box)
materialInterfaceParams_.update(this->problem().fvGridGeometry(), *this, x);
}
//! Returns the material parameters associated with a nodal dof
const BoxMaterialInterfaceParams<ThisType>& materialInterfaceParams() const
{ return materialInterfaceParams_; }
private:
bool isInLens_(const GlobalPosition &globalPos) const
{
......@@ -176,6 +193,9 @@ private:
MaterialLawParams lensMaterialParams_;
MaterialLawParams outerMaterialParams_;
// Determines the parameters associated with the dofs at material interfaces
BoxMaterialInterfaceParams<ThisType> materialInterfaceParams_;
static constexpr Scalar eps_ = 1.5e-7;
};
......
......@@ -126,6 +126,10 @@ int main(int argc, char** argv) try
problem->applyInitialSolution(x);
auto xOld = x;
// maybe update the interface parameters
if (ENABLEINTERFACESOLVER)
problem->spatialParams().updateMaterialInterfaceParams(x);
// the grid variables
using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables);
auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry);
......
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