Merge pull request #1221 from andlaus/flow_ebos-remove-fluidprops

flow_ebos: do not use BlackoilPropsAdFromDeck anymore
This commit is contained in:
Atgeirr Flø Rasmussen 2017-06-20 09:05:21 +02:00 committed by GitHub
commit 513b25f63f
4 changed files with 22 additions and 58 deletions

View File

@ -33,7 +33,6 @@
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/GridHelpers.hpp>
#include <opm/autodiff/WellHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
#include <opm/autodiff/GeoProps.hpp>
#include <opm/autodiff/WellDensitySegmented.hpp>
#include <opm/autodiff/VFPProperties.hpp>
@ -48,7 +47,7 @@
#include <opm/core/simulator/SimulatorReport.hpp>
#include <opm/core/linalg/LinearSolverInterface.hpp>
#include <opm/core/linalg/ParallelIstlInformation.hpp>
#include <opm/core/props/rock/RockCompressibility.hpp>
#include <opm/core/props/phaseUsageFromDeck.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/Exceptions.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
@ -141,7 +140,6 @@ namespace Opm {
/// remain in scope for the lifetime of the solver.
/// \param[in] param parameters
/// \param[in] grid grid data structure
/// \param[in] fluid fluid properties
/// \param[in] wells well structure
/// \param[in] vfp_properties Vertical flow performance tables
/// \param[in] linsolver linear solver
@ -149,25 +147,24 @@ namespace Opm {
/// \param[in] terminal_output request output to cout/cerr
BlackoilModelEbos(Simulator& ebosSimulator,
const ModelParameters& param,
const BlackoilPropsAdFromDeck& fluid,
const StandardWellsDense<TypeTag>& well_model,
const NewtonIterationBlackoilInterface& linsolver,
const bool terminal_output)
: ebosSimulator_(ebosSimulator)
, grid_(ebosSimulator_.gridManager().grid())
, istlSolver_( dynamic_cast< const ISTLSolverType* > (&linsolver) )
, fluid_ (fluid)
, phaseUsage_(phaseUsageFromDeck(eclState()))
, vfp_properties_(
eclState().getTableManager().getVFPInjTables(),
eclState().getTableManager().getVFPProdTables())
, active_(detail::activePhases(fluid.phaseUsage()))
, active_(detail::activePhases(phaseUsage_))
, has_disgas_(FluidSystem::enableDissolvedGas())
, has_vapoil_(FluidSystem::enableVaporizedOil())
, has_solvent_(GET_PROP_VALUE(TypeTag, EnableSolvent))
, 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))
, rate_converter_(phaseUsage_, ebosSimulator_.problem().pvtRegionArray().empty()?nullptr:ebosSimulator_.problem().pvtRegionArray().data(), AutoDiffGrid::numCells(grid_), std::vector<int>(AutoDiffGrid::numCells(grid_),0))
, current_relaxation_(1.0)
, dx_old_(AutoDiffGrid::numCells(grid_))
, isBeginReportStep_(false)
@ -562,7 +559,7 @@ namespace Opm {
ReservoirState& reservoir_state)
{
using namespace Opm::AutoDiffGrid;
const int np = fluid_.numPhases();
const int np = phaseUsage_.num_phases;
ElementContext elemCtx( ebosSimulator_ );
const auto& gridView = ebosSimulator_.gridView();
@ -625,7 +622,7 @@ namespace Opm {
double step = dsMax()/maxVal;
step = std::min(step, 1.0);
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
const Opm::PhaseUsage& pu = phaseUsage_;
if (active_[Water]) {
double& sw = reservoir_state.saturation()[cell_idx*np + pu.phase_pos[ Water ]];
sw -= step * dsw;
@ -1048,7 +1045,7 @@ namespace Opm {
/// The number of active fluid phases in the model.
int numPhases() const
{
return fluid_.numPhases();
return phaseUsage_.num_phases;
}
int numComponents() const
@ -1209,7 +1206,7 @@ namespace Opm {
typedef std::vector<double> VectorType;
const auto& ebosModel = ebosSimulator().model();
const auto& phaseUsage = fluid_.phaseUsage();
const auto& phaseUsage = phaseUsage_;
// extract everything which can possibly be written to disk
const int numCells = ebosModel.numGridDof();
@ -1497,7 +1494,7 @@ namespace Opm {
Simulator& ebosSimulator_;
const Grid& grid_;
const ISTLSolverType* istlSolver_;
const BlackoilPropsAdFromDeck& fluid_;
const PhaseUsage phaseUsage_;
VFPProperties vfp_properties_;
// For each canonical phase -> true if active
const std::vector<bool> active_;
@ -1527,7 +1524,6 @@ namespace Opm {
mutable FIPDataType fip_;
public:
/// return the StandardWells object
StandardWellsDense<TypeTag>&
wellModel() { return well_model_; }
@ -1551,10 +1547,10 @@ namespace Opm {
Simulator& simulator ) const
{
SolutionVector& solution = simulator.model().solution( 0 /* timeIdx */ );
const Opm::PhaseUsage pu = fluid_.phaseUsage();
const Opm::PhaseUsage pu = phaseUsage_;
const int numCells = reservoirState.numCells();
const int numPhases = fluid_.numPhases();
const int numPhases = phaseUsage_.num_phases;
const auto& oilPressure = reservoirState.pressure();
const auto& saturations = reservoirState.saturation();
const auto& rs = reservoirState.gasoilratio();
@ -1666,7 +1662,7 @@ namespace Opm {
private:
void convertResults(BVector& ebosResid, Mat& ebosJac) const
{
const Opm::PhaseUsage pu = fluid_.phaseUsage();
const Opm::PhaseUsage pu = phaseUsage_;
const int numFlowPhases = pu.num_phases;
const int numCells = ebosJac.N();
assert( numCells == static_cast<int>(ebosJac.M()) );

View File

@ -101,7 +101,6 @@ namespace Opm
setupLogging();
printPRTHeader();
extractMessages();
setupGridAndProps();
runDiagnostics();
setupState();
writeInit();
@ -414,21 +413,6 @@ namespace Opm
}
}
// Create distributed property objects.
// Writes to:
// fluidprops_
void setupGridAndProps()
{
Dune::CpGrid& grid = ebosSimulator_->gridManager().grid();
// create the legacy properties objects
fluidprops_.reset(new BlackoilPropsAdFromDeck(deck(),
eclState(),
materialLawManager(),
grid));
}
const Deck& deck() const
{ return ebosSimulator_->gridManager().deck(); }
@ -445,7 +429,6 @@ namespace Opm
// Writes to:
// state_
// threshold_pressures_
// fluidprops_ (if SWATINIT is used)
void setupState()
{
const PhaseUsage pu = Opm::phaseUsageFromDeck(deck());
@ -514,15 +497,6 @@ namespace Opm
props, deck(), gravity(), *state_);
}
// The capillary pressure is scaled in fluidprops_ to match the scaled capillary pressure in props.
if (deck().hasKeyword("SWATINIT")) {
const int numCells = Opm::UgGridHelpers::numCells(grid);
std::vector<int> cells(numCells);
for (int c = 0; c < numCells; ++c) { cells[c] = c; }
std::vector<double> pc = state_->saturation();
props.capPress(numCells, state_->saturation().data(), cells.data(), pc.data(), nullptr);
fluidprops_->setSwatInitScaling(state_->saturation(), pc);
}
initHydroCarbonState(*state_, pu, Opm::UgGridHelpers::numCells(grid), deck().hasKeyword("DISGAS"), deck().hasKeyword("VAPOIL"));
}
@ -672,7 +646,6 @@ namespace Opm
// Create the simulator instance.
simulator_.reset(new Simulator(*ebosSimulator_,
param_,
*fluidprops_,
*fis_solver_,
FluidSystem::enableDissolvedGas(),
FluidSystem::enableVaporizedOil(),
@ -912,7 +885,6 @@ namespace Opm
ParameterGroup param_;
bool output_to_files_ = false;
std::string output_dir_ = std::string(".");
std::unique_ptr<BlackoilPropsAdFromDeck> fluidprops_;
std::unique_ptr<ReservoirState> state_;
NNC nnc_;
std::unique_ptr<EclipseIO> eclIO_;

View File

@ -90,7 +90,7 @@ public:
}
template<class Buffer>
void scatter(Buffer& buffer, std::size_t i, std::size_t s)
void scatter(Buffer& buffer, std::size_t i, std::size_t s OPM_OPTIM_UNUSED)
{
assert(s==size(i));
static_cast<void>(s);

View File

@ -21,8 +21,6 @@
#ifndef OPM_SIMULATORFULLYIMPLICITBLACKOILEBOS_HEADER_INCLUDED
#define OPM_SIMULATORFULLYIMPLICITBLACKOILEBOS_HEADER_INCLUDED
//#include <opm/autodiff/SimulatorBase.hpp>
//#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutputEbos.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp>
#include <opm/autodiff/IterationReport.hpp>
#include <opm/autodiff/NonlinearSolver.hpp>
@ -95,7 +93,6 @@ public:
/// \param[in] threshold_pressures_by_face if nonempty, threshold pressures that inhibit flow
SimulatorFullyImplicitBlackoilEbos(Simulator& ebosSimulator,
const ParameterGroup& param,
BlackoilPropsAdFromDeck& props,
NewtonIterationBlackoilInterface& linsolver,
const bool has_disgas,
const bool has_vapoil,
@ -106,8 +103,8 @@ public:
param_(param),
model_param_(param),
solver_param_(param),
props_(props),
solver_(linsolver),
phaseUsage_(phaseUsageFromDeck(eclState())),
has_disgas_(has_disgas),
has_vapoil_(has_vapoil),
terminal_output_(param.getDefault("output_terminal", true)),
@ -116,7 +113,7 @@ public:
is_parallel_run_( false )
{
extractLegacyCellPvtRegionIndex_();
rateConverter_.reset(new RateConverterType(props.phaseUsage(),
rateConverter_.reset(new RateConverterType(phaseUsage_,
legacyCellPvtRegionIdx_.data(),
AutoDiffGrid::numCells(grid()),
std::vector<int>(AutoDiffGrid::numCells(grid()), 0)));
@ -152,8 +149,8 @@ public:
if (output_writer_.isRestart()) {
// This is a restart, populate WellState and ReservoirState state objects from restart file
output_writer_.initFromRestartFile(props_.phaseUsage(), grid(), state, prev_well_state, extra);
initHydroCarbonState(state, props_.phaseUsage(), Opm::UgGridHelpers::numCells(grid()), has_disgas_, has_vapoil_);
output_writer_.initFromRestartFile(phaseUsage_, grid(), state, prev_well_state, extra);
initHydroCarbonState(state, phaseUsage_, Opm::UgGridHelpers::numCells(grid()), has_disgas_, has_vapoil_);
initHysteresisParams(state);
}
@ -241,7 +238,7 @@ public:
defunct_well_names_ );
const Wells* wells = wells_manager.c_wells();
WellState well_state;
well_state.init(wells, state, prev_well_state, props_.phaseUsage());
well_state.init(wells, state, prev_well_state, phaseUsage_);
// give the polymer and surfactant simulators the chance to do their stuff
handleAdditionalWellInflow(timer, wells_manager, well_state, wells);
@ -422,7 +419,7 @@ protected:
std::unique_ptr<Solver> createSolver(WellModel& well_model)
{
const auto& gridView = ebosSimulator_.gridView();
const PhaseUsage& phaseUsage = props_.phaseUsage();
const PhaseUsage& phaseUsage = phaseUsage_;
const std::vector<bool> activePhases = detail::activePhases(phaseUsage);
const double gravity = ebosSimulator_.problem().gravity()[2];
@ -442,7 +439,6 @@ protected:
globalNumCells);
auto model = std::unique_ptr<Model>(new Model(ebosSimulator_,
model_param_,
props_,
well_model,
solver_,
terminal_output_));
@ -489,8 +485,8 @@ protected:
}
if (! resv_wells.empty()) {
const PhaseUsage& pu = props_.phaseUsage();
const std::vector<double>::size_type np = props_.numPhases();
const PhaseUsage& pu = phaseUsage_;
const std::vector<double>::size_type np = phaseUsage_.num_phases;
std::vector<double> distr (np);
std::vector<double> hrates(np);
@ -869,8 +865,8 @@ protected:
SolverParameters solver_param_;
// Observed objects.
BlackoilPropsAdFromDeck& props_;
NewtonIterationBlackoilInterface& solver_;
PhaseUsage phaseUsage_;
// Misc. data
const bool has_disgas_;
const bool has_vapoil_;