Merge pull request #819 from blattms/use-defunct-wells-from-loadbalancer-for-wellsmanager

Use names of defunct wells from loadbalancer for wellsmanager
This commit is contained in:
Atgeirr Flø Rasmussen 2016-09-19 13:42:42 +02:00 committed by GitHub
commit 06e41bdaca
14 changed files with 108 additions and 46 deletions

View File

@ -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_));
}
};

View File

@ -19,6 +19,8 @@
#ifndef OPM_PARALLELDEBUGOUTPUT_HEADER_INCLUDED
#define OPM_PARALLELDEBUGOUTPUT_HEADER_INCLUDED
#include <unordered_set>
#include <opm/common/data/SimulationDataContainer.hpp>
@ -543,7 +545,14 @@ namespace Opm
Opm::UgGridHelpers::beginFaceCentroids( globalGrid ),
permeability_,
dynamic_list_econ_limited,
false);
false
// We need to pass the optionaly arguments
// as we get the following error otherwise
// with c++ (Debian 4.9.2-10) 4.9.2 and -std=c++11
// converting to const std::unordered_set<std::basic_string<char> > from initializer list would use explicit constructor
, std::vector<double>(),
std::unordered_set<std::string>()
);
const Wells* wells = wells_manager.c_wells();
globalWellState_.init(wells, *globalReservoirState_, globalWellState_ );

View File

@ -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

View File

@ -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

View File

@ -43,7 +43,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),
@ -60,7 +61,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);
@ -167,7 +169,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);

View File

@ -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)
{}
};

View File

@ -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)
{}

View File

@ -108,7 +108,13 @@ namespace Opm
Opm::UgGridHelpers::beginFaceCentroids(grid_),
props_.permeability(),
dynamic_list_econ_limited,
is_parallel_run_);
is_parallel_run_,
// We need to pass the optionaly arguments
// as we get the following error otherwise
// with c++ (Debian 4.9.2-10) 4.9.2 and -std=c++11
// converting to const std::unordered_set<std::basic_string<char> > from initializer list would use explicit constructor
std::vector<double>(), // null well_potentials
Base::defunct_well_names_);
const Wells* wells = wells_manager.c_wells();
WellState well_state;
// well_state.init(wells, state, prev_well_state);

View File

@ -397,7 +397,14 @@ namespace Opm
Opm::UgGridHelpers::cell2Faces(grid),
Opm::UgGridHelpers::beginFaceCentroids(grid),
permeability,
dummy_list_econ_limited);
dummy_list_econ_limited
// We need to pass the optionaly arguments
// as we get the following error otherwise
// with c++ (Debian 4.9.2-10) 4.9.2 and -std=c++11
// converting to const std::unordered_set<std::basic_string<char> > from initializer list would use explicit constructo
, false,
std::vector<double>(),
std::unordered_set<std::string>());
const Wells* wells = wellsmanager.c_wells();
wellstate.resize(wells, simulatorstate); //Resize for restart step

View File

@ -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)

View File

@ -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>())
{}
};

View File

@ -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)

View File

@ -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)

View File

@ -28,6 +28,7 @@
#define BOOST_TEST_MODULE MultisegmentWellsTest
#include <vector>
#include <unordered_set>
#include <memory>
#include <array>
@ -106,7 +107,13 @@ struct SetupMSW {
Opm::UgGridHelpers::beginFaceCentroids(grid),
fluidprops->permeability(),
dummy_dynamic_list,
false);
false
// We need to pass the optionaly arguments
// as we get the following error otherwise
// with c++ (Debian 4.9.2-10) 4.9.2 and -std=c++11
// converting to const std::unordered_set<std::basic_string<char> > from initializer list would use explicit constructor
, std::vector<double>(), // null well_potentials
std::unordered_set<std::string>());
const Wells* wells = wells_manager.c_wells();
const auto wells_ecl = ecl_state->getSchedule()->getWells(current_timestep);