mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move assignment of gas fractions into CompositionalContainer
This commit is contained in:
parent
ae23b39d40
commit
95e3735678
@ -66,6 +66,21 @@ allocate(const unsigned bufferSize,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class FluidSystem>
|
||||||
|
void CompositionalContainer<FluidSystem>::
|
||||||
|
assignGasFractions(const unsigned globalDofIdx,
|
||||||
|
const AssignFunction& fractions)
|
||||||
|
{
|
||||||
|
if (phaseMoleFractions_[gasPhaseIdx][0].empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::for_each(phaseMoleFractions_[gasPhaseIdx].begin(),
|
||||||
|
phaseMoleFractions_[gasPhaseIdx].end(),
|
||||||
|
[globalDofIdx, &fractions, c = 0](auto& comp) mutable
|
||||||
|
{ comp[globalDofIdx] = fractions(c++); });
|
||||||
|
}
|
||||||
|
|
||||||
template<class FluidSystem>
|
template<class FluidSystem>
|
||||||
void CompositionalContainer<FluidSystem>::
|
void CompositionalContainer<FluidSystem>::
|
||||||
assignMoleFractions(const unsigned globalDofIdx,
|
assignMoleFractions(const unsigned globalDofIdx,
|
||||||
@ -88,6 +103,7 @@ assignOilFractions(const unsigned globalDofIdx,
|
|||||||
if (phaseMoleFractions_[oilPhaseIdx][0].empty()) {
|
if (phaseMoleFractions_[oilPhaseIdx][0].empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::for_each(phaseMoleFractions_[oilPhaseIdx].begin(),
|
std::for_each(phaseMoleFractions_[oilPhaseIdx].begin(),
|
||||||
phaseMoleFractions_[oilPhaseIdx].end(),
|
phaseMoleFractions_[oilPhaseIdx].end(),
|
||||||
[globalDofIdx, &fractions, c = 0](auto& comp) mutable
|
[globalDofIdx, &fractions, c = 0](auto& comp) mutable
|
||||||
|
@ -55,6 +55,9 @@ public:
|
|||||||
|
|
||||||
using AssignFunction = std::function<Scalar(const unsigned)>;
|
using AssignFunction = std::function<Scalar(const unsigned)>;
|
||||||
|
|
||||||
|
void assignGasFractions(const unsigned globalDofIdx,
|
||||||
|
const AssignFunction& fractions);
|
||||||
|
|
||||||
void assignMoleFractions(const unsigned globalDofIdx,
|
void assignMoleFractions(const unsigned globalDofIdx,
|
||||||
const AssignFunction& fractions);
|
const AssignFunction& fractions);
|
||||||
|
|
||||||
|
@ -57,8 +57,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm {
|
||||||
{
|
|
||||||
|
|
||||||
// forward declaration
|
// forward declaration
|
||||||
template <class TypeTag>
|
template <class TypeTag>
|
||||||
@ -196,19 +195,18 @@ public:
|
|||||||
[&fs](const unsigned compIdx)
|
[&fs](const unsigned compIdx)
|
||||||
{ return getValue(fs.moleFraction(compIdx)); });
|
{ return getValue(fs.moleFraction(compIdx)); });
|
||||||
|
|
||||||
|
if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
||||||
|
this->compC_.assignGasFractions(globalDofIdx,
|
||||||
|
[&fs](const unsigned compIdx)
|
||||||
|
{ return getValue(fs.moleFraction(gasPhaseIdx, compIdx)); });
|
||||||
|
}
|
||||||
|
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
|
||||||
this->compC_.assignOilFractions(globalDofIdx,
|
this->compC_.assignOilFractions(globalDofIdx,
|
||||||
[&fs](const unsigned compIdx)
|
[&fs](const unsigned compIdx)
|
||||||
{ return getValue(fs.moleFraction(oilPhaseIdx, compIdx)); });
|
{ return getValue(fs.moleFraction(oilPhaseIdx, compIdx)); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// XMF and YMF
|
|
||||||
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
|
|
||||||
if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
|
|
||||||
if (this->compC_.phaseMoleFractions_[gasPhaseIdx][compIdx].empty()) continue;
|
|
||||||
this->compC_.phaseMoleFractions_[gasPhaseIdx][compIdx][globalDofIdx] = getValue(fs.moleFraction(gasPhaseIdx, compIdx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->fluidPressure_.empty()) {
|
if (!this->fluidPressure_.empty()) {
|
||||||
if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
|
if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user