Initialization of solid salt saturation

This commit is contained in:
Paul Egberts 2022-01-06 12:43:21 +01:00
parent dfe298a424
commit 0824ee0694
3 changed files with 53 additions and 14 deletions

View File

@ -153,9 +153,13 @@ public:
}
// set salt concentration
// set the salt concentration
if (enableBrine)
fluidState.setSaltConcentration(initialState.saltConcentration()[elemIdx]);
//set the (solid) salt saturation
if (enableSaltPrecipitation)
fluidState.setSaltSaturation(initialState.saltSaturation()[elemIdx]);
}
}

View File

@ -619,6 +619,7 @@ class EclProblem : public GetPropType<TypeTag, Properties::BaseProblem>
enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
enum { enablePolymer = getPropValue<TypeTag, Properties::EnablePolymer>() };
enum { enableBrine = getPropValue<TypeTag, Properties::EnableBrine>() };
enum { enableSaltPrecipitation = getPropValue<TypeTag, Properties::EnableSaltPrecipitation>() };
enum { enablePolymerMolarWeight = getPropValue<TypeTag, Properties::EnablePolymerMW>() };
enum { enableFoam = getPropValue<TypeTag, Properties::EnableFoam>() };
enum { enableExtbo = getPropValue<TypeTag, Properties::EnableExtbo>() };
@ -1830,8 +1831,14 @@ public:
if constexpr (enablePolymerMolarWeight)
values[Indices::polymerMoleWeightIdx]= this->polymerMoleWeight_[globalDofIdx];
if constexpr (enableBrine)
values[Indices::saltConcentrationIdx] = initialFluidStates_[globalDofIdx].saltConcentration();
if constexpr (enableBrine) {
if (enableSaltPrecipitation && values.primaryVarsMeaningBrine() == PrimaryVariables::Sp) {
values[Indices::saltConcentrationIdx] = initialFluidStates_[globalDofIdx].saltSaturation();
}
else {
values[Indices::saltConcentrationIdx] = initialFluidStates_[globalDofIdx].saltConcentration();
}
}
if constexpr (enableMICP){
values[Indices::microbialConcentrationIdx]= this->microbialConcentration_[globalDofIdx];

View File

@ -36,17 +36,18 @@
#include <opm/grid/cpgrid/GridHelpers.hpp>
#include <opm/input/eclipse/Units/Units.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <opm/input/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/input/eclipse/EclipseState/Tables/RsvdTable.hpp>
#include <opm/input/eclipse/EclipseState/Tables/RvvdTable.hpp>
#include <opm/input/eclipse/EclipseState/Tables/PbvdTable.hpp>
#include <opm/input/eclipse/EclipseState/Tables/PdvdTable.hpp>
#include <opm/input/eclipse/EclipseState/Tables/SaltvdTable.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/RsvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/RvvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SaltvdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SaltpvdTable.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <fmt/format.h>
@ -1580,6 +1581,7 @@ public:
const bool applySwatInit = true)
: temperature_(gridView.size(/*codim=*/0)),
saltConcentration_(gridView.size(/*codim=*/0)),
saltSaturation_(gridView.size(/*codim=*/0)),
pp_(FluidSystem::numPhases,
std::vector<double>(gridView.size(/*codim=*/0))),
sat_(FluidSystem::numPhases,
@ -1711,6 +1713,9 @@ public:
// EXTRACT the initial salt concentration
updateInitialSaltConcentration_(eclipseState, eqlmap);
// EXTRACT the initial salt saturation
updateInitialSaltSaturation_(eclipseState, eqlmap);
// Compute pressures, saturations, rs and rv factors.
const auto& comm = gridView.comm();
calcPressSatRsRv(eqlmap, rec, materialLawManager, comm, grav);
@ -1727,6 +1732,7 @@ public:
const Vec& temperature() const { return temperature_; }
const Vec& saltConcentration() const { return saltConcentration_; }
const Vec& saltSaturation() const { return saltSaturation_; }
const PVec& press() const { return pp_; }
const PVec& saturation() const { return sat_; }
const Vec& rs() const { return rs_; }
@ -1767,14 +1773,36 @@ private:
}
}
}
template <class RMap>
void updateInitialSaltSaturation_(const EclipseState& eclState, const RMap& reg)
{
const int numEquilReg = rsFunc_.size();
saltpVdTable_.resize(numEquilReg);
const auto& tables = eclState.getTableManager();
const TableContainer& saltpvdTables = tables.getSaltpvdTables();
for (size_t i = 0; i < saltpvdTables.size(); ++i) {
const SaltpvdTable& saltpvdTable = saltpvdTables.getTable<SaltpvdTable>(i);
saltpVdTable_[i].setXYContainers(saltpvdTable.getDepthColumn(), saltpvdTable.getSaltpColumn());
const auto& cells = reg.cells(i);
for (const auto& cell : cells) {
const double depth = cellCenterDepth_[cell];
this->saltSaturation_[cell] = saltpVdTable_[i].eval(depth, /*extrapolate=*/true);
}
}
}
std::vector< std::shared_ptr<Miscibility::RsFunction> > rsFunc_;
std::vector< std::shared_ptr<Miscibility::RsFunction> > rvFunc_;
using TabulatedFunction = Tabulated1DFunction<double>;
std::vector<TabulatedFunction> saltVdTable_;
std::vector<TabulatedFunction> saltpVdTable_;
std::vector<int> regionPvtIdx_;
Vec temperature_;
Vec saltConcentration_;
Vec saltSaturation_;
PVec pp_;
PVec sat_;
Vec rs_;