mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Let WellModel decide whether to apply well contributions.
It queries the Well whether the jacobian also contains well contributions. If not then it applies them in the operator in addition. Thus the well knows whether that is needed or not.
This commit is contained in:
parent
afb806bc3e
commit
96a636f25b
@ -565,11 +565,8 @@ namespace Opm {
|
||||
{
|
||||
A_.mv( x, y );
|
||||
|
||||
if ( ! matrix_add_well_contributions_ )
|
||||
{
|
||||
// add well model modification to y
|
||||
wellMod_.apply(x, y );
|
||||
}
|
||||
// add well model modification to y
|
||||
wellMod_.apply(x, y );
|
||||
|
||||
#if HAVE_MPI
|
||||
if( comm_ )
|
||||
@ -582,11 +579,8 @@ namespace Opm {
|
||||
{
|
||||
A_.usmv(alpha,x,y);
|
||||
|
||||
if ( ! matrix_add_well_contributions_ )
|
||||
{
|
||||
// add scaled well model modification to y
|
||||
wellMod_.applyScaleAdd( alpha, x, y );
|
||||
}
|
||||
// add scaled well model modification to y
|
||||
wellMod_.applyScaleAdd( alpha, x, y );
|
||||
|
||||
#if HAVE_MPI
|
||||
if( comm_ )
|
||||
|
@ -157,12 +157,6 @@ namespace Opm {
|
||||
|
||||
const SimulatorReport& lastReport() const;
|
||||
|
||||
/// \! brief Modifies matrix to include influences of the well perforations.
|
||||
///
|
||||
/// \param mat The linear system with the assembled mass balance
|
||||
/// equations
|
||||
void addWellContributions(Mat& mat) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -294,18 +294,6 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
BlackoilWellModel<TypeTag>::
|
||||
addWellContributions(Mat& mat) const
|
||||
{
|
||||
for(const auto& well: well_container_)
|
||||
{
|
||||
well->addWellContributions(mat);
|
||||
}
|
||||
}
|
||||
|
||||
// applying the well residual to reservoir residuals
|
||||
// r = r - duneC_^T * invDuneD_ * resWell_
|
||||
template<typename TypeTag>
|
||||
@ -333,7 +321,8 @@ namespace Opm {
|
||||
apply(const BVector& x, BVector& Ax) const
|
||||
{
|
||||
// TODO: do we still need localWellsActive()?
|
||||
if ( ! localWellsActive() ) {
|
||||
if ( ! localWellsActive() ||
|
||||
well_container_[0]->jacobianContainsWellContributions() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -352,7 +341,8 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
applyScaleAdd(const Scalar alpha, const BVector& x, BVector& Ax) const
|
||||
{
|
||||
if ( ! localWellsActive() ) {
|
||||
if ( ! localWellsActive() ||
|
||||
well_container_[0]->jacobianContainsWellContributions() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,14 @@ namespace Opm
|
||||
|
||||
virtual void calculateExplicitQuantities(const Simulator& ebosSimulator,
|
||||
const WellState& well_state); // should be const?
|
||||
|
||||
virtual void addWellContributions(Mat& mat) const;
|
||||
|
||||
/// \brief Wether the Jacobian will also have well contributions in it.
|
||||
virtual bool jacobianContainsWellContributions() const
|
||||
{
|
||||
return param_.matrix_add_well_contributions_;
|
||||
}
|
||||
protected:
|
||||
|
||||
// protected functions from the Base class
|
||||
|
@ -203,7 +203,11 @@ namespace Opm
|
||||
virtual void calculateExplicitQuantities(const Simulator& ebosSimulator,
|
||||
const WellState& well_state) = 0; // should be const?
|
||||
|
||||
virtual void addWellContributions(Mat& mat) const;
|
||||
/// \brief Wether the Jacobian will also have well contributions in it.
|
||||
virtual bool jacobianContainsWellContributions() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// updating the voidage rates in well_state when requested
|
||||
void calculateReservoirRates(WellState& well_state) const;
|
||||
|
@ -844,14 +844,6 @@ namespace Opm
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::addWellContributions(Mat& mat) const
|
||||
{
|
||||
OPM_THROW(NotImplemented, "This well class does not support adding well contributions"
|
||||
<< "to the matrix");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user