Commit f4d5a58b authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

box 2p2c: use the identity of SubControlVolumeFace and BoundaryFace.

Now, the only reason for having BoundaryVariables in addition to
FluxVariables is that a different datatype triggers a different value of
the parameter onBoundary in the corresponding constructors. 


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7395 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent b5355b50
...@@ -94,10 +94,8 @@ public: ...@@ -94,10 +94,8 @@ public:
int faceIdx, int faceIdx,
const ElementVolumeVariables &elemVolVars, const ElementVolumeVariables &elemVolVars,
bool onBoundary = false) bool onBoundary = false)
: fvGeom_(elemGeom) : fvGeom_(elemGeom), faceIdx_(faceIdx), onBoundary_(onBoundary)
{ {
scvfIdx_ = faceIdx;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
densityAtIP_[phaseIdx] = Scalar(0); densityAtIP_[phaseIdx] = Scalar(0);
molarDensityAtIP_[phaseIdx] = Scalar(0); molarDensityAtIP_[phaseIdx] = Scalar(0);
...@@ -108,10 +106,9 @@ public: ...@@ -108,10 +106,9 @@ public:
if (!onBoundary) if (!onBoundary)
{ {
const SCVFace &face = fvGeom_.subContVolFace[scvfIdx_]; calculateValues_(problem, element, face(), elemVolVars);
calculateValues_(problem, element, face, elemVolVars);
} }
}; }
protected: protected:
template <class FaceType> template <class FaceType>
...@@ -363,11 +360,17 @@ public: ...@@ -363,11 +360,17 @@ public:
{ return molarConcGrad_[phaseIdx]; }; { return molarConcGrad_[phaseIdx]; };
const SCVFace &face() const const SCVFace &face() const
{ return fvGeom_.subContVolFace[scvfIdx_]; } {
if (onBoundary_)
return fvGeom_.boundaryFace[faceIdx_];
else
return fvGeom_.subContVolFace[faceIdx_];
}
protected: protected:
const FVElementGeometry &fvGeom_; const FVElementGeometry &fvGeom_;
int scvfIdx_; const int faceIdx_;
const bool onBoundary_;
// gradients // gradients
Vector potentialGrad_[numPhases]; Vector potentialGrad_[numPhases];
......
...@@ -405,7 +405,7 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) ...@@ -405,7 +405,7 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
} }
// add diffusive flux of gas component in liquid phase // add diffusive flux of gas component in liquid phase
Scalar tmp = boundaryVars.molarConcGrad(lPhaseIdx)*boundaryVars.boundaryFace().normal; Scalar tmp = boundaryVars.molarConcGrad(lPhaseIdx)*boundaryVars.face().normal;
tmp *= -1; tmp *= -1;
tmp *= boundaryVars.porousDiffCoeff(lPhaseIdx) * tmp *= boundaryVars.porousDiffCoeff(lPhaseIdx) *
boundaryVars.molarDensityAtIP(lPhaseIdx); boundaryVars.molarDensityAtIP(lPhaseIdx);
...@@ -416,7 +416,7 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual) ...@@ -416,7 +416,7 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
flux[contiLEqIdx] -= tmp * FluidSystem::molarMass(lCompIdx); flux[contiLEqIdx] -= tmp * FluidSystem::molarMass(lCompIdx);
// add diffusive flux of liquid component in gas phase // add diffusive flux of liquid component in gas phase
tmp = boundaryVars.molarConcGrad(gPhaseIdx)*boundaryVars.boundaryFace().normal; tmp = boundaryVars.molarConcGrad(gPhaseIdx)*boundaryVars.face().normal;
tmp *= -1; tmp *= -1;
tmp *= boundaryVars.porousDiffCoeff(gPhaseIdx) * tmp *= boundaryVars.porousDiffCoeff(gPhaseIdx) *
boundaryVars.molarDensityAtIP(gPhaseIdx); boundaryVars.molarDensityAtIP(gPhaseIdx);
......
...@@ -63,24 +63,10 @@ public: ...@@ -63,24 +63,10 @@ public:
const FVElementGeometry &elemGeom, const FVElementGeometry &elemGeom,
int boundaryFaceIdx, int boundaryFaceIdx,
const ElementVolumeVariables &elemDat) const ElementVolumeVariables &elemDat)
: ParentType(problem, element, elemGeom, boundaryFaceIdx, elemDat, /*onBoundary=*/ true), : ParentType(problem, element, elemGeom, boundaryFaceIdx, elemDat, /*onBoundary=*/ true)
fvGeom_(elemGeom)
{ {
// evaluate variables at the integration point of the boundary face ParentType::calculateValues_(problem, element, this->face(), elemDat, /*onBoundary=*/ true);
boundaryFaceIdx_ = boundaryFaceIdx; }
const BoundaryFace &boundaryFace = elemGeom.boundaryFace[boundaryFaceIdx_];
ParentType::calculateValues_(problem, element, boundaryFace, elemDat, /*onBoundary=*/ true);
};
// CAREFUL: use this method to address boundary faces
// DO NOT USE face() from the parent flux variables!!!
const BoundaryFace &boundaryFace() const
{ return fvGeom_.boundaryFace[boundaryFaceIdx_]; };
private:
FVElementGeometry fvGeom_;
int boundaryFaceIdx_;
}; };
} // end namespace } // end namespace
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment