3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Loading...
Searching...
No Matches
problem_tracer_bulk.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24
25#ifndef DUMUX_TEST_TPFAFACETCOUPLING_TRACER_BULK_PROBLEM_HH
26#define DUMUX_TEST_TPFAFACETCOUPLING_TRACER_BULK_PROBLEM_HH
27
28#include <dune/alugrid/grid.hh>
29
33
36
38
40#include "tracerfluidsystem.hh"
41#include "tracermodeltraits.hh"
42
43namespace Dumux {
44
45template <class TypeTag>
47
48namespace Properties {
49// Create new type tags
50namespace TTag {
51struct TracerTestBulk { using InheritsFrom = std::tuple<Tracer>; };
52
53// define the type tags
54struct TracerBulkTpfa { using InheritsFrom = std::tuple<CCTpfaFacetCouplingModel, TracerTestBulk>; };
55struct TracerBulkMpfa { using InheritsFrom = std::tuple<CCMpfaFacetCouplingModel, TracerTestBulk>; };
56struct TracerBulkBox { using InheritsFrom = std::tuple<BoxFacetCouplingModel, TracerTestBulk>; };
57} // end namespace TTag
58
59// Set the grid type
60template<class TypeTag>
61struct Grid<TypeTag, TTag::TracerTestBulk> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; };
62
64template<class TypeTag>
66template<class TypeTag>
68
69// Set the problem property
70template<class TypeTag>
71struct Problem<TypeTag, TTag::TracerTestBulk> { using type = TracerBulkProblem<TypeTag>; };
72
73// Set the spatial parameters
74template<class TypeTag>
81
82// Define whether mole(true) or mass (false) fractions are used
83template<class TypeTag>
84struct UseMoles<TypeTag, TTag::TracerTestBulk> { static constexpr bool value = false; };
85
87template<class TypeTag>
95
96// use the test-specific fluid system
97template<class TypeTag>
98struct FluidSystem<TypeTag, TTag::TracerTestBulk> { using type = TracerFluidSystem<TypeTag>; };
99} // end namespace Properties
100
101
106template <class TypeTag>
108{
109 using ParentType = PorousMediumFlowProblem<TypeTag>;
110
115 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
116 using FVElementGeometry = typename GridGeometry::LocalView;
122
124 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
125
126 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
127 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
128
129public:
130 using typename ParentType::SpatialParams;
131
132 TracerBulkProblem(std::shared_ptr<const GridGeometry> gridGeometry,
133 std::shared_ptr<SpatialParams> spatialParams,
134 std::shared_ptr<CouplingManager> couplingManager,
135 const std::string& paramGroup = "")
137 , couplingManagerPtr_(couplingManager)
138 , initialMassFraction_(getParamFromGroup<Scalar>(paramGroup, "Problem.ContaminationMassFraction"))
139 {
140 // stating in the console whether mole or mass fractions are used
141 const auto problemName = getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
142 std::cout<< "problem " << problemName << " uses " << (useMoles ? "mole" : "mass") << " fractions" << '\n';
143 problemName_ = getParamFromGroup<std::string>(this->paramGroup(), "Vtk.OutputName") + "_" + problemName;
144 }
145
147 const std::string& name() const
148 { return problemName_; }
149
156 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
157 {
158 BoundaryTypes values;
159 values.setAllNeumann();
160 return values;
161 }
162
164 BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const
165 {
166 BoundaryTypes values;
167 values.setAllNeumann();
168 return values;
169 }
170
176 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
177 {
178 if (isInContaminatedRegion_(globalPos))
179 return PrimaryVariables(initialMassFraction_);
180 return PrimaryVariables(0.0);
181 }
182
195 template<class ElementVolumeVariables, class ElementFluxVarsCache>
196 NumEqVector neumann(const Element& element,
197 const FVElementGeometry& fvGeometry,
198 const ElementVolumeVariables& elemVolVars,
199 const ElementFluxVarsCache& elemFluxVarsCache,
200 const SubControlVolumeFace& scvf) const
201 {
202 // get the volume flux on this segment
203 const auto flux = this->spatialParams().volumeFlux(element, fvGeometry, elemVolVars, scvf);
204 if (flux > 0.0)
205 {
206 const auto& insideVolVars = elemVolVars[fvGeometry.scv(scvf.insideScvIdx())];
207 const auto tracerFlux = insideVolVars.massFraction(/*phaseIdx*/0, /*compIdx*/0)*flux;
208 return NumEqVector(tracerFlux);
209 }
210
211 return NumEqVector(0.0);
212 }
213
215 const CouplingManager& couplingManager() const
216 { return *couplingManagerPtr_; }
217
218private:
219 bool isInContaminatedRegion_(const GlobalPosition& globalPos) const
220 {
221 return globalPos[0] > 0.75 && globalPos[0] < 1.3
222 && globalPos[1] > 5.3 && globalPos[1] < 5.8;
223 }
224
225 std::shared_ptr<CouplingManager> couplingManagerPtr_;
226 Scalar initialMassFraction_;
227 std::string problemName_;
228};
229
230} // end namespace Dumux
231
232#endif
Fluid system for the tracer facet coupling test.
The model traits used in the tracer facet coupling test.
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:438
make the local view function available whenever we use the grid geometry
Definition adapt.hh:29
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:153
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 common/properties.hh:47
Type tag for numeric models.
Definition grid.hh:35
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition common/fvproblem.hh:592
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition common/fvproblem.hh:588
The DUNE grid type.
Definition common/properties.hh:57
Traits class encapsulating model specifications.
Definition common/properties.hh:65
Property to specify the type of a problem which has to be solved.
Definition common/properties.hh:69
Property whether to use moles or kg as amount unit for balance equations.
Definition common/properties.hh:102
The type for the calculation the advective fluxes.
Definition common/properties.hh:208
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
Evaluates a user given velocity field.
Definition stationaryvelocityfield.hh:41
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition dumux/porousmediumflow/problem.hh:146
GetPropType< TypeTag, Properties::SpatialParams > SpatialParams
Export spatial parameter type.
Definition dumux/porousmediumflow/problem.hh:58
PorousMediumFlowProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< SpatialParams > spatialParams, const std::string &paramGroup="")
Constructor, passing the spatial parameters.
Definition dumux/porousmediumflow/problem.hh:67
The problem for the bulk domain of the tracer facet coupling test.
Definition problem_tracer_bulk.hh:108
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVarsCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition problem_tracer_bulk.hh:196
const CouplingManager & couplingManager() const
Returns reference to the coupling manager.
Definition problem_tracer_bulk.hh:215
const std::string & name() const
The problem name.
Definition problem_tracer_bulk.hh:147
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition problem_tracer_bulk.hh:156
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition problem_tracer_bulk.hh:176
TracerBulkProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< SpatialParams > spatialParams, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
Definition problem_tracer_bulk.hh:132
BoundaryTypes interiorBoundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
Specifies the type of interior boundary condition at a given position.
Definition problem_tracer_bulk.hh:164
Definition problem_tracer_bulk.hh:51
std::tuple< Tracer > InheritsFrom
Definition problem_tracer_bulk.hh:51
Definition problem_tracer_bulk.hh:54
std::tuple< CCTpfaFacetCouplingModel, TracerTestBulk > InheritsFrom
Definition problem_tracer_bulk.hh:54
Definition problem_tracer_bulk.hh:55
std::tuple< CCMpfaFacetCouplingModel, TracerTestBulk > InheritsFrom
Definition problem_tracer_bulk.hh:55
Definition problem_tracer_bulk.hh:56
std::tuple< BoxFacetCouplingModel, TracerTestBulk > InheritsFrom
Definition problem_tracer_bulk.hh:56
Dune::ALUGrid< 2, 2, Dune::simplex, Dune::conforming > type
Definition problem_tracer_bulk.hh:61
StationaryVelocityField< GetPropType< TypeTag, Properties::Scalar > > type
Definition problem_tracer_bulk.hh:65
StationaryVelocityField< GetPropType< TypeTag, Properties::Scalar > > type
Definition problem_tracer_bulk.hh:67
TracerBulkProblem< TypeTag > type
Definition problem_tracer_bulk.hh:71
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition problem_tracer_bulk.hh:78
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition problem_tracer_bulk.hh:77
TracerSpatialParams< GridGeometry, Scalar > type
Definition problem_tracer_bulk.hh:79
static constexpr bool value
Definition problem_tracer_bulk.hh:84
TracerTestModelTraits< FluidSystem::numComponents, getPropValue< TypeTag, Properties::UseMoles >()> type
Definition problem_tracer_bulk.hh:93
TracerFluidSystem< TypeTag > type
Definition problem_tracer_bulk.hh:98
Definition of the spatial parameters for the tracer problem.
Definition multidomain/facet/tracer_tracer/spatialparams_tracer.hh:41
Custom model traits disabling diffusion.
Definition tracermodeltraits.hh:35
A simple fluid system with one tracer component.
Definition 1ptracer/problem_tracer.hh:89
Properties (and default properties) for all models using the box scheme together with coupling across...
Properties (and default properties) for all models using cell-centered finite volume scheme with MPFA...
Properties (and default properties) for all models using cell-centered finite volume scheme with TPFA...
Adaption of the fully implicit scheme to the tracer transport model.
Base class for all porous media problems.
Fluid system base class.
Definition of the spatial parameters for the tracer problem.