mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-01 21:39:09 -06:00
using getWellConvergence in BlackoilModelEbos
Tested with SPE1. TODO: with the current way, we are not outputting any well residual information. We need to address what kind of residual information we want to output with the new well model.
This commit is contained in:
parent
ab67635134
commit
f1677015fe
@ -909,7 +909,6 @@ namespace Opm {
|
||||
|
||||
Vector CNV(numComp);
|
||||
Vector mass_balance_residual(numComp);
|
||||
Vector well_flux_residual(numComp);
|
||||
|
||||
bool converged_MB = true;
|
||||
bool converged_CNV = true;
|
||||
@ -923,8 +922,7 @@ namespace Opm {
|
||||
converged_CNV = converged_CNV && (CNV[compIdx] < tol_cnv);
|
||||
// Well flux convergence is only for fluid phases, not other materials
|
||||
// in our current implementation.
|
||||
well_flux_residual[compIdx] = B_avg[compIdx] * maxNormWell[compIdx];
|
||||
converged_Well = converged_Well && (well_flux_residual[compIdx] < tol_wells);
|
||||
converged_Well = wellModel().getWellConvergence(ebosSimulator_, B_avg);
|
||||
|
||||
residual_norms.push_back(CNV[compIdx]);
|
||||
}
|
||||
@ -961,9 +959,9 @@ namespace Opm {
|
||||
for (int compIdx = 0; compIdx < numComp; ++compIdx) {
|
||||
msg += " CNV(" + key[ compIdx ] + ") ";
|
||||
}
|
||||
for (int compIdx = 0; compIdx < numComp; ++compIdx) {
|
||||
/* for (int compIdx = 0; compIdx < numComp; ++compIdx) {
|
||||
msg += " W-FLUX(" + key[ compIdx ] + ")";
|
||||
}
|
||||
} */
|
||||
OpmLog::note(msg);
|
||||
}
|
||||
std::ostringstream ss;
|
||||
@ -976,9 +974,9 @@ namespace Opm {
|
||||
for (int compIdx = 0; compIdx < numComp; ++compIdx) {
|
||||
ss << std::setw(11) << CNV[compIdx];
|
||||
}
|
||||
for (int compIdx = 0; compIdx < numComp; ++compIdx) {
|
||||
ss << std::setw(11) << well_flux_residual[compIdx];
|
||||
}
|
||||
// for (int compIdx = 0; compIdx < numComp; ++compIdx) {
|
||||
// ss << std::setw(11) << well_flux_residual[compIdx];
|
||||
// }
|
||||
ss.precision(oprec);
|
||||
ss.flags(oflags);
|
||||
OpmLog::note(ss.str());
|
||||
@ -988,13 +986,13 @@ namespace Opm {
|
||||
const auto& phaseName = FluidSystem::phaseName(flowPhaseToEbosPhaseIdx(phaseIdx));
|
||||
|
||||
if (std::isnan(mass_balance_residual[phaseIdx])
|
||||
|| std::isnan(CNV[phaseIdx])
|
||||
|| (phaseIdx < numPhases() && std::isnan(well_flux_residual[phaseIdx]))) {
|
||||
|| std::isnan(CNV[phaseIdx])) {
|
||||
// || (phaseIdx < numPhases() && std::isnan(well_flux_residual[phaseIdx]))) {
|
||||
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << phaseName);
|
||||
}
|
||||
if (mass_balance_residual[phaseIdx] > maxResidualAllowed()
|
||||
|| CNV[phaseIdx] > maxResidualAllowed()
|
||||
|| (phaseIdx < numPhases() && well_flux_residual[phaseIdx] > maxResidualAllowed())) {
|
||||
|| CNV[phaseIdx] > maxResidualAllowed()) {
|
||||
// || (phaseIdx < numPhases() && well_flux_residual[phaseIdx] > maxResidualAllowed())) {
|
||||
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << phaseName);
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ enum WellVariablePositions {
|
||||
std::vector<double> residual() const;
|
||||
|
||||
bool getWellConvergence(Simulator& ebosSimulator,
|
||||
const int iteration) const;
|
||||
const std::vector<Scalar>& B_avg) const;
|
||||
|
||||
void computeWellConnectionPressures(const Simulator& ebosSimulator,
|
||||
const WellState& xw);
|
||||
|
@ -901,11 +901,16 @@ namespace Opm {
|
||||
const int nw = wells().number_of_wells;
|
||||
WellState well_state0 = well_state;
|
||||
|
||||
const int numComp = numComponents();
|
||||
std::vector< Scalar > B_avg( numComp, Scalar() );
|
||||
computeAverageFormationFactor(ebosSimulator, B_avg);
|
||||
|
||||
int it = 0;
|
||||
bool converged;
|
||||
do {
|
||||
assembleWellEq(ebosSimulator, dt, well_state, true);
|
||||
converged = getWellConvergence(ebosSimulator, it);
|
||||
|
||||
converged = getWellConvergence(ebosSimulator, B_avg);
|
||||
|
||||
// checking whether the group targets are converged
|
||||
if (wellCollection()->groupControlActive()) {
|
||||
@ -998,16 +1003,8 @@ namespace Opm {
|
||||
bool
|
||||
StandardWellsDense<TypeTag>::
|
||||
getWellConvergence(Simulator& ebosSimulator,
|
||||
const int iteration) const
|
||||
const std::vector<Scalar>& B_avg) const
|
||||
{
|
||||
typedef double Scalar;
|
||||
typedef std::vector< Scalar > Vector;
|
||||
|
||||
const int numComp = numComponents();
|
||||
|
||||
std::vector< Scalar > B_avg( numComp, Scalar() );
|
||||
computeAverageFormationFactor(ebosSimulator, B_avg);
|
||||
|
||||
bool converged_well = true;
|
||||
|
||||
// TODO: to check the strategy here
|
||||
|
Loading…
Reference in New Issue
Block a user