20#ifndef DUMUX_FVMPFALINTERACTIONVOLUME_HH
21#define DUMUX_FVMPFALINTERACTIONVOLUME_HH
39template<
class TypeTag>
49 dim = GridView::dimension
52 using Element =
typename GridView::template Codim<0>::Entity;
53 using ElementSeed =
typename Grid::template Codim<0>::EntitySeed;
55 using BoundaryTypes =
typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
56 using SolutionTypes =
typename GET_PROP(TypeTag, SolutionTypes);
57 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
59 using DimVector = Dune::FieldVector<Scalar, dim>;
60 using FieldVectorVector = Dune::FieldVector<DimVector, dim>;
61 using IndexVector = Dune::FieldVector<int, dim>;
62 using BCTypeVector = std::vector<BoundaryTypes>;
63 using BCVector = std::vector<PrimaryVariables>;
76 stored_(false), normal_(FieldVectorVector(DimVector(0.0))),
77 facePos_(FieldVectorVector(DimVector(0.0))),
78 faceArea_(DimVector(0.0)),
80 indexOnElement_(IndexVector(0.0)),
85 faceIndexOnSubVolume_[0][0] = 0;
86 faceIndexOnSubVolume_[0][1] = 3;
87 faceIndexOnSubVolume_[1][0] = 1;
88 faceIndexOnSubVolume_[1][1] = 0;
89 faceIndexOnSubVolume_[2][0] = 2;
90 faceIndexOnSubVolume_[2][1] = 1;
91 faceIndexOnSubVolume_[3][0] = 3;
92 faceIndexOnSubVolume_[3][1] = 2;
100 elements_.resize(2*dim);
101 centerVertexPos_ = 0;
102 indexOnElement_ = IndexVector(0.0);
104 faceType_.resize(2*dim,
inside);
105 faceArea_ = DimVector(0.0);
106 facePos_ = FieldVectorVector(DimVector(0.0));
107 normal_ = FieldVectorVector(DimVector(0.0));
109 boundaryTypes_.clear();
110 neumannValues_.clear();
111 dirichletValues_.clear();
129 centerVertexPos_ = centerVertexPos;
139 elements_[subVolumeIdx].push_back(element.seed());
149 void setFacePosition(
const DimVector& pos,
int subVolumeIdx,
int subVolumeFaceIdxInInside)
151 facePos_[subVolumeIdx][subVolumeFaceIdxInInside] = pos;
160 void setFaceArea(Scalar& faceArea,
int subVolumeIdx,
int subVolumeFaceIdxInInside)
162 faceArea_[subVolumeIdx][subVolumeFaceIdxInInside] = faceArea;
171 void setNormal(DimVector& normal,
int subVolumeIdx,
int subVolumeFaceIdxInInside)
173 normal_[subVolumeIdx][subVolumeFaceIdxInInside] = normal;
181 void setBoundary(BoundaryTypes& boundaryTypes,
int subVolumeFaceIdx)
183 if (boundaryTypes_.size() == 0)
185 boundaryTypes_.resize(2 * dim);
187 boundaryTypes_[subVolumeFaceIdx] = boundaryTypes;
188 faceType_[subVolumeFaceIdx] =
boundary;
197 faceType_[subVolumeFaceIdx] =
outside;
207 if (dirichletValues_.size() == 0)
209 dirichletValues_.resize(2 * dim);
211 dirichletValues_[subVolumeFaceIdx] = condition;
221 if (neumannValues_.size() == 0)
223 neumannValues_.resize(2 * dim);
225 neumannValues_[subVolumeFaceIdx] = condition;
236 indexOnElement_[subVolumeIdx][subVolumeFaceIdxInInside] = indexInInside;
242 return centerVertexPos_;
260 return indexOnElement_[subVolumeIdx][subVolumeFaceIdx];
272 return faceIndexOnSubVolume_[subVolumeIdx][subVolumeFaceIdx];
283 return grid_->entity(elements_[subVolumeIdx][0]);
294 return boundaryTypes_[subVolumeFaceIdx];
303 return (faceType_[subVolumeFaceIdx] ==
outside);
312 return (faceType_[subVolumeFaceIdx] ==
inside);
318 for (
unsigned int i = 0; i < faceType_.size(); i++)
332 return (faceType_[subVolumeFaceIdx] ==
boundary);
343 return dirichletValues_[subVolumeFaceIdx];
354 return neumannValues_[subVolumeFaceIdx];
364 DimVector&
getNormal(
int subVolumeIdx,
int subVolumeFaceIdxInInside)
366 return normal_[subVolumeIdx][subVolumeFaceIdxInInside];
378 return facePos_[subVolumeIdx][subVolumeFaceIdxInInside];
388 Scalar&
getFaceArea(
int subVolumeIdx,
int subVolumeFaceIdxInInside)
390 return faceArea_[subVolumeIdx][subVolumeFaceIdxInInside];
396 std::cout<<
"\nNumber of stored elements: "<<elementNum_<<
"\n";
397 std::cout<<
" center position: "<<centerVertexPos_<<
"\n";
398 for (
int i = 0; i < 2*dim; i++)
400 if (elements_[i].size() > 0)
402 std::cout<<
"element "<<i<<
":\n";
403 std::cout<<
"element position: "<<elements_[i][0]->geometry().center()<<
"\n";
404 std::cout<<
"face indices on element: "<<indexOnElement_[i]<<
"\n";
405 std::cout<<
"face normals on element: "<<normal_[i]<<
"\n";
406 std::cout<<
"face areas on element: "<<faceArea_[i]<<
"\n";
407 std::cout<<
"face position on element: "<<facePos_[i]<<
"\n";
408 std::cout<<
"face type: "<<faceType_[i]<<
"\n";
416 Dune::FieldVector<FieldVectorVector, 2*dim> normal_;
417 Dune::FieldVector<FieldVectorVector, 2*dim> facePos_;
418 Dune::FieldVector<DimVector, 2*dim> faceArea_;
419 BCTypeVector boundaryTypes_;
420 std::vector<int> faceType_;
421 Dune::FieldVector<IndexVector, 2*dim> indexOnElement_;
422 Dune::FieldVector<IndexVector, 2*dim> faceIndexOnSubVolume_;
423 std::vector<std::vector<ElementSeed> > elements_;
424 BCVector neumannValues_;
425 BCVector dirichletValues_;
426 DimVector centerVertexPos_;
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Class including the information of an interaction volume of a MPFA L-method that does not change with...
Definition: linteractionvolume.hh:41
bool isInnerVolume()
Returns true if the interaction volume is completely inside the model domain.
Definition: linteractionvolume.hh:316
void setSubVolumeElement(const Element &element, int subVolumeIdx)
Store an element of the interaction volume.
Definition: linteractionvolume.hh:137
int getElementNumber()
Get number of stored elements.
Definition: linteractionvolume.hh:246
void reset()
Delete stored information.
Definition: linteractionvolume.hh:96
void setFacePosition(const DimVector &pos, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store position of the center of a flux face.
Definition: linteractionvolume.hh:149
void setBoundary(BoundaryTypes &boundaryTypes, int subVolumeFaceIdx)
Store boundary condtion types for a flux face.
Definition: linteractionvolume.hh:181
int getIndexOnElement(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering to numbering of the Dune reference element.
Definition: linteractionvolume.hh:258
void setIndexOnElement(int indexInInside, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store map from local interaction volume numbering to numbering of the Dune reference element.
Definition: linteractionvolume.hh:234
bool isInsideFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is inside the model domain and no boundary face.
Definition: linteractionvolume.hh:310
void setOutsideFace(int subVolumeFaceIdx)
Mark a flux face to be outside the model domain.
Definition: linteractionvolume.hh:195
DimVector & getNormal(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face normal.
Definition: linteractionvolume.hh:364
Element getSubVolumeElement(int subVolumeIdx)
Get an element of the interaction volume.
Definition: linteractionvolume.hh:281
DimVector & getFacePosition(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get position of the center of a flux face.
Definition: linteractionvolume.hh:376
void setStored()
Mark storage as completed.
Definition: linteractionvolume.hh:115
BoundaryTypes & getBoundaryType(int subVolumeFaceIdx)
Get boundary condtion types for a flux face.
Definition: linteractionvolume.hh:292
void printInteractionVolumeInfo()
Outputs stored information.
Definition: linteractionvolume.hh:394
Scalar & getFaceArea(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face area.
Definition: linteractionvolume.hh:388
void setNormal(DimVector &normal, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store a flux face normal.
Definition: linteractionvolume.hh:171
PrimaryVariables & getNeumannValues(int subVolumeFaceIdx)
Get the Neumann boundary condtions for a flux face.
Definition: linteractionvolume.hh:352
bool isBoundaryFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is a boundary face.
Definition: linteractionvolume.hh:330
void setDirichletCondition(PrimaryVariables &condition, int subVolumeFaceIdx)
Store Dirichlet boundary condtions for a flux face.
Definition: linteractionvolume.hh:205
FVMPFALInteractionVolume(const Grid &grid)
Constructs a FVMPFALInteractionVolume object.
Definition: linteractionvolume.hh:74
FaceTypes
Definition: linteractionvolume.hh:67
@ inside
Definition: linteractionvolume.hh:68
@ outside
Definition: linteractionvolume.hh:70
@ boundary
Definition: linteractionvolume.hh:69
int getFaceIndexFromSubVolume(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering on element to numbering on interaction volume.
Definition: linteractionvolume.hh:270
void setCenterPosition(DimVector ¢erVertexPos)
Store position of the center vertex of the interaction volume.
Definition: linteractionvolume.hh:127
void setNeumannCondition(PrimaryVariables &condition, int subVolumeFaceIdx)
Store Neumann boundary condtions for a flux face.
Definition: linteractionvolume.hh:219
bool isStored() const
Returns true if information has already been stored.
Definition: linteractionvolume.hh:121
DimVector & getCenterPosition()
Get position vector of central vertex.
Definition: linteractionvolume.hh:240
void setFaceArea(Scalar &faceArea, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store a flux face area.
Definition: linteractionvolume.hh:160
PrimaryVariables & getDirichletValues(int subVolumeFaceIdx)
Get the Dirichlet boundary condtions for a flux face.
Definition: linteractionvolume.hh:341
bool isOutsideFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is outside the model domain.
Definition: linteractionvolume.hh:301
Properties for a MPFA method.