3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
problem_fracture.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 *****************************************************************************/
25#ifndef DUMUX_FRACTURE_PROBLEM_HH
26#define DUMUX_FRACTURE_PROBLEM_HH
27
28#include <dune/foamgrid/foamgrid.hh>
29
33
37
40
41#include "spatialparams.hh"
42
43namespace Dumux {
44// forward declaration
45template <class TypeTag> class FractureProblem;
46
47namespace Properties {
48
49// Create new type tags
50namespace TTag {
51struct Fracture { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; };
52} // end namespace TTag
53
54// Set the grid type
55template<class TypeTag>
56struct Grid<TypeTag, TTag::Fracture> { using type = Dune::FoamGrid<2, 3>; };
57
58template<class TypeTag>
59struct EnableGridGeometryCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; };
60template<class TypeTag>
61struct EnableGridVolumeVariablesCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; };
62template<class TypeTag>
63struct EnableGridFluxVariablesCache<TypeTag, TTag::Fracture> { static constexpr bool value = true; };
64template<class TypeTag>
65struct SolutionDependentAdvection<TypeTag, TTag::Fracture> { static constexpr bool value = false; };
66template<class TypeTag>
67struct SolutionDependentMolecularDiffusion<TypeTag, TTag::Fracture> { static constexpr bool value = false; };
68template<class TypeTag>
69struct SolutionDependentHeatConduction<TypeTag, TTag::Fracture> { static constexpr bool value = false; };
70
71// Set the problem property
72template<class TypeTag>
73struct Problem<TypeTag, TTag::Fracture> { using type = FractureProblem<TypeTag>; };
74
75// the fluid system
76template<class TypeTag>
77struct FluidSystem<TypeTag, TTag::Fracture>
78{
81};
82
83// Set the problem property
84template<class TypeTag>
85struct LocalResidual<TypeTag, TTag::Fracture> { using type = OnePIncompressibleLocalResidual<TypeTag>; };
86
87// Set the spatial parameters
88template<class TypeTag>
89struct SpatialParams<TypeTag, TTag::Fracture>
90{
93};
94} // end namespace Properties
95
100template <class TypeTag>
101class FractureProblem : public PorousMediumFlowProblem<TypeTag>
102{
103 using ParentType = PorousMediumFlowProblem<TypeTag>;
111 using GridView = typename GridGeometry::GridView;
112 using FVElementGeometry = typename GridGeometry::LocalView;
113 using SubControlVolume = typename GridGeometry::SubControlVolume;
116 using Element = typename GridView::template Codim<0>::Entity;
117 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
118
120
121public:
122 FractureProblem(std::shared_ptr<const GridGeometry> gridGeometry,
123 std::shared_ptr<typename ParentType::SpatialParams> spatialParams,
124 std::shared_ptr<CouplingManager> couplingManager,
125 const std::string& paramGroup = "Fracture")
127 , couplingManager_(couplingManager)
128 {
129 // read parameters from input file
130 name_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
131 }
132
139 template<class ElementSolution>
140 Scalar extrusionFactor(const Element &element,
141 const SubControlVolume &scv,
142 const ElementSolution& elemSol) const
143 {
144 static const Scalar aperture = getParamFromGroup<Scalar>("Fracture", "SpatialParams.Aperture");
145 return aperture;
146 }
147
151 // \{
152
158 const std::string& name() const
159 { return name_; }
160
165 Scalar temperature() const
166 { return 273.15 + 37.0; } // Body temperature
167
168 // \}
172 // \{
173
180 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
181 {
182 BoundaryTypes values;
183 values.setAllNeumann();
184 if (globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_)
185 values.setAllDirichlet();
186 else if (globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
187 values.setAllDirichlet();
188 return values;
189 }
190
198 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
199 {
200 if (globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_)
201 return PrimaryVariables(2e5);
202 else // (globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
203 return PrimaryVariables(1e5);
204 }
205
206 // \}
207
211 // \{
212
223 void addPointSources(std::vector<PointSource>& pointSources) const
224 { pointSources = this->couplingManager().lowDimPointSources(); }
225
244 template<class ElementVolumeVariables>
245 void pointSource(PointSource& source,
246 const Element &element,
247 const FVElementGeometry& fvGeometry,
248 const ElementVolumeVariables& elemVolVars,
249 const SubControlVolume &scv) const
250 {
251 // compute source at every integration point
252 const Scalar pressure3D = this->couplingManager().bulkPriVars(source.id())[Indices::pressureIdx];
253 const Scalar pressure1D = this->couplingManager().lowDimPriVars(source.id())[Indices::pressureIdx];
254
255 // calculate the source
256 const Scalar meanDistance = this->couplingManager().averageDistance(source.id());
257 static const Scalar matrixPerm = getParamFromGroup<Scalar>("Matrix", "SpatialParams.Permeability");
258 static const Scalar rho = getParam<Scalar>("Component.LiquidDensity");
259 static const Scalar mu = getParam<Scalar>("Component.LiquidKinematicViscosity")*rho;
260 const Scalar sourceValue = rho*(pressure3D - pressure1D)/meanDistance*matrixPerm/mu;
261 source = sourceValue*source.quadratureWeight()*source.integrationElement();
262 }
263
272 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
273 { return PrimaryVariables(1e5); }
274
275 // \}
276
279 void computeSourceIntegral(const SolutionVector& sol, const GridVariables& gridVars)
280 {
281 NumEqVector source(0.0);
282 for (const auto& element : elements(this->gridGeometry().gridView()))
283 {
284 auto fvGeometry = localView(this->gridGeometry());
285 fvGeometry.bindElement(element);
286
287 auto elemVolVars = localView(gridVars.curGridVolVars());
288 elemVolVars.bindElement(element, fvGeometry, sol);
289
290 for (auto&& scv : scvs(fvGeometry))
291 {
292 auto pointSources = this->scvPointSources(element, fvGeometry, elemVolVars, scv);
293 pointSources *= scv.volume()*elemVolVars[scv].extrusionFactor();
294 source += pointSources;
295 }
296 }
297
298 std::cout << "Global integrated source (1D): " << source << '\n';
299 }
300
302 const CouplingManager& couplingManager() const
303 { return *couplingManager_; }
304
305private:
306
307 static constexpr Scalar eps_ = 1.5e-7;
308 std::string name_;
309
310 std::shared_ptr<CouplingManager> couplingManager_;
311};
312
313} // end namespace Dumux
314
315#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Properties for all models using cell-centered finite volume scheme with TPFA.
Setting constant fluid properties via the input file.
A liquid phase consisting of a single component.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
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
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
NumEqVector scvPointSources(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Adds contribution of point sources for a specific sub control volume to the values....
Definition: common/fvproblem.hh:435
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:592
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: common/fvproblem.hh:327
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
A point source base class.
Definition: pointsource.hh:49
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Definition: common/properties.hh:91
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
specifies if data on flux vars should be saved (faster, but more memory consuming)
Definition: common/properties.hh:188
specifies if the parameters for the advective fluxes depend on the solution
Definition: common/properties.hh:210
specifies if the parameters for the diffusive fluxes depend on the solution
Definition: common/properties.hh:214
specifies if the parameters for the heat conduction fluxes depend on the solution
Definition: common/properties.hh:218
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
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
Definition: multidomain/couplingmanager.hh:46
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
Definition: 1p/incompressiblelocalresidual.hh:41
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
Exact solution 1D-3D.
Definition: test/porousmediumflow/2p/implicit/fracture/problem.hh:109
void pointSource(PointSource &source, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluates the point sources (added by addPointSources) for all phases within a given sub-control volu...
Definition: problem_fracture.hh:245
void addPointSources(std::vector< PointSource > &pointSources) const
Applies a vector of point sources which are possibly solution dependent.
Definition: problem_fracture.hh:223
FractureProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< typename ParentType::SpatialParams > spatialParams, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="Fracture")
Definition: problem_fracture.hh:122
Scalar temperature() const
Returns the temperature within the domain in [K].
Definition: problem_fracture.hh:165
const std::string & name() const
The problem name.
Definition: problem_fracture.hh:158
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet control volume.
Definition: problem_fracture.hh:198
void computeSourceIntegral(const SolutionVector &sol, const GridVariables &gridVars)
Definition: problem_fracture.hh:279
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_fracture.hh:180
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: problem_fracture.hh:272
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: problem_fracture.hh:140
const CouplingManager & couplingManager() const
Get the coupling manager.
Definition: problem_fracture.hh:302
Definition: problem_fracture.hh:51
std::tuple< OneP, CCTpfaModel > InheritsFrom
Definition: problem_fracture.hh:51
Dune::FoamGrid< 2, 3 > type
Definition: problem_fracture.hh:56
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: problem_fracture.hh:79
Definition of the spatial parameters for the matrix and fracture problem.
Definition: multidomain/embedded/2d3d/1p_1p/spatialparams.hh:39
Declares all properties used in Dumux.
A single-phase, isothermal flow model using the fully implicit scheme.
Base class for all porous media problems.
Element-wise calculation of the residual and its derivatives for a single-phase, incompressible,...
Definition of the spatial parameters for the MaxwellStefan problem.