mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Changes made to test variations of matrix vs matrixless(ish) operator.
This commit is contained in:
parent
0db0e83843
commit
b276aaa16b
@ -374,6 +374,12 @@ namespace Opm {
|
||||
OPM_THROW(Opm::NumericalIssue,"Error encounted when solving well equations");
|
||||
}
|
||||
|
||||
auto& ebosJac = ebosSimulator_.model().linearizer().matrix();
|
||||
matrix_for_preconditioner_ = ebosJac;
|
||||
if (param_.matrix_add_well_contributions_) {
|
||||
wellModel().addWellContributions(ebosJac);
|
||||
}
|
||||
|
||||
return wellModel().lastReport();
|
||||
}
|
||||
|
||||
@ -488,7 +494,7 @@ namespace Opm {
|
||||
if( isParallel() )
|
||||
{
|
||||
typedef WellModelMatrixAdapter< Mat, BVector, BVector, BlackoilWellModel<TypeTag>, true > Operator;
|
||||
Operator opA(ebosJac, wellModel(),
|
||||
Operator opA(ebosJac, matrix_for_preconditioner_, wellModel(),
|
||||
param_.matrix_add_well_contributions_,
|
||||
istlSolver().parallelInformation() );
|
||||
assert( opA.comm() );
|
||||
@ -497,7 +503,7 @@ namespace Opm {
|
||||
else
|
||||
{
|
||||
typedef WellModelMatrixAdapter< Mat, BVector, BVector, BlackoilWellModel<TypeTag>, false > Operator;
|
||||
Operator opA(ebosJac, wellModel(),
|
||||
Operator opA(ebosJac, matrix_for_preconditioner_, wellModel(),
|
||||
param_.matrix_add_well_contributions_ );
|
||||
istlSolver().solve( opA, x, ebosResid );
|
||||
}
|
||||
@ -545,10 +551,12 @@ namespace Opm {
|
||||
#endif
|
||||
|
||||
//! constructor: just store a reference to a matrix
|
||||
WellModelMatrixAdapter (const M& A, const WellModel& wellMod,
|
||||
WellModelMatrixAdapter (const M& A,
|
||||
const M& A_for_precond,
|
||||
const WellModel& wellMod,
|
||||
bool matrix_add_well_contributions,
|
||||
const boost::any& parallelInformation = boost::any() )
|
||||
: A_( A ), wellMod_( wellMod ), comm_(),
|
||||
: A_( A ), A_for_precond_(A_for_precond), wellMod_( wellMod ), comm_(),
|
||||
matrix_add_well_contributions_(matrix_add_well_contributions)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
@ -588,7 +596,7 @@ namespace Opm {
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual const matrix_type& getmat() const { return A_; }
|
||||
virtual const matrix_type& getmat() const { return A_for_precond_; }
|
||||
|
||||
communication_type* comm()
|
||||
{
|
||||
@ -597,6 +605,7 @@ namespace Opm {
|
||||
|
||||
protected:
|
||||
const matrix_type& A_ ;
|
||||
const matrix_type& A_for_precond_ ;
|
||||
const WellModel& wellMod_;
|
||||
std::unique_ptr< communication_type > comm_;
|
||||
bool matrix_add_well_contributions_;
|
||||
@ -1057,6 +1066,8 @@ namespace Opm {
|
||||
double current_relaxation_;
|
||||
BVector dx_old_;
|
||||
|
||||
Mat matrix_for_preconditioner_;
|
||||
|
||||
public:
|
||||
/// return the StandardWells object
|
||||
BlackoilWellModel<TypeTag>&
|
||||
|
@ -153,6 +153,16 @@ namespace Opm {
|
||||
const SimulatorReport& lastReport() const;
|
||||
|
||||
|
||||
void addWellContributions(Mat& mat)
|
||||
{
|
||||
for (int w = 0; w < numWells(); ++w) {
|
||||
auto* well = dynamic_cast<StandardWell<TypeTag>*>(well_container_[w].get());
|
||||
if (well) {
|
||||
well->addWellContributions(mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Simulator& ebosSimulator_;
|
||||
|
@ -179,12 +179,12 @@ public:
|
||||
|
||||
WellState wellStateDummy; //not used. Only passed to make the old interfaces happy
|
||||
|
||||
if ( model_param_.matrix_add_well_contributions_ )
|
||||
{
|
||||
// if ( model_param_.matrix_add_well_contributions_ )
|
||||
// {
|
||||
ebosSimulator_.model().clearAuxiliaryModules();
|
||||
auto auxMod = std::make_shared<WellConnectionAuxiliaryModule<TypeTag> >(schedule(), grid());
|
||||
ebosSimulator_.model().addAuxiliaryModule(auxMod);
|
||||
}
|
||||
// }
|
||||
|
||||
// Main simulation loop.
|
||||
while (!timer.done()) {
|
||||
|
@ -672,10 +672,10 @@ namespace Opm
|
||||
auto original = invDuneD_[0][0];
|
||||
Dune::FMatrixHelp::invertMatrix(original, invDuneD_[0][0]);
|
||||
|
||||
if ( param_.matrix_add_well_contributions_ )
|
||||
{
|
||||
addWellContributions( ebosJac );
|
||||
}
|
||||
// if ( param_.matrix_add_well_contributions_ )
|
||||
// {
|
||||
// addWellContributions( ebosJac );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user