From 3422e18583ac328ad87e5f0ee0eba3fc5a3ffdd9 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 1 Jun 2021 11:55:54 +0200 Subject: [PATCH] Optional passing of the temperature vector to the restart machinary If enableTemperature and --enable-opm-restart-file=true the temperature is passed to or read from the restart file --- ebos/eclgenericoutputblackoilmodule.cc | 13 +++++++++++-- ebos/eclgenericoutputblackoilmodule.hh | 2 ++ ebos/ecloutputblackoilmodule.hh | 1 + ebos/eclwriter.hh | 5 ++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ebos/eclgenericoutputblackoilmodule.cc b/ebos/eclgenericoutputblackoilmodule.cc index db28fd9bf..ff386865e 100644 --- a/ebos/eclgenericoutputblackoilmodule.cc +++ b/ebos/eclgenericoutputblackoilmodule.cc @@ -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; } diff --git a/ebos/eclgenericoutputblackoilmodule.hh b/ebos/eclgenericoutputblackoilmodule.hh index 968cf878d..865fbc9e1 100644 --- a/ebos/eclgenericoutputblackoilmodule.hh +++ b/ebos/eclgenericoutputblackoilmodule.hh @@ -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_; diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index 9fe2a36ea..3e3542697 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -118,6 +118,7 @@ public: simulator.vanguard().summaryConfig(), simulator.vanguard().summaryState(), getPropValue(), + getPropValue(), getPropValue(), getPropValue(), getPropValue(), diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index bcde644bc..18469543f 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -98,6 +98,7 @@ class EclWriter : public EclGenericWriter using BaseType = EclGenericWriter; enum { enableEnergy = getPropValue() }; + enum { enableTemperature = getPropValue() }; enum { enableSolvent = getPropValue() }; public: @@ -272,11 +273,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 solutionKeys{ {"PRESSURE", UnitSystem::measure::pressure}, {"SWAT", UnitSystem::measure::identity, static_cast(FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx))}, {"SGAS", UnitSystem::measure::identity, static_cast(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()},