24#ifndef DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH
25#define DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH
29#include <dune/common/fvector.hh>
30#include <dune/geometry/type.hh>
31#include <dune/geometry/multilineargeometry.hh>
49 template<
class Container>
50 auto operator()(Container&& c)
51 ->
decltype(c.resize(1))
64template<
class Gr
idView,
int upwindSchemeOrder>
69 using Scalar =
typename GridView::ctype;
74 using Grid =
typename GridView::Grid;
75 static constexpr int dim = Grid::dimension;
76 static constexpr int dimWorld = Grid::dimensionworld;
84 template<
int mydim,
int cdim >
87 using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(
dim-1)) >;
102 int upwindSchemeOrder,
109 using Geometry =
typename T::Geometry;
112 using CornerStorage =
typename T::CornerStorage;
114 using PairData =
typename T::PairData;
115 using AxisData =
typename T::AxisData;
117 using Scalar =
typename T::Scalar;
118 static const int dim = GV::dimension;
120 static constexpr int numPairs = 2 * (dim - 1);
122 static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
134 template <
class Intersection,
class GeometryHelper>
136 const typename Intersection::Geometry& isGeometry,
137 GridIndexType scvfIndex,
138 const std::vector<GridIndexType>& scvIndices,
139 const GeometryHelper& geometryHelper)
141 geomType_(isGeometry.type()),
142 area_(isGeometry.volume()),
143 center_(isGeometry.
center()),
144 unitOuterNormal_(is.centerUnitOuterNormal()),
145 scvfIndex_(scvfIndex),
146 scvIndices_(scvIndices),
149 axisData_(geometryHelper.
axisData()),
150 pairData_(std::move(geometryHelper.
pairData())),
151 localFaceIdx_(geometryHelper.localFaceIndex()),
157 maybeResizeCornerStorage_(HasResize{}, isGeometry.corners());
158 for (
int i = 0; i < isGeometry.corners(); ++i)
159 corners_[i] = isGeometry.corner(i);
196 return unitOuterNormal_;
202 return scvIndices_[0];
209 return scvIndices_[1];
221 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
222 return corners_[localIdx];
228 return Geometry(geomType_, corners_);
234 return localFaceIdx_;
252 return outerNormalSign_;
258 return pairData_[idx];
262 const std::array<PairData, numPairs>&
pairData()
const
284 if (localSubFaceIdx < 2)
301 return pairData(localSubFaceIdx).hasParallelNeighbor[parallelDegreeIdx];
311 return pairData(localSubFaceIdx).hasOuterLateral;
319 template<
bool enable = useHigherOrder, std::enable_if_t<enable,
int> = 0>
322 return axisData().hasBackwardNeighbor[backwardIdx];
330 template<
bool enable = useHigherOrder, std::enable_if_t<enable,
int> = 0>
333 return axisData().hasForwardNeighbor[forwardIdx];
351 return axisData().inAxisForwardDofs[0];
357 return axisData().inAxisBackwardDofs[0];
363 return axisData().selfToOppositeDistance;
374 if (parallelDegreeIdx == 0)
375 return (
faceLength(localSubFaceIdx) +
pairData(localSubFaceIdx).parallelCellWidths[0]) * 0.5;
379 assert((parallelDegreeIdx == 1) &&
"Only the width of the first two parallel cells (indicies 0 and 1) is stored for each scvf.");
380 return (
pairData(localSubFaceIdx).parallelCellWidths[0] +
pairData(localSubFaceIdx).parallelCellWidths[1]) * 0.5;
394 boundaryFace.center_ = pos;
395 boundaryFace.boundary_ =
true;
396 boundaryFace.isGhostFace_ =
true;
401 void maybeResizeCornerStorage_(std::true_type , std::size_t size)
402 { corners_.resize(size); }
404 void maybeResizeCornerStorage_(std::false_type , std::size_t size)
407 Dune::GeometryType geomType_;
408 CornerStorage corners_;
412 GridIndexType scvfIndex_;
413 std::vector<GridIndexType> scvIndices_;
416 Scalar selfToOppositeDistance_;
418 std::array<PairData, numPairs> pairData_;
421 unsigned int dirIdx_;
422 int outerNormalSign_;
A helper function for class member function introspection.
Defines the index types used for grid and local indices.
Base class for a sub control volume face.
constexpr int sign(const ValueType &value) noexcept
Sign or signum function.
Definition: math.hh:618
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:93
const auto hasResize
Definition: test_isvalid.cc:22
Struture to define the index types used for grid and local indices.
Definition: indextraits.hh:38
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:39
unsigned int LocalIndex
Definition: indextraits.hh:40
Parallel Data stored per sub face.
Definition: staggeredgeometryhelper.hh:48
In Axis Data stored per sub face.
Definition: staggeredgeometryhelper.hh:77
Default traits class to be used for the sub-control volume faces for the free-flow staggered finite v...
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:66
static constexpr int dimWorld
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:76
typename ScvfMLGTraits< Scalar >::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:92
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:67
static constexpr int dim
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:75
typename GridView::Grid Grid
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:74
typename CornerStorage::value_type GlobalPosition
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:93
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, ScvfMLGTraits< Scalar > > Geometry
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:91
typename FreeFlowStaggeredGeometryHelper< GridView, upwindSchemeOrder >::AxisData AxisData
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:71
typename GridView::ctype Scalar
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:69
typename FreeFlowStaggeredGeometryHelper< GridView, upwindSchemeOrder >::PairData PairData
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:70
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:68
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:81
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:86
std::array< Dune::FieldVector< ct, cdim >,(1<<(dim-1)) > Type
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:87
Class for a sub control volume face in the staggered method, i.e a part of the boundary of a sub cont...
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:106
LocalIndexType localFaceIdx() const
The local index of this sub control volume face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:232
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:163
GridIndexType dofIndex() const
Returns the dof of the face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:337
const AxisData & axisData() const
Return an array of all pair data.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:268
bool hasOuterLateral(const int localSubFaceIdx) const
Check if the face has an outer normal neighbor.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:309
GridIndexType dofIndexForwardFace() const
Returns the dof the first forward face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:349
bool normalInPosCoordDir() const
Returns whether the unitNormal of the face points in positive coordinate direction.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:244
FreeFlowStaggeredSubControlVolumeFace()=default
const std::array< PairData, numPairs > & pairData() const
Return an array of all pair data.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:262
GridIndexType dofIndexOpposingFace() const
Returns the dof of the opposing face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:343
const Geometry geometry() const
The geometry of the sub control volume face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:226
Scalar parallelDofsDistance(const int localSubFaceIdx, const int parallelDegreeIdx) const
Returns the distance between the parallel dofs.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:372
Scalar selfToOppositeDistance() const
Returns the distance between the face and the opposite one.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:361
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:175
unsigned int directionIndex() const
Returns the dirction index of the facet (0 = x, 1 = y, 2 = z)
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:238
bool isGhostFace() const
Returns true if the face is a ghost face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:274
const GlobalPosition & unitOuterNormal() const
The unit outer normal vector.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:194
FreeFlowStaggeredSubControlVolumeFace(const Intersection &is, const typename Intersection::Geometry &isGeometry, GridIndexType scvfIndex, const std::vector< GridIndexType > &scvIndices, const GeometryHelper &geometryHelper)
Constructor with intersection.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:135
int directionSign() const
Returns the sign of the unit outer normal's vector.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:250
FreeFlowStaggeredSubControlVolumeFace makeBoundaryFace(const GlobalPosition &pos) const
Returns a copy of the own scvf whith a user-specified center position. This is needed for retrieving ...
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:391
bool hasForwardNeighbor(const int forwardIdx) const
Check if the face has a forward neighbor.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:331
GridIndexType outsideScvIdx() const
index of the outside sub control volume for spatial param evaluation
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:207
typename T::GlobalPosition GlobalPosition
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:125
const GlobalPosition & corner(unsigned int localIdx) const
The positions of the corners.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:219
bool hasBackwardNeighbor(const int backwardIdx) const
Check if the face has a backward neighbor.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:320
T Traits
State the traits public and thus export all types.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:128
bool boundary() const
Returns bolean if the sub control volume face is on the boundary.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:188
const PairData & pairData(const int idx) const
Returns the data for one sub face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:256
const GlobalPosition & dofPosition() const
The position of the dof living on the face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:169
GridIndexType index() const
The global index of this sub control volume face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:213
GridIndexType dofIndexBackwardFace() const
Returns the dof of the first backward face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:355
Scalar faceLength(const int localSubFaceIdx) const
Returns the length of the face in a certain direction (adaptation of area() for 3d)
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:280
Scalar area() const
The area of the sub control volume face.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:182
bool hasParallelNeighbor(const int localSubFaceIdx, const int parallelDegreeIdx) const
Check if the face has a parallel neighbor.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:299
GridIndexType insideScvIdx() const
Index of the inside sub control volume for spatial param evaluation.
Definition: discretization/staggered/freeflow/subcontrolvolumeface.hh:200
Base class for a sub control volume face, i.e a part of the boundary of a sub control volume we compu...
Definition: subcontrolvolumefacebase.hh:41