diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.cpp b/opm/simulators/flow/GenericOutputBlackoilModule.cpp index 6ac5b1d74..f1408f9c2 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.cpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.cpp @@ -513,22 +513,11 @@ assignToSolution(data::Solution& sol) const auto extendedSolutionArrays = std::array { DataEntry{"BIOFILM", UnitSystem::measure::identity, cBiofilm_}, DataEntry{"CALCITE", UnitSystem::measure::identity, cCalcite_}, - DataEntry{"DELSTRXX", UnitSystem::measure::pressure, mech_.delstressXX_}, - DataEntry{"DELSTRYY", UnitSystem::measure::pressure, mech_.delstressYY_}, - DataEntry{"DELSTRZZ", UnitSystem::measure::pressure, mech_.delstressZZ_}, - DataEntry{"DELSTRXY", UnitSystem::measure::pressure, mech_.delstressXY_}, - DataEntry{"DELSTRXZ", UnitSystem::measure::pressure, mech_.delstressXZ_}, - DataEntry{"DELSTRYZ", UnitSystem::measure::pressure, mech_.delstressYZ_}, - DataEntry{"DISPX", UnitSystem::measure::length, mech_.dispX_}, - DataEntry{"DISPY", UnitSystem::measure::length, mech_.dispY_}, - DataEntry{"DISPZ", UnitSystem::measure::length, mech_.dispZ_}, DataEntry{"DRSDTCON", UnitSystem::measure::gas_oil_ratio_rate, drsdtcon_}, - DataEntry{"MECHPOTF", UnitSystem::measure::pressure, mech_.potentialForce_}, DataEntry{"MICROBES", UnitSystem::measure::density, cMicrobes_}, DataEntry{"OXYGEN", UnitSystem::measure::density, cOxygen_}, DataEntry{"PERMFACT", UnitSystem::measure::identity, permFact_}, DataEntry{"PORV_RC", UnitSystem::measure::identity, rockCompPorvMultiplier_}, - DataEntry{"PRESPOTF", UnitSystem::measure::pressure, mech_.potentialPressForce_}, DataEntry{"PRES_OVB", UnitSystem::measure::pressure, overburdenPressure_}, DataEntry{"RSW", UnitSystem::measure::gas_oil_ratio, rsw_}, DataEntry{"RSWSAT", UnitSystem::measure::gas_oil_ratio, gasDissolutionFactorInWater_}, @@ -542,31 +531,6 @@ assignToSolution(data::Solution& sol) DataEntry{"STD_CO2", UnitSystem::measure::identity, mFracCo2_}, DataEntry{"STD_GAS", UnitSystem::measure::identity, mFracGas_}, DataEntry{"STD_OIL", UnitSystem::measure::identity, mFracOil_}, - DataEntry{"STRAINXX", UnitSystem::measure::identity, mech_.strainXX_}, - DataEntry{"STRAINYY", UnitSystem::measure::identity, mech_.strainYY_}, - DataEntry{"STRAINZZ", UnitSystem::measure::identity, mech_.strainZZ_}, - DataEntry{"STRAINXY", UnitSystem::measure::identity, mech_.strainXY_}, - DataEntry{"STRAINXZ", UnitSystem::measure::identity, mech_.strainXZ_}, - DataEntry{"STRAINYZ", UnitSystem::measure::identity, mech_.strainYZ_}, - DataEntry{"STRESSXX", UnitSystem::measure::pressure, mech_.stressXX_}, - DataEntry{"STRESSYY", UnitSystem::measure::pressure, mech_.stressYY_}, - DataEntry{"STRESSZZ", UnitSystem::measure::pressure, mech_.stressZZ_}, - DataEntry{"STRESSXY", UnitSystem::measure::pressure, mech_.stressXY_}, - DataEntry{"STRESSXZ", UnitSystem::measure::pressure, mech_.stressXZ_}, - DataEntry{"STRESSYZ", UnitSystem::measure::pressure, mech_.stressYZ_}, - DataEntry{"LINSTRXX", UnitSystem::measure::pressure, mech_.linstressXX_}, - DataEntry{"LINSTRYY", UnitSystem::measure::pressure, mech_.linstressYY_}, - DataEntry{"LINSTRZZ", UnitSystem::measure::pressure, mech_.linstressZZ_}, - DataEntry{"LINSTRXY", UnitSystem::measure::pressure, mech_.linstressXY_}, - DataEntry{"LINSTRXZ", UnitSystem::measure::pressure, mech_.linstressXZ_}, - DataEntry{"LINSTRYZ", UnitSystem::measure::pressure, mech_.linstressYZ_}, - DataEntry{"FRCSTRXX", UnitSystem::measure::pressure, mech_.fracstressXX_}, - DataEntry{"FRCSTRYY", UnitSystem::measure::pressure, mech_.fracstressYY_}, - DataEntry{"FRCSTRZZ", UnitSystem::measure::pressure, mech_.fracstressZZ_}, - DataEntry{"FRCSTRXY", UnitSystem::measure::pressure, mech_.fracstressXY_}, - DataEntry{"FRCSTRXZ", UnitSystem::measure::pressure, mech_.fracstressXZ_}, - DataEntry{"FRCSTRYZ", UnitSystem::measure::pressure, mech_.fracstressYZ_}, - DataEntry{"TEMPPOTF", UnitSystem::measure::pressure, mech_.potentialTempForce_}, DataEntry{"TMULT_RC", UnitSystem::measure::identity, rockCompTransMultiplier_}, DataEntry{"UREA", UnitSystem::measure::density, cUrea_}, }; @@ -617,6 +581,8 @@ assignToSolution(data::Solution& sol) doInsert(array, data::TargetType::RESTART_OPM_EXTENDED); } + this->mech_.outputRestart(sol); + if (! this->temperature_.empty()) { sol.insert("TEMP", UnitSystem::measure::temperature, diff --git a/opm/simulators/flow/MechContainer.cpp b/opm/simulators/flow/MechContainer.cpp index 05f4c32a4..ab15f481c 100644 --- a/opm/simulators/flow/MechContainer.cpp +++ b/opm/simulators/flow/MechContainer.cpp @@ -23,6 +23,12 @@ #include #include +#include + +#include +#include +#include + namespace Opm { template @@ -111,6 +117,73 @@ allocate(const std::size_t bufferSize, allocated_ = true; } +template +void MechContainer:: +outputRestart(data::Solution& sol) const +{ + if (!allocated_) { + return; + } + using DataEntry = + std::tuple&>; + + auto doInsert = [&sol](const DataEntry& entry, + const data::TargetType target) + { + if (std::get<2>(entry).empty()) { + return; + } + + sol.insert(std::get(entry), + std::get(entry), + std::move(std::get<2>(entry)), + target); + }; + + const auto solutionVectors = std::array{ + DataEntry{"DELSTRXX", UnitSystem::measure::pressure, delstressXX_}, + DataEntry{"DELSTRYY", UnitSystem::measure::pressure, delstressYY_}, + DataEntry{"DELSTRZZ", UnitSystem::measure::pressure, delstressZZ_}, + DataEntry{"DELSTRXY", UnitSystem::measure::pressure, delstressXY_}, + DataEntry{"DELSTRXZ", UnitSystem::measure::pressure, delstressXZ_}, + DataEntry{"DELSTRYZ", UnitSystem::measure::pressure, delstressYZ_}, + DataEntry{"DISPX", UnitSystem::measure::length, dispX_}, + DataEntry{"DISPY", UnitSystem::measure::length, dispY_}, + DataEntry{"DISPZ", UnitSystem::measure::length, dispZ_}, + DataEntry{"FRCSTRXX", UnitSystem::measure::pressure, fracstressXX_}, + DataEntry{"FRCSTRYY", UnitSystem::measure::pressure, fracstressYY_}, + DataEntry{"FRCSTRZZ", UnitSystem::measure::pressure, fracstressZZ_}, + DataEntry{"FRCSTRXY", UnitSystem::measure::pressure, fracstressXY_}, + DataEntry{"FRCSTRXZ", UnitSystem::measure::pressure, fracstressXZ_}, + DataEntry{"FRCSTRYZ", UnitSystem::measure::pressure, fracstressYZ_}, + DataEntry{"LINSTRXX", UnitSystem::measure::pressure, linstressXX_}, + DataEntry{"LINSTRYY", UnitSystem::measure::pressure, linstressYY_}, + DataEntry{"LINSTRZZ", UnitSystem::measure::pressure, linstressZZ_}, + DataEntry{"LINSTRXY", UnitSystem::measure::pressure, linstressXY_}, + DataEntry{"LINSTRXZ", UnitSystem::measure::pressure, linstressXZ_}, + DataEntry{"LINSTRYZ", UnitSystem::measure::pressure, linstressYZ_}, + DataEntry{"MECHPOTF", UnitSystem::measure::pressure, potentialForce_}, + DataEntry{"PRESPOTF", UnitSystem::measure::pressure, potentialPressForce_}, + DataEntry{"STRAINXX", UnitSystem::measure::identity, strainXX_}, + DataEntry{"STRAINYY", UnitSystem::measure::identity, strainYY_}, + DataEntry{"STRAINZZ", UnitSystem::measure::identity, strainZZ_}, + DataEntry{"STRAINXY", UnitSystem::measure::identity, strainXY_}, + DataEntry{"STRAINXZ", UnitSystem::measure::identity, strainXZ_}, + DataEntry{"STRAINYZ", UnitSystem::measure::identity, strainYZ_}, + DataEntry{"STRESSXX", UnitSystem::measure::length, stressXX_}, + DataEntry{"STRESSYY", UnitSystem::measure::length, stressYY_}, + DataEntry{"STRESSZZ", UnitSystem::measure::length, stressZZ_}, + DataEntry{"STRESSXY", UnitSystem::measure::length, stressXY_}, + DataEntry{"STRESSXZ", UnitSystem::measure::length, stressXZ_}, + DataEntry{"STRESSYZ", UnitSystem::measure::length, stressYZ_}, + DataEntry{"TEMPPOTF", UnitSystem::measure::pressure, potentialTempForce_}, + }; + + std::for_each(solutionVectors.begin(), solutionVectors.end(), + [doInsert](const auto& array) + { doInsert(array, data::TargetType::RESTART_OPM_EXTENDED); }); +} + template class MechContainer; #if FLOW_INSTANTIATE_FLOAT diff --git a/opm/simulators/flow/MechContainer.hpp b/opm/simulators/flow/MechContainer.hpp index 94b244b44..bd9196b39 100644 --- a/opm/simulators/flow/MechContainer.hpp +++ b/opm/simulators/flow/MechContainer.hpp @@ -33,6 +33,8 @@ namespace Opm { +namespace data { class Solution; } + template class MechContainer { @@ -42,6 +44,8 @@ public: void allocate(const std::size_t bufferSize, std::map& rstKeywords); + void outputRestart(data::Solution& sol) const; + bool allocated() const { return allocated_; }