mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #719 from akva2/brine_module_params
BlackOilBrineModules: put parameters in separate struct
This commit is contained in:
commit
ed8d0aa181
@ -29,10 +29,8 @@
|
|||||||
#define EWOMS_BLACK_OIL_BRINE_MODULE_HH
|
#define EWOMS_BLACK_OIL_BRINE_MODULE_HH
|
||||||
|
|
||||||
#include "blackoilproperties.hh"
|
#include "blackoilproperties.hh"
|
||||||
#include <opm/models/common/quantitycallbacks.hh>
|
|
||||||
|
|
||||||
#include <opm/material/common/Tabulated1DFunction.hpp>
|
#include <opm/models/blackoil/blackoilbrineparams.hh>
|
||||||
#include <opm/material/common/IntervalTabulated2DFunction.hpp>
|
|
||||||
|
|
||||||
#if HAVE_ECL_INPUT
|
#if HAVE_ECL_INPUT
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
@ -43,8 +41,6 @@
|
|||||||
#include <opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp>
|
#include <opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <opm/material/common/Valgrind.hpp>
|
|
||||||
|
|
||||||
#include <dune/common/fvector.hh>
|
#include <dune/common/fvector.hh>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -74,8 +70,7 @@ class BlackOilBrineModule
|
|||||||
|
|
||||||
using Toolbox = MathToolbox<Evaluation>;
|
using Toolbox = MathToolbox<Evaluation>;
|
||||||
|
|
||||||
using TabulatedFunction = Tabulated1DFunction<Scalar>;
|
using TabulatedFunction = typename BlackOilBrineParams<Scalar>::TabulatedFunction;
|
||||||
using TabulatedTwoDFunction = IntervalTabulated2DFunction<Scalar>;
|
|
||||||
|
|
||||||
static constexpr unsigned saltConcentrationIdx = Indices::saltConcentrationIdx;
|
static constexpr unsigned saltConcentrationIdx = Indices::saltConcentrationIdx;
|
||||||
static constexpr unsigned contiBrineEqIdx = Indices::contiBrineEqIdx;
|
static constexpr unsigned contiBrineEqIdx = Indices::contiBrineEqIdx;
|
||||||
@ -113,38 +108,38 @@ public:
|
|||||||
const auto& tableManager = eclState.getTableManager();
|
const auto& tableManager = eclState.getTableManager();
|
||||||
|
|
||||||
unsigned numPvtRegions = tableManager.getTabdims().getNumPVTTables();
|
unsigned numPvtRegions = tableManager.getTabdims().getNumPVTTables();
|
||||||
referencePressure_.resize(numPvtRegions);
|
params_.referencePressure_.resize(numPvtRegions);
|
||||||
|
|
||||||
const auto& pvtwsaltTables = tableManager.getPvtwSaltTables();
|
const auto& pvtwsaltTables = tableManager.getPvtwSaltTables();
|
||||||
|
|
||||||
// initialize the objects which deal with the BDENSITY keyword
|
// initialize the objects which deal with the BDENSITY keyword
|
||||||
const auto& bdensityTables = tableManager.getBrineDensityTables();
|
const auto& bdensityTables = tableManager.getBrineDensityTables();
|
||||||
if (!bdensityTables.empty()) {
|
if (!bdensityTables.empty()) {
|
||||||
bdensityTable_.resize(numPvtRegions);
|
params_.bdensityTable_.resize(numPvtRegions);
|
||||||
assert(numPvtRegions == bdensityTables.size());
|
assert(numPvtRegions == bdensityTables.size());
|
||||||
for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) {
|
for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) {
|
||||||
const auto& bdensityTable = bdensityTables[pvtRegionIdx];
|
const auto& bdensityTable = bdensityTables[pvtRegionIdx];
|
||||||
const auto& pvtwsaltTable = pvtwsaltTables[pvtRegionIdx];
|
const auto& pvtwsaltTable = pvtwsaltTables[pvtRegionIdx];
|
||||||
const auto& c = pvtwsaltTable.getSaltConcentrationColumn();
|
const auto& c = pvtwsaltTable.getSaltConcentrationColumn();
|
||||||
bdensityTable_[pvtRegionIdx].setXYContainers(c, bdensityTable);
|
params_.bdensityTable_[pvtRegionIdx].setXYContainers(c, bdensityTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if constexpr (enableSaltPrecipitation) {
|
if constexpr (enableSaltPrecipitation) {
|
||||||
const TableContainer& permfactTables = tableManager.getPermfactTables();
|
const TableContainer& permfactTables = tableManager.getPermfactTables();
|
||||||
permfactTable_.resize(numPvtRegions);
|
params_.permfactTable_.resize(numPvtRegions);
|
||||||
for (size_t i = 0; i < permfactTables.size(); ++i) {
|
for (size_t i = 0; i < permfactTables.size(); ++i) {
|
||||||
const PermfactTable& permfactTable = permfactTables.getTable<PermfactTable>(i);
|
const PermfactTable& permfactTable = permfactTables.getTable<PermfactTable>(i);
|
||||||
permfactTable_[i].setXYContainers(permfactTable.getPorosityChangeColumn(), permfactTable.getPermeabilityMultiplierColumn());
|
params_.permfactTable_[i].setXYContainers(permfactTable.getPorosityChangeColumn(), permfactTable.getPermeabilityMultiplierColumn());
|
||||||
}
|
}
|
||||||
|
|
||||||
const TableContainer& saltsolTables = tableManager.getSaltsolTables();
|
const TableContainer& saltsolTables = tableManager.getSaltsolTables();
|
||||||
if (!saltsolTables.empty()) {
|
if (!saltsolTables.empty()) {
|
||||||
saltsolTable_.resize(numPvtRegions);
|
params_.saltsolTable_.resize(numPvtRegions);
|
||||||
assert(numPvtRegions == saltsolTables.size());
|
assert(numPvtRegions == saltsolTables.size());
|
||||||
for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) {
|
for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) {
|
||||||
const SaltsolTable& saltsolTable = saltsolTables.getTable<SaltsolTable>(pvtRegionIdx );
|
const SaltsolTable& saltsolTable = saltsolTables.getTable<SaltsolTable>(pvtRegionIdx );
|
||||||
saltsolTable_[pvtRegionIdx] = saltsolTable.getSaltsolColumn().front();
|
params_.saltsolTable_[pvtRegionIdx] = saltsolTable.getSaltsolColumn().front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +314,7 @@ public:
|
|||||||
unsigned timeIdx)
|
unsigned timeIdx)
|
||||||
{
|
{
|
||||||
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
||||||
return referencePressure_[pvtnumRegionIdx];
|
return params_.referencePressure_[pvtnumRegionIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,7 +323,7 @@ public:
|
|||||||
unsigned timeIdx)
|
unsigned timeIdx)
|
||||||
{
|
{
|
||||||
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
||||||
return bdensityTable_[pvtnumRegionIdx];
|
return params_.bdensityTable_[pvtnumRegionIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TabulatedFunction& permfactTable(const ElementContext& elemCtx,
|
static const TabulatedFunction& permfactTable(const ElementContext& elemCtx,
|
||||||
@ -336,7 +331,7 @@ public:
|
|||||||
unsigned timeIdx)
|
unsigned timeIdx)
|
||||||
{
|
{
|
||||||
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
||||||
return permfactTable_[pvtnumRegionIdx];
|
return params_.permfactTable_[pvtnumRegionIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Scalar saltsolTable(const ElementContext& elemCtx,
|
static const Scalar saltsolTable(const ElementContext& elemCtx,
|
||||||
@ -344,46 +339,31 @@ public:
|
|||||||
unsigned timeIdx)
|
unsigned timeIdx)
|
||||||
{
|
{
|
||||||
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
unsigned pvtnumRegionIdx = elemCtx.problem().pvtRegionIndex(elemCtx, scvIdx, timeIdx);
|
||||||
return saltsolTable_[pvtnumRegionIdx];
|
return params_.saltsolTable_[pvtnumRegionIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hasBDensityTables()
|
static bool hasBDensityTables()
|
||||||
{
|
{
|
||||||
return !bdensityTable_.empty();
|
return !params_.bdensityTable_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hasSaltsolTables()
|
static bool hasSaltsolTables()
|
||||||
{
|
{
|
||||||
return !saltsolTable_.empty();
|
return !params_.saltsolTable_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Scalar saltSol(unsigned regionIdx) {
|
static Scalar saltSol(unsigned regionIdx) {
|
||||||
return saltsolTable_[regionIdx];
|
return params_.saltsolTable_[regionIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<TabulatedFunction> bdensityTable_;
|
static BlackOilBrineParams<Scalar> params_;
|
||||||
static std::vector<TabulatedFunction> permfactTable_;
|
|
||||||
static std::vector<Scalar> saltsolTable_;
|
|
||||||
static std::vector<Scalar> referencePressure_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class TypeTag, bool enableBrineV>
|
template <class TypeTag, bool enableBrineV>
|
||||||
std::vector<typename BlackOilBrineModule<TypeTag, enableBrineV>::TabulatedFunction>
|
BlackOilBrineParams<typename BlackOilBrineModule<TypeTag, enableBrineV>::Scalar>
|
||||||
BlackOilBrineModule<TypeTag, enableBrineV>::bdensityTable_;
|
BlackOilBrineModule<TypeTag, enableBrineV>::params_;
|
||||||
|
|
||||||
template <class TypeTag, bool enableBrineV>
|
|
||||||
std::vector<typename BlackOilBrineModule<TypeTag, enableBrineV>::Scalar>
|
|
||||||
BlackOilBrineModule<TypeTag, enableBrineV>::referencePressure_;
|
|
||||||
|
|
||||||
template <class TypeTag, bool enableBrineV>
|
|
||||||
std::vector<typename BlackOilBrineModule<TypeTag, enableBrineV>::Scalar>
|
|
||||||
BlackOilBrineModule<TypeTag, enableBrineV>::saltsolTable_;
|
|
||||||
|
|
||||||
template <class TypeTag, bool enableBrineV>
|
|
||||||
std::vector<typename BlackOilBrineModule<TypeTag, enableBrineV>::TabulatedFunction>
|
|
||||||
BlackOilBrineModule<TypeTag, enableBrineV>::permfactTable_;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup BlackOil
|
* \ingroup BlackOil
|
||||||
|
50
opm/models/blackoil/blackoilbrineparams.hh
Normal file
50
opm/models/blackoil/blackoilbrineparams.hh
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// -*- 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 Contains the parameters required to extend the black-oil model by brine.
|
||||||
|
*/
|
||||||
|
#ifndef EWOMS_BLACK_OIL_BRINE_PARAMS_HH
|
||||||
|
#define EWOMS_BLACK_OIL_BRINE_PARAMS_HH
|
||||||
|
|
||||||
|
#include <opm/material/common/Tabulated1DFunction.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Opm {
|
||||||
|
|
||||||
|
//! \brief Struct holding the parameters for the BlackoilBrineModule class.
|
||||||
|
template<class Scalar>
|
||||||
|
struct BlackOilBrineParams {
|
||||||
|
using TabulatedFunction = Tabulated1DFunction<Scalar>;
|
||||||
|
|
||||||
|
std::vector<TabulatedFunction> bdensityTable_;
|
||||||
|
std::vector<TabulatedFunction> permfactTable_;
|
||||||
|
std::vector<Scalar> saltsolTable_;
|
||||||
|
std::vector<Scalar> referencePressure_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Opm
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user