26#ifndef DUMUX_ONEP_TUBES_TEST_PROBLEM_HH
27#define DUMUX_ONEP_TUBES_TEST_PROBLEM_HH
29#include <dune/localfunctions/lagrange/pqkfactory.hh>
30#include <dune/geometry/quadraturerules.hh>
33#include <dune/foamgrid/foamgrid.hh>
50template <
class TypeTag>
51class TubesTestProblem;
64template<
class TypeTag>
65struct Grid<TypeTag, TTag::TubesTest> {
using type = Dune::FoamGrid<1, 3>; };
73#pragma GCC diagnostic push
74#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
76template<
class TypeTag>
80 static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
84 using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
91template<
class TypeTag>
95 static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>();
99 using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
105#pragma GCC diagnostic pop
108template<
class TypeTag>
112template<
class TypeTag>
121template<
class TypeTag>
134template <
class TypeTag>
143 static const int dim = GridView::dimension;
144 static const int dimWorld = GridView::dimensionworld;
149 conti0EqIdx = Indices::conti0EqIdx,
150 pressureIdx = Indices::pressureIdx
156 using Element =
typename GridView::template Codim<0>::Entity;
160 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
161 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
169 name_ = getParam<std::string>(
"Problem.Name");
173 for (
const auto& element : elements(
gridGeometry->gridView()))
174 hMax_ = std::max(element.geometry().volume(), hMax_);
187 const std::string&
name()
const
197 {
return 273.15 + 37.0; }
208 template<
class ElementSolution>
210 const SubControlVolume &scv,
211 const ElementSolution& elemSol)
const
214 return M_PI*radius*radius;
231 BoundaryTypes bcTypes;
232 bcTypes.setAllDirichlet();
245 return PrimaryVariables(0.0);
273 NumEqVector
source(
const Element &element,
274 const FVElementGeometry& fvGeometry,
275 const ElementVolumeVariables& elemVolVars,
276 const SubControlVolume &scv)
const
280 const auto& globalPos = scv.center();
281 const auto& volVars = elemVolVars[scv];
285 if (globalPos[2] > 0.5 - eps_)
286 source[conti0EqIdx] = K/volVars.viscosity()*volVars.density()
287 *4.0*4.0*M_PI*M_PI*sin(4.0*M_PI*globalPos[2]);
290 source[conti0EqIdx] = K/volVars.viscosity()*volVars.density()
291 *4.0*4.0*M_PI*M_PI*sin(4.0*M_PI*globalPos[2])/3.0;
304 return PrimaryVariables(0.0);
312 Scalar lTwoNorm = 0.0;
315 const auto& quad = Dune::QuadratureRules<Scalar, dim>::rule(Dune::GeometryType(1), 1);
318 for (
const auto& element : elements(gg.gridView()))
320 const auto eIdx = gg.elementMapper().index(element);
321 const auto geometry = element.geometry();
322 for(
auto&& qp : quad)
324 const auto globalPos = geometry.global(qp.position());
325 const Scalar pe = exactPressure_(globalPos);
326 const Scalar integrationElement = geometry.integrationElement(qp.position());
329 p = solution[eIdx][pressureIdx];
333 std::vector<Dune::FieldVector<Scalar, 1> > shapeValues;
334 const auto& localFiniteElement = feCache_.get(geometry.type());
335 localFiniteElement.localBasis().evaluateFunction(qp.position(), shapeValues);
336 for (
unsigned int i = 0; i < shapeValues.size(); ++i)
337 p += shapeValues[i]*solution[gg.dofMapper().subIndex(element, i, dim)][pressureIdx];
339 lTwoNorm += (p - pe)*(p - pe)*qp.weight()*integrationElement;
342 lTwoNorm = std::sqrt(lTwoNorm);
345 std::ofstream logFile;
346 logFile.open(this->
name() +
".log", std::ios::app);
347 logFile <<
"[ConvergenceTest] L2-norm(pressure) = " << lTwoNorm <<
" hMax = " << hMax_ << std::endl;
353 Scalar exactPressure_(
const GlobalPosition& globalPos)
const
356 return sin(4.0*M_PI*globalPos[2]);
359 static constexpr Scalar eps_ = 1e-8;
364 typename Dune::PQkLocalFiniteElementCache<Scalar, Scalar, dim, 1> feCache_;
An SCSG element mapper that sorts the indices in order to optimize the matrix sparsity pattern.
Element solution classes and factory functions.
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with TPFA.
The available discretization methods in Dumux.
Setting constant fluid properties via the input file.
A liquid phase consisting of a single component.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Dune::MultipleCodimMultipleGeomTypeMapper< GridView > ReorderingDofMapper
Definition: reorderingdofmapper.hh:191
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Definition: defaultmappertraits.hh:35
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
UndefinedProperty type
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
The type of the global finite volume geometry.
Definition: common/properties.hh:125
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
Base class for the finite volume geometry vector for box schemes This builds up the sub control volum...
Definition: discretization/box/fvgridgeometry.hh:73
The finite volume geometry (scvs and scvfs) for cell-centered TPFA models on a grid view This builds ...
Definition: discretization/cellcentered/tpfa/fvgridgeometry.hh:79
Definition: elementsolution.hh:33
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
A test problem for the 1p model: A pipe system with circular cross-section and a branching point embe...
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:136
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:243
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:302
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:196
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary cont...
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:229
Scalar extrusionFactor(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns how much the domain is extruded at a given sub-control volume.
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:209
TubesTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:166
void outputL2Norm(const SolutionVector solution) const
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:309
const std::string & name() const
The problem name.
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:187
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term for all phases within a given sub-control volume.
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:273
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:57
std::tuple< OneP > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:57
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:58
std::tuple< TubesTest, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:58
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:59
std::tuple< TubesTest, BoxModel > InheritsFrom
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:59
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:115
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:116
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/1p/implicit/network1d3d/problem.hh:124
A test problem for the 1p model: A pipe system with circular cross-section and a branching point embe...
Definition: porousmediumflow/1p/implicit/network1d3d/spatialparams.hh:43
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.