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>();
95 const FVElementGeometry& fvGeometry,
96 const SubControlVolume& scv,
118 template<
class ElementVolumeVariables,
class ElementFaceVariables,
class Entity>
119 NumEqVector
source(
const Element &element,
120 const FVElementGeometry& fvGeometry,
121 const ElementVolumeVariables& elemVolVars,
122 const ElementFaceVariables& elementFaceVars,
123 const Entity &e)
const
126 return asImp_().sourceAtPos(e.center());
145 const FVElementGeometry& fvGeometry,
146 const ElementVolumeVariables& elemVolVars,
147 const ElementFaceVariables& elemFaceVars,
148 const SubControlVolumeFace& scvf)
const
151 return asImp_().neumannAtPos(scvf.ipGlobal());
160 template<
class Entity>
161 PrimaryVariables
initial(
const Entity& entity)
const
163 return asImp_().initialAtPos(entity.center());
170 template<
class SolutionVector>
173 sol[cellCenterIdx].resize(this->
gridGeometry().numCellCenterDofs());
174 sol[faceIdx].resize(this->
gridGeometry().numFaceDofs());
176 for (
const auto& element : elements(this->
gridGeometry().gridView()))
179 fvGeometry.bindElement(element);
182 for (
auto&& scv : scvs(fvGeometry))
186 auto initPriVars =
asImp_().initial(scv);
187 asImp_().applyInitialCellCenterSolution(sol, scv, initPriVars);
191 for(
auto&& scvf : scvfs(fvGeometry))
193 auto initPriVars =
asImp_().initial(scvf);
194 asImp_().applyInitialFaceSolution(sol, scvf, initPriVars);
201 template<
class SolutionVector>
203 const SubControlVolume& scv,
204 const PrimaryVariables& initSol)
const
208 static constexpr auto offset = PrimaryVariables::dimension - numEqCellCenter;
210 for(
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
211 sol[cellCenterIdx][scv.dofIndex()][pvIdx] = initSol[pvIdx + offset];
215 template<
class SolutionVector>
217 const SubControlVolumeFace& scvf,
218 const PrimaryVariables& initSol)
const
220 for(
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
221 sol[faceIdx][scvf.dofIndex()][pvIdx] = initSol[pvIdx];
227 {
return *
static_cast<Implementation *
>(
this); }
231 {
return *
static_cast<const Implementation *
>(
this); }
A helper to deduce a vector with the same size as numbers of equations.
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
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
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:579
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:575
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:144
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:94
const Implementation & asImp_() const
Returns the implementation of the problem (i.e. static polymorphism)
Definition: staggeredfvproblem.hh:230
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:161
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism)
Definition: staggeredfvproblem.hh:226
void applyInitialFaceSolution(SolutionVector &sol, const SubControlVolumeFace &scvf, const PrimaryVariables &initSol) const
Applys the initial face solution.
Definition: staggeredfvproblem.hh:216
void applyInitialCellCenterSolution(SolutionVector &sol, const SubControlVolume &scv, const PrimaryVariables &initSol) const
Applys the initial cell center solution.
Definition: staggeredfvproblem.hh:202
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: staggeredfvproblem.hh:171
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:119
Base class for all finite volume problems.
Declares all properties used in Dumux.