12#ifndef DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH 
   13#define DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH 
   17#include <dune/common/fvector.hh> 
   18#include <dune/geometry/type.hh> 
   19#include <dune/geometry/multilineargeometry.hh> 
   37template<
class Gr
idView, 
int upwindSchemeOrder>
 
   42    using Scalar = 
typename GridView::ctype;
 
   47    using Grid = 
typename GridView::Grid;
 
   48    static constexpr int dim = Grid::dimension;
 
   49    static constexpr int dimWorld = Grid::dimensionworld;
 
   51    using Element = 
typename GridView::template Codim<0>::Entity;
 
 
   61template<
class SubControlVolumeFace>
 
   63                                               const typename SubControlVolumeFace::GlobalPosition& newCenter)
 
   66    bf.setCenter(newCenter);
 
   68    bf.setIsGhostFace(
true);
 
 
   78         int upwindSchemeOrder,
 
   79         class T = FreeFlowStaggeredDefaultScvfGeometryTraits<GV, upwindSchemeOrder>>
 
   85    using Geometry = 
typename T::Geometry;
 
   89    using PairData = 
typename T::PairData;
 
   90    using AxisData = 
typename T::AxisData;
 
   92    using Scalar = 
typename T::Scalar;
 
   93    static const int dim = GV::dimension;
 
   95    static constexpr int numPairs = 2 * (dim - 1);
 
   97    static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
 
  111    template <
class Intersection>
 
  113                                          const typename Intersection::Geometry& isGeometry,
 
  114                                          GridIndexType scvfIndex,
 
  115                                          const std::vector<GridIndexType>& scvIndices,
 
  116                                          const typename T::GeometryHelper& geometryHelper)
 
  118      area_(isGeometry.
volume()),
 
  119      center_(isGeometry.
center()),
 
  120      unitOuterNormal_(is.centerUnitOuterNormal()),
 
  121      scvfIndex_(scvfIndex),
 
  122      scvIndices_(scvIndices),
 
  124      axisData_(geometryHelper.
axisData()),
 
  125      pairData_(std::move(geometryHelper.
pairData())),
 
  126      localFaceIdx_(geometryHelper.localFaceIndex()),
 
  131        dimensions[0] = (isGeometry.corner(1) - isGeometry.corner(0)).two_norm();
 
  132        if constexpr (dim == 3)
 
  133            dimensions[1] = (isGeometry.corner(2) - isGeometry.corner(0)).two_norm();
 
 
  170        return unitOuterNormal_;
 
 
  176        return scvIndices_[0];
 
 
  182        return scvIndices_[1];
 
 
  194        return localFaceIdx_;
 
 
  212        return outerNormalSign_;
 
 
  218        return pairData_[idx];
 
 
  222    const std::array<PairData, numPairs>& 
pairData()
 const 
 
  242        if (dim == 3 && localSubFaceIdx > 1)
 
  243            return dimensions[1];
 
  245            return dimensions[0];
 
 
  256        return pairData(localSubFaceIdx).hasParallelNeighbor[parallelDegreeIdx];
 
 
  279        return pairData(localSubFaceIdx).hasHalfParallelNeighbor;
 
 
  303        return pairData(localSubFaceIdx).hasCornerParallelNeighbor;
 
 
  313        return pairData(localSubFaceIdx).hasOuterLateral;
 
 
  321    template<
bool enable = useHigherOrder, std::enable_if_t<enable, 
int> = 0>
 
  324        return axisData().hasBackwardNeighbor[backwardIdx];
 
 
  332    template<
bool enable = useHigherOrder, std::enable_if_t<enable, 
int> = 0>
 
  335        return axisData().hasForwardNeighbor[forwardIdx];
 
 
  353        return axisData().inAxisForwardDofs[0];
 
 
  359        return axisData().inAxisBackwardDofs[0];
 
 
  365        return axisData().selfToOppositeDistance;
 
 
  376        if (parallelDegreeIdx == 0)
 
  377            return (
faceLength(localSubFaceIdx) + 
pairData(localSubFaceIdx).parallelCellWidths[0]) * 0.5;
 
  381            assert((parallelDegreeIdx == 1) && 
"Only the width of the first two parallel cells (indices 0 and 1) is stored for each scvf.");
 
  382            return (
pairData(localSubFaceIdx).parallelCellWidths[0] + 
pairData(localSubFaceIdx).parallelCellWidths[1]) * 0.5;
 
 
  392    { boundary_ = boundaryFlag; }
 
 
  396    { isGhostFace_ = isGhostFaceFlag; }
 
 
  399    std::array<Scalar, dim-1> dimensions;
 
  403    GridIndexType scvfIndex_;
 
  404    std::vector<GridIndexType> scvIndices_;
 
  407    Scalar selfToOppositeDistance_;
 
  409    std::array<PairData, numPairs> pairData_;
 
  412    unsigned int dirIdx_;
 
  413    int outerNormalSign_;
 
 
Helper class constructing the dual grid finite volume geometries for the free flow staggered discreti...
Definition staggeredgeometryhelper.hh:134
Detail::AxisData< GridView, upwindSchemeOrder > AxisData
Definition staggeredgeometryhelper.hh:154
Detail::PairData< GridView, upwindSchemeOrder > PairData
Definition staggeredgeometryhelper.hh:153
LocalIndexType localFaceIdx() const
The local index of this sub control volume face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:192
const GlobalPosition & center() const
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:137
GridIndexType dofIndex() const
Returns the dof of the face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:339
void setBoundary(bool boundaryFlag)
set the boundary flag
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:391
const AxisData & axisData() const
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:228
bool hasOuterLateral(const int localSubFaceIdx) const
Check if the face has an outer normal neighbor.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:311
GridIndexType dofIndexForwardFace() const
Returns the dof the first forward face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:351
bool normalInPosCoordDir() const
Returns whether the unitNormal of the face points in positive coordinate direction.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:204
FreeFlowStaggeredSubControlVolumeFace()=default
const std::array< PairData, numPairs > & pairData() const
Return an array of all pair data.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:222
GridIndexType dofIndexOpposingFace() const
Returns the dof of the opposing face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:345
Scalar parallelDofsDistance(const int localSubFaceIdx, const int parallelDegreeIdx) const
Returns the distance between the parallel dofs.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:374
Scalar selfToOppositeDistance() const
Returns the distance between the face and the opposite one.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:363
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:149
unsigned int directionIndex() const
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:198
bool isGhostFace() const
Returns true if the face is a ghost face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:234
const GlobalPosition & unitOuterNormal() const
The unit outer normal vector.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:168
bool hasHalfParallelNeighbor(const int localSubFaceIdx) const
Check if the face has a half parallel neighbor.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:277
void setIsGhostFace(bool isGhostFaceFlag)
set the ghost face flag
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:395
int directionSign() const
Returns the sign of the unit outer normal's vector.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:210
bool hasForwardNeighbor(const int forwardIdx) const
Check if the face has a forward neighbor.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:333
void setCenter(const GlobalPosition ¢er)
set the center to a different position
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:387
GridIndexType outsideScvIdx() const
index of the outside sub control volume for spatial param evaluation
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:180
static constexpr int numCornersPerFace
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:102
FreeFlowStaggeredSubControlVolumeFace(const Intersection &is, const typename Intersection::Geometry &isGeometry, GridIndexType scvfIndex, const std::vector< GridIndexType > &scvIndices, const typename T::GeometryHelper &geometryHelper)
Constructor with intersection.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:112
typename FreeFlowStaggeredDefaultScvfGeometryTraits< GridView, upwindSchemeOrder >::GlobalPosition GlobalPosition
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:100
bool hasBackwardNeighbor(const int backwardIdx) const
Check if the face has a backward neighbor.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:322
FreeFlowStaggeredDefaultScvfGeometryTraits< GridView, upwindSchemeOrder > Traits
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:105
bool boundary() const
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:162
const PairData & pairData(const int idx) const
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:216
const GlobalPosition & dofPosition() const
The position of the dof living on the face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:143
GridIndexType index() const
The global index of this sub control volume face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:186
GridIndexType dofIndexBackwardFace() const
Returns the dof of the first backward face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:357
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:240
Scalar area() const
The area of the sub control volume face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:156
bool hasParallelNeighbor(const int localSubFaceIdx, const int parallelDegreeIdx) const
Check if the face has a parallel neighbor.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:254
bool hasCornerParallelNeighbor(const int localSubFaceIdx) const
Check if the face has a corner parallel neighbor.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:301
GridIndexType insideScvIdx() const
Index of the inside sub control volume for spatial param evaluation.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:174
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:29
Class for a sub control volume face in the staggered method, i.e a part of the boundary of a sub cont...
constexpr int sign(const ValueType &value) noexcept
Sign or signum function.
Definition math.hh:658
auto volume(const Geometry &geo, unsigned int integrationOrder=4)
The volume of a given geometry.
Definition volume.hh:159
SubControlVolumeFace makeStaggeredBoundaryFace(const SubControlVolumeFace &scvf, const typename SubControlVolumeFace::GlobalPosition &newCenter)
Helper function to turn a given cell scvface into a fake boundary face.
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:62
Helper class constructing the dual grid finite volume geometries for the free flow staggered discreti...
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:39
static constexpr int dimWorld
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:49
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:40
static constexpr int dim
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:48
typename GridView::Grid Grid
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:47
typename GeometryHelper::AxisData AxisData
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:45
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:52
typename GeometryHelper::PairData PairData
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:44
Dune::AxisAlignedCubeGeometry< Scalar, dim-1, dimWorld > Geometry
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:53
typename GridView::template Codim< 0 >::Entity Element
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:51
typename GridView::ctype Scalar
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:42
FreeFlowStaggeredGeometryHelper< GridView, upwindSchemeOrder > GeometryHelper
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:43
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition discretization/staggered/freeflow/subcontrolvolumeface.hh:41
typename GridView::IndexSet::IndexType GridIndex
Definition indextraits.hh:27
unsigned int LocalIndex
Definition indextraits.hh:28
Base class for a sub control volume face.