25#ifndef DUMUX_STAGGERD_FV_PROBLEM_HH
26#define DUMUX_STAGGERD_FV_PROBLEM_HH
28#include <dune/common/rangeutilities.hh>
46template<
class TypeTag>
52 using Element =
typename GridView::template Codim<0>::Entity;
55 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
56 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
57 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
58 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
62 using FVElementGeometry =
typename GridGeometry::LocalView;
63 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
64 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
67 using CoordScalar =
typename GridView::ctype;
68 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
70 static constexpr auto cellCenterIdx = GridGeometry::cellCenterIdx();
71 static constexpr auto faceIdx = GridGeometry::faceIdx();
73 static constexpr auto numEqCellCenter = getPropValue<TypeTag, Properties::NumEqCellCenter>();
74 static constexpr auto numEqFace = getPropValue<TypeTag, Properties::NumEqFace>();
96 const FVElementGeometry& fvGeometry,
97 const SubControlVolume& scv,
119 template<
class ElementVolumeVariables,
class ElementFaceVariables,
class Entity>
120 NumEqVector
source(
const Element &element,
121 const FVElementGeometry& fvGeometry,
122 const ElementVolumeVariables& elemVolVars,
123 const ElementFaceVariables& elementFaceVars,
124 const Entity &e)
const
127 return this->
asImp_().sourceAtPos(e.center());
146 const FVElementGeometry& fvGeometry,
147 const ElementVolumeVariables& elemVolVars,
148 const ElementFaceVariables& elemFaceVars,
149 const SubControlVolumeFace& scvf)
const
152 return this->
asImp_().neumannAtPos(scvf.ipGlobal());
161 template<
class Entity>
162 PrimaryVariables
initial(
const Entity& entity)
const
164 return this->
asImp_().initialAtPos(entity.center());
171 template<
class SolutionVector>
174 sol[cellCenterIdx].resize(this->
gridGeometry().numCellCenterDofs());
175 sol[faceIdx].resize(this->
gridGeometry().numFaceDofs());
178 for (
const auto& element : elements(this->
gridGeometry().gridView()))
180 fvGeometry.bindElement(element);
183 for (
auto&& scv : scvs(fvGeometry))
187 auto initPriVars = this->
asImp_().initial(scv);
188 this->
asImp_().applyInitialCellCenterSolution(sol, scv, initPriVars);
192 for(
auto&& scvf : scvfs(fvGeometry))
194 auto initPriVars = this->
asImp_().initial(scvf);
195 this->
asImp_().applyInitialFaceSolution(sol, scvf, initPriVars);
202 template<
class SolutionVector>
204 const SubControlVolume& scv,
205 const PrimaryVariables& initSol)
const
209 static constexpr auto offset = PrimaryVariables::dimension - numEqCellCenter;
211 for(
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
212 sol[cellCenterIdx][scv.dofIndex()][pvIdx] = initSol[pvIdx + offset];
216 template<
class SolutionVector>
218 const SubControlVolumeFace& scvf,
219 const PrimaryVariables& initSol)
const
221 for(
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
222 sol[faceIdx][scvf.dofIndex()][pvIdx] = initSol[pvIdx];
A helper to deduce a vector with the same size as numbers of equations.
Base class for all finite volume problems that are parameterized.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:46
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:180
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:55
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:544
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:540
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism)
Definition: common/fvproblem.hh:549
Base class for all finite-volume problems using spatial parameters.
Definition: fvproblemwithspatialparams.hh:41
Base class for all staggered finite-volume problems.
Definition: staggeredfvproblem.hh:48
NumEqVector neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf) const
Evaluate the boundary conditions for a neumann boundary segment.
Definition: staggeredfvproblem.hh:145
bool isDirichletCell(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, int pvIdx) const
Returns whether a fixed Dirichlet value shall be used at a given cell.
Definition: staggeredfvproblem.hh:95
StaggeredFVProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string ¶mGroup="")
Constructor.
Definition: staggeredfvproblem.hh:82
PrimaryVariables initial(const Entity &entity) const
Evaluate the initial value for an element (for cell-centered primary variables) or face (for velociti...
Definition: staggeredfvproblem.hh:162
void applyInitialFaceSolution(SolutionVector &sol, const SubControlVolumeFace &scvf, const PrimaryVariables &initSol) const
Applies the initial face solution.
Definition: staggeredfvproblem.hh:217
void applyInitialCellCenterSolution(SolutionVector &sol, const SubControlVolume &scv, const PrimaryVariables &initSol) const
Applies the initial cell center solution.
Definition: staggeredfvproblem.hh:203
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: staggeredfvproblem.hh:172
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elementFaceVars, const Entity &e) const
Evaluate the source term for all phases within a given sub-control-volume (-face).
Definition: staggeredfvproblem.hh:120
Declares all properties used in Dumux.