Commit 1cec12ba authored by Timo Koch's avatar Timo Koch
Browse files

[cleanup] Remove extract dof privars in volumevariables. Extract directly from elemsol.

parent 839a1e54
......@@ -78,18 +78,10 @@ public:
const Element &element,
const SubControlVolume& scv)
{
priVars_ = extractDofPriVars(elemSol, scv);
priVars_ = elemSol[scv.localDofIndex()];
extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol);
}
/*!
* \brief Returns the primary variables at the dof associated with a given scv.
*/
template<class ElementSolution, class SubControlVolume>
static const auto& extractDofPriVars(const ElementSolution& elemSol,
const SubControlVolume& scv)
{ return elemSol[0]; }
/*!
* \brief Return how much the sub-control volume is extruded.
*
......@@ -226,7 +218,7 @@ public:
const Element &element,
const Scv &scv)
{
return ParentType::extractDofPriVars(elemSol, scv)[Indices::temperatureIdx];
return elemSol[scv.localDofIndex()][Indices::temperatureIdx];
}
//! The phase enthalpy is zero for isothermal models
......
......@@ -108,7 +108,7 @@ public:
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
fluidState.setSaturation(/*phaseIdx=*/0, 1.);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]);
// saturation in a single phase is always 1 and thus redundant
......
......@@ -142,7 +142,7 @@ public:
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
fluidState.setSaturation(fluidSystemPhaseIdx, 1.);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
fluidState.setPressure(fluidSystemPhaseIdx, priVars[pressureIdx]);
// calculate the phase composition
......
......@@ -133,7 +133,7 @@ public:
using MaterialLaw = typename Problem::SpatialParams::MaterialLaw;
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const int wPhaseIdx = problem.spatialParams().template wettingPhase<FluidSystem>(element, scv, elemSol);
if (formulation == TwoPFormulation::p0s1)
......
......@@ -143,7 +143,7 @@ public:
// capillary pressure parameters
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
// get saturations
......
......@@ -174,7 +174,7 @@ public:
{
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
using MaterialLaw = typename Problem::SpatialParams::MaterialLaw;
......
......@@ -193,7 +193,7 @@ public:
{
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
using MaterialLaw = typename Problem::SpatialParams::MaterialLaw;
......
......@@ -136,7 +136,7 @@ public:
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const Scalar sw = priVars[swIdx];
const Scalar sn = priVars[snIdx];
......
......@@ -110,7 +110,7 @@ public:
const Scv& scv)
{
ParentType::update(elemSol, problem, element, scv);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
constexpr bool useConstraintSolver = ModelTraits::useConstraintSolver();
......
......@@ -103,7 +103,7 @@ public:
const Scv& scv)
{
ParentType::update(elemSol, problem, element, scv);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
bool onlyGasPhaseCanDisappear = Traits::ModelTraits::onlyGasPhaseCanDisappear();
......
......@@ -162,7 +162,7 @@ public:
{
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
using MaterialLaw = typename Problem::SpatialParams::MaterialLaw;
......
......@@ -167,7 +167,7 @@ public:
/////////////
// set the phase saturations
/////////////
auto&& priVars = ParentType::extractDofPriVars(elemSol, scv);
auto&& priVars = elemSol[scv.localDofIndex()];
Scalar sumSat = 0;
for (int phaseIdx = 0; phaseIdx < numPhases() - 1; ++phaseIdx) {
sumSat += priVars[Indices::s0Idx + phaseIdx];
......@@ -620,7 +620,7 @@ public:
/////////////
// set the phase saturations
/////////////
auto&& priVars = ParentType::extractDofPriVars(elemSol, scv);
auto&& priVars = elemSol[scv.localDofIndex()];
Scalar sumSat = 0;
for (int phaseIdx = 0; phaseIdx < numPhases() - 1; ++phaseIdx) {
sumSat += priVars[Indices::s0Idx + phaseIdx];
......
......@@ -125,7 +125,7 @@ public:
if (numEnergyEq == 1)
{
// retrieve temperature from solution vector, all phases have the same temperature
const Scalar T = ParentType::extractDofPriVars(elemSol, scv)[temperatureIdx];
const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx];
for(int phaseIdx=0; phaseIdx < FluidSystem::numPhases; ++phaseIdx)
{
fluidState.setTemperature(phaseIdx, T);
......@@ -138,11 +138,11 @@ public:
for(int phaseIdx=0; phaseIdx < numEnergyEq-1; ++phaseIdx)
{
// retrieve temperatures from solution vector, phases might have different temperature
const Scalar T = ParentType::extractDofPriVars(elemSol, scv)[temperatureIdx + phaseIdx];
const Scalar T = elemSol[scv.localDofIndex()][temperatureIdx + phaseIdx];
fluidState.setTemperature(phaseIdx, T);
}
const Scalar solidTemperature = ParentType::extractDofPriVars(elemSol, scv)[temperatureIdx+numEnergyEq-1];
const Scalar solidTemperature = elemSol[scv.localDofIndex()][temperatureIdx+numEnergyEq-1];
solidState.setTemperature(solidTemperature);
}
}
......
......@@ -85,7 +85,7 @@ public:
{
ParentType::update(elemSol, problem, element, scv);
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
const auto phasePresence = priVars.state();
// precompute the minimum capillary pressure (entry pressure)
......@@ -183,7 +183,7 @@ public:
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
// set the wetting pressure
using std::max;
......
......@@ -140,7 +140,7 @@ public:
EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const auto& priVars = elemSol[scv.localDofIndex()];
// set the wetting pressure
fluidState.setPressure(fluidSystemPhaseIdx, priVars[Indices::pressureIdx]);
......
......@@ -65,21 +65,10 @@ public:
const Element& element,
const Scv& scv)
{
priVars_ = extractDofPriVars(elemSol, scv);
priVars_ = elemSol[scv.localDofIndex()];
extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol);
}
/*!
* \brief Returns the primary variables at the dof associated with a given scv.
*
* \param elemSol A vector containing all primary variables connected to the element
* \param scv The sub-control volume
*/
template<class ElemSol, class Scv>
static const PrimaryVariables& extractDofPriVars(const ElemSol& elemSol,
const Scv& scv)
{ return elemSol[scv.localDofIndex()]; }
/*!
* \brief Return the vector of primary variables
*/
......
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