Cleans up the code and removes unused functions

This commit is contained in:
kel85uk 2018-04-10 13:05:30 +02:00
parent 0df51a8797
commit 1a33e81d9c
8 changed files with 7 additions and 172 deletions

View File

@ -69,21 +69,12 @@ namespace Opm
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval; typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
typedef Opm::BlackOilFluidState<Eval, FluidSystem> FluidState; typedef Opm::BlackOilFluidState<Eval, FluidSystem> FluidState;
typedef typename FluidSystem::WaterPvt WaterPvt;
typedef Ewoms::BlackOilPolymerModule<TypeTag> PolymerModule;
static const bool has_solvent = GET_PROP_VALUE(TypeTag, EnableSolvent);
static const bool has_polymer = GET_PROP_VALUE(TypeTag, EnablePolymer);
static const int contiSolventEqIdx = BlackoilIndices::contiSolventEqIdx;
static const int contiPolymerEqIdx = BlackoilIndices::contiPolymerEqIdx;
explicit AquiferCarterTracy( const AquiferCT::AQUCT_data& params, const Aquancon::AquanconOutput& connection, explicit AquiferCarterTracy( const AquiferCT::AQUCT_data& params, const Aquancon::AquanconOutput& connection,
const int numComponents, const Scalar gravity, const Simulator& ebosSimulator ) const Scalar gravity, const Simulator& ebosSimulator )
: phi_aq_ (params.phi_aq), // : phi_aq_ (params.phi_aq), //
C_t_ (params.C_t), // C_t_ (params.C_t), //
r_o_ (params.r_o), // r_o_ (params.r_o), //
@ -100,22 +91,12 @@ namespace Opm
aquiferID_ (params.aquiferID), aquiferID_ (params.aquiferID),
inftableID_ (params.inftableID), inftableID_ (params.inftableID),
pvttableID_ (params.pvttableID), pvttableID_ (params.pvttableID),
num_components_ (numComponents),
gravity_ (gravity), gravity_ (gravity),
ebos_simulator_ (ebosSimulator) ebos_simulator_ (ebosSimulator)
{ {
init_quantities(connection); init_quantities(connection);
} }
inline const PhaseUsage&
phaseUsage() const
{
assert(phase_usage_);
return *phase_usage_;
}
inline void assembleAquiferEq(Simulator& ebosSimulator, const SimulatorTimerInterface& timer) inline void assembleAquiferEq(Simulator& ebosSimulator, const SimulatorTimerInterface& timer)
{ {
dt_ = timer.currentStepLength(); dt_ = timer.currentStepLength();
@ -166,10 +147,6 @@ namespace Opm
} }
} }
inline const double area_fraction(const size_t i)
{
return alphai_.at(i);
}
inline const std::vector<int> cell_id() const inline const std::vector<int> cell_id() const
{ {
@ -183,13 +160,11 @@ namespace Opm
private: private:
const PhaseUsage* phase_usage_;
const Simulator& ebos_simulator_; const Simulator& ebos_simulator_;
// Aquifer ID, and other IDs // Aquifer ID, and other IDs
int aquiferID_, inftableID_, pvttableID_; int aquiferID_, inftableID_, pvttableID_;
int num_components_;
// Grid variables // Grid variables
@ -225,6 +200,10 @@ namespace Opm
Eval W_flux_; Eval W_flux_;
inline const double area_fraction(const size_t i)
{
return alphai_.at(i);
}
inline void get_influence_table_values(Scalar& pitd, Scalar& pitd_prime, const Scalar& td) inline void get_influence_table_values(Scalar& pitd, Scalar& pitd_prime, const Scalar& td)
{ {
@ -309,13 +288,6 @@ namespace Opm
cell_idx_ = connection.global_index; cell_idx_ = connection.global_index;
auto globalCellIdx = ugrid.globalCell(); auto globalCellIdx = ugrid.globalCell();
// for (auto globalCells : globalCellIdx){
// std::cout << "global id = " << globalCells << std::endl;
// }
// for (auto cellidx : cell_idx_){
// std::cout << "aqucell id = " << cellidx << std::endl;
// }
assert( cell_idx_ == connection.global_index); assert( cell_idx_ == connection.global_index);
assert( (cell_idx_.size() == connection.influx_coeff.size()) ); assert( (cell_idx_.size() == connection.influx_coeff.size()) );
@ -332,8 +304,6 @@ namespace Opm
auto faceCells = Opm::AutoDiffGrid::faceCells(ugrid); auto faceCells = Opm::AutoDiffGrid::faceCells(ugrid);
// static_assert(decltype(faceCells)::dummy_error, "DUMP MY TYPE" );
// Translate the C face tag into the enum used by opm-parser's TransMult class // Translate the C face tag into the enum used by opm-parser's TransMult class
Opm::FaceDir::DirEnum faceDirection; Opm::FaceDir::DirEnum faceDirection;

View File

@ -92,19 +92,9 @@ namespace Opm {
void assemble( const SimulatorTimerInterface& timer, void assemble( const SimulatorTimerInterface& timer,
const int iterationIdx ); const int iterationIdx );
// called at the beginning of a time step
void beginTimeStep();
// called at the end of a time step // called at the end of a time step
void timeStepSucceeded(const SimulatorTimerInterface& timer); void timeStepSucceeded(const SimulatorTimerInterface& timer);
// called at the beginning of a report step
void beginReportStep(const int time_step);
// called at the end of a report step
void endReportStep();
const SimulatorReport& lastReport() const;
inline const Simulator& simulator() const inline const Simulator& simulator() const
{ {
return ebosSimulator_; return ebosSimulator_;
@ -119,11 +109,7 @@ namespace Opm {
const ModelParameters param_; const ModelParameters param_;
bool terminal_output_; bool terminal_output_;
bool has_solvent_;
bool has_polymer_;
std::vector<int> pvt_region_idx_;
PhaseUsage phase_usage_;
std::vector<bool> active_;
size_t global_nc_; size_t global_nc_;
// the number of the cells in the local grid // the number of the cells in the local grid
size_t number_of_cells_; size_t number_of_cells_;
@ -132,23 +118,12 @@ namespace Opm {
std::vector<Aquifer_object> aquifers_; std::vector<Aquifer_object> aquifers_;
SimulatorReport last_report_;
void updateConnectionIntensiveQuantities() const; void updateConnectionIntensiveQuantities() const;
// The number of components in the model.
int numComponents() const;
int numAquifers() const; int numAquifers() const;
int numPhases() const;
void assembleAquiferEq(const SimulatorTimerInterface& timer); void assembleAquiferEq(const SimulatorTimerInterface& timer);
SimulatorReport solveAquiferEq(const SimulatorTimerInterface& timer);
// some preparation work, mostly related to group control and RESV,
// at the beginning of each time step (Not report step) // at the beginning of each time step (Not report step)
void prepareTimeStep(const SimulatorTimerInterface& timer); void prepareTimeStep(const SimulatorTimerInterface& timer);

View File

@ -9,22 +9,11 @@ namespace Opm {
: ebosSimulator_(ebosSimulator) : ebosSimulator_(ebosSimulator)
, param_(param) , param_(param)
, terminal_output_(terminal_output) , terminal_output_(terminal_output)
, has_solvent_(GET_PROP_VALUE(TypeTag, EnableSolvent))
, has_polymer_(GET_PROP_VALUE(TypeTag, EnablePolymer))
{ {
const auto& eclState = ebosSimulator_.vanguard().eclState(); const auto& eclState = ebosSimulator_.vanguard().eclState();
phase_usage_ = phaseUsageFromDeck(eclState);
active_.resize(phase_usage_.MaxNumPhases, false);
for (int p = 0; p < phase_usage_.MaxNumPhases; ++p) {
active_[ p ] = phase_usage_.phase_used[ p ] != 0;
}
const auto& gridView = ebosSimulator_.gridView(); const auto& gridView = ebosSimulator_.gridView();
// calculate the number of elements of the compressed sequential grid. this needs
// to be done in two steps because the dune communicator expects a reference as
// argument for sum()
number_of_cells_ = gridView.size(/*codim=*/0); number_of_cells_ = gridView.size(/*codim=*/0);
global_nc_ = gridView.comm().sum(number_of_cells_); global_nc_ = gridView.comm().sum(number_of_cells_);
gravity_ = ebosSimulator_.problem().gravity()[2]; gravity_ = ebosSimulator_.problem().gravity()[2];
@ -32,15 +21,6 @@ namespace Opm {
} }
// called at the beginning of a time step
template<typename TypeTag>
void
BlackoilAquiferModel<TypeTag>:: beginTimeStep()
{
}
// called at the end of a time step // called at the end of a time step
template<typename TypeTag> template<typename TypeTag>
void void
@ -52,37 +32,12 @@ namespace Opm {
} }
} }
// called at the beginning of a report step
template<typename TypeTag>
void
BlackoilAquiferModel<TypeTag>:: beginReportStep(const int time_step)
{
}
// called at the end of a report step
template<typename TypeTag>
void
BlackoilAquiferModel<TypeTag>:: endReportStep()
{
}
// Get the last report step
template<typename TypeTag>
const SimulatorReport&
BlackoilAquiferModel<TypeTag>:: lastReport() const
{
return last_report_;
}
template<typename TypeTag> template<typename TypeTag>
void void
BlackoilAquiferModel<TypeTag>:: BlackoilAquiferModel<TypeTag>::
assemble( const SimulatorTimerInterface& timer, assemble( const SimulatorTimerInterface& timer,
const int iterationIdx ) const int iterationIdx )
{ {
last_report_ = SimulatorReport();
// We need to update the reservoir pressures connected to the aquifer // We need to update the reservoir pressures connected to the aquifer
updateConnectionIntensiveQuantities(); updateConnectionIntensiveQuantities();
@ -92,12 +47,7 @@ namespace Opm {
prepareTimeStep(timer); prepareTimeStep(timer);
} }
if (param_.solve_aquifereq_initially_ && iterationIdx == 0) {
// solve the aquifer equations as a pre-processing step
last_report_ = solveAquiferEq(timer);
}
assembleAquiferEq(timer); assembleAquiferEq(timer);
last_report_.converged = true;
} }
@ -118,32 +68,6 @@ namespace Opm {
} }
template<typename TypeTag>
SimulatorReport
BlackoilAquiferModel<TypeTag>:: solveAquiferEq(const SimulatorTimerInterface& timer)
{
// We need to solve the equilibrium equation first to
// obtain the initial pressure of water in the aquifer
SimulatorReport report = SimulatorReport();
return report;
}
// Protected function: Return number of components in the model.
template<typename TypeTag>
int
BlackoilAquiferModel<TypeTag>:: numComponents() const
{
if (numPhases() == 2) {
return 2;
}
int numComp = FluidSystem::numComponents;
if (has_solvent_) {
numComp ++;
}
return numComp;
}
// Protected function: Return number of aquifers in the model. // Protected function: Return number of aquifers in the model.
template<typename TypeTag> template<typename TypeTag>
int int
@ -152,14 +76,6 @@ namespace Opm {
return aquifers_.size(); return aquifers_.size();
} }
// Protected function: Return number of phases in the model.
template<typename TypeTag>
int
BlackoilAquiferModel<TypeTag>:: numPhases() const
{
const auto& pu = phase_usage_;
return pu.num_phases;
}
// Protected function which calls the individual aquifer models // Protected function which calls the individual aquifer models
template<typename TypeTag> template<typename TypeTag>
@ -216,7 +132,7 @@ namespace Opm {
for (int i = 0; i < aquifersData.size(); ++i) for (int i = 0; i < aquifersData.size(); ++i)
{ {
aquifers.push_back( aquifers.push_back(
AquiferCarterTracy<TypeTag> (aquifersData.at(i), aquifer_connection.at(i), numComponents(), gravity_, ebosSimulator_) AquiferCarterTracy<TypeTag> (aquifersData.at(i), aquifer_connection.at(i), gravity_, ebosSimulator_)
); );
} }
} }

View File

@ -209,7 +209,6 @@ namespace Opm {
wasSwitched_.resize(numDof); wasSwitched_.resize(numDof);
std::fill(wasSwitched_.begin(), wasSwitched_.end(), false); std::fill(wasSwitched_.begin(), wasSwitched_.end(), false);
aquiferModel().beginTimeStep();
wellModel().beginTimeStep(); wellModel().beginTimeStep();
if (param_.update_equations_scaling_) { if (param_.update_equations_scaling_) {
@ -1127,20 +1126,6 @@ namespace Opm {
const BlackoilAquiferModel<TypeTag>& const BlackoilAquiferModel<TypeTag>&
aquiferModel() const { return aquifer_model_; } aquiferModel() const { return aquifer_model_; }
int ebosPhaseToFlowCanonicalPhaseIdx( const int phaseIdx ) const
{
if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && FluidSystem::waterPhaseIdx == phaseIdx)
return Water;
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && FluidSystem::oilPhaseIdx == phaseIdx)
return Oil;
if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && FluidSystem::gasPhaseIdx == phaseIdx)
return Gas;
assert(phaseIdx < 3);
// for other phases return the index
return phaseIdx;
}
void beginReportStep() void beginReportStep()
{ {
ebosSimulator_.problem().beginEpisode(); ebosSimulator_.problem().beginEpisode();

View File

@ -63,7 +63,6 @@ namespace Opm
param.getDefault("max_single_precision_days", unit::convert::to( maxSinglePrecisionTimeStep_, unit::day) ), unit::day ); param.getDefault("max_single_precision_days", unit::convert::to( maxSinglePrecisionTimeStep_, unit::day) ), unit::day );
max_strict_iter_ = param.getDefault("max_strict_iter",8); max_strict_iter_ = param.getDefault("max_strict_iter",8);
solve_welleq_initially_ = param.getDefault("solve_welleq_initially",solve_welleq_initially_); solve_welleq_initially_ = param.getDefault("solve_welleq_initially",solve_welleq_initially_);
solve_aquifereq_initially_ = param.getDefault("solve_aquifereq_initially",solve_aquifereq_initially_);
update_equations_scaling_ = param.getDefault("update_equations_scaling", update_equations_scaling_); update_equations_scaling_ = param.getDefault("update_equations_scaling", update_equations_scaling_);
use_update_stabilization_ = param.getDefault("use_update_stabilization", use_update_stabilization_); use_update_stabilization_ = param.getDefault("use_update_stabilization", use_update_stabilization_);
deck_file_name_ = param.template get<std::string>("deck_filename"); deck_file_name_ = param.template get<std::string>("deck_filename");
@ -95,7 +94,6 @@ namespace Opm
max_inner_iter_ms_wells_ = 10; max_inner_iter_ms_wells_ = 10;
maxSinglePrecisionTimeStep_ = unit::convert::from( 20.0, unit::day ); maxSinglePrecisionTimeStep_ = unit::convert::from( 20.0, unit::day );
solve_welleq_initially_ = true; solve_welleq_initially_ = true;
solve_aquifereq_initially_ = true;
update_equations_scaling_ = false; update_equations_scaling_ = false;
use_update_stabilization_ = true; use_update_stabilization_ = true;
use_multisegment_well_ = false; use_multisegment_well_ = false;

View File

@ -77,9 +77,6 @@ namespace Opm
/// Solve well equation initially /// Solve well equation initially
bool solve_welleq_initially_; bool solve_welleq_initially_;
/// Solve aquifer equation initially
bool solve_aquifereq_initially_;
/// Update scaling factors for mass balance equations /// Update scaling factors for mass balance equations
bool update_equations_scaling_; bool update_equations_scaling_;

View File

@ -86,7 +86,6 @@ namespace Opm {
{ {
Base::prepareStep(timer, reservoir_state, well_state); Base::prepareStep(timer, reservoir_state, well_state);
Base::param_.solve_welleq_initially_ = false; Base::param_.solve_welleq_initially_ = false;
Base::param_.solve_aquifereq_initially_ = false;
SolutionState state0 = variableState(reservoir_state, well_state); SolutionState state0 = variableState(reservoir_state, well_state);
asImpl().makeConstantState(state0); asImpl().makeConstantState(state0);
asImpl().computeAccum(state0, 0); asImpl().computeAccum(state0, 0);

View File

@ -208,8 +208,6 @@ public:
well_model.beginReportStep(timer.currentStepNum()); well_model.beginReportStep(timer.currentStepNum());
aquifer_model.beginReportStep(timer.currentStepNum());
auto solver = createSolver(well_model, aquifer_model); auto solver = createSolver(well_model, aquifer_model);
// write the inital state at the report stage // write the inital state at the report stage
@ -274,7 +272,6 @@ public:
} }
solver->model().endReportStep(); solver->model().endReportStep();
aquifer_model.endReportStep();
well_model.endReportStep(); well_model.endReportStep();
// take time that was used to solve system for this reportStep // take time that was used to solve system for this reportStep
@ -318,8 +315,6 @@ public:
report.total_time = total_timer.secsSinceStart(); report.total_time = total_timer.secsSinceStart();
report.converged = true; report.converged = true;
auto reportaquifer = aquifer_model.lastReport();
return report; return report;
} }