24#ifndef DUMUX_STAGGERD_FV_PROBLEM_HH
25#define DUMUX_STAGGERD_FV_PROBLEM_HH
27#include <dune/common/rangeutilities.hh>
43template<
class TypeTag>
49 using Element =
typename GridView::template Codim<0>::Entity;
52 using GridVolumeVariables =
typename GridVariables::GridVolumeVariables;
53 using ElementVolumeVariables =
typename GridVolumeVariables::LocalView;
54 using GridFaceVariables =
typename GridVariables::GridFaceVariables;
55 using ElementFaceVariables =
typename GridFaceVariables::LocalView;
59 using FVElementGeometry =
typename GridGeometry::LocalView;
60 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
61 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
64 using CoordScalar =
typename GridView::ctype;
65 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
67 static constexpr auto cellCenterIdx = GridGeometry::cellCenterIdx();
68 static constexpr auto faceIdx = GridGeometry::faceIdx();
70 static constexpr auto numEqCellCenter = getPropValue<TypeTag, Properties::NumEqCellCenter>();
71 static constexpr auto numEqFace = getPropValue<TypeTag, Properties::NumEqFace>();
92 const FVElementGeometry& fvGeometry,
93 const SubControlVolume& scv,
115 template<
class ElementVolumeVariables,
class ElementFaceVariables,
class Entity>
116 NumEqVector
source(
const Element &element,
117 const FVElementGeometry& fvGeometry,
118 const ElementVolumeVariables& elemVolVars,
119 const ElementFaceVariables& elementFaceVars,
120 const Entity &e)
const
123 return asImp_().sourceAtPos(e.center());
142 const FVElementGeometry& fvGeometry,
143 const ElementVolumeVariables& elemVolVars,
144 const ElementFaceVariables& elemFaceVars,
145 const SubControlVolumeFace& scvf)
const
148 return asImp_().neumannAtPos(scvf.ipGlobal());
157 template<
class Entity>
158 PrimaryVariables
initial(
const Entity& entity)
const
160 return asImp_().initialAtPos(entity.center());
167 template<
class SolutionVector>
170 sol[cellCenterIdx].resize(this->
gridGeometry().numCellCenterDofs());
171 sol[faceIdx].resize(this->
gridGeometry().numFaceDofs());
173 for (
const auto& element : elements(this->
gridGeometry().gridView()))
176 fvGeometry.bindElement(element);
179 for (
auto&& scv : scvs(fvGeometry))
183 auto initPriVars =
asImp_().initial(scv);
184 asImp_().applyInitialCellCenterSolution(sol, scv, initPriVars);
188 for(
auto&& scvf : scvfs(fvGeometry))
190 auto initPriVars =
asImp_().initial(scvf);
191 asImp_().applyInitialFaceSolution(sol, scvf, initPriVars);
198 template<
class SolutionVector>
200 const SubControlVolume& scv,
201 const PrimaryVariables& initSol)
const
205 static constexpr auto offset = PrimaryVariables::dimension - numEqCellCenter;
207 for(
int pvIdx = 0; pvIdx < numEqCellCenter; ++pvIdx)
208 sol[cellCenterIdx][scv.dofIndex()][pvIdx] = initSol[pvIdx + offset];
212 template<
class SolutionVector>
214 const SubControlVolumeFace& scvf,
215 const PrimaryVariables& initSol)
const
217 for(
int pvIdx = 0; pvIdx < numEqFace; ++pvIdx)
218 sol[faceIdx][scvf.dofIndex()][pvIdx] = initSol[pvIdx];
224 {
return *
static_cast<Implementation *
>(
this); }
228 {
return *
static_cast<const Implementation *
>(
this); }
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
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
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
Base class for all staggered finite-volume problems.
Definition: staggeredfvproblem.hh:45
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:141
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:91
const Implementation & asImp_() const
Returns the implementation of the problem (i.e. static polymorphism)
Definition: staggeredfvproblem.hh:227
StaggeredFVProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string ¶mGroup="")
Constructor.
Definition: staggeredfvproblem.hh:79
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:158
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism)
Definition: staggeredfvproblem.hh:223
void applyInitialFaceSolution(SolutionVector &sol, const SubControlVolumeFace &scvf, const PrimaryVariables &initSol) const
Applys the initial face solution.
Definition: staggeredfvproblem.hh:213
void applyInitialCellCenterSolution(SolutionVector &sol, const SubControlVolume &scv, const PrimaryVariables &initSol) const
Applys the initial cell center solution.
Definition: staggeredfvproblem.hh:199
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: staggeredfvproblem.hh:168
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:116
Declares all properties used in Dumux.
Base class for all finite volume problems.