mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
-Fixed buges related to cpr with wells.
- change interfaces to have access to pressureVarIndex - added option in cmake files to propagate checking in dune-istl
This commit is contained in:
parent
fef06a77af
commit
da572d1f60
@ -13,6 +13,7 @@ set (opm-simulators_CONFIG_VAR
|
|||||||
HAVE_VEXCL
|
HAVE_VEXCL
|
||||||
HAVE_SUITESPARSE_UMFPACK_H
|
HAVE_SUITESPARSE_UMFPACK_H
|
||||||
HAVE_DUNE_ISTL
|
HAVE_DUNE_ISTL
|
||||||
|
DUNE_ISTL_WITH_CHECKING
|
||||||
DUNE_ISTL_VERSION_MAJOR
|
DUNE_ISTL_VERSION_MAJOR
|
||||||
DUNE_ISTL_VERSION_MINOR
|
DUNE_ISTL_VERSION_MINOR
|
||||||
DUNE_ISTL_VERSION_REVISION
|
DUNE_ISTL_VERSION_REVISION
|
||||||
|
@ -183,11 +183,12 @@ namespace Opm
|
|||||||
if (prm_.get<bool>("add_wells")) {
|
if (prm_.get<bool>("add_wells")) {
|
||||||
assert(transpose == false); // not implemented
|
assert(transpose == false); // not implemented
|
||||||
fineOperator.addWellPressureEquations(*coarseLevelMatrix_, weights_);
|
fineOperator.addWellPressureEquations(*coarseLevelMatrix_, weights_);
|
||||||
}
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
std::advance(rowCoarse, fineOperator.getNumberOfExtraEquations());
|
std::advance(rowCoarse, fineOperator.getNumberOfExtraEquations());
|
||||||
assert(rowCoarse == coarseLevelMatrix_->end());
|
assert(rowCoarse == coarseLevelMatrix_->end());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void moveToCoarseLevel(const typename ParentType::FineRangeType& fine) override
|
virtual void moveToCoarseLevel(const typename ParentType::FineRangeType& fine) override
|
||||||
|
@ -112,7 +112,7 @@ namespace Opm {
|
|||||||
typename BlackoilWellModelGeneric::GLiftWellStateMap;
|
typename BlackoilWellModelGeneric::GLiftWellStateMap;
|
||||||
using GLiftEclWells = typename GasLiftGroupInfo::GLiftEclWells;
|
using GLiftEclWells = typename GasLiftGroupInfo::GLiftEclWells;
|
||||||
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups;
|
using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups;
|
||||||
|
constexpr static std::size_t pressureVarIndex = GetPropType<TypeTag, Properties::Indices>::pressureSwitchIdx;
|
||||||
typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
|
typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
|
||||||
|
|
||||||
static const int numEq = Indices::numEq;
|
static const int numEq = Indices::numEq;
|
||||||
@ -299,7 +299,7 @@ namespace Opm {
|
|||||||
void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights) const
|
void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights) const
|
||||||
{
|
{
|
||||||
for (const auto& well : well_container_) {
|
for (const auto& well : well_container_) {
|
||||||
well->addWellPressureEquations(jacobian, weights);
|
well->addWellPressureEquations(jacobian, weights, pressureVarIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ namespace Opm
|
|||||||
using Eval = typename StdWellEval::Eval;
|
using Eval = typename StdWellEval::Eval;
|
||||||
using EvalWell = typename StdWellEval::EvalWell;
|
using EvalWell = typename StdWellEval::EvalWell;
|
||||||
using BVectorWell = typename StdWellEval::BVectorWell;
|
using BVectorWell = typename StdWellEval::BVectorWell;
|
||||||
|
using DiagMatrixBlockWellType = typename StdWellEval::DiagMatrixBlockWellType;
|
||||||
|
|
||||||
StandardWell(const Well& well,
|
StandardWell(const Well& well,
|
||||||
const ParallelWellInfo& pw_info,
|
const ParallelWellInfo& pw_info,
|
||||||
@ -183,7 +184,7 @@ namespace Opm
|
|||||||
|
|
||||||
virtual void addWellPressureEquationsStruct(PressureMatrix& mat) const override;
|
virtual void addWellPressureEquationsStruct(PressureMatrix& mat) const override;
|
||||||
|
|
||||||
virtual void addWellPressureEquations(PressureMatrix& mat, const BVector& x) const override;
|
virtual void addWellPressureEquations(PressureMatrix& mat, const BVector& x,const int pressureVarIndex) const override;
|
||||||
|
|
||||||
// iterate well equations with the specified control until converged
|
// iterate well equations with the specified control until converged
|
||||||
bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
bool iterateWellEqWithControl(const Simulator& ebosSimulator,
|
||||||
|
@ -2203,7 +2203,7 @@ namespace Opm
|
|||||||
|
|
||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
void
|
void
|
||||||
StandardWell<TypeTag>::addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights) const
|
StandardWell<TypeTag>::addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights,const int pressureVarIndex) const
|
||||||
{
|
{
|
||||||
// sustem is the pressur variant of
|
// sustem is the pressur variant of
|
||||||
// We need to change matrx A as follows
|
// We need to change matrx A as follows
|
||||||
@ -2226,17 +2226,28 @@ namespace Opm
|
|||||||
jacobian[row_ind][welldof_ind] = matel;
|
jacobian[row_ind][welldof_ind] = matel;
|
||||||
}
|
}
|
||||||
// make quasipes weights for bhp it should be trival
|
// make quasipes weights for bhp it should be trival
|
||||||
using VectorBlockType = typename BVector::block_type;
|
//using VectorBlockType = BVectorWell;
|
||||||
VectorBlockType bweights(0.0);
|
//VectorBlockType
|
||||||
|
BVectorWell bweights(1);
|
||||||
|
size_t blockSz = this->numWellEq_;
|
||||||
|
bweights[0].resize(blockSz);
|
||||||
double diagElem = 0;
|
double diagElem = 0;
|
||||||
{
|
{
|
||||||
// const DiagMatrixBlockWellType& invA = invDuneD_[0][0];
|
// const DiagMatrixBlockWellType& invA = invDuneD_[0][0];
|
||||||
VectorBlockType rhs(0.0);
|
BVectorWell rhs(1);
|
||||||
rhs[bhp_var_index] = 1.0;
|
rhs[0].resize(blockSz);
|
||||||
auto inv_diag_block = this->invDuneD_[0][0];
|
rhs[0][bhp_var_index] = 1.0;
|
||||||
auto inv_diag_block_transpose = Opm::wellhelpers::transposeDenseDynMatrix(inv_diag_block);
|
DiagMatrixBlockWellType inv_diag_block = this->invDuneD_[0][0];
|
||||||
|
DiagMatrixBlockWellType inv_diag_block_transpose = Opm::wellhelpers::transposeDenseDynMatrix(inv_diag_block);
|
||||||
// diag_block_transpose.solve(bweights, rhs);
|
// diag_block_transpose.solve(bweights, rhs);
|
||||||
inv_diag_block_transpose.mv(rhs, bweights);
|
//HACK due to template errors
|
||||||
|
for (size_t i = 0; i < blockSz; ++i) {
|
||||||
|
bweights[0][i] = 0;
|
||||||
|
for (size_t j = 0; j < blockSz; ++j) {
|
||||||
|
bweights[0][i] += inv_diag_block_transpose[i][j]*rhs[0][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//inv_diag_block_transpose.mv(rhs[0], bweights[0]);
|
||||||
// NB how to scale to make it most symmetric
|
// NB how to scale to make it most symmetric
|
||||||
// double abs_max = *std::max_element(
|
// double abs_max = *std::max_element(
|
||||||
// bweights.begin(), bweights.end(), [](double a, double b) { return std::fabs(a) < std::fabs(b); });
|
// bweights.begin(), bweights.end(), [](double a, double b) { return std::fabs(a) < std::fabs(b); });
|
||||||
@ -2247,10 +2258,11 @@ namespace Opm
|
|||||||
// set the matrix elements for well reservoir coupling
|
// set the matrix elements for well reservoir coupling
|
||||||
for (auto colB = this->duneB_[0].begin(), endB = this->duneB_[0].end(); colB != endB; ++colB) {
|
for (auto colB = this->duneB_[0].begin(), endB = this->duneB_[0].end(); colB != endB; ++colB) {
|
||||||
const auto col_index = colB.index();
|
const auto col_index = colB.index();
|
||||||
const auto& bw = bweights;
|
const auto& bw = bweights[0];
|
||||||
double matel = 0;
|
double matel = 0;
|
||||||
for (size_t i = 0; i < bw.size(); ++i) {
|
for (size_t i = 0; i < bw.size(); ++i) {
|
||||||
matel += (*colB)[bhp_var_index][i] * bw[i];
|
const double w = bw[i];
|
||||||
|
matel += (*colB)[i][pressureVarIndex] * bw[i];
|
||||||
}
|
}
|
||||||
jacobian[welldof_ind][col_index] = matel;
|
jacobian[welldof_ind][col_index] = matel;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void addWellPressureEquations(PressureMatrix&,
|
virtual void addWellPressureEquations(PressureMatrix&,
|
||||||
const BVector& x) const
|
const BVector& x,const int pressureVarIndex) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user