mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adding a rate converter to BlackoilModelEbos
and also function updateRateConverter() to update its state.
This commit is contained in:
parent
4ff9996f80
commit
af26b70fc9
@ -42,6 +42,7 @@
|
||||
#include <opm/autodiff/BlackoilDetails.hpp>
|
||||
#include <opm/autodiff/BlackoilModelEnums.hpp>
|
||||
#include <opm/autodiff/NewtonIterationBlackoilInterface.hpp>
|
||||
#include <opm/autodiff/RateConverter.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
@ -138,6 +139,10 @@ namespace Opm {
|
||||
typedef ISTLSolver< MatrixBlockType, VectorBlockType > ISTLSolverType;
|
||||
//typedef typename SolutionVector :: value_type PrimaryVariables ;
|
||||
|
||||
// For the conversion between the surface volume rate and resrevoir voidage rate
|
||||
using RateConverterType = RateConverter::
|
||||
SurfaceToReservoirVoidage<BlackoilPropsAdFromDeck::FluidSystem, std::vector<int> >;
|
||||
|
||||
struct FIPData {
|
||||
enum FipId {
|
||||
FIP_AQUA = Opm::Water,
|
||||
@ -187,6 +192,7 @@ namespace Opm {
|
||||
, param_( param )
|
||||
, well_model_ (well_model)
|
||||
, terminal_output_ (terminal_output)
|
||||
, rate_converter_(fluid_.phaseUsage(), fluid_.cellPvtRegionIndex(), AutoDiffGrid::numCells(grid_), std::vector<int>(AutoDiffGrid::numCells(grid_),0))
|
||||
, current_relaxation_(1.0)
|
||||
, dx_old_(AutoDiffGrid::numCells(grid_))
|
||||
, isBeginReportStep_(false)
|
||||
@ -1229,6 +1235,9 @@ namespace Opm {
|
||||
/// \brief The number of cells of the global grid.
|
||||
long int global_nc_;
|
||||
|
||||
// rate converter between the surface volume rates and reservoir voidage rates
|
||||
RateConverterType rate_converter_;
|
||||
|
||||
std::vector<std::vector<double>> residual_norms_history_;
|
||||
double current_relaxation_;
|
||||
BVector dx_old_;
|
||||
@ -1429,6 +1438,33 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
void updateRateConverter(const ReservoirState& reservoir_state)
|
||||
{
|
||||
const int nw = numWells();
|
||||
int global_number_wells = nw;
|
||||
|
||||
#if HAVE_MPI
|
||||
if ( istlSolver_->parallelInformation().type() == typeid(ParallelISTLInformation) )
|
||||
{
|
||||
const auto& info =
|
||||
boost::any_cast<const ParallelISTLInformation&>(istlSolver_->parallelInformation());
|
||||
global_number_wells = info.communicator().sum(global_number_wells);
|
||||
if ( global_number_wells )
|
||||
{
|
||||
rate_converter_.defineState(reservoir_state, boost::any_cast<const ParallelISTLInformation&>(istlSolver_->parallelInformation()));
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if ( global_number_wells )
|
||||
{
|
||||
rate_converter_.defineState(reservoir_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
void beginReportStep()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user