mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-24 17:06:25 -06:00
Use foam module.
This commit is contained in:
parent
0e309fc254
commit
7fb90bff47
@ -149,6 +149,7 @@ opm_add_test(flow
|
||||
flow/flow_ebos_gasoil.cpp
|
||||
flow/flow_ebos_oilwater.cpp
|
||||
flow/flow_ebos_polymer.cpp
|
||||
flow/flow_ebos_foam.cpp
|
||||
flow/flow_ebos_solvent.cpp
|
||||
flow/flow_ebos_energy.cpp
|
||||
flow/flow_ebos_oilwater_polymer.cpp
|
||||
|
@ -244,6 +244,8 @@ public:
|
||||
sSol_.resize(bufferSize, 0.0);
|
||||
if (GET_PROP_VALUE(TypeTag, EnablePolymer))
|
||||
cPolymer_.resize(bufferSize, 0.0);
|
||||
if (GET_PROP_VALUE(TypeTag, EnableFoam))
|
||||
cFoam_.resize(bufferSize, 0.0);
|
||||
|
||||
if (simulator_.problem().vapparsActive())
|
||||
soMax_.resize(bufferSize, 0.0);
|
||||
@ -486,6 +488,10 @@ public:
|
||||
cPolymer_[globalDofIdx] = intQuants.polymerConcentration().value();
|
||||
}
|
||||
|
||||
if (cFoam_.size() > 0) {
|
||||
cFoam_[globalDofIdx] = intQuants.foamConcentration().value();
|
||||
}
|
||||
|
||||
if (bubblePointPressure_.size() > 0) {
|
||||
try {
|
||||
bubblePointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex()));
|
||||
@ -877,6 +883,9 @@ public:
|
||||
if (cPolymer_.size() > 0)
|
||||
sol.insert ("POLYMER", Opm::UnitSystem::measure::identity, std::move(cPolymer_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
|
||||
if (cFoam_.size() > 0)
|
||||
sol.insert ("FOAM", Opm::UnitSystem::measure::identity, std::move(cFoam_), Opm::data::TargetType::RESTART_SOLUTION);
|
||||
|
||||
if (dewPointPressure_.size() > 0)
|
||||
sol.insert ("PDEW", Opm::UnitSystem::measure::pressure, std::move(dewPointPressure_), Opm::data::TargetType::RESTART_AUXILIARY);
|
||||
|
||||
@ -1053,6 +1062,8 @@ public:
|
||||
}
|
||||
if (cPolymer_.size() > 0 && sol.has("POLYMER"))
|
||||
cPolymer_[elemIdx] = sol.data("POLYMER")[globalDofIndex];
|
||||
if (cFoam_.size() > 0 && sol.has("FOAM"))
|
||||
cFoam_[elemIdx] = sol.data("FOAM")[globalDofIndex];
|
||||
if (soMax_.size() > 0 && sol.has("SOMAX"))
|
||||
soMax_[elemIdx] = sol.data("SOMAX")[globalDofIndex];
|
||||
if (pcSwMdcOw_.size() > 0 &&sol.has("PCSWM_OW"))
|
||||
@ -1149,6 +1160,14 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
Scalar getFoamConcentration(unsigned elemIdx) const
|
||||
{
|
||||
if (cFoam_.size() > 0)
|
||||
return cFoam_[elemIdx];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::map<std::pair<std::string, int>, double>& getBlockData()
|
||||
{ return blockData_; }
|
||||
|
||||
@ -1459,6 +1478,7 @@ private:
|
||||
ScalarBuffer relativePermeability_[numPhases];
|
||||
ScalarBuffer sSol_;
|
||||
ScalarBuffer cPolymer_;
|
||||
ScalarBuffer cFoam_;
|
||||
ScalarBuffer soMax_;
|
||||
ScalarBuffer pcSwMdcOw_;
|
||||
ScalarBuffer krnSwMdcOw_;
|
||||
|
@ -352,6 +352,7 @@ SET_BOOL_PROP(EclBaseProblem, EnableTemperature, true);
|
||||
SET_BOOL_PROP(EclBaseProblem, EnablePolymer, false);
|
||||
SET_BOOL_PROP(EclBaseProblem, EnableSolvent, false);
|
||||
SET_BOOL_PROP(EclBaseProblem, EnableEnergy, false);
|
||||
SET_BOOL_PROP(EclBaseProblem, EnableFoam, false);
|
||||
|
||||
// disable thermal flux boundaries by default
|
||||
SET_BOOL_PROP(EclBaseProblem, EnableThermalFluxBoundaries, false);
|
||||
@ -403,6 +404,7 @@ class EclProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
|
||||
enum { enableSolvent = GET_PROP_VALUE(TypeTag, EnableSolvent) };
|
||||
enum { enablePolymer = GET_PROP_VALUE(TypeTag, EnablePolymer) };
|
||||
enum { enablePolymerMolarWeight = GET_PROP_VALUE(TypeTag, EnablePolymerMW) };
|
||||
enum { enableFoam = GET_PROP_VALUE(TypeTag, EnableFoam) };
|
||||
enum { enableTemperature = GET_PROP_VALUE(TypeTag, EnableTemperature) };
|
||||
enum { enableEnergy = GET_PROP_VALUE(TypeTag, EnableEnergy) };
|
||||
enum { enableThermalFluxBoundaries = GET_PROP_VALUE(TypeTag, EnableThermalFluxBoundaries) };
|
||||
@ -435,6 +437,7 @@ class EclProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
|
||||
|
||||
typedef BlackOilSolventModule<TypeTag> SolventModule;
|
||||
typedef BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
typedef BlackOilFoamModule<TypeTag> FoamModule;
|
||||
|
||||
typedef typename EclEquilInitializer<TypeTag>::ScalarFluidState InitialFluidState;
|
||||
|
||||
@ -595,6 +598,7 @@ public:
|
||||
const auto& vanguard = simulator.vanguard();
|
||||
SolventModule::initFromDeck(vanguard.deck(), vanguard.eclState());
|
||||
PolymerModule::initFromDeck(vanguard.deck(), vanguard.eclState());
|
||||
FoamModule::initFromDeck(vanguard.deck(), vanguard.eclState());
|
||||
|
||||
// create the ECL writer
|
||||
eclWriter_.reset(new EclWriterType(simulator));
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <flow/flow_ebos_oilwater.hpp>
|
||||
#include <flow/flow_ebos_solvent.hpp>
|
||||
#include <flow/flow_ebos_polymer.hpp>
|
||||
#include <flow/flow_ebos_foam.hpp>
|
||||
#include <flow/flow_ebos_energy.hpp>
|
||||
#include <flow/flow_ebos_oilwater_polymer.hpp>
|
||||
#include <flow/flow_ebos_oilwater_polymer_injectivity.hpp>
|
||||
@ -271,6 +272,11 @@ int main(int argc, char** argv)
|
||||
return Opm::flowEbosPolymerMain(argc, argv);
|
||||
}
|
||||
}
|
||||
// Foam case
|
||||
else if ( phases.active( Opm::Phase::FOAM ) ) {
|
||||
Opm::flowEbosFoamSetDeck(externalSetupTimer.elapsed(), *deck, *eclipseState, *schedule, *summaryConfig);
|
||||
return Opm::flowEbosFoamMain(argc, argv);
|
||||
}
|
||||
// Solvent case
|
||||
else if ( phases.active( Opm::Phase::SOLVENT ) ) {
|
||||
Opm::flowEbosSolventSetDeck(externalSetupTimer.elapsed(), *deck, *eclipseState, *schedule, *summaryConfig);
|
||||
@ -289,7 +295,7 @@ int main(int argc, char** argv)
|
||||
else
|
||||
{
|
||||
if (outputCout)
|
||||
std::cerr << "No suitable configuration found, valid are Twophase, polymer, solvent, energy, or blackoil" << std::endl;
|
||||
std::cerr << "No suitable configuration found, valid are Twophase, polymer, foam, solvent, energy, blackoil." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
70
flow/flow_ebos_foam.cpp
Normal file
70
flow/flow_ebos_foam.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
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_foam.hpp>
|
||||
|
||||
#include <opm/material/common/ResetLocale.hpp>
|
||||
#include <opm/grid/CpGrid.hpp>
|
||||
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
|
||||
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
#include <dune/fem/misc/mpimanager.hh>
|
||||
#else
|
||||
#include <dune/common/parallel/mpihelper.hh>
|
||||
#endif
|
||||
|
||||
namespace Ewoms {
|
||||
namespace Properties {
|
||||
NEW_TYPE_TAG(EclFlowFoamProblem, INHERITS_FROM(EclFlowProblem));
|
||||
SET_BOOL_PROP(EclFlowFoamProblem, EnableFoam, true);
|
||||
}}
|
||||
|
||||
namespace Opm {
|
||||
void flowEbosFoamSetDeck(double setupTime, Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
|
||||
{
|
||||
typedef TTAG(EclFlowFoamProblem) TypeTag;
|
||||
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
|
||||
|
||||
Vanguard::setExternalSetupTime(setupTime);
|
||||
Vanguard::setExternalDeck(&deck);
|
||||
Vanguard::setExternalEclState(&eclState);
|
||||
Vanguard::setExternalSchedule(&schedule);
|
||||
Vanguard::setExternalSummaryConfig(&summaryConfig);
|
||||
}
|
||||
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int flowEbosFoamMain(int argc, char** argv)
|
||||
{
|
||||
// we always want to use the default locale, and thus spare us the trouble
|
||||
// with incorrect locale settings.
|
||||
Opm::resetLocale();
|
||||
|
||||
// initialize MPI, finalize is done automatically on exit
|
||||
#if HAVE_DUNE_FEM
|
||||
Dune::Fem::MPIManager::initialize(argc, argv);
|
||||
#else
|
||||
Dune::MPIHelper::instance(argc, argv).rank();
|
||||
#endif
|
||||
|
||||
Opm::FlowMainEbos<TTAG(EclFlowFoamProblem)> mainfunc;
|
||||
return mainfunc.execute(argc, argv);
|
||||
}
|
||||
|
||||
}
|
31
flow/flow_ebos_foam.hpp
Normal file
31
flow/flow_ebos_foam.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
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_FOAM_HPP
|
||||
#define FLOW_EBOS_FOAM_HPP
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
void flowEbosFoamSetDeck(double setupTime, Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
|
||||
int flowEbosFoamMain(int argc, char** argv);
|
||||
}
|
||||
|
||||
#endif // FLOW_EBOS_FOAM_HPP
|
@ -52,6 +52,7 @@ public:
|
||||
typedef Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent),
|
||||
GET_PROP_VALUE(TypeTag, EnablePolymer),
|
||||
GET_PROP_VALUE(TypeTag, EnableEnergy),
|
||||
GET_PROP_VALUE(TypeTag, EnableFoam),
|
||||
/*PVOffset=*/0,
|
||||
/*disabledCompIdx=*/FluidSystem::waterCompIdx> type;
|
||||
};
|
||||
|
@ -52,6 +52,7 @@ public:
|
||||
typedef Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent),
|
||||
GET_PROP_VALUE(TypeTag, EnablePolymer),
|
||||
GET_PROP_VALUE(TypeTag, EnableEnergy),
|
||||
GET_PROP_VALUE(TypeTag, EnableFoam),
|
||||
/*PVOffset=*/0,
|
||||
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
|
||||
};
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
typedef Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent),
|
||||
GET_PROP_VALUE(TypeTag, EnablePolymer),
|
||||
GET_PROP_VALUE(TypeTag, EnableEnergy),
|
||||
GET_PROP_VALUE(TypeTag, EnableFoam),
|
||||
/*PVOffset=*/0,
|
||||
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
|
||||
};
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
typedef Ewoms::BlackOilTwoPhaseIndices<0,
|
||||
2,
|
||||
0,
|
||||
GET_PROP_VALUE(TypeTag, EnableFoam),
|
||||
/*PVOffset=*/0,
|
||||
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
|
||||
};
|
||||
|
@ -54,21 +54,24 @@ namespace Opm
|
||||
using typename Base::ModelParameters;
|
||||
using typename Base::Indices;
|
||||
using typename Base::PolymerModule;
|
||||
using typename Base::FoamModule;
|
||||
using typename Base::RateConverterType;
|
||||
|
||||
using Base::numEq;
|
||||
|
||||
using Base::has_solvent;
|
||||
using Base::has_polymer;
|
||||
using Base::has_foam;
|
||||
using Base::has_energy;
|
||||
|
||||
// polymer concentration and temperature are already known by the well, so
|
||||
// polymer and energy conservation do not need to be considered explicitly
|
||||
static const int numPolymerEq = Indices::numPolymers;
|
||||
static const int numEnergyEq = Indices::numEnergy;
|
||||
static const int numFoamEq = Indices::numFoam;
|
||||
|
||||
// number of the conservation equations
|
||||
static const int numWellConservationEq = numEq - numPolymerEq - numEnergyEq;
|
||||
static const int numWellConservationEq = numEq - numPolymerEq - numEnergyEq - numFoamEq;
|
||||
// number of the well control equations
|
||||
static const int numWellControlEq = 1;
|
||||
// number of the well equations that will always be used
|
||||
|
@ -1974,7 +1974,7 @@ namespace Opm
|
||||
{
|
||||
// the following implementation assume that the polymer is always after the w-o-g phases
|
||||
// For the polymer case and the energy case, there is one more mass balance equations of reservoir than wells
|
||||
assert((int(B_avg.size()) == num_components_) || has_polymer || has_energy);
|
||||
assert((int(B_avg.size()) == num_components_) || has_polymer || has_energy || has_foam);
|
||||
|
||||
const double tol_wells = param_.tolerance_wells_;
|
||||
const double maxResidualAllowed = param_.max_residual_allowed_;
|
||||
|
@ -49,6 +49,7 @@
|
||||
|
||||
#include <ewoms/models/blackoil/blackoilpolymermodules.hh>
|
||||
#include <ewoms/models/blackoil/blackoilsolventmodules.hh>
|
||||
#include <ewoms/models/blackoil/blackoilfoammodules.hh>
|
||||
|
||||
#include<dune/common/fmatrix.hh>
|
||||
#include<dune/istl/bcrsmatrix.hh>
|
||||
@ -98,6 +99,7 @@ namespace Opm
|
||||
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
|
||||
|
||||
typedef Ewoms::BlackOilPolymerModule<TypeTag> PolymerModule;
|
||||
typedef Ewoms::BlackOilFoamModule<TypeTag> FoamModule;
|
||||
|
||||
static const bool has_solvent = GET_PROP_VALUE(TypeTag, EnableSolvent);
|
||||
static const bool has_polymer = GET_PROP_VALUE(TypeTag, EnablePolymer);
|
||||
@ -109,6 +111,8 @@ namespace Opm
|
||||
// index for the polymer molecular weight continuity equation
|
||||
static const int contiPolymerMWEqIdx = Indices::contiPolymerMWEqIdx;
|
||||
|
||||
static const bool has_foam = GET_PROP_VALUE(TypeTag, EnableFoam);
|
||||
|
||||
// For the conversion between the surface volume rate and resrevoir voidage rate
|
||||
using RateConverterType = RateConverter::
|
||||
SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
|
||||
|
Loading…
Reference in New Issue
Block a user