addd simple salt/brine implementation

This commit is contained in:
Trine S. Mykkeltvedt 2019-11-07 09:39:42 +01:00 committed by Tor Harald Sandve
parent d20bec2f71
commit 5749615bd8
19 changed files with 355 additions and 15 deletions

View File

@ -168,6 +168,7 @@ opm_add_test(flow
flow/flow_ebos_oilwater.cpp
flow/flow_ebos_polymer.cpp
flow/flow_ebos_foam.cpp
flow/flow_ebos_saltwater.cpp
flow/flow_ebos_solvent.cpp
flow/flow_ebos_energy.cpp
flow/flow_ebos_oilwater_polymer.cpp
@ -247,7 +248,7 @@ else()
set(EBOS_EXTENSIONS_DEFAULT_ENABLE_IF "TRUE")
endif()
foreach(OBJ solvent polymer foam gasoil oilwater oilwaterpolymer thermal)
foreach(OBJ solvent polymer foam saltwater gasoil oilwater oilwaterpolymer thermal)
opm_add_test(ebos_${OBJ}
ONLY_COMPILE
DEFAULT_ENABLE_IF ${EBOS_EXTENSIONS_DEFAULT_ENABLE_IF}
@ -287,7 +288,7 @@ opm_add_test(ebos_plain
LIBRARIES opmsimulators)
if (BUILD_EBOS_EXTENSIONS)
foreach(TGT ebos_solvent ebos_polymer ebos_foam ebos_gasoil ebos_oilwater ebos_oilwaterpolymer ebos_thermal mebos)
foreach(TGT ebos_solvent ebos_polymer ebos_foam ebos_saltwater ebos_gasoil ebos_oilwater ebos_oilwaterpolymer ebos_thermal mebos)
install(TARGETS ${TGT} DESTINATION bin)
opm_add_bash_completion(${TGT})
endforeach()
@ -296,10 +297,3 @@ endif()
if (OPM_ENABLE_PYTHON)
add_subdirectory(python)
endif()
# must link libraries after target 'flow' has been defined
if(CUDA_FOUND)
target_link_libraries( opmsimulators ${CUDA_cublas_LIBRARY} )
target_link_libraries( opmsimulators ${CUDA_cusparse_LIBRARY} )
endif()

64
ebos/ebos_saltwater.cc Normal file
View File

@ -0,0 +1,64 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
*
* \brief A general-purpose simulator for ECL decks using the black-oil model.
*/
#include "config.h"
#include "ebos.hh"
#include "startEbos.hh"
BEGIN_PROPERTIES
NEW_TYPE_TAG(EbosSaltWaterTypeTag, INHERITS_FROM(EbosTypeTag));
// enable the salt extension of the black oil model
SET_BOOL_PROP(EbosSaltWaterTypeTag, EnableSaltWater, true);
END_PROPERTIES
namespace Opm {
void ebosSaltWaterSetDeck(Opm::Deck* deck,
Opm::ParseContext* parseContext,
Opm::ErrorGuard* errorGuard,
double externalSetupTime)
{
typedef TTAG(EbosSaltWaterTypeTag) ProblemTypeTag;
typedef GET_PROP_TYPE(ProblemTypeTag, Vanguard) Vanguard;
Vanguard::setExternalSetupTime(externalSetupTime);
Vanguard::setExternalParseContext(parseContext);
Vanguard::setExternalErrorGuard(errorGuard);
Vanguard::setExternalDeck(deck);
}
int ebosSaltWaterMain(int argc, char **argv)
{
typedef TTAG(EbosSaltWaterTypeTag) ProblemTypeTag;
return Opm::startEbos<ProblemTypeTag>(argc, argv);
}
}

44
ebos/ebos_saltwater.hh Normal file
View File

@ -0,0 +1,44 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
*
* \brief The function prototypes required to start the salt variant of ebos
*/
#ifndef EBOS_SALTWATER_HH
#define EBOS_SALTWATER_HH
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
namespace Opm {
void ebosSaltWaterSetDeck(Opm::Deck* deck,
Opm::ParseContext* parseContext,
Opm::ErrorGuard* errorGuard,
double externalSetupTime);
int ebosSaltWaterMain(int argc, char** argv);
}
#endif

View File

@ -0,0 +1,37 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
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 2 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/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
*
* \brief The main function for the stand alone salt variant of ebos.
*
* This only calls the ebosSaltWaterMain() function.
*/
#include "config.h"
#include "ebos_saltwater.hh"
int main(int argc, char** argv)
{
return Opm::ebosSaltWaterMain(argc, argv);
}

View File

@ -312,6 +312,8 @@ public:
cPolymer_.resize(bufferSize, 0.0);
if (GET_PROP_VALUE(TypeTag, EnableFoam))
cFoam_.resize(bufferSize, 0.0);
if (GET_PROP_VALUE(TypeTag, EnableSaltWater))
cSalt_.resize(bufferSize, 0.0);
if (simulator_.problem().vapparsActive())
soMax_.resize(bufferSize, 0.0);
@ -567,6 +569,10 @@ public:
cFoam_[globalDofIdx] = intQuants.foamConcentration().value();
}
if (cSalt_.size() > 0) {
cSalt_[globalDofIdx] = fs.saltconcentration().value();
}
if (bubblePointPressure_.size() > 0) {
try {
bubblePointPressure_[globalDofIdx] = Opm::getValue(FluidSystem::bubblePointPressure(fs, intQuants.pvtRegionIndex()));
@ -961,6 +967,9 @@ public:
if (cFoam_.size() > 0)
sol.insert ("FOAM", Opm::UnitSystem::measure::identity, std::move(cFoam_), Opm::data::TargetType::RESTART_SOLUTION);
if (cSalt_.size() > 0)
sol.insert ("SALT", Opm::UnitSystem::measure::identity, std::move(cSalt_), Opm::data::TargetType::RESTART_SOLUTION);
if (dewPointPressure_.size() > 0)
sol.insert ("PDEW", Opm::UnitSystem::measure::pressure, std::move(dewPointPressure_), Opm::data::TargetType::RESTART_AUXILIARY);
@ -1522,6 +1531,8 @@ public:
cPolymer_[elemIdx] = sol.data("POLYMER")[globalDofIndex];
if (cFoam_.size() > 0 && sol.has("FOAM"))
cFoam_[elemIdx] = sol.data("FOAM")[globalDofIndex];
if (cSalt_.size() > 0 && sol.has("SALT"))
cSalt_[elemIdx] = sol.data("SALT")[globalDofIndex];
if (soMax_.size() > 0 && sol.has("SOMAX"))
soMax_[elemIdx] = sol.data("SOMAX")[globalDofIndex];
if (pcSwMdcOw_.size() > 0 &&sol.has("PCSWM_OW"))
@ -1626,6 +1637,14 @@ public:
return 0;
}
Scalar getSaltConcentration(unsigned elemIdx) const
{
if (cSalt_.size() > elemIdx)
return cSalt_[elemIdx];
return 0;
}
const std::map<std::pair<std::string, int>, double>& getBlockData()
{ return blockData_; }
@ -2102,6 +2121,7 @@ private:
ScalarBuffer sSol_;
ScalarBuffer cPolymer_;
ScalarBuffer cFoam_;
ScalarBuffer cSalt_;
ScalarBuffer soMax_;
ScalarBuffer pcSwMdcOw_;
ScalarBuffer krnSwMdcOw_;

View File

@ -26,6 +26,7 @@
#include <flow/flow_ebos_solvent.hpp>
#include <flow/flow_ebos_polymer.hpp>
#include <flow/flow_ebos_foam.hpp>
#include <flow/flow_ebos_saltwater.hpp>
#include <flow/flow_ebos_energy.hpp>
#include <flow/flow_ebos_oilwater_polymer.hpp>
#include <flow/flow_ebos_oilwater_polymer_injectivity.hpp>
@ -428,6 +429,11 @@ int main(int argc, char** argv)
Opm::flowEbosFoamSetDeck(externalSetupTimer.elapsed(), *deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosFoamMain(argc, argv, outputCout, outputFiles);
}
// Salt case
else if ( phases.active( Opm::Phase::SALTWATER ) ) {
Opm::flowEbosSaltWaterSetDeck(externalSetupTimer.elapsed(), *deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosSaltWaterMain(argc, argv, outputCout, outputFiles);
}
// Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) {
Opm::flowEbosSolventSetDeck(externalSetupTimer.elapsed(), *deck, *eclipseState, *schedule, *summaryConfig);
@ -446,7 +452,7 @@ int main(int argc, char** argv)
else
{
if (outputCout)
std::cerr << "No suitable configuration found, valid are Twophase, polymer, foam, solvent, energy, blackoil." << std::endl;
std::cerr << "No suitable configuration found, valid are Twophase, polymer, foam, salt, solvent, energy, blackoil." << std::endl;
return EXIT_FAILURE;
}
}

View File

@ -53,6 +53,7 @@ public:
GET_PROP_VALUE(TypeTag, EnablePolymer),
GET_PROP_VALUE(TypeTag, EnableEnergy),
GET_PROP_VALUE(TypeTag, EnableFoam),
GET_PROP_VALUE(TypeTag, EnableSaltWater),
/*PVOffset=*/0,
/*disabledCompIdx=*/FluidSystem::waterCompIdx> type;
};

View File

@ -53,6 +53,7 @@ public:
GET_PROP_VALUE(TypeTag, EnablePolymer),
GET_PROP_VALUE(TypeTag, EnableEnergy),
GET_PROP_VALUE(TypeTag, EnableFoam),
GET_PROP_VALUE(TypeTag, EnableSaltWater),
/*PVOffset=*/0,
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
};

View File

@ -54,6 +54,7 @@ public:
GET_PROP_VALUE(TypeTag, EnablePolymer),
GET_PROP_VALUE(TypeTag, EnableEnergy),
GET_PROP_VALUE(TypeTag, EnableFoam),
GET_PROP_VALUE(TypeTag, EnableSaltWater),
/*PVOffset=*/0,
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
};

View File

@ -56,6 +56,7 @@ public:
2,
0,
GET_PROP_VALUE(TypeTag, EnableFoam),
GET_PROP_VALUE(TypeTag, EnableSaltWater),
/*PVOffset=*/0,
/*disabledCompIdx=*/FluidSystem::gasCompIdx> type;
};

View 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_saltwater.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 Opm {
namespace Properties {
NEW_TYPE_TAG(EclFlowSaltWaterProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowSaltWaterProblem, EnableSaltWater, true);
}}
namespace Opm {
void flowEbosSaltWaterSetDeck(double setupTime, Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{
typedef TTAG(EclFlowSaltWaterProblem) 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 flowEbosSaltWaterMain(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();
// 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(EclFlowSaltWaterProblem)> mainfunc;
return mainfunc.execute(argc, argv, outputCout, outputFiles);
}
}

View 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_SALTWATER_HPP
#define FLOW_EBOS_SALTWATER_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 flowEbosSaltWaterSetDeck(double setupTime, Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosSaltWaterMain(int argc, char** argv, bool outputCout, bool outputFiles);
}
#endif // FLOW_EBOS_SALTWATER_HPP

View File

@ -33,11 +33,11 @@ namespace Opm
// sense that they can be active or not and canonical indices can be translated
// to and from active ones. That said, they are not considered by num_phases or
// MaxNumPhases. The crypto phases which are currently implemented are solvent,
// polymer, energy, polymer molecular weight and foam.
static const int NumCryptoPhases = 5;
// polymer, energy, polymer molecular weight, foam and salt.
static const int NumCryptoPhases = 6;
// enum ComponentIndex { Water = 0, Oil = 1, Gas = 2 };
enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2, Solvent = 3, Polymer = 4, Energy = 5, PolymerMW = 6, Foam = 7 };
enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2, Solvent = 3, Polymer = 4, Energy = 5, PolymerMW = 6, Foam = 7, Salt = 8 };
};
struct PhaseUsage : public BlackoilPhases
@ -51,6 +51,7 @@ namespace Opm
// polymer molecular weight
bool has_polymermw;
bool has_foam;
bool has_salt;
};
/// Check or assign presence of a formed, free phase. Limited to

View File

@ -123,6 +123,15 @@ namespace Opm
else
pu.phase_pos[BlackoilPhases::Foam] = -1;
// Add salt info
pu.has_salt = phases.active(Phase::SALTWATER);
if (pu.has_salt) {
pu.phase_pos[BlackoilPhases::Salt] = numActivePhases;
++ numActivePhases;
}
else
pu.phase_pos[BlackoilPhases::Salt] = -1;
return pu;
}

View File

@ -84,6 +84,7 @@ SET_BOOL_PROP(EclFlowProblem, EnableSolvent, false);
SET_BOOL_PROP(EclFlowProblem, EnableTemperature, true);
SET_BOOL_PROP(EclFlowProblem, EnableEnergy, false);
SET_BOOL_PROP(EclFlowProblem, EnableFoam, false);
SET_BOOL_PROP(EclFlowProblem, EnableSaltWater, false);
SET_TYPE_PROP(EclFlowProblem, EclWellModel, Opm::BlackoilWellModel<TypeTag>);
SET_TAG_PROP(EclFlowProblem, LinearSolverSplice, FlowIstlSolver);
@ -124,11 +125,13 @@ namespace Opm {
static const int contiEnergyEqIdx = Indices::contiEnergyEqIdx;
static const int contiPolymerMWEqIdx = Indices::contiPolymerMWEqIdx;
static const int contiFoamEqIdx = Indices::contiFoamEqIdx;
static const int contiSaltWaterEqIdx = Indices::contiSaltWaterEqIdx;
static const int solventSaturationIdx = Indices::solventSaturationIdx;
static const int polymerConcentrationIdx = Indices::polymerConcentrationIdx;
static const int polymerMoleWeightIdx = Indices::polymerMoleWeightIdx;
static const int temperatureIdx = Indices::temperatureIdx;
static const int foamConcentrationIdx = Indices::foamConcentrationIdx;
static const int saltWaterConcentrationIdx = Indices::saltConcentrationIdx;
typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
typedef typename SparseMatrixAdapter::MatrixBlock MatrixBlockType;
@ -164,6 +167,7 @@ namespace Opm {
, has_polymermw_(GET_PROP_VALUE(TypeTag, EnablePolymerMW))
, has_energy_(GET_PROP_VALUE(TypeTag, EnableEnergy))
, has_foam_(GET_PROP_VALUE(TypeTag, EnableFoam))
, has_salt_(GET_PROP_VALUE(TypeTag, EnableSaltWater))
, param_( param )
, well_model_ (well_model)
, terminal_output_ (terminal_output)
@ -631,6 +635,12 @@ namespace Opm {
R_sum[ contiFoamEqIdx ] += R2;
maxCoeff[ contiFoamEqIdx ] = std::max( maxCoeff[ contiFoamEqIdx ], std::abs( R2 ) / pvValue );
}
if (has_salt_ ) {
B_avg[ contiSaltWaterEqIdx ] += 1.0 / fs.invB(FluidSystem::gasPhaseIdx).value();
const auto R2 = ebosResid[cell_idx][contiSaltWaterEqIdx];
R_sum[ contiSaltWaterEqIdx ] += R2;
maxCoeff[ contiSaltWaterEqIdx ] = std::max( maxCoeff[ contiSaltWaterEqIdx ], std::abs( R2 ) / pvValue );
}
if (has_polymermw_) {
assert(has_polymer_);
@ -720,6 +730,9 @@ namespace Opm {
if (has_foam_) {
compNames[foamConcentrationIdx] = "Foam";
}
if (has_salt_) {
compNames[saltWaterConcentrationIdx] = "Salt";
}
}
// Create convergence report.
@ -872,6 +885,7 @@ namespace Opm {
const bool has_polymermw_;
const bool has_energy_;
const bool has_foam_;
const bool has_salt_;
ModelParameters param_;
SimulatorReport failureReport_;

View File

@ -31,6 +31,7 @@
#include <opm/models/blackoil/blackoilpolymermodules.hh>
#include <opm/models/blackoil/blackoilsolventmodules.hh>
#include <opm/models/blackoil/blackoilfoammodules.hh>
#include <opm/models/blackoil/blackoilsaltwatermodules.hh>
#include <opm/material/densead/DynamicEvaluation.hpp>
@ -68,19 +69,22 @@ namespace Opm
using Base::has_solvent;
using Base::has_polymer;
using Base::has_foam;
using Base::has_salt;
using Base::has_energy;
using PolymerModule = Opm::BlackOilPolymerModule<TypeTag>;
using FoamModule = Opm::BlackOilFoamModule<TypeTag>;
using SaltWaterModule = Opm::BlackOilSaltWaterModule<TypeTag>;
// 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;
static const int numSaltEq = Indices::numSaltWater;
// number of the conservation equations
static const int numWellConservationEq = numEq - numPolymerEq - numEnergyEq - numFoamEq;
static const int numWellConservationEq = numEq - numPolymerEq - numEnergyEq - numFoamEq - numSaltEq;
// number of the well control equations
static const int numWellControlEq = 1;
// number of the well equations that will always be used
@ -138,6 +142,7 @@ namespace Opm
using Base::contiSolventEqIdx;
using Base::contiPolymerEqIdx;
using Base::contiFoamEqIdx;
using Base::contiSaltWaterEqIdx;
static const int contiEnergyEqIdx = Indices::contiEnergyEqIdx;
StandardWell(const Well& well, const int time_step,
@ -214,6 +219,7 @@ namespace Opm
using Base::phaseUsage;
using Base::flowPhaseToEbosCompIdx;
using Base::ebosCompIdxToFlowCompIdx;
using Base::wsalt;
using Base::wsolvent;
using Base::wpolymer;
using Base::wfoam;

View File

@ -691,6 +691,18 @@ namespace Opm
connectionRates_[perf][contiFoamEqIdx] = Base::restrictEval(cq_s_foam);
}
if (has_salt) {
// TODO: the application of well efficiency factor has not been tested with an example yet
const unsigned waterCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::waterCompIdx);
EvalWell cq_s_sm = cq_s[waterCompIdx] * well_efficiency_factor_;
if (this->isInjector()) {
cq_s_sm *= wsalt();
} else {
cq_s_sm *= extendEval(intQuants.fluidState().saltconcentration());
}
connectionRates_[perf][contiSaltWaterEqIdx] = Base::restrictEval(cq_s_sm);
}
// Store the perforation pressure for later usage.
well_state.perfPress()[first_perf_ + perf] = well_state.bhp()[index_of_well_] + perf_pressure_diffs_[perf];
@ -2516,7 +2528,7 @@ namespace Opm
{
// the following implementation assume that the polymer is always after the w-o-g phases
// For the polymer, energy and foam cases, there is one more mass balance equations of reservoir than wells
assert((int(B_avg.size()) == num_components_) || has_polymer || has_energy || has_foam);
assert((int(B_avg.size()) == num_components_) || has_polymer || has_energy || has_foam || has_salt);
const double tol_wells = param_.tolerance_wells_;
const double maxResidualAllowed = param_.max_residual_allowed_;

View File

@ -98,11 +98,13 @@ namespace Opm
// flag for polymer molecular weight related
static const bool has_polymermw = GET_PROP_VALUE(TypeTag, EnablePolymerMW);
static const bool has_foam = GET_PROP_VALUE(TypeTag, EnableFoam);
static const bool has_salt = GET_PROP_VALUE(TypeTag, EnableSaltWater);
static const int contiSolventEqIdx = Indices::contiSolventEqIdx;
static const int contiPolymerEqIdx = Indices::contiPolymerEqIdx;
// index for the polymer molecular weight continuity equation
static const int contiPolymerMWEqIdx = Indices::contiPolymerMWEqIdx;
static const int contiFoamEqIdx = Indices::contiFoamEqIdx;
static const int contiSaltWaterEqIdx = Indices::contiSaltWaterEqIdx;
// For the conversion between the surface volume rate and reservoir voidage rate
using RateConverterType = RateConverter::
@ -113,6 +115,7 @@ namespace Opm
has_temperature,
has_energy,
compositionSwitchEnabled,
has_salt,
Indices::numPhases >;
/// Constructor
WellInterface(const Well& well, const int time_step,
@ -385,6 +388,8 @@ namespace Opm
double wfoam() const;
double wsalt() const;
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
const WellState& well_state,
Opm::DeferredLogger& deferred_logger) const;

View File

@ -373,6 +373,29 @@ namespace Opm
template<typename TypeTag>
double
WellInterface<TypeTag>::
wsalt() const
{
if (!has_salt) {
return 0.0;
}
auto injectorType = well_ecl_.injectorType();
if (injectorType == Well::InjectorType::WATER) {
WellSaltwaterProperties fprop = well_ecl_.getSaltwaterProperties();
return fprop.m_saltwaterConcentration;
} else {
// Not a water injection well => no salt (?).
return 0.0;
}
}
template<typename TypeTag>
bool
WellInterface<TypeTag>::