mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Finishing the modification for solver class.
This commit is contained in:
parent
94e3fd3fcb
commit
cd50b54ddf
@ -105,7 +105,7 @@ try
|
|||||||
Opm::LinearSolverFactory linsolver(param);
|
Opm::LinearSolverFactory linsolver(param);
|
||||||
Opm::NewtonIterationBlackoilSimple fis_solver(linsolver);
|
Opm::NewtonIterationBlackoilSimple fis_solver(linsolver);
|
||||||
|
|
||||||
Opm::FullyImplicitBlackoilSolver<UnstructuredGrid> solver(*g, props, geo, 0, *wells, fis_solver);
|
Opm::FullyImplicitBlackoilSolver<UnstructuredGrid> solver(param, *g, props, geo, 0, *wells, fis_solver);
|
||||||
|
|
||||||
Opm::BlackoilState state;
|
Opm::BlackoilState state;
|
||||||
initStateBasic(*g, props0, param, 0.0, state);
|
initStateBasic(*g, props0, param, 0.0, state);
|
||||||
|
@ -31,6 +31,7 @@ struct Wells;
|
|||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
|
namespace parameter { class ParameterGroup; }
|
||||||
class DerivedGeology;
|
class DerivedGeology;
|
||||||
class RockCompressibility;
|
class RockCompressibility;
|
||||||
class NewtonIterationBlackoilInterface;
|
class NewtonIterationBlackoilInterface;
|
||||||
@ -56,13 +57,16 @@ namespace Opm {
|
|||||||
/// Construct a solver. It will retain references to the
|
/// Construct a solver. It will retain references to the
|
||||||
/// arguments of this functions, and they are expected to
|
/// arguments of this functions, and they are expected to
|
||||||
/// remain in scope for the lifetime of the solver.
|
/// remain in scope for the lifetime of the solver.
|
||||||
|
/// \param[in] param parameters
|
||||||
/// \param[in] grid grid data structure
|
/// \param[in] grid grid data structure
|
||||||
/// \param[in] fluid fluid properties
|
/// \param[in] fluid fluid properties
|
||||||
/// \param[in] geo rock properties
|
/// \param[in] geo rock properties
|
||||||
/// \param[in] rock_comp_props if non-null, rock compressibility properties
|
/// \param[in] rock_comp_props if non-null, rock compressibility properties
|
||||||
/// \param[in] wells well structure
|
/// \param[in] wells well structure
|
||||||
/// \param[in] linsolver linear solver
|
/// \param[in] linsolver linear solver
|
||||||
FullyImplicitBlackoilSolver(const Grid& grid ,
|
|
||||||
|
FullyImplicitBlackoilSolver(const parameter::ParameterGroup& param,
|
||||||
|
const Grid& grid ,
|
||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo ,
|
const DerivedGeology& geo ,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
@ -137,6 +141,9 @@ namespace Opm {
|
|||||||
HelperOps ops_;
|
HelperOps ops_;
|
||||||
const WellOps wops_;
|
const WellOps wops_;
|
||||||
const M grav_;
|
const M grav_;
|
||||||
|
double dp_max_rel_;
|
||||||
|
double ds_max_;
|
||||||
|
double drs_max_rel_;
|
||||||
|
|
||||||
std::vector<ReservoirResidualQuant> rq_;
|
std::vector<ReservoirResidualQuant> rq_;
|
||||||
std::vector<PhasePresence> phaseCondition_;
|
std::vector<PhasePresence> phaseCondition_;
|
||||||
@ -266,6 +273,9 @@ namespace Opm {
|
|||||||
/// residual mass balance (tol_cnv).
|
/// residual mass balance (tol_cnv).
|
||||||
bool getConvergence(const double dt);
|
bool getConvergence(const double dt);
|
||||||
|
|
||||||
|
const double dpMaxRel () const { return dp_max_rel_; }
|
||||||
|
const double dsMax () const { return ds_max_; }
|
||||||
|
const double drsMaxRel () const { return drs_max_rel_; }
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <opm/core/utility/Exceptions.hpp>
|
#include <opm/core/utility/Exceptions.hpp>
|
||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
#include <opm/core/well_controls.h>
|
#include <opm/core/well_controls.h>
|
||||||
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -209,10 +210,10 @@ namespace {
|
|||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
FullyImplicitBlackoilSolver<T>::
|
FullyImplicitBlackoilSolver<T>::
|
||||||
FullyImplicitBlackoilSolver(const Grid& grid ,
|
FullyImplicitBlackoilSolver(const parameter::ParameterGroup& param,
|
||||||
|
const Grid& grid ,
|
||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo ,
|
const DerivedGeology& geo ,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
@ -235,12 +236,22 @@ namespace {
|
|||||||
, residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()),
|
, residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()),
|
||||||
ADB::null(),
|
ADB::null(),
|
||||||
ADB::null() } )
|
ADB::null() } )
|
||||||
|
, dp_max_rel_ ( 0.2 )
|
||||||
|
, ds_max_ ( 0.05 )
|
||||||
|
, drs_max_rel_ ( 0.2 )
|
||||||
{
|
{
|
||||||
|
if (param.has("dp_max_rel")) {
|
||||||
|
dp_max_rel_ = param.get<double>(std::string("dp_max_rel"));
|
||||||
|
}
|
||||||
|
if (param.has("dp_max")) {
|
||||||
|
ds_max_ = param.get<double>("dp_max");
|
||||||
|
}
|
||||||
|
if (param.has("drs_max_rel")) {
|
||||||
|
ds_max_ = param.get<double>("drs_max_rel");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void
|
void
|
||||||
FullyImplicitBlackoilSolver<T>::
|
FullyImplicitBlackoilSolver<T>::
|
||||||
@ -1224,7 +1235,7 @@ namespace {
|
|||||||
assert(varstart == dx.size());
|
assert(varstart == dx.size());
|
||||||
|
|
||||||
// Pressure update.
|
// Pressure update.
|
||||||
const double dpmaxrel = 0.2;
|
const double dpmaxrel = dpMaxRel();
|
||||||
const V p_old = Eigen::Map<const V>(&state.pressure()[0], nc, 1);
|
const V p_old = Eigen::Map<const V>(&state.pressure()[0], nc, 1);
|
||||||
const V absdpmax = dpmaxrel*p_old.abs();
|
const V absdpmax = dpmaxrel*p_old.abs();
|
||||||
const V dp_limited = sign(dp) * dp.abs().min(absdpmax);
|
const V dp_limited = sign(dp) * dp.abs().min(absdpmax);
|
||||||
@ -1235,7 +1246,7 @@ namespace {
|
|||||||
// Saturation updates.
|
// Saturation updates.
|
||||||
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
||||||
const DataBlock s_old = Eigen::Map<const DataBlock>(& state.saturation()[0], nc, np);
|
const DataBlock s_old = Eigen::Map<const DataBlock>(& state.saturation()[0], nc, np);
|
||||||
const double dsmax = 0.05;
|
const double dsmax = dsMax();
|
||||||
V so = one;
|
V so = one;
|
||||||
V sw;
|
V sw;
|
||||||
V sg;
|
V sg;
|
||||||
@ -1275,7 +1286,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double drsmaxrel = 0.2;
|
const double drsmaxrel = drsMaxRel();
|
||||||
const double drvmax = 1e9;//% same as in Mrst
|
const double drvmax = 1e9;//% same as in Mrst
|
||||||
V rs;
|
V rs;
|
||||||
if (disgas) {
|
if (disgas) {
|
||||||
|
@ -200,7 +200,7 @@ namespace Opm
|
|||||||
wells_(wells_manager.c_wells()),
|
wells_(wells_manager.c_wells()),
|
||||||
gravity_(gravity),
|
gravity_(gravity),
|
||||||
geo_(grid_, props_, gravity_),
|
geo_(grid_, props_, gravity_),
|
||||||
solver_(grid_, props_, geo_, rock_comp_props, *wells_manager.c_wells(), linsolver)
|
solver_(param, grid_, props_, geo_, rock_comp_props, *wells_manager.c_wells(), linsolver)
|
||||||
/* param.getDefault("nl_pressure_residual_tolerance", 0.0),
|
/* param.getDefault("nl_pressure_residual_tolerance", 0.0),
|
||||||
param.getDefault("nl_pressure_change_tolerance", 1.0),
|
param.getDefault("nl_pressure_change_tolerance", 1.0),
|
||||||
param.getDefault("nl_pressure_maxiter", 10),
|
param.getDefault("nl_pressure_maxiter", 10),
|
||||||
|
Loading…
Reference in New Issue
Block a user