Commit cb8f226f authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[boxdfm] add 2p tests for different grid types/dimensions

parent 4490b428
......@@ -9,6 +9,7 @@ add_subdirectory("2pncmin")
add_subdirectory("3p")
add_subdirectory("3p3c")
add_subdirectory("3pwateroil")
add_subdirectory("boxdfm")
add_subdirectory("co2")
add_subdirectory("mpnc")
add_subdirectory("richards")
......
dune_symlink_to_source_files(FILES "test_2p.input" "grids")
# quadrilaterals yasp
dune_add_test(NAME test_2pboxdfm_quads_yasp
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-foamgrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::YaspGrid<2>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<1,2>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_quads-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_quads_yasp-00011.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_quads_yasp test_2p.input -Problem.Name 2pboxdfm_quads_yasp")
# quadrilaterals alu grid
dune_add_test(NAME test_2pboxdfm_quads_alu
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-alugrid_FOUND
CMAKE_GUARD dune-foamgrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::ALUGrid<2,2,Dune::cube,Dune::nonconforming>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<1,2>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_quads_alu-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_quads_alu-00011.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_quads_alu test_2p.input -Problem.Name 2pboxdfm_quads_alu")
# quadrilaterals ug grid
dune_add_test(NAME test_2pboxdfm_quads_ug
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-uggrid_FOUND
CMAKE_GUARD dune-foamgrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::UGGrid<2>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<1,2>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_quads-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_quads_ug-00011.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_quads_ug test_2p.input -Problem.Name 2pboxdfm_quads_ug")
# triangles alu
dune_add_test(NAME test_2pboxdfm_trias_alu
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-foamgrid_FOUND
CMAKE_GUARD dune-alugrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::ALUGrid<2,2,Dune::simplex,Dune::nonconforming>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<1,2>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_trias_alu-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_trias_alu-00007.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_trias_alu test_2p.input -Problem.Name 2pboxdfm_trias_alu -Grid.File grids/2d_trias.msh")
# triangles ug
dune_add_test(NAME test_2pboxdfm_trias_ug
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-uggrid_FOUND
CMAKE_GUARD dune-foamgrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::UGGrid<2>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<1,2>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_trias_ug-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_trias_ug-00007.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_trias_ug test_2p.input -Problem.Name 2pboxdfm_trias_ug -Grid.File grids/2d_trias.msh")
# tetrahedra alu
dune_add_test(NAME test_2pboxdfm_tets_alu
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-foamgrid_FOUND
CMAKE_GUARD dune-alugrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::ALUGrid<3,3,Dune::simplex,Dune::nonconforming>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<2,3>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_tets_alu-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_tets_alu-00007.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_tets_alu test_2p.input -Problem.Name 2pboxdfm_tets_alu -Grid.File grids/3d_simplex.msh")
# tetrahedra ug
dune_add_test(NAME test_2pboxdfm_tets_ug
SOURCES test_2pboxdfm.cc
CMAKE_GUARD dune-uggrid_FOUND
CMAKE_GUARD dune-foamgrid_FOUND
COMPILE_DEFINITIONS GRIDTYPE=Dune::UGGrid<3>
COMPILE_DEFINITIONS FRACTUREGRIDTYPE=Dune::FoamGrid<2,3>
COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
CMD_ARGS --script fuzzy
--files ${CMAKE_SOURCE_DIR}/test/references/2pboxdfm_2d_tets_ug-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/2pboxdfm_tets_ug-00007.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/test_2pboxdfm_tets_ug test_2p.input -Problem.Name 2pboxdfm_tets_ug -Grid.File grids/3d_simplex.msh")
set(CMAKE_BUILD_TYPE Release)
#install sources
install(FILES
problem.hh
spatialparams.hh
test_2p_fv.cc
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/test/implicit/2p/incompressible)
This diff is collapsed.
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
47
1 0 0 0
2 1 0 0
3 1 1 0
4 0 1 0
5 0.5 0.15 0
6 0.5 0.6 0
7 0.25 0.25 0
8 0.25 0.5 0
9 0.5 0.25 0
10 0.5 0.5 0
11 0.75 0.25 0
12 0.75 0.5 0
13 0 0.7500000000003465 0
14 0 0.5000000000020591 0
15 0 0.2500000000010404 0
16 0.2499999999994121 0 0
17 0.499999999998694 0 0
18 0.7499999999993416 0 0
19 1 0.2499999999994121 0
20 1 0.499999999998694 0
21 1 0.7499999999993416 0
22 0.7500000000003465 1 0
23 0.5000000000020591 1 0
24 0.2500000000010404 1 0
25 0.711417494935904 0.7190981070920686 0
26 0.2884548114665013 0.7080473703448205 0
27 0.375 0.375 0
28 0.625 0.375 0
29 0.507496506788062 0.8187950663570192 0
30 0.3915459609771306 0.6025613056035204 0
31 0.6097871575237765 0.6029146214184037 0
32 0.3766399416909452 0.1799562682216394 0
33 0.6233600583090159 0.1799562682215093 0
34 0.5978265380495438 0.07882095257883703 0
35 0.4021734619503089 0.07882095257972785 0
36 0.4307640269479863 0.7123410071193929 0
37 0.5766600339976918 0.7100513215467172 0
38 0.360238614305264 0.8612495775664406 0
39 0.8525000000002459 0.8524999999998341 0
40 0.1474999999998658 0.647500000000008 0
41 0.1544933285512806 0.8460702549249612 0
42 0.8524999999997666 0.6474999999999634 0
43 0.6463282750423706 0.8618011273288519 0
44 0.124999999999853 0.1250000000002601 0
45 0.8749999999997061 0.124999999999706 0
46 0.125 0.3750000000007749 0
47 0.8750000000002941 0.3749999999990531 0
$EndNodes
$Elements
79
1 1 2 1 7 6 10
2 1 2 1 8 10 9
3 1 2 1 9 9 5
4 2 2 1 1 16 35 32
5 2 2 1 1 18 33 34
6 2 2 1 1 6 37 36
7 2 2 1 1 12 25 31
8 2 2 1 1 8 30 26
9 2 2 1 1 25 37 31
10 2 2 1 1 5 9 32
11 2 2 1 1 6 30 10
12 2 2 1 1 6 10 31
13 2 2 1 1 5 33 9
14 2 2 1 1 26 30 36
15 2 2 1 1 6 36 30
16 2 2 1 1 7 16 32
17 2 2 1 1 11 33 18
18 2 2 1 1 7 27 8
19 2 2 1 1 11 12 28
20 2 2 1 1 6 31 37
21 2 2 1 1 5 17 34
22 2 2 1 1 5 35 17
23 2 2 1 1 29 37 43
24 2 2 1 1 42 25 12
25 2 2 1 1 8 26 40
26 2 2 1 1 22 23 43
27 2 2 1 1 23 24 38
28 2 2 1 1 20 21 42
29 2 2 1 1 3 22 39
30 2 2 1 1 4 41 24
31 2 2 1 1 3 39 21
32 2 2 1 1 4 13 41
33 2 2 1 1 8 40 14
34 2 2 1 1 12 20 42
35 2 2 1 1 13 14 40
36 2 2 1 1 29 36 37
37 2 2 1 1 25 43 37
38 2 2 1 1 29 38 36
39 2 2 1 1 14 15 46
40 2 2 1 1 1 44 15
41 2 2 1 1 2 45 18
42 2 2 1 1 8 14 46
43 2 2 1 1 12 47 20
44 2 2 1 1 7 44 16
45 2 2 1 1 11 47 12
46 2 2 1 1 7 15 44
47 2 2 1 1 11 18 45
48 2 2 1 1 7 8 46
49 2 2 1 1 7 46 15
50 2 2 1 1 1 16 44
51 2 2 1 1 2 19 45
52 2 2 1 1 19 20 47
53 2 2 1 1 19 47 45
54 2 2 1 1 11 45 47
55 2 2 1 1 26 38 41
56 2 2 1 1 5 34 33
57 2 2 1 1 5 32 35
58 2 2 1 1 23 29 43
59 2 2 1 1 25 39 43
60 2 2 1 1 24 41 38
61 2 2 1 1 26 36 38
62 2 2 1 1 22 43 39
63 2 2 1 1 23 38 29
64 2 2 1 1 25 42 39
65 2 2 1 1 26 41 40
66 2 2 1 1 13 40 41
67 2 2 1 1 21 39 42
68 2 2 1 1 7 32 9
69 2 2 1 1 8 10 30
70 2 2 1 1 9 33 11
71 2 2 1 1 10 12 31
72 2 2 1 1 16 17 35
73 2 2 1 1 17 18 34
74 2 2 1 1 7 9 27
75 2 2 1 1 8 27 10
76 2 2 1 1 9 10 27
77 2 2 1 1 9 28 10
78 2 2 1 1 9 11 28
79 2 2 1 1 10 28 12
$EndElements
This diff is collapsed.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \ingroup TwoPTests
* \brief The properties for the incompressible 2p-boxdfm test
*/
#ifndef DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH
#define DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH
#include <dumux/material/components/trichloroethene.hh>
#include <dumux/material/components/simpleh2o.hh>
#include <dumux/material/fluidsystems/1pliquid.hh>
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/porousmediumflow/boxdfm/model.hh>
#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh>
#include "spatialparams.hh"
#ifndef GRIDTYPE
#define GRIDTYPE Dune::YaspGrid<2>
#endif
namespace Dumux
{
// forward declarations
template<class TypeTag> class TwoPTestProblem;
namespace Properties
{
// we need to derive first from twop and then from the box-dfm Model
// because the flux variables cache type of TwoP is overwritten in BoxDfmModel
NEW_TYPE_TAG(TwoPIncompressibleBoxDfm, INHERITS_FROM(TwoP, BoxDfmModel));
// Set the grid type
SET_TYPE_PROP(TwoPIncompressibleBoxDfm, Grid, GRIDTYPE);
// Set the problem type
SET_TYPE_PROP(TwoPIncompressibleBoxDfm, Problem, TwoPTestProblem<TypeTag>);
// Set the spatial parameters
SET_PROP(TwoPIncompressibleBoxDfm, SpatialParams)
{
private:
using FVG = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
public:
using type = TwoPTestSpatialParams<FVG, Scalar>;
};
// the local residual containing the analytic derivative methods
SET_TYPE_PROP(TwoPIncompressibleBoxDfm, LocalResidual, TwoPIncompressibleLocalResidual<TypeTag>);
// Set the fluid system
SET_PROP(TwoPIncompressibleBoxDfm, FluidSystem)
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >;
using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >;
using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
};
// Enable caching
SET_BOOL_PROP(TwoPIncompressibleBoxDfm, EnableGridVolumeVariablesCache, false);
SET_BOOL_PROP(TwoPIncompressibleBoxDfm, EnableGridFluxVariablesCache, false);
SET_BOOL_PROP(TwoPIncompressibleBoxDfm, EnableFVGridGeometryCache, false);
// Enable the box-interface solver
SET_BOOL_PROP(TwoPIncompressibleBoxDfm, EnableBoxInterfaceSolver, true);
} // end namespace Properties
/*!
* \ingroup TwoPTests
* \brief The incompressible 2p-boxdfm test problem.
*/
template<class TypeTag>
class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag>
{
using ParentType = PorousMediumFlowProblem<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using SubControlVolume = typename FVGridGeometry::SubControlVolume;
// some indices for convenience
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
enum
{
pressureH2OIdx = Indices::pressureIdx,
saturationDNAPLIdx = Indices::saturationIdx,
contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx,
waterPhaseIdx = FluidSystem::phase0Idx,
dnaplPhaseIdx = FluidSystem::phase1Idx
};
static constexpr Scalar eps_ = 1e-6;
static constexpr int dimWorld = GridView::dimensionworld;
public:
//! The constructor
TwoPTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry)
{}
/*!
* \brief Return how much the domain is extruded at a given sub-control volume.
*
* Here, we extrude the fracture scvs by half the aperture
*/
template<class ElementSolution>
Scalar extrusionFactor(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
{
// In the box-scheme, we compute fluxes etc element-wise,
// thus per element we compute only half a fracture !!!
static const Scalar aHalf = getParam<Scalar>("SpatialParams.FractureAperture")/2.0;
if (scv.isOnFracture())
return aHalf;
return 1.0;
}
/*!
* \brief Specifies which kind of boundary condition should be
* used for which equation on a given boundary segment
*
* \param values Stores the value of the boundary type
* \param globalPos The global position
*/
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
{
BoundaryTypes values;
values.setAllNeumann();
if (globalPos[0] > this->fvGridGeometry().bBoxMax()[0] - eps_ || globalPos[dimWorld-1] < 0.25)
values.setAllDirichlet();
return values;
}
/*!
* \brief Evaluates the boundary conditions for a Dirichlet
* boundary segment
*
* \param values Stores the Dirichlet values for the conservation equations in
* \f$ [ \textnormal{unit of primary variable} ] \f$
* \param globalPos The global position
*/
PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
{ return initialAtPos(globalPos); }
/*!
* \brief Evaluate the boundary conditions for a neumann
* boundary segment.
*
* \param values Stores the Neumann values for the conservation equations in
* \f$ [ \textnormal{unit of conserved quantity} / (m^(dim-1) \cdot s )] \f$
* \param globalPos The position of the integration point of the boundary segment.
*
* For this method, the \a values parameter stores the mass flux
* in normal direction of each phase. Negative values mean influx.
*/
NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
{
NumEqVector fluxes(0.0);
if (isInInjectionPatch_(globalPos)) fluxes[contiDNAPLEqIdx] = -0.04; // kg / s / m^2
return fluxes;
}
/*!
* \brief Evaluates the initial values for a control volume
*
* \param values Stores the initial values for the conservation equations in
* \f$ [ \textnormal{unit of primary variables} ] \f$
* \param globalPos The global position
*/
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
{
PrimaryVariables values;
values[pressureH2OIdx] = 1e5 + 9.81*1000*(1.0-globalPos[dimWorld-1]);
values[saturationDNAPLIdx] = 0;
return values;
}
//! Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem.
Scalar temperature() const { return 293.15; /* 10°C */ }
private:
bool isInInjectionPatch_(const GlobalPosition& globalPos) const
{
bool isInPatch = true;
if ( !(globalPos[dimWorld-1] > this->fvGridGeometry().bBoxMax()[dimWorld-1] - eps_) )
isInPatch = false;
for (int dir = 0; dir < dimWorld-1; ++dir)
if (globalPos[dir] < 0.25 || globalPos[dir] > 0.5)
isInPatch = false;
return isInPatch;
}
};
} // end namespace Dumux
#endif
This diff is collapsed.
[TimeLoop]
DtInitial = 200 # [s]
TEnd = 2000 # [s]
[Grid]
LowerLeft = 0 0
UpperRight = 1 1
Cells = 20 20
[SpatialParams]
FractureAperture = 1e-3
[Problem]
Name = 2pboxdfm_quads_yasp
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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