Merge pull request #2693 from totto82/addOilWaterBrine

Add oil water brine specialization
This commit is contained in:
Atgeirr Flø Rasmussen 2020-07-01 09:58:45 +02:00 committed by GitHub
commit 3554fae75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 138 additions and 3 deletions

View File

@ -222,6 +222,7 @@ opm_add_test(flow
flow/flow_ebos_polymer.cpp
flow/flow_ebos_foam.cpp
flow/flow_ebos_brine.cpp
flow/flow_ebos_oilwater_brine.cpp
flow/flow_ebos_solvent.cpp
flow/flow_ebos_energy.cpp
flow/flow_ebos_oilwater_polymer.cpp

View File

@ -0,0 +1,92 @@
/*
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"
// Define making clear that the simulator supports AMG
#define FLOW_SUPPORT_AMG 1
#include <flow/flow_ebos_oilwater_brine.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/FlowMainEbos.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
#include <dune/common/parallel/mpihelper.hh>
#endif
namespace Opm {
namespace Properties {
NEW_TYPE_TAG(EclFlowOilWaterBrineProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowOilWaterBrineProblem, EnableBrine, true);
//! The indices required by the model
SET_PROP(EclFlowOilWaterBrineProblem, Indices)
{
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.
typedef TTAG(EclFlowProblem) BaseTypeTag;
typedef typename GET_PROP_TYPE(BaseTypeTag, FluidSystem) FluidSystem;
public:
typedef Opm::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent),
GET_PROP_VALUE(TypeTag, EnablePolymer),
GET_PROP_VALUE(TypeTag, EnableEnergy),
GET_PROP_VALUE(TypeTag, EnableFoam),
GET_PROP_VALUE(TypeTag, EnableBrine),
/*PVOffset=*/0,
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
};
}}
namespace Opm {
void flowEbosOilWaterBrineSetDeck(double setupTime, Deck* deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{
typedef TTAG(EclFlowOilWaterBrineProblem) 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 flowEbosOilWaterBrineMain(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.
Opm::resetLocale();
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
#else
Dune::MPIHelper::instance(argc, argv);
#endif
Opm::FlowMainEbos<TTAG(EclFlowOilWaterBrineProblem)> mainfunc;
return mainfunc.execute(argc, argv, outputCout, outputFiles);
}
}

View File

@ -0,0 +1,30 @@
/*
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_OILWATER_BRINE_HPP
#define FLOW_EBOS_OILWATER_BRINE_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 flowEbosOilWaterBrineSetDeck(double setupTime, Deck* deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosOilWaterBrineMain(int argc, char** argv, bool outputCout, bool outputFiles);
}
#endif // FLOW_EBOS_OILWATER_BRINE_HPP

View File

@ -640,7 +640,7 @@ namespace Opm {
maxCoeff[ contiFoamEqIdx ] = std::max( maxCoeff[ contiFoamEqIdx ], std::abs( R2 ) / pvValue );
}
if (has_brine_ ) {
B_avg[ contiBrineEqIdx ] += 1.0 / fs.invB(FluidSystem::gasPhaseIdx).value();
B_avg[ contiBrineEqIdx ] += 1.0 / fs.invB(FluidSystem::waterPhaseIdx).value();
const auto R2 = ebosResid[cell_idx][contiBrineEqIdx];
R_sum[ contiBrineEqIdx ] += R2;
maxCoeff[ contiBrineEqIdx ] = std::max( maxCoeff[ contiBrineEqIdx ], std::abs( R2 ) / pvValue );

View File

@ -31,6 +31,7 @@
# include <flow/flow_ebos_polymer.hpp>
# include <flow/flow_ebos_foam.hpp>
# include <flow/flow_ebos_brine.hpp>
# include <flow/flow_ebos_oilwater_brine.hpp>
# include <flow/flow_ebos_energy.hpp>
# include <flow/flow_ebos_oilwater_polymer.hpp>
# include <flow/flow_ebos_oilwater_polymer_injectivity.hpp>
@ -260,8 +261,19 @@ namespace Opm
}
// Brine case
else if ( phases.active( Opm::Phase::BRINE ) ) {
Opm::flowEbosBrineSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_);
return Opm::flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_);
if ( !phases.active( Opm::Phase::WATER) ) {
if (outputCout_)
std::cerr << "No valid configuration is found for brine simulation, valid options include "
<< "oilwater + brine and blackoil + brine" << std::endl;
return EXIT_FAILURE;
}
if ( phases.size() == 3 ) { // oil water brine case
Opm::flowEbosOilWaterBrineSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_);
return Opm::flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
} else {
Opm::flowEbosBrineSetDeck(setupTime_, deck_.get(), *eclipseState_, *schedule_, *summaryConfig_);
return Opm::flowEbosBrineMain(argc_, argv_, outputCout_, outputFiles_);
}
}
// Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) {