3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Loading...
Searching...
No Matches
problem_tracer_lowdim.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_LOWDIM_PROBLEM_HH
26#define DUMUX_TEST_TPFAFACETCOUPLING_TRACER_LOWDIM_PROBLEM_HH
27
28#include <dune/foamgrid/foamgrid.hh>
29
32
35
37
39#include "tracerfluidsystem.hh"
40#include "tracermodeltraits.hh"
41
42namespace Dumux {
43
44template <class TypeTag>
46
47namespace Properties {
48// Create new type tags
49namespace TTag {
50struct TracerTestLowDim { using InheritsFrom = std::tuple<Tracer>; };
51
52// define the type tags for both bulk and lowdim type tag here
53struct TracerLowDimTpfa { using InheritsFrom = std::tuple<TracerTestLowDim, CCTpfaModel>; };
54struct TracerLowDimMpfa { using InheritsFrom = std::tuple<TracerTestLowDim, CCTpfaModel>; };
55struct TracerLowDimBox { using InheritsFrom = std::tuple<TracerTestLowDim, BoxModel>; };
56} // end namespace TTag
57
58// Set the grid type
59template<class TypeTag>
60struct Grid<TypeTag, TTag::TracerTestLowDim> { using type = Dune::FoamGrid<1, 2>; };
61
62// Set the problem property
63template<class TypeTag>
64struct Problem<TypeTag, TTag::TracerTestLowDim> { using type = TracerLowDimProblem<TypeTag>; };
65
66// Set the spatial parameters
67template<class TypeTag>
74
75// Define whether mole(true) or mass (false) fractions are used
76template<class TypeTag>
77struct UseMoles<TypeTag, TTag::TracerTestLowDim> { static constexpr bool value = false; };
78
80template<class TypeTag>
88
89// use the test-specific fluid system
90template<class TypeTag>
91struct FluidSystem<TypeTag, TTag::TracerTestLowDim> { using type = TracerFluidSystem<TypeTag>; };
92} // end namespace Properties
93
94
99template <class TypeTag>
101{
102 using ParentType = PorousMediumFlowProblem<TypeTag>;
103
108 using FVElementGeometry = typename GridGeometry::LocalView;
109 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
115
117 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
118
119 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
120 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
121
122public:
123 using typename ParentType::SpatialParams;
124
125 TracerLowDimProblem(std::shared_ptr<const GridGeometry> gridGeometry,
126 std::shared_ptr<SpatialParams> spatialParams,
127 std::shared_ptr<CouplingManager> couplingManager,
128 const std::string& paramGroup = "")
130 , couplingManagerPtr_(couplingManager)
131 , aperture_(getParamFromGroup<Scalar>(paramGroup, "Problem.FractureAperture"))
132 {
133 // stating in the console whether mole or mass fractions are used
134 const auto problemName = getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
135 std::cout<< "problem " << problemName << " uses " << (useMoles ? "mole" : "mass") << " fractions" << '\n';
136 problemName_ = getParamFromGroup<std::string>(this->paramGroup(), "Vtk.OutputName") + "_" + problemName;
137 }
138
140 const std::string& name() const
141 { return problemName_; }
142
149 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
150 {
151 BoundaryTypes values;
152 values.setAllNeumann();
153 return values;
154 }
155
161 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
162 { return PrimaryVariables(0.0); }
163
169 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
170 { return initialAtPos(globalPos); }
171
173 template<class ElementVolumeVariables, class SubControlVolume>
174 NumEqVector source(const Element& element,
175 const FVElementGeometry& fvGeometry,
176 const ElementVolumeVariables& elemVolVars,
177 const SubControlVolume& scv) const
178 {
179 // evaluate sources from bulk domain
180 auto source = couplingManagerPtr_->evalSourcesFromBulk(element, fvGeometry, elemVolVars, scv);
181 source /= scv.volume()*elemVolVars[scv].extrusionFactor();
182 return source;
183 }
184
197 template<class ElementVolumeVariables, class ElementFluxVarsCache>
198 NumEqVector neumann(const Element& element,
199 const FVElementGeometry& fvGeometry,
200 const ElementVolumeVariables& elemVolVars,
201 const ElementFluxVarsCache& elemFluxVarsCache,
202 const SubControlVolumeFace& scvf) const
203 {
204 // get the volume flux on this segment
205 const auto flux = this->spatialParams().volumeFlux(element, fvGeometry, elemVolVars, scvf);
206 if (flux > 0.0)
207 {
208 const auto& insideVolVars = elemVolVars[fvGeometry.scv(scvf.insideScvIdx())];
209 const auto tracerFlux = insideVolVars.massFraction(/*phaseIdx*/0, /*compIdx*/0)*flux;
210 return NumEqVector(tracerFlux);
211 }
212
213 return NumEqVector(0.0);
214 }
215
217 Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const
218 { return aperture_; }
219
221 const CouplingManager& couplingManager() const
222 { return *couplingManagerPtr_; }
223
224private:
225 std::shared_ptr<CouplingManager> couplingManagerPtr_;
226 Scalar aperture_;
227 std::string problemName_;
228};
229
230} // end namespace Dumux
231
232#endif
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.
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 of the spatial parameters object.
Definition common/properties.hh:221
The type of the fluid system to use.
Definition common/properties.hh:223
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_lowdim.hh:101
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the source term at a given position.
Definition problem_tracer_lowdim.hh:174
TracerLowDimProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< SpatialParams > spatialParams, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
Definition problem_tracer_lowdim.hh:125
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_lowdim.hh:149
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition problem_tracer_lowdim.hh:161
const CouplingManager & couplingManager() const
Returns reference to the coupling manager.
Definition problem_tracer_lowdim.hh:221
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the Dirichlet boudnary conditions for a control volume.
Definition problem_tracer_lowdim.hh:169
const std::string & name() const
The problem name.
Definition problem_tracer_lowdim.hh:140
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_lowdim.hh:198
Scalar extrusionFactorAtPos(const GlobalPosition &globalPos) const
Sets the aperture as extrusion factor.
Definition problem_tracer_lowdim.hh:217
Definition problem_tracer_lowdim.hh:50
std::tuple< Tracer > InheritsFrom
Definition problem_tracer_lowdim.hh:50
Definition problem_tracer_lowdim.hh:53
std::tuple< TracerTestLowDim, CCTpfaModel > InheritsFrom
Definition problem_tracer_lowdim.hh:53
Definition problem_tracer_lowdim.hh:54
std::tuple< TracerTestLowDim, CCTpfaModel > InheritsFrom
Definition problem_tracer_lowdim.hh:54
Definition problem_tracer_lowdim.hh:55
std::tuple< TracerTestLowDim, BoxModel > InheritsFrom
Definition problem_tracer_lowdim.hh:55
Dune::FoamGrid< 1, 2 > type
Definition problem_tracer_lowdim.hh:60
TracerLowDimProblem< TypeTag > type
Definition problem_tracer_lowdim.hh:64
TracerSpatialParams< GridGeometry, Scalar > type
Definition problem_tracer_lowdim.hh:72
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition problem_tracer_lowdim.hh:71
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition problem_tracer_lowdim.hh:70
static constexpr bool value
Definition problem_tracer_lowdim.hh:77
TracerTestModelTraits< FluidSystem::numComponents, getPropValue< TypeTag, Properties::UseMoles >()> type
Definition problem_tracer_lowdim.hh:86
TracerFluidSystem< TypeTag > type
Definition problem_tracer_lowdim.hh:91
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
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.