Commit 5597514c authored by Klaus Mosthaf's avatar Klaus Mosthaf
Browse files

implemented naming convention, added several consts and ran

fixFileIndention over header files


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8177 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent c6ae8f32
......@@ -120,10 +120,10 @@ protected:
{
for (int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++)
{
density_[phaseIdx] += elemVolVars[idx].density(phaseIdx)*
face().shapeValue[idx];
molarDensity_[phaseIdx] += elemVolVars[idx].molarDensity(phaseIdx)*
face().shapeValue[idx];
density_[phaseIdx] += elemVolVars[idx].density(phaseIdx)*
face().shapeValue[idx];
molarDensity_[phaseIdx] += elemVolVars[idx].molarDensity(phaseIdx)*
face().shapeValue[idx];
}
}
......@@ -260,8 +260,8 @@ protected:
}
void calculatePorousDiffCoeff_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
const Element &element,
const ElementVolumeVariables &elemVolVars)
{
const VolumeVariables &volVarsI = elemVolVars[face().i];
const VolumeVariables &volVarsJ = elemVolVars[face().j];
......
......@@ -218,11 +218,11 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
void computeFlux(PrimaryVariables &flux, const int faceIdx, bool onBoundary=false) const
{
FluxVariables fluxVars(this->problem_(),
this->element_(),
this->fvGeometry_(),
faceIdx,
this->curVolVars_(),
onBoundary);
this->element_(),
this->fvGeometry_(),
faceIdx,
this->curVolVars_(),
onBoundary);
flux = 0;
asImp_()->computeAdvectiveFlux(flux, fluxVars);
......
......@@ -381,7 +381,7 @@ public:
for(int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
{
tmpVelocity[phaseIdx] = Scalar(0.0);
tmpVelocity[phaseIdx] = Scalar(0.0);
}
typedef Dune::BlockVector<Dune::FieldVector<Scalar, dim> > SCVVelocities;
......@@ -393,73 +393,73 @@ public:
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
*eIt,
fvGeometry,
false /* oldSol? */);
*eIt,
fvGeometry,
false /* oldSol? */);
for (int faceIdx = 0; faceIdx < fvGeometry.numEdges; faceIdx++)
{
FluxVariables fluxVars(this->problem_(),
*eIt,
fvGeometry,
faceIdx,
elemVolVars);
*eIt,
fvGeometry,
faceIdx,
elemVolVars);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
{
// data attached to upstream and the downstream vertices
// data attached to upstream and the downstream vertices
// of the current phase
const VolumeVariables up =
elemVolVars[fluxVars.upstreamIdx(phaseIdx)];
const VolumeVariables dn =
elemVolVars[fluxVars.downstreamIdx(phaseIdx)];
// local position of integration point
const Dune::FieldVector<Scalar, dim>& localPosIP = fvGeometry.subContVolFace[faceIdx].ipLocal;
// local position of integration point
const Dune::FieldVector<Scalar, dim>& localPosIP = fvGeometry.subContVolFace[faceIdx].ipLocal;
// Transformation of the global normal vector to normal vector in the reference element
const Dune::FieldMatrix<CoordScalar, dim, dim> jacobianT1 = eIt->geometry().jacobianTransposed(localPosIP);
const GlobalPosition globalNormal = fluxVars.face().normal;
// Transformation of the global normal vector to normal vector in the reference element
const Dune::FieldMatrix<CoordScalar, dim, dim> jacobianT1 = eIt->geometry().jacobianTransposed(localPosIP);
const GlobalPosition globalNormal = fluxVars.face().normal;
GlobalPosition localNormal(0);
jacobianT1.mv(globalNormal, localNormal);
GlobalPosition localNormal(0);
jacobianT1.mv(globalNormal, localNormal);
// note only works for cubes
const Scalar localArea = pow(2,-(dim-1));
localNormal /= localNormal.two_norm();
// Get the Darcy velocities. The Darcy velocities are divided by the area of the subcontrolvolume
// face in the reference element.
massUpwindWeight_ = GET_PARAM(TypeTag, Scalar, MassUpwindWeight);
PhasesVector flux;
flux[phaseIdx] = fluxVars.KmvpNormal(phaseIdx)
* (massUpwindWeight_
* up.mobility(phaseIdx)
+ (1- massUpwindWeight_)
* dn.mobility(phaseIdx)) / localArea;
// transform the normal Darcy velocity into a vector
tmpVelocity[phaseIdx] = localNormal;
tmpVelocity[phaseIdx] *= flux[phaseIdx];
if(phaseIdx == wPhaseIdx){
scvVelocityW[fluxVars.face().i] += tmpVelocity[phaseIdx];
scvVelocityW[fluxVars.face().j] += tmpVelocity[phaseIdx];
}
else if(phaseIdx == nPhaseIdx){
scvVelocityN[fluxVars.face().i] += tmpVelocity[phaseIdx];
scvVelocityN[fluxVars.face().j] += tmpVelocity[phaseIdx];
}
}
const Scalar localArea = pow(2,-(dim-1));
localNormal /= localNormal.two_norm();
// Get the Darcy velocities. The Darcy velocities are divided by the area of the subcontrolvolume
// face in the reference element.
massUpwindWeight_ = GET_PARAM(TypeTag, Scalar, MassUpwindWeight);
PhasesVector flux;
flux[phaseIdx] = fluxVars.KmvpNormal(phaseIdx)
* (massUpwindWeight_
* up.mobility(phaseIdx)
+ (1- massUpwindWeight_)
* dn.mobility(phaseIdx)) / localArea;
// transform the normal Darcy velocity into a vector
tmpVelocity[phaseIdx] = localNormal;
tmpVelocity[phaseIdx] *= flux[phaseIdx];
if(phaseIdx == wPhaseIdx){
scvVelocityW[fluxVars.face().i] += tmpVelocity[phaseIdx];
scvVelocityW[fluxVars.face().j] += tmpVelocity[phaseIdx];
}
else if(phaseIdx == nPhaseIdx){
scvVelocityN[fluxVars.face().i] += tmpVelocity[phaseIdx];
scvVelocityN[fluxVars.face().j] += tmpVelocity[phaseIdx];
}
}
}
typedef Dune::GenericReferenceElements<Scalar, dim> ReferenceElements;
const Dune::FieldVector<Scalar, dim>& localPos =
ReferenceElements::general(eIt->geometry().type()).position(0, 0);
// get the transposed Jacobian of the element mapping
// get the transposed Jacobian of the element mapping
const Dune::FieldMatrix<CoordScalar, dim, dim> jacobianT2 = eIt->geometry().jacobianTransposed(localPos);
// transform vertex velocities from local to global coordinates
......@@ -481,14 +481,14 @@ public:
}
}
}
if(velocityOutput_)
{
// divide the vertex velocities by the number of adjacent scvs i.e. cells
for(int globalIdx = 0; globalIdx<numVertices; ++globalIdx){
(*velocityW)[globalIdx] /= (*cellNum)[globalIdx];
(*velocityN)[globalIdx] /= (*cellNum)[globalIdx];
}
if(velocityOutput_)
{
// divide the vertex velocities by the number of adjacent scvs i.e. cells
for(int globalIdx = 0; globalIdx<numVertices; ++globalIdx){
(*velocityW)[globalIdx] /= (*cellNum)[globalIdx];
(*velocityN)[globalIdx] /= (*cellNum)[globalIdx];
}
}
writer.attachVertexData(*sN, "Sn");
......
......@@ -59,9 +59,9 @@ public:
*/
DUMUX_DEPRECATED_MSG("use PorousMediaBoxProblem instead")
TwoPTwoCProblem(TimeManager &timeManager,
const GridView &gridView,
bool verbose = true)
: ParentType(timeManager, gridView)
const GridView &gridView,
bool verbose = true)
: ParentType(timeManager, gridView)
{}
};
}
......
......@@ -153,7 +153,7 @@ public:
if (phaseIdx == wPhaseIdx)
kr = MaterialLaw::krw(materialParams, saturation(wPhaseIdx));
else // ATTENTION: krn requires the wetting phase saturation
// as parameter!
// as parameter!
kr = MaterialLaw::krn(materialParams, saturation(wPhaseIdx));
relativePermeability_[phaseIdx] = kr;
Valgrind::CheckDefined(relativePermeability_[phaseIdx]);
......@@ -170,8 +170,8 @@ public:
// porosity
porosity_ = problem.spatialParams().porosity(element,
fvGeometry,
scvIdx);
fvGeometry,
scvIdx);
Valgrind::CheckDefined(porosity_);
// energy related quantities not contained in the fluid state
......@@ -412,10 +412,10 @@ public:
protected:
static Scalar temperature_(const PrimaryVariables &priVars,
const Problem& problem,
const Element &element,
const FVElementGeometry &fvGeometry,
int scvIdx)
const Problem& problem,
const Element &element,
const FVElementGeometry &fvGeometry,
int scvIdx)
{
return problem.boxTemperature(element, fvGeometry, scvIdx);
}
......
......@@ -63,7 +63,7 @@ class TwoPTwoCNIFluxVariables : public TwoPTwoCFluxVariables<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GridView::template Codim<0>::Entity Element;
enum { dimWorld = GridView::dimensionworld };
typedef Dune::FieldVector<Scalar, dimWorld> Vector;
typedef Dune::FieldVector<Scalar, dimWorld> DimVector;
public:
/*
......@@ -76,14 +76,14 @@ public:
* \param elemVolVars The volume variables of the current element
*/
TwoPTwoCNIFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &elemGeom,
int faceIdx,
const ElementVolumeVariables &elemVolVars,
bool onBoundary = false)
: ParentType(problem, element, elemGeom, faceIdx, elemVolVars, onBoundary)
const Element &element,
const FVElementGeometry &fvGeometry,
const int faceIdx,
const ElementVolumeVariables &elemVolVars,
bool onBoundary = false)
: ParentType(problem, element, fvGeometry, faceIdx, elemVolVars, onBoundary)
{
scvfIdx_ = faceIdx;
faceIdx_ = faceIdx;
calculateValues_(problem, element, elemVolVars);
}
......@@ -96,7 +96,7 @@ public:
Scalar normalMatrixHeatFlux() const
{ return normalMatrixHeatFlux_; }
Vector temperatureGradient() const
DimVector temperatureGradient() const
{ return temperatureGrad_; }
protected:
......@@ -107,30 +107,30 @@ protected:
// calculate temperature gradient using finite element
// gradients
temperatureGrad_ = 0;
Vector tmp(0.0);
for (int vertIdx = 0; vertIdx < this->fvGeometry_.numVertices; vertIdx++)
DimVector tmp(0.0);
for (int idx = 0; idx < this->fvGeometry_.numVertices; idx++)
{
tmp = this->face().grad[vertIdx];
tmp *= elemVolVars[vertIdx].temperature();
tmp = this->face().grad[idx];
tmp *= elemVolVars[idx].temperature();
temperatureGrad_ += tmp;
}
// The spatial parameters calculates the actual heat flux vector
if (this->face().i != this->face().j)
problem.spatialParameters().matrixHeatFlux(tmp,
*this,
elemVolVars,
temperatureGrad_,
element,
this->fvGeometry_,
scvfIdx_);
problem.spatialParams().matrixHeatFlux(tmp,
*this,
elemVolVars,
temperatureGrad_,
element,
this->fvGeometry_,
faceIdx_);
else // heat flux at outflow boundaries
problem.spatialParameters().boundaryMatrixHeatFlux(tmp,
*this,
elemVolVars,
this->face(),
element,
this->fvGeometry_);
problem.spatialParams().boundaryMatrixHeatFlux(tmp,
*this,
elemVolVars,
this->face(),
element,
this->fvGeometry_);
// project the heat flux vector on the face's normal vector
normalMatrixHeatFlux_ = tmp*this->face().normal;
......@@ -138,8 +138,8 @@ protected:
private:
Scalar normalMatrixHeatFlux_;
Vector temperatureGrad_;
int scvfIdx_;
DimVector temperatureGrad_;
int faceIdx_;
};
} // end namespace
......
......@@ -62,8 +62,8 @@ class TwoPTwoCNILocalResidual : public TwoPTwoCLocalResidual<TypeTag>
numPhases = GET_PROP_VALUE(TypeTag, NumPhases),
energyEqIdx = Indices::energyEqIdx,
temperatureIdx = Indices::temperatureIdx,
lPhaseIdx = Indices::lPhaseIdx,
gPhaseIdx = Indices::gPhaseIdx
wPhaseIdx = Indices::wPhaseIdx,
nPhaseIdx = Indices::nPhaseIdx
};
public:
......@@ -89,32 +89,32 @@ public:
* \param scvIdx The SCV (sub-control-volume) index
* \param usePrevSol Evaluate function with solution of current or previous time step
*/
void computeStorage(PrimaryVariables &result, int scvIdx, bool usePrevSol) const
void computeStorage(PrimaryVariables &storage, const int scvIdx, bool usePrevSol) const
{
// compute the storage term for phase mass
ParentType::computeStorage(result, scvIdx, usePrevSol);
ParentType::computeStorage(storage, scvIdx, usePrevSol);
// if flag usePrevSol is set, the solution from the previous
// time step is used, otherwise the current solution is
// used. The secondary variables are used accordingly. This
// is required to compute the derivative of the storage term
// using the implicit euler method.
const ElementVolumeVariables &elemDat = usePrevSol ? this->prevVolVars_() : this->curVolVars_();
const VolumeVariables &vertDat = elemDat[scvIdx];
const ElementVolumeVariables &elemVolVars = usePrevSol ? this->prevVolVars_() : this->curVolVars_();
const VolumeVariables &volVars = elemVolVars[scvIdx];
// compute the energy storage
result[energyEqIdx] =
vertDat.porosity()*(vertDat.density(lPhaseIdx) *
vertDat.internalEnergy(lPhaseIdx) *
//vertDat.enthalpy(lPhaseIdx) *
vertDat.saturation(lPhaseIdx)
storage[energyEqIdx] =
volVars.porosity()*(volVars.density(wPhaseIdx) *
volVars.internalEnergy(wPhaseIdx) *
//vertDat.enthalpy(wPhaseIdx) *
volVars.saturation(wPhaseIdx)
+
vertDat.density(gPhaseIdx) *
vertDat.internalEnergy(gPhaseIdx) *
//vertDat.enthalpy(gPhaseIdx) *
vertDat.saturation(gPhaseIdx))
volVars.density(nPhaseIdx) *
volVars.internalEnergy(nPhaseIdx) *
//vertDat.enthalpy(nPhaseIdx) *
volVars.saturation(nPhaseIdx))
+
vertDat.temperature()*vertDat.heatCapacity();
volVars.temperature()*volVars.heatCapacity();
}
/*!
......@@ -128,29 +128,28 @@ public:
* This method is called by compute flux (base class)
*/
void computeAdvectiveFlux(PrimaryVariables &flux,
const FluxVariables &fluxData) const
const FluxVariables &fluxVars) const
{
// advective mass flux
ParentType::computeAdvectiveFlux(flux, fluxData);
ParentType::computeAdvectiveFlux(flux, fluxVars);
// advective heat flux in all phases
flux[energyEqIdx] = 0;
for (int phase = 0; phase < numPhases; ++phase) {
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
// vertex data of the upstream and the downstream vertices
const VolumeVariables &up = this->curVolVars_(fluxData.upstreamIdx(phase));
const VolumeVariables &dn = this->curVolVars_(fluxData.downstreamIdx(phase));
const VolumeVariables &up = this->curVolVars_(fluxVars.upstreamIdx(phaseIdx));
const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx(phaseIdx));
flux[energyEqIdx] +=
fluxData.KmvpNormal(phase) * (
massUpwindWeight_ * // upstream vertex
( up.density(phase) *
up.mobility(phase) *
up.enthalpy(phase))
+
(1-massUpwindWeight_) * // downstream vertex
( dn.density(phase) *
dn.mobility(phase) *
dn.enthalpy(phase)) );
fluxVars.KmvpNormal(phaseIdx) * (massUpwindWeight_ * // upstream vertex
( up.density(phaseIdx) *
up.mobility(phaseIdx) *
up.enthalpy(phaseIdx))
+
(1-massUpwindWeight_) * // downstream vertex
( dn.density(phaseIdx) *
dn.mobility(phaseIdx) *
dn.enthalpy(phaseIdx)) );
}
}
......@@ -164,14 +163,14 @@ public:
* This method is called by compute flux (base class)
*/
void computeDiffusiveFlux(PrimaryVariables &flux,
const FluxVariables &fluxData) const
const FluxVariables &fluxVars) const
{
// diffusive mass flux
ParentType::computeDiffusiveFlux(flux, fluxData);
ParentType::computeDiffusiveFlux(flux, fluxVars);
// diffusive heat flux
flux[temperatureIdx] +=
fluxData.normalMatrixHeatFlux();
fluxVars.normalMatrixHeatFlux();
}
private:
......
......@@ -43,26 +43,26 @@ namespace Dumux {
* Using the standard multiphase Darcy approach a mass balance equation is
* solved:
* \f{eqnarray*}
&& \phi \frac{\partial (\sum_\alpha \varrho_\alpha X_\alpha^\kappa S_\alpha )}{\partial t}
- \sum_\alpha \text{div} \left\{ \varrho_\alpha X_\alpha^\kappa
\frac{k_{r\alpha}}{\mu_\alpha} \mbox{\bf K}
(\text{grad}\, p_\alpha - \varrho_{\alpha} \mbox{\bf g}) \right\}\\
&-& \sum_\alpha \text{div} \left\{{\bf D}_{\alpha, pm}^\kappa \varrho_{\alpha} \text{grad}\, X^\kappa_{\alpha} \right\}
- \sum_\alpha q_\alpha^\kappa = 0 \qquad \kappa \in \{w, a\} \, ,
\alpha \in \{w, n\}
&& \phi \frac{\partial (\sum_\alpha \varrho_\alpha X_\alpha^\kappa S_\alpha )}{\partial t}
- \sum_\alpha \text{div} \left\{ \varrho_\alpha X_\alpha^\kappa
\frac{k_{r\alpha}}{\mu_\alpha} \mbox{\bf K}
(\text{grad}\, p_\alpha - \varrho_{\alpha} \mbox{\bf g}) \right\}\\
&-& \sum_\alpha \text{div} \left\{{\bf D}_{\alpha, pm}^\kappa \varrho_{\alpha} \text{grad}\, X^\kappa_{\alpha} \right\}
- \sum_\alpha q_\alpha^\kappa = 0 \qquad \kappa \in \{w, a\} \, ,
\alpha \in \{w, n\}
* \f}
* For the energy balance, local thermal equilibrium is assumed which results in one
* energy conservation equation for the porous solid matrix and the fluids:
* \f{eqnarray*}
&& \phi \frac{\partial \left( \sum_\alpha \varrho_\alpha u_\alpha S_\alpha \right)}{\partial t}
+ \left( 1 - \phi \right) \frac{\partial (\varrho_s c_s T)}{\partial t}
- \sum_\alpha \text{div} \left\{ \varrho_\alpha h_\alpha
\frac{k_{r\alpha}}{\mu_\alpha} \mathbf{K} \left( \text{grad}\,
p_\alpha
- \varrho_\alpha \mathbf{g} \right) \right\} \\
&-& \text{div} \left( \lambda_{pm} \text{grad} \, T \right)
- q^h = 0 \qquad \alpha \in \{w, n\}
\f}
&& \phi \frac{\partial \left( \sum_\alpha \varrho_\alpha u_\alpha S_\alpha \right)}{\partial t}
+ \left( 1 - \phi \right) \frac{\partial (\varrho_s c_s T)}{\partial t}
- \sum_\alpha \text{div} \left\{ \varrho_\alpha h_\alpha
\frac{k_{r\alpha}}{\mu_\alpha} \mathbf{K} \left( \text{grad}\,
p_\alpha
- \varrho_\alpha \mathbf{g} \right) \right\} \\
&-& \text{div} \left( \lambda_{pm} \text{grad} \, T \right)
- q^h = 0 \qquad \alpha \in \{w, n\}
\f}
*
* This is discretized using a fully-coupled vertex
* centered finite volume (box) scheme as spatial and
......
......@@ -73,7 +73,7 @@ SET_TYPE_PROP(BoxTwoPTwoCNI, FluxVariables, TwoPTwoCNIFluxVariables<TypeTag>);
SET_PROP(BoxTwoPTwoCNI, Indices)
{ private:
enum { formulation = GET_PROP_VALUE(TypeTag, Formulation) };
public:
public:
typedef TwoPTwoCNIIndices<TypeTag, formulation, 0> type;
};
......
......@@ -70,7 +70,7 @@ public:
*
* \param phaseIdx The phase index
*/
Scalar internalEnergy(int phaseIdx) const
Scalar internalEnergy(const int phaseIdx) const
{ return this->fluidState_.internalEnergy(phaseIdx); };
/*!
......@@ -79,7 +79,7 @@ public:
*
* \param phaseIdx The phase index
*/
Scalar enthalpy(int phaseIdx) const
Scalar enthalpy(const int phaseIdx) const
{ return this->fluidState_.enthalpy(phaseIdx); };
/*!
......@@ -95,10 +95,10 @@ protected:
friend class TwoPTwoCVolumeVariables<TypeTag>;
static Scalar temperature_(const PrimaryVariables &priVars,
const Problem& problem,
const Element &element,
const FVElementGeometry &elemGeom,
int scvIdx)
const Problem& problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int scvIdx)
{
return priVars[temperatureIdx];
}
......@@ -106,7 +106,7 @@ protected:
template<class ParameterCache>
static Scalar enthalpy_(const FluidState& fluidState,
const ParameterCache& paramCache,
int phaseIdx)
const int phaseIdx)
{
return FluidSystem::enthalpy(fluidState, paramCache, phaseIdx);
}
......@@ -117,19 +117,19 @@ protected:
* \param sol The solution primary variables
* \param problem The problem
* \param element The element
* \param elemGeom Evaluate function with solution of current or previous time step
* \param fvGeometry Evaluate function with solution of current or previous time step
* \param scvIdx The local index of the SCV (sub-control volume)
* \param isOldSol Evaluate function with solution of current or previous time step
*/
void updateEnergy_(const PrimaryVariables &sol,
const Problem &problem,
const Element &element,
const FVElementGeometry &elemGeom,
int scvIdx,
bool isOldSol)
const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int scvIdx,
bool isOldSol)
{
// copmute and set the heat capacity of the solid phase
heatCapacity_ = problem.spatialParameters().heatCapacity(element, elemGeom, scvIdx);
heatCapacity_ = problem.spatialParams().heatCapacity(element, fvGeometry, scvIdx);
Valgrind::CheckDefined(heatCapacity_);
};
......
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