Merge pull request #3333 from totto82/fixTEMPrestart

Pass the temperature to the restart machinary if enableTemperature is true
This commit is contained in:
Bård Skaflestad 2021-06-02 13:09:41 +02:00 committed by GitHub
commit d974f6bd03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 3 deletions

View File

@ -69,6 +69,7 @@ EclGenericOutputBlackoilModule(const EclipseState& eclState,
const SummaryConfig& summaryConfig,
const SummaryState& summaryState,
bool enableEnergy,
bool enableTemperature,
bool enableSolvent,
bool enablePolymer,
bool enableFoam,
@ -79,6 +80,7 @@ EclGenericOutputBlackoilModule(const EclipseState& eclState,
, summaryConfig_(summaryConfig)
, summaryState_(summaryState)
, enableEnergy_(enableEnergy)
, enableTemperature_(enableTemperature)
, enableSolvent_(enableSolvent)
, enablePolymer_(enablePolymer)
, enableFoam_(enableFoam)
@ -554,7 +556,14 @@ assignToSolution(data::Solution& sol)
}
if (!temperature_.empty()) {
sol.insert("TEMP", UnitSystem::measure::temperature, std::move(temperature_), data::TargetType::RESTART_SOLUTION);
if (enableEnergy_)
sol.insert("TEMP", UnitSystem::measure::temperature, std::move(temperature_), data::TargetType::RESTART_SOLUTION);
else {
// Flow allows for initializing of non-constant initial temperature.
// For output of this temperature for visualization and restart set --enable-opm-restart=true
assert(enableTemperature_);
sol.insert("TEMP", UnitSystem::measure::temperature, std::move(temperature_), data::TargetType::RESTART_AUXILIARY);
}
}
if (FluidSystem::phaseIsActive(waterPhaseIdx) && !saturation_[waterPhaseIdx].empty()) {
@ -898,7 +907,7 @@ doAllocBuffers(unsigned bufferSize,
rstKeywords["PRESSURE"] = 0;
// allocate memory for temperature
if (enableEnergy_ || rstKeywords["TEMP"]) {
if (enableEnergy_ || enableTemperature_) {
temperature_.resize(bufferSize, 0.0);
rstKeywords["TEMP"] = 0;
}

View File

@ -148,6 +148,7 @@ protected:
const SummaryConfig& summaryConfig,
const SummaryState& summaryState,
bool enableEnergy,
bool enableTemperature,
bool enableSolvent,
bool enablePolymer,
bool enableFoam,
@ -297,6 +298,7 @@ protected:
const SummaryConfig& summaryConfig_;
const SummaryState& summaryState_;
bool enableEnergy_;
bool enableTemperature_;
bool enableSolvent_;
bool enablePolymer_;

View File

@ -118,6 +118,7 @@ public:
simulator.vanguard().summaryConfig(),
simulator.vanguard().summaryState(),
getPropValue<TypeTag, Properties::EnableEnergy>(),
getPropValue<TypeTag, Properties::EnableTemperature>(),
getPropValue<TypeTag, Properties::EnableSolvent>(),
getPropValue<TypeTag, Properties::EnablePolymer>(),
getPropValue<TypeTag, Properties::EnableFoam>(),

View File

@ -98,6 +98,7 @@ class EclWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::Grid>
using BaseType = EclGenericWriter<Grid,EquilGrid,GridView,ElementMapper,Scalar>;
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
enum { enableTemperature = getPropValue<TypeTag, Properties::EnableTemperature>() };
enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
public:
@ -270,11 +271,13 @@ public:
{
bool enableHysteresis = simulator_.problem().materialLawManager()->enableHysteresis();
bool enableSwatinit = simulator_.vanguard().eclState().fieldProps().has_double("SWATINIT");
bool opm_rst_file = EWOMS_GET_PARAM(TypeTag, bool, EnableOpmRstFile);
bool read_temp = enableEnergy || (opm_rst_file && enableTemperature);
std::vector<RestartKey> solutionKeys{
{"PRESSURE", UnitSystem::measure::pressure},
{"SWAT", UnitSystem::measure::identity, static_cast<bool>(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx))},
{"SGAS", UnitSystem::measure::identity, static_cast<bool>(FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))},
{"TEMP" , UnitSystem::measure::temperature, enableEnergy},
{"TEMP" , UnitSystem::measure::temperature, read_temp},
{"SSOLVENT" , UnitSystem::measure::identity, enableSolvent},
{"RS", UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGas()},
{"RV", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedOil()},