mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-27 21:16:26 -06:00
Use set of names of defunct wells from load balancer for parallel WellManager.
Instead of the WellsManager guessing which wells are handled by other processes we now use tha ouput of the load balancer to compute wells that are handled by other processes. With the previous approach it was not possible to calculate this information correctly. Wells with only one completion next to the border of the processes' partition were represented on multiple processes. In additition wells that the eclipse schedule section defined with completions on non-active cells in sequential runs were not at all calculated in parallel runs. With the new approach the CpGrid::loaBalance routine returns the set names of wells that are not handled by this process when setting up the simulation. This information is then used throughout the simulation.
This commit is contained in:
parent
fbc47cc186
commit
33edf62a78
@ -214,6 +214,9 @@ namespace Opm
|
||||
std::unique_ptr<Simulator> simulator_;
|
||||
// create log file
|
||||
std::string logFile_;
|
||||
// The names of wells that are artifically defunct in parallel runs.
|
||||
// Those wells are handled on a another process.
|
||||
std::unordered_set<std::string> defunct_well_names_;
|
||||
// ------------ Methods ------------
|
||||
|
||||
|
||||
@ -598,10 +601,11 @@ namespace Opm
|
||||
// If there are more than one processors involved, we now repartition the grid
|
||||
// and initilialize new properties and states for it.
|
||||
if (must_distribute_) {
|
||||
distributeGridAndData(grid_init_->grid(), deck_, eclipse_state_,
|
||||
*state_, *fluidprops_, *geoprops_,
|
||||
material_law_manager_, threshold_pressures_,
|
||||
parallel_information_, use_local_perm_);
|
||||
defunct_well_names_ =
|
||||
distributeGridAndData(grid_init_->grid(), deck_, eclipse_state_,
|
||||
*state_, *fluidprops_, *geoprops_,
|
||||
material_law_manager_, threshold_pressures_,
|
||||
parallel_information_, use_local_perm_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -811,7 +815,8 @@ namespace Opm
|
||||
Base::deck_->hasKeyword("VAPOIL"),
|
||||
Base::eclipse_state_,
|
||||
*Base::output_writer_,
|
||||
Base::threshold_pressures_));
|
||||
Base::threshold_pressures_,
|
||||
Base::defunct_well_names_));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
Copyright 2015 Dr. Blatt - HPC-Simulation-Software & Services.
|
||||
Coypright 2015 NTNU
|
||||
Copyright 2015 Statoil AS
|
||||
Copyright 2015 IRIS AS
|
||||
Copyright 2015-2016 Dr. Blatt - HPC-Simulation-Software & Services.
|
||||
Coypright 2015 NTNU
|
||||
Copyright 2015-2016 Statoil AS
|
||||
Copyright 2015 IRIS AS
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@ -22,6 +22,9 @@
|
||||
#ifndef OPM_REDISTRIBUTEDATAHANDLES_HEADER
|
||||
#define OPM_REDISTRIBUTEDATAHANDLES_HEADER
|
||||
|
||||
#include <unordered_set>
|
||||
#include <string>
|
||||
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
|
||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||
@ -33,17 +36,19 @@ namespace Opm
|
||||
{
|
||||
|
||||
template <class Grid>
|
||||
inline void distributeGridAndData( Grid& ,
|
||||
Opm::DeckConstPtr ,
|
||||
EclipseStateConstPtr ,
|
||||
BlackoilState& ,
|
||||
BlackoilPropsAdFromDeck& ,
|
||||
DerivedGeology&,
|
||||
std::shared_ptr<BlackoilPropsAdFromDeck::MaterialLawManager>&,
|
||||
std::vector<double>&,
|
||||
boost::any& ,
|
||||
const bool )
|
||||
inline std::unordered_set<std::string>
|
||||
distributeGridAndData( Grid& ,
|
||||
Opm::DeckConstPtr ,
|
||||
EclipseStateConstPtr ,
|
||||
BlackoilState& ,
|
||||
BlackoilPropsAdFromDeck& ,
|
||||
DerivedGeology&,
|
||||
std::shared_ptr<BlackoilPropsAdFromDeck::MaterialLawManager>&,
|
||||
std::vector<double>&,
|
||||
boost::any& ,
|
||||
const bool )
|
||||
{
|
||||
return std::unordered_set<std::string>();
|
||||
}
|
||||
|
||||
#if HAVE_OPM_GRID && HAVE_MPI
|
||||
@ -413,22 +418,25 @@ private:
|
||||
};
|
||||
|
||||
inline
|
||||
void distributeGridAndData( Dune::CpGrid& grid,
|
||||
Opm::DeckConstPtr deck,
|
||||
EclipseStateConstPtr eclipseState,
|
||||
BlackoilState& state,
|
||||
BlackoilPropsAdFromDeck& properties,
|
||||
DerivedGeology& geology,
|
||||
std::shared_ptr<BlackoilPropsAdFromDeck::MaterialLawManager>& material_law_manager,
|
||||
std::vector<double>& threshold_pressures,
|
||||
boost::any& parallelInformation,
|
||||
const bool useLocalPerm)
|
||||
std::unordered_set<std::string>
|
||||
distributeGridAndData( Dune::CpGrid& grid,
|
||||
Opm::DeckConstPtr deck,
|
||||
EclipseStateConstPtr eclipseState,
|
||||
BlackoilState& state,
|
||||
BlackoilPropsAdFromDeck& properties,
|
||||
DerivedGeology& geology,
|
||||
std::shared_ptr<BlackoilPropsAdFromDeck::MaterialLawManager>& material_law_manager,
|
||||
std::vector<double>& threshold_pressures,
|
||||
boost::any& parallelInformation,
|
||||
const bool useLocalPerm)
|
||||
{
|
||||
Dune::CpGrid global_grid ( grid );
|
||||
global_grid.switchToGlobalView();
|
||||
|
||||
// distribute the grid and switch to the distributed view
|
||||
grid.loadBalance(eclipseState, geology.transmissibility().data());
|
||||
using std::get;
|
||||
auto my_defunct_wells = get<1>(grid.loadBalance(eclipseState,
|
||||
geology.transmissibility().data()));
|
||||
grid.switchToDistributedView();
|
||||
std::vector<int> compressedToCartesianIdx;
|
||||
Opm::createGlobalCellArray(grid, compressedToCartesianIdx);
|
||||
@ -493,6 +501,8 @@ void distributeGridAndData( Dune::CpGrid& grid,
|
||||
material_law_manager = distributed_material_law_manager;
|
||||
threshold_pressures = distributed_pressures;
|
||||
extractParallelGridInformationToISTL(grid, parallelInformation);
|
||||
|
||||
return my_defunct_wells;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -130,7 +130,8 @@ namespace Opm
|
||||
const bool vapoil,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
OutputWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face);
|
||||
const std::vector<double>& threshold_pressures_by_face,
|
||||
const std::unordered_set<std::string>& defunct_well_names);
|
||||
|
||||
/// Run the simulation.
|
||||
/// This will run succesive timesteps until timer.done() is true. It will
|
||||
@ -214,6 +215,10 @@ namespace Opm
|
||||
std::vector<double> threshold_pressures_by_face_;
|
||||
// Whether this a parallel simulation or not
|
||||
bool is_parallel_run_;
|
||||
// The names of wells that should be defunct
|
||||
// (e.g. in a parallel run when they are handeled by
|
||||
// a different process)
|
||||
std::unordered_set<std::string> defunct_well_names_;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -42,7 +42,8 @@ namespace Opm
|
||||
const bool has_vapoil,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
OutputWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face)
|
||||
const std::vector<double>& threshold_pressures_by_face,
|
||||
const std::unordered_set<std::string>& defunct_well_names)
|
||||
: param_(param),
|
||||
model_param_(param),
|
||||
solver_param_(param),
|
||||
@ -59,7 +60,8 @@ namespace Opm
|
||||
output_writer_(output_writer),
|
||||
rateConverter_(props_, std::vector<int>(AutoDiffGrid::numCells(grid_), 0)),
|
||||
threshold_pressures_by_face_(threshold_pressures_by_face),
|
||||
is_parallel_run_( false )
|
||||
is_parallel_run_( false ),
|
||||
defunct_well_names_(defunct_well_names)
|
||||
{
|
||||
// Misc init.
|
||||
const int num_cells = AutoDiffGrid::numCells(grid);
|
||||
@ -166,7 +168,8 @@ namespace Opm
|
||||
props_.permeability(),
|
||||
dynamic_list_econ_limited,
|
||||
is_parallel_run_,
|
||||
well_potentials);
|
||||
well_potentials,
|
||||
defunct_well_names_);
|
||||
const Wells* wells = wells_manager.c_wells();
|
||||
WellState well_state;
|
||||
well_state.init(wells, state, prev_well_state);
|
||||
|
@ -61,9 +61,10 @@ public:
|
||||
const bool vapoil,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
BlackoilOutputWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face)
|
||||
const std::vector<double>& threshold_pressures_by_face,
|
||||
const std::unordered_set<std::string>& defunct_well_names)
|
||||
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
|
||||
eclipse_state, output_writer, threshold_pressures_by_face)
|
||||
eclipse_state, output_writer, threshold_pressures_by_face, defunct_well_names)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -73,9 +73,10 @@ public:
|
||||
const bool vapoil,
|
||||
std::shared_ptr<EclipseState> eclipse_state,
|
||||
BlackoilOutputWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face)
|
||||
const std::vector<double>& threshold_pressures_by_face,
|
||||
const std::unordered_set<std::string>& defunct_well_names)
|
||||
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
|
||||
eclipse_state, output_writer, threshold_pressures_by_face)
|
||||
eclipse_state, output_writer, threshold_pressures_by_face, defunct_well_names)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -50,7 +50,9 @@ namespace Opm
|
||||
has_vapoil,
|
||||
eclipse_state,
|
||||
output_writer,
|
||||
threshold_pressures_by_face)
|
||||
threshold_pressures_by_face,
|
||||
// names of deactivated wells in parallel run
|
||||
std::unordered_set<std::string>())
|
||||
, has_solvent_(has_solvent)
|
||||
, deck_(deck)
|
||||
, solvent_props_(solvent_props)
|
||||
|
@ -65,7 +65,9 @@ public:
|
||||
BlackoilOutputWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face)
|
||||
: Base(param, grid, geo, props, rock_comp_props, linsolver, gravity, disgas, vapoil,
|
||||
eclipse_state, output_writer, threshold_pressures_by_face)
|
||||
eclipse_state, output_writer, threshold_pressures_by_face,
|
||||
// names of deactivated wells in parallel run
|
||||
std::unordered_set<std::string>())
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,9 @@ namespace Opm
|
||||
has_vapoil,
|
||||
eclipse_state,
|
||||
output_writer,
|
||||
threshold_pressures_by_face)
|
||||
threshold_pressures_by_face,
|
||||
// names of deactivated wells in parallel run
|
||||
std::unordered_set<std::string>())
|
||||
, polymer_props_(polymer_props)
|
||||
, has_polymer_(has_polymer)
|
||||
, has_plyshlog_(has_plyshlog)
|
||||
|
@ -48,7 +48,9 @@ SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param
|
||||
/*vapoil=*/false,
|
||||
eclipse_state,
|
||||
output_writer,
|
||||
/*threshold_pressures_by_face=*/std::vector<double>())
|
||||
/*threshold_pressures_by_face=*/std::vector<double>(),
|
||||
// names of deactivated wells in parallel run
|
||||
std::unordered_set<std::string>())
|
||||
, deck_(deck)
|
||||
, polymer_props_(polymer_props)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user