mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-10 02:55:33 -06:00
ebos: salvage temperature from the initial fluid states for isothermal simulations
this is required because temperature needs to be always specified. in the case of isothermal simulations, the temperature is assumed to be the initial one, i.e., freeing up the initial fluid states also makes the temperature undefined. I suspect that the reason why this did not lead to crashes is that for isothermal `BlackOilFluidState` objects, the temperature is stored in a static member variable. thanks to at [at]bska for catching this issue.
This commit is contained in:
parent
ffe3914ddd
commit
f96d553d8e
@ -659,8 +659,21 @@ public:
|
||||
}
|
||||
|
||||
// we no longer need the initial soluiton
|
||||
if (this->simulator().episodeIndex() == 0)
|
||||
if (this->simulator().episodeIndex() == 0 && !initialFluidStates_.empty()) {
|
||||
// we always need to provide a temperature and if energy is not conserved, we
|
||||
// use the initial one. This means we have to "salvage" the temperature from
|
||||
// the initial fluid states before deleting the array.
|
||||
if (!enableEnergy) {
|
||||
initialTemperature_.resize(initialFluidStates_.size());
|
||||
for (unsigned i = 0; i < initialFluidStates_.size(); ++i) {
|
||||
const auto& fs = initialFluidStates_[i];
|
||||
initialTemperature_[i] = fs.temperature(/*phaseIdx=*/0);
|
||||
}
|
||||
}
|
||||
|
||||
initialFluidStates_.clear();
|
||||
}
|
||||
|
||||
|
||||
updateCompositionChangeLimits_();
|
||||
}
|
||||
@ -1088,7 +1101,9 @@ public:
|
||||
// use the temporally constant temperature, i.e. use the initial temperature of
|
||||
// the DOF
|
||||
unsigned globalDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
||||
return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0);
|
||||
if (!initialFluidStates_.empty())
|
||||
return initialFluidStates_[globalDofIdx].temperature(/*phaseIdx=*/0);
|
||||
return initialTemperature_[globalDofIdx];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1275,9 +1290,8 @@ public:
|
||||
{ return wellManager_; }
|
||||
|
||||
// temporary solution to facilitate output of initial state from flow
|
||||
const InitialFluidState& initialFluidState(unsigned globalDofIdx ) const {
|
||||
return initialFluidStates_[globalDofIdx];
|
||||
}
|
||||
const InitialFluidState& initialFluidState(unsigned globalDofIdx ) const
|
||||
{ return initialFluidStates_[globalDofIdx]; }
|
||||
|
||||
const Opm::EclipseIO& eclIO() const
|
||||
{ return eclWriter_->eclIO(); }
|
||||
@ -1979,6 +1993,7 @@ private:
|
||||
|
||||
bool useMassConservativeInitialCondition_;
|
||||
std::vector<InitialFluidState> initialFluidStates_;
|
||||
std::vector<Scalar> initialTemperature_;
|
||||
|
||||
std::vector<Scalar> polymerConcentration_;
|
||||
std::vector<Scalar> solventSaturation_;
|
||||
|
Loading…
Reference in New Issue
Block a user