17#ifndef DUMUX_FVMPFAOINTERACTIONVOLUME_HH
18#define DUMUX_FVMPFAOINTERACTIONVOLUME_HH
36template<
class TypeTag>
46 dim = GridView::dimension
49 using Element =
typename GridView::template Codim<0>::Entity;
50 using ElementSeed =
typename Grid::template Codim<0>::EntitySeed;
54 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
56 using DimVector = Dune::FieldVector<Scalar, dim>;
57 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
58 using FieldVectorVector = Dune::FieldVector<DimVector, dim>;
59 using IndexVector = Dune::FieldVector<int, dim>;
60 using BCTypeVector = std::vector<BoundaryTypes>;
61 using BCVector = std::vector<PrimaryVariables>;
74 stored_(false), permTimesNu_(FieldVectorVector(DimVector(0.0))),
75 nu_(FieldVectorVector(DimVector(0.0))), normal_(FieldVectorVector(DimVector(0.0))),
76 faceArea_(DimVector(0.0)), dF_(0.0),
78 indexOnElement_(IndexVector(0.0)),
81 faceIndexOnSubVolume_[0][0] = 0;
82 faceIndexOnSubVolume_[0][1] = 3;
83 faceIndexOnSubVolume_[1][0] = 1;
84 faceIndexOnSubVolume_[1][1] = 0;
85 faceIndexOnSubVolume_[2][0] = 2;
86 faceIndexOnSubVolume_[2][1] = 1;
87 faceIndexOnSubVolume_[3][0] = 3;
88 faceIndexOnSubVolume_[3][1] = 2;
110 elements_[subVolumeIdx].push_back(element.seed());
118 void setDF(Scalar dF,
int subVolumeIdx)
120 dF_[subVolumeIdx] = dF;
129 void setFaceArea(Scalar& faceArea,
int subVolumeIdx,
int subVolumeFaceIdxInInside)
131 faceArea_[subVolumeIdx][subVolumeFaceIdxInInside] = faceArea;
141 void setPermTimesNu(DimVector& nu, DimMatrix& perm,
int subVolumeIdx,
int subVolumeFaceIdxInInside)
143 permTimesNu_[subVolumeIdx][subVolumeFaceIdxInInside] = 0;
145 perm.mv(nu, permTimesNu_[subVolumeIdx][subVolumeFaceIdxInInside]);
147 nu_[subVolumeIdx][subVolumeFaceIdxInInside] = nu;
158 normal_[subVolumeIdx][subVolumeFaceIdxInInside] =
normal;
166 void setBoundary(BoundaryTypes& boundaryTypes,
int subVolumeFaceIdx)
170 if (boundaryTypes_.size() == 0)
172 boundaryTypes_.resize(2 * dim);
174 boundaryTypes_[subVolumeFaceIdx] = boundaryTypes;
175 faceType_[subVolumeFaceIdx] =
boundary;
184 faceType_[subVolumeFaceIdx] =
outside;
194 if (dirichletValues_.size() == 0)
196 dirichletValues_.resize(2 * dim);
198 dirichletValues_[subVolumeFaceIdx] = condition;
208 if (neumannValues_.size() == 0)
210 neumannValues_.resize(2 * dim);
212 neumannValues_[subVolumeFaceIdx] = condition;
223 indexOnElement_[subVolumeIdx][subVolumeFaceIdxInInside] = indexInInside;
235 return indexOnElement_[subVolumeIdx][subVolumeFaceIdx];
247 return faceIndexOnSubVolume_[subVolumeIdx][subVolumeFaceIdx];
258 return grid_->entity(elements_[subVolumeIdx][0]);
269 return boundaryTypes_[subVolumeFaceIdx];
278 return (faceType_[subVolumeFaceIdx] ==
outside);
287 return (faceType_[subVolumeFaceIdx] ==
inside);
293 for (
unsigned int i = 0; i < faceType_.size(); i++)
307 return (faceType_[subVolumeFaceIdx] ==
boundary);
318 return dirichletValues_[subVolumeFaceIdx];
329 return neumannValues_[subVolumeFaceIdx];
339 DimVector&
getNormal(
int subVolumeIdx,
int subVolumeFaceIdxInInside)
341 return normal_[subVolumeIdx][subVolumeFaceIdxInInside];
351 Scalar&
getFaceArea(
int subVolumeIdx,
int subVolumeFaceIdxInInside)
353 return faceArea_[subVolumeIdx][subVolumeFaceIdxInInside];
363 DimVector&
getNu(
int subVolumeIdx,
int subVolumeFaceIdxInInside)
365 return nu_[subVolumeIdx][subVolumeFaceIdxInInside];
378 Scalar
getNtkNu(
int subVolumeIdx,
int subVolumeFaceIdxInInsideN,
int subVolumeFaceIdxInInsideNu)
const
380 return normal_[subVolumeIdx][subVolumeFaceIdxInInsideN] * permTimesNu_[subVolumeIdx][subVolumeFaceIdxInInsideNu];
394 Scalar
getNtkrkNu(Scalar& relPerm,
int subVolumeIdx,
int subVolumeFaceIdxInInsideN,
395 int subVolumeFaceIdxInInsideNu)
const
397 DimVector krKNu(permTimesNu_[subVolumeIdx][subVolumeFaceIdxInInsideNu]);
401 return normal_[subVolumeIdx][subVolumeFaceIdxInInsideN] * krKNu;
415 Scalar
getNtkNu_df(
int subVolumeIdx,
int subVolumeFaceIdxInInsideN,
int subVolumeFaceIdxInInsideNu)
const
417 return faceArea_[subVolumeIdx][subVolumeFaceIdxInInsideN]
418 *
getNtkNu(subVolumeIdx, subVolumeFaceIdxInInsideN, subVolumeFaceIdxInInsideNu)
434 Scalar
getNtkrkNu_df(Scalar& relPerm,
int subVolumeIdx,
int subVolumeFaceIdxInInsideN,
int subVolumeFaceIdxInInsideNu)
const
436 return faceArea_[subVolumeIdx][subVolumeFaceIdxInInsideN]
437 *
getNtkrkNu(relPerm, subVolumeIdx, subVolumeFaceIdxInInsideN, subVolumeFaceIdxInInsideNu)
444 Dune::FieldVector<FieldVectorVector, 2*dim> permTimesNu_;
445 Dune::FieldVector<FieldVectorVector, 2*dim> nu_;
446 Dune::FieldVector<FieldVectorVector, 2*dim> normal_;
447 Dune::FieldVector<DimVector, 2*dim> faceArea_;
448 Dune::FieldVector<Scalar, 2*dim> dF_;
449 BCTypeVector boundaryTypes_;
450 std::vector<int> faceType_;
451 Dune::FieldVector<IndexVector, 2*dim> indexOnElement_;
452 Dune::FieldVector<IndexVector, 2*dim> faceIndexOnSubVolume_;
453 std::vector<std::vector<ElementSeed> > elements_;
454 BCVector neumannValues_;
455 BCVector dirichletValues_;
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: geometry/normal.hh:36
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition: propertysystem.hh:140
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
Class including the information of an interaction volume of a MPFA O-method that does not change with...
Definition: ointeractionvolume.hh:38
DimVector & getNu(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get vector used for the transmissiblity calculation.
Definition: ointeractionvolume.hh:363
bool isInnerVolume()
Returns true if the interaction volume is completely inside the model domain.
Definition: ointeractionvolume.hh:291
FVMPFAOInteractionVolume(const Grid &grid)
Constructs a FVMPFAOInteractionVolume object.
Definition: ointeractionvolume.hh:72
bool isInsideFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is inside the model domain and no boundary face.
Definition: ointeractionvolume.hh:285
void setIndexOnElement(int indexInInside, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store map from local interaction volume numbering to numbering of the Dune reference element.
Definition: ointeractionvolume.hh:221
bool isOutsideFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is outside the model domain.
Definition: ointeractionvolume.hh:276
Scalar getNtkrkNu(Scalar &relPerm, int subVolumeIdx, int subVolumeFaceIdxInInsideN, int subVolumeFaceIdxInInsideNu) const
Get for the transmissiblity calculation.
Definition: ointeractionvolume.hh:394
BoundaryTypes & getBoundaryType(int subVolumeFaceIdx)
Get boundary condtion types for a flux face.
Definition: ointeractionvolume.hh:267
void setDirichletCondition(PrimaryVariables &condition, int subVolumeFaceIdx)
Store Dirichlet boundary condtions for a flux face.
Definition: ointeractionvolume.hh:192
void setSubVolumeElement(const Element &element, int subVolumeIdx)
Store an element of the interaction volume.
Definition: ointeractionvolume.hh:108
bool isBoundaryFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is a boundary face.
Definition: ointeractionvolume.hh:305
PrimaryVariables & getDirichletValues(int subVolumeFaceIdx)
Get the Dirichlet boundary condtions for a flux face.
Definition: ointeractionvolume.hh:316
void setOutsideFace(int subVolumeFaceIdx)
Mark a flux face to be outside the model domain.
Definition: ointeractionvolume.hh:182
void setBoundary(BoundaryTypes &boundaryTypes, int subVolumeFaceIdx)
Store boundary condtion types for a flux face.
Definition: ointeractionvolume.hh:166
void setNeumannCondition(PrimaryVariables &condition, int subVolumeFaceIdx)
Store Neumann boundary condtions for a flux face.
Definition: ointeractionvolume.hh:206
Scalar & getFaceArea(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face area.
Definition: ointeractionvolume.hh:351
Scalar getNtkrkNu_df(Scalar &relPerm, int subVolumeIdx, int subVolumeFaceIdxInInsideN, int subVolumeFaceIdxInInsideNu) const
Definition: ointeractionvolume.hh:434
void setStored()
Mark storage as completed.
Definition: ointeractionvolume.hh:92
Scalar getNtkNu_df(int subVolumeIdx, int subVolumeFaceIdxInInsideN, int subVolumeFaceIdxInInsideNu) const
Definition: ointeractionvolume.hh:415
PrimaryVariables & getNeumannValues(int subVolumeFaceIdx)
Get the Neumann boundary condtions for a flux face.
Definition: ointeractionvolume.hh:327
Scalar getNtkNu(int subVolumeIdx, int subVolumeFaceIdxInInsideN, int subVolumeFaceIdxInInsideNu) const
Get for the transmissiblity calculation.
Definition: ointeractionvolume.hh:378
DimVector & getNormal(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face normal.
Definition: ointeractionvolume.hh:339
void setNormal(DimVector &normal, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store a flux face normal.
Definition: ointeractionvolume.hh:156
void setFaceArea(Scalar &faceArea, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store a flux face area.
Definition: ointeractionvolume.hh:129
int getFaceIndexFromSubVolume(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering on element to numbering on interaction volume.
Definition: ointeractionvolume.hh:245
bool isStored() const
Returns true if information has already been stored.
Definition: ointeractionvolume.hh:98
void setDF(Scalar dF, int subVolumeIdx)
Store the for the transmissiblity calculation.
Definition: ointeractionvolume.hh:118
FaceTypes
Definition: ointeractionvolume.hh:65
@ outside
Definition: ointeractionvolume.hh:68
@ boundary
Definition: ointeractionvolume.hh:67
@ inside
Definition: ointeractionvolume.hh:66
void setPermTimesNu(DimVector &nu, DimMatrix &perm, int subVolumeIdx, int subVolumeFaceIdxInInside)
Store for the transmissiblity calculation.
Definition: ointeractionvolume.hh:141
Element getSubVolumeElement(int subVolumeIdx)
Get an element of the interaction volume.
Definition: ointeractionvolume.hh:256
int getIndexOnElement(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering to numbering of the Dune reference element.
Definition: ointeractionvolume.hh:233
Properties for a MPFA method.