Commit 5555d1d1 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

Merge branch 'cleanup/fluxvar-deprecated-constructors' into 'master'

[fluxvars] Remove deprecated constructors and methods in all fluxvariables



See merge request !180
parents f3d52a6d 0dc99b97
......@@ -81,31 +81,6 @@ class ElOnePTwoCFluxVariables: public ElasticFluxVariablesBase<TypeTag> ,
typedef typename FVElementGeometry::SubControlVolumeFace SCVFace;
public:
/*
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx 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
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
ElOnePTwoCFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false) {}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
ElOnePTwoCFluxVariables() = default;
/*!
* \brief Compute / update the flux variables
*
......
......@@ -85,32 +85,6 @@ class ElTwoPFluxVariables: public ImplicitDarcyFluxVariables<TypeTag>
enum {numEq = GET_PROP_VALUE(TypeTag, NumEq)};
public:
/*
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx 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
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
ElTwoPFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: ParentType(problem, element, fvGeometry, fIdx, elemVolVars) {}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
ElTwoPFluxVariables() = default;
/*!
* \brief Compute / update the flux variables
*
......
......@@ -68,39 +68,6 @@ class ElasticFluxVariablesBase
typedef typename FVElementGeometry::SubControlVolumeFace SCVFace;
public:
/*
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx 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
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
ElasticFluxVariablesBase(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
{
DUNE_THROW(Dune::InvalidStateException, "The FluxVariables now have to be default contructed. "
<< "In case you have your own FluxVariables you have to make them default "
<< " constructable too. All calls to the old constructor will throw this error. "
<< "Everywhere you instantiate FluxVariables do this now by default constructing "
<< "a FluxVariables object (FluxVariables fluxVars;) and then updating it where "
<< "the update method has the same signature as the old constructor (fluxVars.update(...).)");
}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
ElasticFluxVariablesBase() = default;
/*!
* \brief Compute / update the flux variables
*
......
......@@ -82,39 +82,6 @@ class OnePTwoCFluxVariables
typedef typename FVElementGeometry::SubControlVolumeFace SCVFace;
public:
/*
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param scvfIdx 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
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
OnePTwoCFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
{
DUNE_THROW(Dune::InvalidStateException, "The FluxVariables now have to be default contructed. "
<< "In case you have your own FluxVariables you have to make them default "
<< " constructable too. All calls to the old constructor will throw this error. "
<< "Everywhere you instantiate FluxVariables do this now by default constructing "
<< "a FluxVariables object (FluxVariables fluxVars;) and then updating it where "
<< "the update method has the same signature as the old constructor (fluxVars.update(...).)");
}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
OnePTwoCFluxVariables() = default;
/*!
* \brief Compute / update the flux variables
*
......
......@@ -73,32 +73,7 @@ class TwoPTwoCFluxVariables : public GET_PROP_TYPE(TypeTag, BaseFluxVariables)
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
public:
/*!
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx The local index of the sub-control-volume face
* \param elemVolVars The volume variables of the current element
* \param onBoundary Evaluate flux at inner sub-control-volume face or on a boundary face
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
TwoPTwoCFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: BaseFluxVariables(problem, element, fvGeometry, fIdx, elemVolVars, onBoundary) {}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
TwoPTwoCFluxVariables() = default;
public:
/*!
* \brief Compute / update the flux variables
*
......@@ -187,22 +162,6 @@ class TwoPTwoCFluxVariables : public GET_PROP_TYPE(TypeTag, BaseFluxVariables)
}
}
DUNE_DEPRECATED_MSG("This method will be removed without replacement!")
Scalar rhoFactor_(int phaseIdx, int scvIdx, const ElementVolumeVariables &vDat)
{
static const Scalar eps = 1e-2;
const Scalar sat = vDat[scvIdx].density(phaseIdx);
if (sat > eps)
return 0.5;
if (sat <= 0)
return 0;
static const Spline<Scalar> sp(0, eps, // x0, x1
0, 0.5, // y0, y1
0, 0); // m0, m1
return sp.eval(sat);
}
void calculatePorousDiffCoeff_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
......
......@@ -68,32 +68,6 @@ class TwoPDFMFluxVariables : public ImplicitDarcyFluxVariables<TypeTag>
typedef Dune::FieldVector<Scalar, numPhases> PhasesVector;
public:
/*!
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx 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
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
TwoPDFMFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: ImplicitDarcyFluxVariables<TypeTag>(problem, element, fvGeometry, fIdx, elemVolVars, onBoundary) {}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
TwoPDFMFluxVariables() = default;
/*!
* \brief Compute / update the flux variables
*
......
......@@ -75,39 +75,6 @@ class TwoPMincFluxVariables
typedef typename FVElementGeometry::SubControlVolumeFace SCVFace;
public:
/*!
* \brief The old constructor
*
* \param problem The problem
* \param element The grid element
* \param fvGeometry The finite-volume geometry
* \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
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
TwoPMincFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int faceIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
{
DUNE_THROW(Dune::InvalidStateException, "The FluxVariables now have to be default contructed. "
<< "In case you have your own FluxVariables you have to make them default "
<< " constructable too. All calls to the old constructor will throw this error. "
<< "Everywhere you instantiate FluxVariables do this now by default constructing "
<< "a FluxVariables object (FluxVariables fluxVars;) and then updating it where "
<< "the update method has the same signature as the old constructor (fluxVars.update(...).)");
}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
TwoPMincFluxVariables() = default;
/*!
* \brief Compute / update the flux variables
*
......
......@@ -80,31 +80,6 @@ class TwoPNCFluxVariables : public GET_PROP_TYPE(TypeTag, BaseFluxVariables)
};
public:
/*!
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx The local index of the sub-control-volume face
* \param elemVolVars The volume variables of the current element
* \param onBoundary Evaluate flux at inner sub-control-volume face or on a boundary face
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
TwoPNCFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: BaseFluxVariables(problem, element, fvGeometry, fIdx, elemVolVars, onBoundary) {}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
TwoPNCFluxVariables() = default;
/*!
* \brief Compute / update the flux variables
*
......@@ -128,25 +103,40 @@ public:
}
protected:
void calculateIpDensities_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
{
// calculate densities at the integration points of the face
density_.fill(0.0);
molarDensity_.fill(0.0);
for (unsigned int idx = 0; idx < this->face().numFap; idx++) // loop over adjacent vertices
{
// index for the element volume variables
int volVarsIdx = this->face().fapIndices[idx];
for (int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++)
{
density_[phaseIdx] += elemVolVars[volVarsIdx].density(phaseIdx)*this->face().shapeValue[idx];
molarDensity_[phaseIdx] += elemVolVars[volVarsIdx].molarDensity(phaseIdx)*this->face().shapeValue[idx];
}
}
}
void calculateGradients_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
{
calculateIpDensities_(problem, element, elemVolVars);
BaseFluxVariables::calculateGradients_(problem, element, elemVolVars);
// initialize to mole/mass fraction gradients to zero
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
{
for (int compIdx = 0; compIdx < numComponents; ++compIdx)
{
moleFractionGrad_[phaseIdx][compIdx] = 0.0; // deprecated
massFractionGrad_[phaseIdx][compIdx] = 0.0; // deprecated
}
concentrationGrad_[phaseIdx].fill(GlobalPosition(0.0)); // TODO: deprecated, remove this once the interface function gets removed
moleFractionGrad_[phaseIdx].fill(GlobalPosition(0.0));
}
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
concentrationGrad_[phaseIdx].fill(GlobalPosition(0.0));
// loop over number of flux approximation points
for (unsigned int idx = 0; idx < this->face().numFap; ++idx)
{
......@@ -164,40 +154,16 @@ protected:
{
if(compIdx != phaseIdx) //No grad is needed for this case
{
GlobalPosition tmp(feGrad); // deprecated
tmp *= elemVolVars[volVarsIdx].massFraction(phaseIdx, compIdx);
massFractionGrad_[phaseIdx][compIdx] += tmp;
tmp = feGrad; // deprecated
tmp *= elemVolVars[volVarsIdx].moleFraction(phaseIdx, compIdx);
moleFractionGrad_[phaseIdx][compIdx] += tmp;
tmp = feGrad;
tmp *= elemVolVars[volVarsIdx].moleFraction(phaseIdx, compIdx)*elemVolVars[volVarsIdx].molarDensity(phaseIdx);
concentrationGrad_[phaseIdx][compIdx] += tmp;
moleFractionGrad_[phaseIdx][compIdx].axpy(elemVolVars[volVarsIdx].moleFraction(phaseIdx, compIdx), feGrad);
// TODO: deprecated, remove this once the interface function gets removed
concentrationGrad_[phaseIdx][compIdx].axpy(elemVolVars[volVarsIdx].moleFraction(phaseIdx, compIdx)
*elemVolVars[volVarsIdx].molarDensity(phaseIdx), feGrad);
}
}
}
}
}
DUNE_DEPRECATED_MSG("This method will be removed without replacement!")
Scalar rhoFactor_(int phaseIdx, int scvIdx, const ElementVolumeVariables &vDat)
{
static const Scalar eps = 1e-2;
const Scalar sat = vDat[scvIdx].density(phaseIdx);
if (sat > eps)
return 0.5;
if (sat <= 0)
return 0;
static const Spline<Scalar> sp(0, eps, // x0, x1
0, 0.5, // y0, y1
0, 0); // m0, m1
return sp.eval(sat);
}
void calculatePorousDiffCoeff_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
......@@ -246,21 +212,7 @@ protected:
}
}
DUNE_DEPRECATED_MSG("Use calculatePorousDiffCoeff_ (captial P)")
void calculateporousDiffCoeff_(const Problem &problem,
const Element &element,
const ElementVolumeVariables &elemVolVars)
{ calculatePorousDiffCoeff_(problem, element, elemVolVars); }
public:
DUNE_DEPRECATED_MSG("Use darcy flux variables interface.")
Scalar KmvpNormal(int phaseIdx) const
{ return this->kGradPNormal_[phaseIdx]; }
DUNE_DEPRECATED_MSG("Will be removed without replacement. Use darcy flux variables interface.")
GlobalPosition Kmvp(int phaseIdx) const
{ return this->kGradP_[phaseIdx]; }
/*!
* \brief The binary diffusion coefficient for each fluid phase.
*
......@@ -294,43 +246,32 @@ public:
* \param phaseIdx The phase index
* \param compIdx The component index
*/
DUNE_DEPRECATED_MSG("Use concentrationGrad!")
const GlobalPosition &massFractionGrad(int phaseIdx, int compIdx) const
{ return massFractionGrad_[phaseIdx][compIdx]; }
DUNE_DEPRECATED_MSG("Don't use concentration gradient. Fick's law is based on mole fraction gradients!")
const GlobalPosition &concentrationGrad(int phaseIdx, int compIdx) const
{ return concentrationGrad_[phaseIdx][compIdx]; }
/*!
* \brief The molar concentration gradient of a component in a phase.
* \brief The mole fraction gradient of a component in a phase.
*
* \param phaseIdx The phase index
* \param compIdx The component index
*/
DUNE_DEPRECATED_MSG("Use concentrationGrad!")
const GlobalPosition &moleFractionGrad(int phaseIdx, int compIdx) const
{ return moleFractionGrad_[phaseIdx][compIdx]; }
/*!
* \brief The concentration gradient of a component in a phase.
*
* \param phaseIdx The phase index
* \param compIdx The component index
*/
const GlobalPosition &concentrationGrad(int phaseIdx, int compIdx) const
{ return concentrationGrad_[phaseIdx][compIdx]; }
protected:
// gradients
GlobalPosition massFractionGrad_[numPhases][numComponents]; // deprecated
GlobalPosition moleFractionGrad_[numPhases][numComponents]; // deprecated
std::array<std::array<GlobalPosition, numComponents>, numPhases> concentrationGrad_;
// mole fraction gradient
std::array<std::array<GlobalPosition, numComponents>, numPhases> moleFractionGrad_;
std::array<std::array<GlobalPosition, numComponents>, numPhases> concentrationGrad_; // TODO: deprecated
// density of each face at the integration point
Scalar density_[numPhases], molarDensity_[numPhases];
std::array<Scalar, numPhases> density_, molarDensity_;
// the diffusion coefficient for the porous medium
Dune::FieldMatrix<Scalar, numPhases, numComponents> porousDiffCoeff_;
};
} // end namespace
} // end namespace Dumux
#endif
......@@ -301,14 +301,14 @@ public:
{
for (int compIdx = 0; compIdx < numComponents; ++compIdx)
{
const auto diffCont = - fluxVars.porousDiffCoeff(phaseIdx, compIdx) * fluxVars.molarDensity(phaseIdx)
*(fluxVars.moleFractionGrad(phaseIdx, compIdx) * fluxVars.face().normal);
//add diffusive fluxes only to the component balances
if (replaceCompEqIdx != (conti0EqIdx + compIdx))
{
Scalar diffCont = - fluxVars.porousDiffCoeff(phaseIdx, compIdx)
* (fluxVars.concentrationGrad(phaseIdx, compIdx) * fluxVars.face().normal);
flux[conti0EqIdx + compIdx] += diffCont;
if (replaceCompEqIdx != (conti0EqIdx + phaseIdx))
flux[conti0EqIdx + phaseIdx] -= diffCont;
}
}
}
}
......
......@@ -55,13 +55,11 @@ class TwoPNCMinFluxVariables : public TwoPNCFluxVariables<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
typedef typename GridView::ctype CoordScalar;
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
enum {
dim = GridView::dimension,
......@@ -70,13 +68,7 @@ class TwoPNCMinFluxVariables : public TwoPNCFluxVariables<TypeTag>
numComponents = GET_PROP_VALUE(TypeTag, NumComponents),
};
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename GET_PROP_TYPE(TypeTag, SpatialParams) SpatialParams;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename FVElementGeometry::SubControlVolume SCV;
typedef typename FVElementGeometry::SubControlVolumeFace SCVFace;
typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
typedef Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld> DimWorldMatrix;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
......@@ -86,32 +78,6 @@ class TwoPNCMinFluxVariables : public TwoPNCFluxVariables<TypeTag>
wCompIdx = FluidSystem::wCompIdx,
};
public:
/*!
* \brief The old constructor
*
* \param problem The problem
* \param element The finite element
* \param fvGeometry The finite-volume geometry in the fully implicit scheme
* \param fIdx The local index of the sub-control-volume face
* \param elemVolVars The volume variables of the current element
* \param onBoundary Evaluate flux at inner sub-control-volume face or on a boundary face
*/
DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.")
TwoPNCMinFluxVariables(const Problem &problem,
const Element &element,
const FVElementGeometry &fvGeometry,
const int fIdx,
const ElementVolumeVariables &elemVolVars,
const bool onBoundary = false)
: ParentType(problem, element, fvGeometry, fIdx, elemVolVars, onBoundary) {}
/*!
* \brief Default constructor
* \note This can be removed when the deprecated constructor is removed.
*/
TwoPNCMinFluxVariables() = default;
protected:
/*!
* \brief Actual calculation of the normal Darcy velocities.
......@@ -128,10 +94,10 @@ protected:
const ElementVolumeVariables &elemVolVars)
{
// calculate the mean intrinsic permeability
const SpatialParams &spatialParams = problem.spatialParams();
const auto& spatialParams = problem.spatialParams();
DimWorldMatrix K(0.0);
const VolumeVariables &volVarsI = elemVolVars[this->face().i];
const VolumeVariables &volVarsJ = elemVolVars[this->face().j];
const auto& volVarsI = elemVolVars[this->face().i];
const auto& volVarsJ = elemVolVars[this->face().j];
if (GET_PROP_VALUE(TypeTag, ImplicitIsBox))
{
......@@ -192,8 +158,8 @@ protected:
}
// obtain the upwind volume variables
const VolumeVariables& upVolVars = elemVolVars[ this->upstreamIdx(phaseIdx) ];
const VolumeVariables& downVolVars = elemVolVars[ this->downstreamIdx(phaseIdx) ];
const auto& upVolVars = elemVolVars[ this->upstreamIdx(phaseIdx) ];
const auto& downVolVars = elemVolVars[ this->downstreamIdx(phaseIdx) ];
// the minus comes from the Darcy relation which states that
// the flux is from high to low potentials.
......
......@@ -82,30 +82,6 @@ class ThreePThreeCFluxVariables : public GET_PROP_TYPE(TypeTag, BaseFluxVariable
};
public:
/*!