mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-22 09:16:27 -06:00
Add gasoil + energy simulator
Useful when combining CO2STORE + THERMAL This PR also fixes an issue with missing phases in computation of output temperature
This commit is contained in:
parent
ad10e419da
commit
4f75d1ab8d
@ -383,7 +383,8 @@ add_dependencies(moduleVersion opmsimulators)
|
||||
|
||||
set(FLOW_MODELS blackoil brine energy extbo foam gasoil gaswater
|
||||
oilwater oilwater_brine oilwater_polymer
|
||||
oilwater_polymer_injectivity micp polymer solvent)
|
||||
oilwater_polymer_injectivity micp polymer solvent
|
||||
gasoil_energy)
|
||||
set(FLOW_VARIANT_MODELS brine_energy onephase onephase_energy)
|
||||
|
||||
set(FLOW_TGTS)
|
||||
|
@ -621,6 +621,13 @@ add_test_compareECLFiles(CASENAME co2store_drsdtcon
|
||||
REL_TOL ${rel_tol}
|
||||
DIR co2store)
|
||||
|
||||
add_test_compareECLFiles(CASENAME co2store_energy
|
||||
FILENAME CO2STORE_ENERGY
|
||||
SIMULATOR flow
|
||||
ABS_TOL ${abs_tol}
|
||||
REL_TOL ${rel_tol}
|
||||
DIR co2store)
|
||||
|
||||
if (opm-common_EMBEDDED_PYTHON)
|
||||
add_test_compareECLFiles(CASENAME udq_pyaction
|
||||
FILENAME PYACTION_WCONPROD
|
||||
|
100
flow/flow_ebos_gasoil_energy.cpp
Normal file
100
flow/flow_ebos_gasoil_energy.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <flow/flow_ebos_gasoil_energy.hpp>
|
||||
|
||||
#include <opm/material/common/ResetLocale.hpp>
|
||||
#include <opm/models/blackoil/blackoiltwophaseindices.hh>
|
||||
|
||||
#include <opm/grid/CpGrid.hpp>
|
||||
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
|
||||
#include <opm/simulators/flow/Main.hpp>
|
||||
|
||||
namespace Opm {
|
||||
namespace Properties {
|
||||
namespace TTag {
|
||||
struct EclFlowGasOilEnergyProblem {
|
||||
using InheritsFrom = std::tuple<EclFlowProblem>;
|
||||
};
|
||||
}
|
||||
|
||||
//! The indices required by the model
|
||||
template<class TypeTag>
|
||||
struct Indices<TypeTag, TTag::EclFlowGasOilEnergyProblem>
|
||||
{
|
||||
private:
|
||||
// it is unfortunately not possible to simply use 'TypeTag' here because this leads
|
||||
// to cyclic definitions of some properties. if this happens the compiler error
|
||||
// messages unfortunately are *really* confusing and not really helpful.
|
||||
using BaseTypeTag = TTag::EclFlowProblem;
|
||||
using FluidSystem = GetPropType<BaseTypeTag, Properties::FluidSystem>;
|
||||
|
||||
public:
|
||||
typedef BlackOilTwoPhaseIndices<getPropValue<TypeTag, Properties::EnableSolvent>(),
|
||||
getPropValue<TypeTag, Properties::EnableExtbo>(),
|
||||
getPropValue<TypeTag, Properties::EnablePolymer>(),
|
||||
getPropValue<TypeTag, Properties::EnableEnergy>(),
|
||||
getPropValue<TypeTag, Properties::EnableFoam>(),
|
||||
getPropValue<TypeTag, Properties::EnableBrine>(),
|
||||
/*PVOffset=*/0,
|
||||
/*disabledCompIdx=*/FluidSystem::waterCompIdx,
|
||||
getPropValue<TypeTag, Properties::EnableMICP>()> type;
|
||||
};
|
||||
template<class TypeTag>
|
||||
struct EnableEnergy<TypeTag, TTag::EclFlowGasOilEnergyProblem> {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
}}
|
||||
|
||||
namespace Opm {
|
||||
void flowEbosGasOilEnergySetDeck(double setupTime, std::shared_ptr<Deck> deck,
|
||||
std::shared_ptr<EclipseState> eclState,
|
||||
std::shared_ptr<Schedule> schedule,
|
||||
std::shared_ptr<SummaryConfig> summaryConfig)
|
||||
{
|
||||
using TypeTag = Properties::TTag::EclFlowGasOilEnergyProblem;
|
||||
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
|
||||
|
||||
Vanguard::setExternalSetupTime(setupTime);
|
||||
Vanguard::setExternalDeck(std::move(deck));
|
||||
Vanguard::setExternalEclState(std::move(eclState));
|
||||
Vanguard::setExternalSchedule(std::move(schedule));
|
||||
Vanguard::setExternalSummaryConfig(std::move(summaryConfig));
|
||||
}
|
||||
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int flowEbosGasOilEnergyMain(int argc, char** argv, bool outputCout, bool outputFiles)
|
||||
{
|
||||
// we always want to use the default locale, and thus spare us the trouble
|
||||
// with incorrect locale settings.
|
||||
resetLocale();
|
||||
|
||||
FlowMainEbos<Properties::TTag::EclFlowGasOilEnergyProblem>
|
||||
mainfunc {argc, argv, outputCout, outputFiles} ;
|
||||
return mainfunc.execute();
|
||||
}
|
||||
|
||||
int flowEbosGasOilEnergyMainStandalone(int argc, char** argv)
|
||||
{
|
||||
using TypeTag = Properties::TTag::EclFlowGasOilEnergyProblem;
|
||||
auto mainObject = Opm::Main(argc, argv);
|
||||
return mainObject.runStatic<TypeTag>();
|
||||
}
|
||||
|
||||
}
|
42
flow/flow_ebos_gasoil_energy.hpp
Normal file
42
flow/flow_ebos_gasoil_energy.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef FLOW_EBOS_GASOIL_ENERGY_HPP
|
||||
#define FLOW_EBOS_GASOIL_ENERGY_HPP
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class Deck;
|
||||
class EclipseState;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
|
||||
void flowEbosGasOilEnergySetDeck(double setupTime, std::shared_ptr<Deck> deck,
|
||||
std::shared_ptr<EclipseState> eclState,
|
||||
std::shared_ptr<Schedule> schedule,
|
||||
std::shared_ptr<SummaryConfig> summaryConfig);
|
||||
|
||||
//! \brief Main function used in flow binary.
|
||||
int flowEbosGasOilEnergyMain(int argc, char** argv, bool outputCout, bool outputFiles);
|
||||
|
||||
//! \brief Main function used in flow_gasoil_energy binary.
|
||||
int flowEbosGasOilEnergyMainStandalone(int argc, char** argv);
|
||||
|
||||
}
|
||||
|
||||
#endif // FLOW_EBOS_GASOIL_ENERGY_HPP
|
24
flow/flow_gasoil_energy.cpp
Normal file
24
flow/flow_gasoil_energy.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <flow/flow_ebos_gasoil_energy.hpp>
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return Opm::flowEbosGasOilEnergyMainStandalone(argc, argv);
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
#include <flow/flow_ebos_blackoil.hpp>
|
||||
|
||||
#include <flow/flow_ebos_gasoil.hpp>
|
||||
#include <flow/flow_ebos_gasoil_energy.hpp>
|
||||
#include <flow/flow_ebos_oilwater.hpp>
|
||||
#include <flow/flow_ebos_gaswater.hpp>
|
||||
#include <flow/flow_ebos_solvent.hpp>
|
||||
@ -288,7 +289,7 @@ private:
|
||||
}
|
||||
|
||||
// Twophase cases
|
||||
else if (phases.size() == 2) {
|
||||
else if (phases.size() == 2 && !eclipseState_->getSimulationConfig().isThermal()) {
|
||||
return this->runTwoPhase(phases);
|
||||
}
|
||||
|
||||
@ -319,7 +320,7 @@ private:
|
||||
|
||||
// Energy case
|
||||
else if (eclipseState_->getSimulationConfig().isThermal()) {
|
||||
return this->runThermal();
|
||||
return this->runThermal(phases);
|
||||
}
|
||||
|
||||
// Blackoil case
|
||||
@ -666,8 +667,15 @@ private:
|
||||
return flowEbosExtboMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
|
||||
int runThermal()
|
||||
int runThermal(const Phases& phases)
|
||||
{
|
||||
// oil-gas-thermal
|
||||
if (!phases.active( Phase::WATER ) && phases.active( Phase::OIL ) && phases.active( Phase::GAS )) {
|
||||
flowEbosGasOilEnergySetDeck(
|
||||
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
|
||||
return flowEbosGasOilEnergyMain(argc_, argv_, outputCout_, outputFiles_);
|
||||
}
|
||||
|
||||
flowEbosEnergySetDeck(
|
||||
setupTime_, deck_, eclipseState_, schedule_, summaryConfig_);
|
||||
|
||||
|
@ -1686,9 +1686,15 @@ namespace Opm {
|
||||
const auto& intQuants = *(ebosSimulator_.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
||||
const auto& fs = intQuants.fluidState();
|
||||
|
||||
// we on only have one temperature pr cell any phaseIdx will do
|
||||
double cellTemperatures = fs.temperature(/*phaseIdx*/0).value();
|
||||
|
||||
double weight_factor = 0.0;
|
||||
for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) {
|
||||
for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx)
|
||||
{
|
||||
if (!FluidSystem::phaseIsActive(phaseIdx)) {
|
||||
continue;
|
||||
}
|
||||
cellInternalEnergy = fs.enthalpy(phaseIdx).value() - fs.pressure(phaseIdx).value() / fs.density(phaseIdx).value();
|
||||
cellBinv = fs.invB(phaseIdx).value();
|
||||
cellDensity = fs.density(phaseIdx).value();
|
||||
|
@ -1863,6 +1863,8 @@ INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,fa
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||
|
||||
|
||||
// Blackoil
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
|
||||
|
@ -1122,6 +1122,7 @@ INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,tr
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,true,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||
|
||||
// Blackoil
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
|
||||
|
@ -129,6 +129,7 @@ INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,fa
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,2u,0u,false,false,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,0u,false,true,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,1u,0u,false,true,0u,2u,0u>)
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilTwoPhaseIndices<0u,0u,0u,1u,false,false,0u,1u,0u>)
|
||||
|
||||
// Blackoil
|
||||
INSTANCE(BlackOilDefaultIndexTraits,BlackOilIndices<0u,0u,0u,0u,false,false,0u,0u>)
|
||||
|
@ -161,6 +161,7 @@ tests[3d_tran_operator]="flow parallel_fieldprops 3D_TRAN_OPERATOR"
|
||||
tests[co2store]="flow co2store CO2STORE"
|
||||
tests[co2store_diffusive]="flow co2store CO2STORE_DIFFUSIVE"
|
||||
tests[co2store_drsdtcon]="flow co2store CO2STORE_DRSDTCON"
|
||||
tests[co2store_energy]="flow co2store CO2STORE_ENERGY"
|
||||
tests[actionx_gconinje]="flow actionx ACTIONX_GCONINJE"
|
||||
tests[actionx_gconprod]="flow actionx ACTIONX_GCONPROD"
|
||||
tests[actionx_wconinje]="flow actionx ACTIONX_WCONINJE"
|
||||
|
Loading…
Reference in New Issue
Block a user