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

box fluxvariables and localresiduals: prepare for outflow boundary conditions....

box fluxvariables and localresiduals: prepare for outflow boundary conditions. Add an optional bool argument onBoundary to the constructors of the fluxvariables and to the computeFlux routine of the localresiduals.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8146 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 26253d9e
......@@ -73,13 +73,16 @@ public:
* \param fvGeometry The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemVolVars The volume variables of the current element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
OnePFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int faceIdx,
const ElementVolumeVariables &elemVolVars)
: fvGeometry_(fvGeometry)
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: fvGeometry_(fvGeometry), onBoundary_(onBoundary)
{
faceIdx_ = faceIdx;
......@@ -91,7 +94,12 @@ OnePFluxVariables(const Problem &problem,
* \brief The face of the current sub-control volume.
*/
const SCVFace &face() const
{ return fvGeometry_.subContVolFace[faceIdx_]; }
{
if (onBoundary_)
return fvGeometry_.boundaryFace[faceIdx_];
else
return fvGeometry_.subContVolFace[faceIdx_];
}
/*!
* \brief Return the intrinsic permeability \f$\mathrm{[m^2]}\f$.
......@@ -193,6 +201,7 @@ private:
protected:
const FVElementGeometry &fvGeometry_;
int faceIdx_;
const bool onBoundary_;
// gradients
DimVector potentialGrad_;
......
......@@ -106,14 +106,17 @@ public:
*
* \param flux The flux over the SCV (sub-control-volume) face
* \param faceIdx The index of the SCV face
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
void computeFlux(PrimaryVariables &flux, const int faceIdx) const
void computeFlux(PrimaryVariables &flux, const int faceIdx, const bool onBoundary=false) const
{
FluxVariables fluxVars(this->problem_(),
this->element_(),
this->fvGeometry_(),
faceIdx,
this->curVolVars_());
this->curVolVars_(),
onBoundary);
DimVector tmpVec;
fluxVars.intrinsicPermeability().mv(fluxVars.potentialGrad(),
tmpVec);
......
......@@ -81,13 +81,16 @@ public:
* \param elemGeom The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemDat The volume variables of the current element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
TwoPFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &elemGeom,
int faceIdx,
const ElementVolumeVariables &elemDat)
: fvElemGeom_(elemGeom)
const ElementVolumeVariables &elemDat,
const bool onBoundary = false)
: fvElemGeom_(elemGeom), onBoundary_(onBoundary)
{
scvfIdx_ = faceIdx;
......@@ -138,11 +141,17 @@ public:
* \brief Return the SCV (sub-control-volume) face
*/
const SCVFace &face() const
{ return fvElemGeom_.subContVolFace[scvfIdx_]; }
{
if (onBoundary_)
return fvElemGeom_.boundaryFace[scvfIdx_];
else
return fvElemGeom_.subContVolFace[scvfIdx_];
}
protected:
const FVElementGeometry &fvElemGeom_;
int scvfIdx_;
const bool onBoundary_;
// gradients
Vector potentialGrad_[numPhases];
......
......@@ -114,14 +114,17 @@ public:
*
* \param flux The flux over the SCV (sub-control-volume) face for each phase
* \param faceIdx The index of the SCV face
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
void computeFlux(PrimaryVariables &flux, int faceIdx) const
void computeFlux(PrimaryVariables &flux, int faceIdx, const bool onBoundary=false) const
{
FluxVariables vars(this->problem_(),
this->elem_(),
this->fvElemGeom_(),
faceIdx,
this->curVolVars_());
this->curVolVars_(),
onBoundary);
flux = 0;
asImp_()->computeAdvectiveFlux(flux, vars);
asImp_()->computeDiffusiveFlux(flux, vars);
......
......@@ -70,21 +70,24 @@ class TwoPNIFluxVariables : public TwoPFluxVariables<TypeTag>
public:
/*
* \brief The constructor
*
* \param problem The problem
* \param element The finite element
* \param elemGeom The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemDat The volume variables of the current element
*/
* \brief The constructor
*
* \param problem The problem
* \param element The finite element
* \param elemGeom The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemDat The volume variables of the current element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
TwoPNIFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &elemGeom,
int scvfIdx,
const ElementVolumeVariables &elemDat)
: ParentType(problem, element, elemGeom, scvfIdx, elemDat)
const ElementVolumeVariables &elemDat,
const bool onBoundary = false)
: ParentType(problem, element, elemGeom, scvfIdx, elemDat, onBoundary)
{
// calculate temperature gradient using finite element
// gradients
......@@ -92,7 +95,7 @@ public:
Vector tmp(0.0);
for (int vertIdx = 0; vertIdx < elemGeom.numVertices; vertIdx++)
{
tmp = elemGeom.subContVolFace[scvfIdx].grad[vertIdx];
tmp = this->face().grad[vertIdx];
tmp *= elemDat[vertIdx].temperature();
temperatureGrad += tmp;
}
......@@ -106,7 +109,7 @@ public:
elemGeom,
scvfIdx);
// project the heat flux vector on the face's normal vector
normalMatrixHeatFlux_ = tmp * elemGeom.subContVolFace[scvfIdx].normal;
normalMatrixHeatFlux_ = tmp * this->face().normal;
}
/*!
......
......@@ -97,13 +97,16 @@ public:
* \param elemGeom The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemDat The volume variables of the current element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
ThreePThreeCFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &elemGeom,
int faceIdx,
const ElementVolumeVariables &elemDat)
: fvElemGeom_(elemGeom)
const ElementVolumeVariables &elemDat,
const bool onBoundary = false)
: fvElemGeom_(elemGeom), onBoundary_(onBoundary)
{
scvfIdx_ = faceIdx;
......@@ -435,11 +438,17 @@ public:
{ return molarAConcGrad_[phaseIdx]; };
const SCVFace &face() const
{ return fvElemGeom_.subContVolFace[scvfIdx_]; }
{
if (onBoundary_)
return fvElemGeom_.boundaryFace[scvfIdx_];
else
return fvElemGeom_.subContVolFace[scvfIdx_];
}
protected:
const FVElementGeometry &fvElemGeom_;
int scvfIdx_;
const bool onBoundary_;
// gradients
Vector potentialGrad_[numPhases];
......
......@@ -132,14 +132,17 @@ public:
*
* \param flux The flux over the SCV (sub-control-volume) face for each component
* \param faceIdx The index of the SCV face
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
void computeFlux(PrimaryVariables &flux, int faceIdx) const
void computeFlux(PrimaryVariables &flux, int faceIdx, const bool onBoundary=false) const
{
FluxVariables vars(this->problem_(),
this->elem_(),
this->fvElemGeom_(),
faceIdx,
this->curVolVars_());
this->curVolVars_(),
onBoundary);
flux = 0;
asImp_()->computeAdvectiveFlux(flux, vars);
......
......@@ -81,13 +81,16 @@ public:
* \param elemGeom The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemDat The volume variables of the current element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
ThreePThreeCNIFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &elemGeom,
int scvfIdx,
const ElementVolumeVariables &elemDat)
: ParentType(problem, element, elemGeom, scvfIdx, elemDat)
const ElementVolumeVariables &elemDat,
const bool onBoundary = false)
: ParentType(problem, element, elemGeom, scvfIdx, elemDat, onBoundary)
{
// calculate temperature gradient using finite element
// gradients
......@@ -95,7 +98,7 @@ public:
Vector tmp(0.0);
for (int vertIdx = 0; vertIdx < elemGeom.numVertices; vertIdx++)
{
tmp = elemGeom.subContVolFace[scvfIdx].grad[vertIdx];
tmp = this->face().grad[vertIdx];
tmp *= elemDat[vertIdx].temperature();
temperatureGrad += tmp;
}
......@@ -109,7 +112,7 @@ public:
elemGeom,
scvfIdx);
// project the heat flux vector on the face's normal vector
normalMatrixHeatFlux_ = tmp*elemGeom.subContVolFace[scvfIdx].normal;
normalMatrixHeatFlux_ = tmp*this->face().normal;
}
/*!
......
......@@ -63,8 +63,8 @@ public:
const unsigned int faceIdx,
const ElementVolumeVariables &elemVolVars)
{
const unsigned int i = fvGeometry.subContVolFace[faceIdx].i;
const unsigned int j = fvGeometry.subContVolFace[faceIdx].j;
const unsigned int i = this->face().i;
const unsigned int j = this->face().j;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
for (int compIdx = 0; compIdx < numComponents; ++compIdx) {
......@@ -76,7 +76,7 @@ public:
// update the concentration gradients using two-point
// gradients
const DimVector &normal = fvGeometry.subContVolFace[faceIdx].normal;
const DimVector &normal = this->face().normal;
DimVector tmp = element.geometry().corner(j);
tmp -= element.geometry().corner(i);
......
......@@ -112,13 +112,13 @@ public:
DimVector temperatureGradient(0.);
for (int scvIdx = 0; scvIdx < fvGeometry.numVertices; scvIdx++)
{
tmp = fvGeometry.subContVolFace[faceIdx].grad[scvIdx];
tmp = this->face().grad[scvIdx];
tmp *= elemVolVars[scvIdx].fluidState().temperature(/*phaseIdx=*/0);
temperatureGradient += tmp;
}
// project the heat flux vector on the face's normal vector
temperatureGradientNormal_ = temperatureGradient * fvGeometry.subContVolFace[faceIdx].normal;
temperatureGradientNormal_ = temperatureGradient * this->face().normal;
lambdaPm_ = lumpedLambdaPm(problem,
......@@ -136,8 +136,8 @@ public:
const ElementVolumeVariables & elemVolVars)
{
// arithmetic mean of the liquid saturation and the porosity
const unsigned int i = fvGeometry.subContVolFace[faceIdx].i;
const unsigned int j = fvGeometry.subContVolFace[faceIdx].j;
const unsigned int i = this->face().i;
const unsigned int j = this->face().j;
const FluidState &fsI = elemVolVars[i].fluidState();
const FluidState &fsJ = elemVolVars[j].fluidState();
......
......@@ -78,12 +78,24 @@ class MPNCFluxVariables
typedef MPNCFluxVariablesEnergy<TypeTag, enableEnergy, enableKineticEnergy> FluxVariablesEnergy;
public:
/*
* \brief The constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the box scheme
* \param faceIdx The local index of the SCV (sub-control-volume) face
* \param elemVolVars The volume variables of the current element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
MPNCFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const unsigned int faceIdx,
const ElementVolumeVariables &elemVolVars)
: fvGeometry_(fvGeometry), elemVolVars_(elemVolVars)
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: fvGeometry_(fvGeometry), elemVolVars_(elemVolVars), onBoundary_(onBoundary)
{
faceIdx_ = faceIdx;
......@@ -152,7 +164,12 @@ public:
}
const SCVFace &face() const
{ return fvGeometry_.subContVolFace[faceIdx_]; }
{
if (onBoundary_)
return fvGeometry_.boundaryFace[faceIdx_];
else
return fvGeometry_.subContVolFace[faceIdx_];
}
const VolumeVariables &volVars(const unsigned int idx) const
{ return elemVolVars_[idx]; }
......@@ -311,6 +328,7 @@ private:
const FVElementGeometry &fvGeometry_;
int faceIdx_;
const ElementVolumeVariables &elemVolVars_;
const bool onBoundary_;
// The extrusion factor for the sub-control volume face
Scalar extrusionFactor_;
......
......@@ -176,15 +176,21 @@ public:
/*!
* \brief Evaluates the total flux of all conservation quantities
* over a face of a subcontrol volume.
*
* \param flux The flux over the SCV (sub-control-volume) face for each component
* \param faceIdx The index of the SCV face
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
void computeFlux(PrimaryVariables &flux,
const unsigned int faceIdx) const
const unsigned int faceIdx, const bool onBoundary=false) const
{
FluxVariables fluxVars(this->problem_(),
this->element_(),
this->fvGeometry_(),
faceIdx,
this->curVolVars_());
this->curVolVars_(),
onBoundary);
flux = 0.0;
MassResid::computeFlux(flux, fluxVars, this->curVolVars_() );
......
......@@ -75,13 +75,16 @@ public:
* element's finite volume geometry.
* \param elemVolVars An array containing the volume variables for all
* sub-control volumes of the element.
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
RichardsFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvElemGeom,
int scvfIdx,
const ElementVolumeVariables &elemVolVars)
: fvElemGeom_(fvElemGeom)
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: fvElemGeom_(fvElemGeom), onBoundary_(onBoundary)
{
scvfIdx_ = scvfIdx;
......@@ -130,7 +133,12 @@ public:
* which the flux variables object looks at
*/
const SCVFace &face() const
{ return fvElemGeom_.subContVolFace[scvfIdx_]; }
{
if (onBoundary_)
return fvElemGeom_.boundaryFace[scvfIdx_];
else
return fvElemGeom_.subContVolFace[scvfIdx_];
}
protected:
void calculateGradients_(const Problem &problem,
......@@ -201,6 +209,7 @@ protected:
const FVElementGeometry &fvElemGeom_;
int scvfIdx_;
const bool onBoundary_;
// gradients
Vector potentialGrad_;
......
......@@ -114,14 +114,17 @@ public:
* of the current element \f$\mathrm{[kg/s]}\f$
* \param scvfIdx The sub control volume face index inside the current
* element
* \param onBoundary A boolean variable to specify whether the flux variables
* are calculated for interior SCV faces or boundary faces, default=false
*/
void computeFlux(PrimaryVariables &flux, int scvfIdx) const
void computeFlux(PrimaryVariables &flux, int scvfIdx, const bool onBoundary=false) const
{
FluxVariables fluxVars(this->problem_(),
this->elem_(),
this->fvElemGeom_(),
scvfIdx,
this->curVolVars_());
this->curVolVars_(),
onBoundary);
// calculate the flux in the normal direction of the
// current sub control volume face
......
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