From 1e41e58ce792337f18e0a343e0c631301513be79 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Tue, 18 Mar 2014 13:25:52 +0800 Subject: [PATCH 01/15] makd PolymerProperties handle PLYSHEAR keyword. --- examples/sim_poly2p_comp_reorder.cpp | 8 +++++++- examples/sim_poly2p_incomp_reorder.cpp | 8 +++++++- examples/test_singlecellsolves.cpp | 8 +++++++- opm/polymer/PolymerProperties.cpp | 12 +++++++++++ opm/polymer/PolymerProperties.hpp | 28 ++++++++++++++++++++++---- 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index 28d34e2a9..4d5da8e22 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -175,9 +175,15 @@ try ads_vals[2] = 0.0025; // ads_vals[1] = 0.0; // ads_vals[2] = 0.0; + std::vector water_vel_vals(2, -1e100); + water_vel_vals[0] = 0.0; + water_vel_vals[1] = 10.0; + std::vector shear_vrf_vals(2, -1e100); + shear_vrf_vals[0] = 1.0; + shear_vrf_vals[1] = 1.0; poly_props.set(c_max, mix_param, rock_density, dead_pore_vol, res_factor, c_max_ads, static_cast(ads_index), - c_vals_visc, visc_mult_vals, c_vals_ads, ads_vals); + c_vals_visc, visc_mult_vals, c_vals_ads, ads_vals, water_vel_vals, shear_vrf_vals); } bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0); diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index 48aab1ebc..5045bb466 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -173,9 +173,15 @@ try ads_vals[2] = 0.0025; // ads_vals[1] = 0.0; // ads_vals[2] = 0.0; + std::vector water_vel_vals(2, -1e100); + water_vel_vals[0] = 0.0; + water_vel_vals[1] = 10.0; + std::vector shear_vrf_vals(2, -1e100); + shear_vrf_vals[0] = 1.0; + shear_vrf_vals[1] = 1.0; poly_props.set(c_max, mix_param, rock_density, dead_pore_vol, res_factor, c_max_ads, static_cast(ads_index), - c_vals_visc, visc_mult_vals, c_vals_ads, ads_vals); + c_vals_visc, visc_mult_vals, c_vals_ads, ads_vals, water_vel_vals, shear_vrf_vals); } // Warn if gravity but no density difference. diff --git a/examples/test_singlecellsolves.cpp b/examples/test_singlecellsolves.cpp index 217be6b49..4ff5fb1d4 100644 --- a/examples/test_singlecellsolves.cpp +++ b/examples/test_singlecellsolves.cpp @@ -129,9 +129,15 @@ try ads_vals[2] = 0.0025; // ads_vals[1] = 0.0; // ads_vals[2] = 0.0; + std::vector water_vel_vals(2, -1e100); + water_vel_vals[0] = 0.0; + water_vel_vals[1] = 10.0; + std::vector shear_vrf_vals(2, -1e100); + shear_vrf_vals[0] = 1.0; + shear_vrf_vals[1] = 1.0; poly_props.set(c_max, mix_param, rock_density, dead_pore_vol, res_factor, c_max_ads, static_cast(ads_index), - c_vals_visc, visc_mult_vals, c_vals_ads, ads_vals); + c_vals_visc, visc_mult_vals, c_vals_ads, ads_vals, water_vel_vals, shear_vrf_vals); // Initialising src int num_cells = grid->c_grid()->number_of_cells; diff --git a/opm/polymer/PolymerProperties.cpp b/opm/polymer/PolymerProperties.cpp index 68bec4479..da5c86125 100644 --- a/opm/polymer/PolymerProperties.cpp +++ b/opm/polymer/PolymerProperties.cpp @@ -58,6 +58,18 @@ namespace Opm { return ads_index_; } + + std::vector + PolymerProperties::shearWaterVelocity() const + { + return water_vel_vals_; + } + + std::vector + PolymerProperties::shearVrf() const + { + return shear_vrf_vals_; + } double PolymerProperties::viscMult(double c) const { diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp index 197fd9489..79741bb1f 100644 --- a/opm/polymer/PolymerProperties.hpp +++ b/opm/polymer/PolymerProperties.hpp @@ -49,6 +49,8 @@ namespace Opm /// \param[in] visc_mult_vals Array of effective vicosity multiplier /// \param[in] c_vals_ads Array of concentration for adsorption values /// \param[in] ads_vals Array of adsorption values + /// \param[in] water_vel_vals_ Array of water phase velocity for shear + /// \param[in] shear_vrf_vals_ Array of viscosity reduction factor PolymerProperties(double c_max, double mix_param, double rock_density, @@ -59,7 +61,9 @@ namespace Opm const std::vector& c_vals_visc, const std::vector& visc_mult_vals, const std::vector& c_vals_ads, - const std::vector& ads_vals + const std::vector& ads_vals, + const std::vector& water_vel_vals, + const std::vector& shear_vrf_vals ) : c_max_(c_max), mix_param_(mix_param), @@ -71,7 +75,9 @@ namespace Opm c_vals_visc_(c_vals_visc), visc_mult_vals_(visc_mult_vals), c_vals_ads_(c_vals_ads), - ads_vals_(ads_vals) + ads_vals_(ads_vals), + water_vel_vals_(water_vel_vals), + shear_vrf_vals_(shear_vrf_vals) { } @@ -90,7 +96,9 @@ namespace Opm const std::vector& c_vals_visc, const std::vector& visc_mult_vals, const std::vector& c_vals_ads, - const std::vector& ads_vals + const std::vector& ads_vals, + const std::vector& water_vel_vals, + const std::vector& shear_vrf_vals ) { c_max_ = c_max; @@ -104,6 +112,8 @@ namespace Opm c_vals_ads_ = c_vals_ads; ads_vals_ = ads_vals; ads_index_ = ads_index; + water_vel_vals_ = water_vel_vals; + shear_vrf_vals_ = shear_vrf_vals; } void readFromDeck(const EclipseGridParser& gridparser) @@ -133,7 +143,11 @@ namespace Opm const PLYADS& plyads = gridparser.getPLYADS(); c_vals_ads_ = plyads.local_concentration_; ads_vals_ = plyads.adsorbed_concentration_; - + + // We assume NTPVT=1 + const PLYSHEAR& plyshear = gridparser.getPLYSHEAR(); + water_vel_vals_ = plyshear.water_velocity_; + shear_vrf_vals_ = plyshear.vrf_; } double cMax() const; @@ -149,6 +163,10 @@ namespace Opm double cMaxAds() const; int adsIndex() const; + + std::vector shearWaterVelocity() const; + + std::vector shearVrf() const; double viscMult(double c) const; @@ -259,6 +277,8 @@ namespace Opm std::vector visc_mult_vals_; std::vector c_vals_ads_; std::vector ads_vals_; + std::vector water_vel_vals_; + std::vector shear_vrf_vals_; void simpleAdsorptionBoth(double c, double& c_ads, double& dc_ads_dc, bool if_with_der) const; void adsorptionBoth(double c, double cmax, From 911e55c5e63414f04fbf3808e8ffab842870df9e Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 18 Mar 2014 12:41:23 +0100 Subject: [PATCH 02/15] fix a few harmless CLang warnings i.e. rename class to struct in two forward declarations and remove an unused private attribute... --- opm/polymer/SimulatorCompressiblePolymer.hpp | 2 +- opm/polymer/SimulatorPolymer.cpp | 1 - opm/polymer/SimulatorPolymer.hpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/opm/polymer/SimulatorCompressiblePolymer.hpp b/opm/polymer/SimulatorCompressiblePolymer.hpp index 76d76d6d1..96986298b 100644 --- a/opm/polymer/SimulatorCompressiblePolymer.hpp +++ b/opm/polymer/SimulatorCompressiblePolymer.hpp @@ -39,7 +39,7 @@ namespace Opm class SimulatorTimer; class PolymerBlackoilState; class WellState; - class SimulatorReport; + struct SimulatorReport; /// Class collecting all necessary components for a two-phase simulation. class SimulatorCompressiblePolymer diff --git a/opm/polymer/SimulatorPolymer.cpp b/opm/polymer/SimulatorPolymer.cpp index db18092fb..e521b4b0a 100644 --- a/opm/polymer/SimulatorPolymer.cpp +++ b/opm/polymer/SimulatorPolymer.cpp @@ -140,7 +140,6 @@ namespace Opm const PolymerInflowInterface& polymer_inflow_; const std::vector& src_; const FlowBoundaryConditions* bcs_; - const double* gravity_; // Solvers IncompTpfaPolymer psolver_; TransportSolverTwophasePolymer tsolver_; diff --git a/opm/polymer/SimulatorPolymer.hpp b/opm/polymer/SimulatorPolymer.hpp index 08f97c5ba..c566a87eb 100644 --- a/opm/polymer/SimulatorPolymer.hpp +++ b/opm/polymer/SimulatorPolymer.hpp @@ -39,7 +39,7 @@ namespace Opm class SimulatorTimer; class PolymerState; class WellState; - class SimulatorReport; + struct SimulatorReport; /// Class collecting all necessary components for a two-phase simulation. class SimulatorPolymer From 3cce559d5266731f48755486c38ab25918c50fdb Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 18 Mar 2014 12:42:42 +0100 Subject: [PATCH 03/15] adapt to the SimulatorTimer renames of opm-core --- opm/polymer/SimulatorCompressiblePolymer.cpp | 6 +++--- opm/polymer/SimulatorPolymer.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/opm/polymer/SimulatorCompressiblePolymer.cpp b/opm/polymer/SimulatorCompressiblePolymer.cpp index 829761fb4..59fd08c9b 100644 --- a/opm/polymer/SimulatorCompressiblePolymer.cpp +++ b/opm/polymer/SimulatorCompressiblePolymer.cpp @@ -388,7 +388,7 @@ namespace Opm Opm::computeTransportSource(props_, wells_, well_state, transport_src); // Find inflow rate. - const double current_time = timer.currentTime(); + const double current_time = timer.simulationTimeElapsed(); double stepsize = timer.currentStepLength(); polymer_inflow_.getInflowValues(current_time, current_time + stepsize, polymer_inflow_c); @@ -488,12 +488,12 @@ namespace Opm << std::endl; std::cout.precision(8); - watercut.push(timer.currentTime() + timer.currentStepLength(), + watercut.push(timer.simulationTimeElapsed() + timer.currentStepLength(), produced[0]/(produced[0] + produced[1]), tot_produced[0]/tot_porevol_init); if (wells_) { wellreport.push(props_, *wells_, state.pressure(), state.surfacevol(), - state.saturation(), timer.currentTime() + timer.currentStepLength(), + state.saturation(), timer.simulationTimeElapsed() + timer.currentStepLength(), well_state.bhp(), well_state.perfRates()); } } diff --git a/opm/polymer/SimulatorPolymer.cpp b/opm/polymer/SimulatorPolymer.cpp index e521b4b0a..547c97189 100644 --- a/opm/polymer/SimulatorPolymer.cpp +++ b/opm/polymer/SimulatorPolymer.cpp @@ -410,7 +410,7 @@ namespace Opm wells_, well_state.perfRates(), transport_src); // Find inflow rate. - const double current_time = timer.currentTime(); + const double current_time = timer.simulationTimeElapsed(); double stepsize = timer.currentStepLength(); polymer_inflow_.getInflowValues(current_time, current_time + stepsize, polymer_inflow_c); @@ -497,12 +497,12 @@ namespace Opm << std::endl; std::cout.precision(8); - watercut.push(timer.currentTime() + timer.currentStepLength(), + watercut.push(timer.simulationTimeElapsed() + timer.currentStepLength(), produced[0]/(produced[0] + produced[1]), tot_produced[0]/tot_porevol_init); if (wells_) { wellreport.push(props_, *wells_, state.saturation(), - timer.currentTime() + timer.currentStepLength(), + timer.simulationTimeElapsed() + timer.currentStepLength(), well_state.bhp(), well_state.perfRates()); } } @@ -620,7 +620,7 @@ namespace Opm Opm::estimateCellVelocity(grid, state.faceflux(), cell_velocity); dm["velocity"] = &cell_velocity; - writeECLData(grid, dm, simtimer.currentStepNum(), simtimer.currentTime(), simtimer.currentDateTime(), + writeECLData(grid, dm, simtimer.currentStepNum(), simtimer.simulationTimeElapsed(), simtimer.currentDateTime(), output_dir, "polymer_ecl"); #else OPM_THROW(std::runtime_error, "Cannot call outputStateBinary() without ert library support. Reconfigure with --with-ert and recompile."); From a6f436534486662b19e7e4fdc97d4954e6e25b38 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 18 Mar 2014 13:13:05 +0100 Subject: [PATCH 04/15] remove forgotten reference to unused attribute "_gravity" for some reason Clang compiled last time. I've got no idea why... --- opm/polymer/SimulatorPolymer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/opm/polymer/SimulatorPolymer.cpp b/opm/polymer/SimulatorPolymer.cpp index 547c97189..827b80ddd 100644 --- a/opm/polymer/SimulatorPolymer.cpp +++ b/opm/polymer/SimulatorPolymer.cpp @@ -203,7 +203,6 @@ namespace Opm polymer_inflow_(polymer_inflow), src_(src), bcs_(bcs), - gravity_(gravity), psolver_(grid, props, rock_comp_props, poly_props, linsolver, param.getDefault("nl_pressure_residual_tolerance", 0.0), param.getDefault("nl_pressure_change_tolerance", 1.0), From 8e5b442b176b565cf20ba2dc66cba775b8c58d5a Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 18 Mar 2014 13:15:59 +0100 Subject: [PATCH 05/15] fix all remaining CLang warnings this time, I've rebuild the whole module and it seems to work... --- opm/polymer/SimulatorCompressiblePolymer.cpp | 4 ---- opm/polymer/TransportSolverTwophasePolymer.cpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/opm/polymer/SimulatorCompressiblePolymer.cpp b/opm/polymer/SimulatorCompressiblePolymer.cpp index 59fd08c9b..544543d78 100644 --- a/opm/polymer/SimulatorCompressiblePolymer.cpp +++ b/opm/polymer/SimulatorCompressiblePolymer.cpp @@ -126,8 +126,6 @@ namespace Opm WellsManager& wells_manager_; const Wells* wells_; const PolymerInflowInterface& polymer_inflow_; - const std::vector& src_; - const FlowBoundaryConditions* bcs_; const double* gravity_; // Solvers CompressibleTpfaPolymer psolver_; @@ -190,8 +188,6 @@ namespace Opm wells_manager_(wells_manager), wells_(wells_manager.c_wells()), polymer_inflow_(polymer_inflow), - src_(src), - bcs_(bcs), gravity_(gravity), psolver_(grid, props, rock_comp_props, poly_props, linsolver, param.getDefault("nl_pressure_residual_tolerance", 0.0), diff --git a/opm/polymer/TransportSolverTwophasePolymer.cpp b/opm/polymer/TransportSolverTwophasePolymer.cpp index e6179bf07..767a7fafd 100644 --- a/opm/polymer/TransportSolverTwophasePolymer.cpp +++ b/opm/polymer/TransportSolverTwophasePolymer.cpp @@ -929,7 +929,7 @@ namespace Opm tmp_x[1]=x[1]; } res_eq.computeJacobiRes(tmp_x, dres_s_dsdc, dres_c_dsdc); - double dFx_dx,dFx_dy,dFy_dx,dFy_dy; + double dFx_dx(0),dFx_dy(0),dFy_dx(0),dFy_dy(0); double det = dFx_dx*dFy_dy - dFy_dx*dFx_dy; if(use_sc){ dFx_dx=(dres_s_dsdc[0]-tmp_x[1]*dres_s_dsdc[1]/tmp_x[0]); From 9204434a4d8ed3f230e3c70e0106cd30a7691c61 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Wed, 19 Mar 2014 09:23:20 +0800 Subject: [PATCH 06/15] make the member functions return a const reference. --- opm/polymer/PolymerProperties.cpp | 4 ++-- opm/polymer/PolymerProperties.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opm/polymer/PolymerProperties.cpp b/opm/polymer/PolymerProperties.cpp index da5c86125..78fdd32da 100644 --- a/opm/polymer/PolymerProperties.cpp +++ b/opm/polymer/PolymerProperties.cpp @@ -59,13 +59,13 @@ namespace Opm return ads_index_; } - std::vector + const std::vector& PolymerProperties::shearWaterVelocity() const { return water_vel_vals_; } - std::vector + const std::vector& PolymerProperties::shearVrf() const { return shear_vrf_vals_; diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp index 79741bb1f..765c53c41 100644 --- a/opm/polymer/PolymerProperties.hpp +++ b/opm/polymer/PolymerProperties.hpp @@ -164,9 +164,9 @@ namespace Opm int adsIndex() const; - std::vector shearWaterVelocity() const; + const std::vector& shearWaterVelocity() const; - std::vector shearVrf() const; + const std::vector& shearVrf() const; double viscMult(double c) const; From 7a193dca1e2bfeb11958e6aed26f8bb9b91bf449 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Fri, 21 Mar 2014 14:34:46 +0800 Subject: [PATCH 07/15] return the value by linear interpolation. --- opm/polymer/PolymerProperties.cpp | 6 +++--- opm/polymer/PolymerProperties.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opm/polymer/PolymerProperties.cpp b/opm/polymer/PolymerProperties.cpp index 78fdd32da..6ac5f125e 100644 --- a/opm/polymer/PolymerProperties.cpp +++ b/opm/polymer/PolymerProperties.cpp @@ -65,10 +65,10 @@ namespace Opm return water_vel_vals_; } - const std::vector& - PolymerProperties::shearVrf() const + double + PolymerProperties::shearVrf(const double velocity) const { - return shear_vrf_vals_; + return Opm::linearInterpolation(water_vel_vals_, shear_vrf_vals_, velocity); } double PolymerProperties::viscMult(double c) const diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp index 765c53c41..cfc01a835 100644 --- a/opm/polymer/PolymerProperties.hpp +++ b/opm/polymer/PolymerProperties.hpp @@ -166,7 +166,7 @@ namespace Opm const std::vector& shearWaterVelocity() const; - const std::vector& shearVrf() const; + double shearVrf(const double velocity) const; double viscMult(double c) const; From b398ce3b3d453f8a952dbf1851fc505f6505f1b1 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 25 Mar 2014 19:12:19 +0100 Subject: [PATCH 08/15] Removed Wellsmanager constructor which used old EclipseGridParser instance. --- examples/sim_poly2p_comp_reorder.cpp | 9 ++++++++- examples/sim_poly2p_incomp_reorder.cpp | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index 28d34e2a9..55a339aa2 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -47,6 +47,9 @@ #include #include +#include +#include + #include #include @@ -87,6 +90,7 @@ try boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; + EclipseStateConstPtr eclipseState; PolymerBlackoilState state; Opm::PolymerProperties poly_props; // bool check_well_controls = false; @@ -94,6 +98,9 @@ try double gravity[3] = { 0.0 }; if (use_deck) { std::string deck_filename = param.get("deck_filename"); + ParserPtr parser(new Opm::Parser()); + eclipseState.reset(new Opm::EclipseState(parser->parseFile(deck_filename))); + deck.reset(new EclipseGridParser(deck_filename)); // Grid init grid.reset(new GridManager(*deck)); @@ -300,7 +307,7 @@ try << simtimer.numSteps() - step << ")\n\n" << std::flush; // Create new wells, polymer inflow controls. - WellsManager wells(*deck, *grid->c_grid(), props->permeability()); + WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability()); boost::scoped_ptr polymer_inflow; if (use_wpolymer) { if (wells.c_wells() == 0) { diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index 48aab1ebc..ca8b8f45f 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -47,6 +47,9 @@ #include #include +#include +#include + #include #include @@ -87,6 +90,7 @@ try boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; + EclipseStateConstPtr eclipseState; PolymerState state; Opm::PolymerProperties poly_props; // bool check_well_controls = false; @@ -94,6 +98,9 @@ try double gravity[3] = { 0.0 }; if (use_deck) { std::string deck_filename = param.get("deck_filename"); + ParserPtr parser(new Opm::Parser()); + eclipseState.reset(new Opm::EclipseState(parser->parseFile(deck_filename))); + deck.reset(new EclipseGridParser(deck_filename)); // Grid init grid.reset(new GridManager(*deck)); @@ -266,6 +273,7 @@ try rep = simulator.run(simtimer, state, well_state); } else { // With a deck, we may have more epochs etc. + WellState well_state; int step = 0; SimulatorTimer simtimer; @@ -304,7 +312,7 @@ try << simtimer.numSteps() - step << ")\n\n" << std::flush; // Create new wells, polymer inflow controls. - WellsManager wells(*deck, *grid->c_grid(), props->permeability()); + WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability()); boost::scoped_ptr polymer_inflow; if (use_wpolymer) { if (wells.c_wells() == 0) { From 31ddb2f098a5889f93bd141c5322507d2fa35754 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Wed, 26 Mar 2014 16:02:39 +0800 Subject: [PATCH 09/15] let shear vef return derivative. --- opm/polymer/PolymerProperties.cpp | 7 +++++++ opm/polymer/PolymerProperties.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/opm/polymer/PolymerProperties.cpp b/opm/polymer/PolymerProperties.cpp index 6ac5f125e..c2e1c4438 100644 --- a/opm/polymer/PolymerProperties.cpp +++ b/opm/polymer/PolymerProperties.cpp @@ -71,6 +71,13 @@ namespace Opm return Opm::linearInterpolation(water_vel_vals_, shear_vrf_vals_, velocity); } + double + PolymerProperties::shearVrfWithDer(const double velocity, double& der) const + { + der = Opm::linearInterpolationDerivative(water_vel_vals_, shear_vrf_vals_, velocity); + return Opm::linearInterpolation(water_vel_vals_, shear_vrf_vals_, velocity); + } + double PolymerProperties::viscMult(double c) const { return Opm::linearInterpolation(c_vals_visc_, visc_mult_vals_, c); diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp index cfc01a835..0482fd46b 100644 --- a/opm/polymer/PolymerProperties.hpp +++ b/opm/polymer/PolymerProperties.hpp @@ -168,6 +168,8 @@ namespace Opm double shearVrf(const double velocity) const; + double shearVrfWithDer(const double velocity, double& der) const; + double viscMult(double c) const; double viscMultWithDer(double c, double* der) const; From 4c0e0c8361f3c37f285220c3f04e6ea8ec2a3c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Mon, 14 Apr 2014 23:52:50 +0200 Subject: [PATCH 10/15] Implement low-level init() routines These are needed by the initialisation routines of the refactored opm-core (PR OPM/opm-core#518) that introduces support for parallel grids. --- opm/polymer/PolymerBlackoilState.hpp | 11 ++++++++--- opm/polymer/PolymerState.hpp | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/opm/polymer/PolymerBlackoilState.hpp b/opm/polymer/PolymerBlackoilState.hpp index d6f714ae0..8116ec2c8 100644 --- a/opm/polymer/PolymerBlackoilState.hpp +++ b/opm/polymer/PolymerBlackoilState.hpp @@ -35,9 +35,14 @@ namespace Opm public: void init(const UnstructuredGrid& g, int num_phases) { - state_blackoil_.init(g, num_phases); - concentration_.resize(g.number_of_cells, 0.0); - cmax_.resize(g.number_of_cells, 0.0); + this->init(g.number_of_cells, g.number_of_faces, num_phases); + } + + void init(int number_of_cells, int number_of_faces, int num_phases) + { + state_blackoil_.init(number_of_cells, number_of_faces, num_phases); + concentration_.resize(number_of_cells, 0.0); + cmax_.resize(number_of_cells, 0.0); } enum ExtremalSat { MinSat = BlackoilState::MinSat, MaxSat = BlackoilState::MaxSat }; diff --git a/opm/polymer/PolymerState.hpp b/opm/polymer/PolymerState.hpp index 6b9d7fd21..d5928edf9 100644 --- a/opm/polymer/PolymerState.hpp +++ b/opm/polymer/PolymerState.hpp @@ -34,9 +34,14 @@ namespace Opm public: void init(const UnstructuredGrid& g, int num_phases) { - state2p_.init(g, num_phases); - concentration_.resize(g.number_of_cells, 0.0); - cmax_.resize(g.number_of_cells, 0.0); + this->init(g.number_of_cells, g.number_of_faces, num_phases); + } + + void init(int number_of_cells, int number_of_faces, int num_phases) + { + state2p_.init(number_of_cells, number_of_faces, num_phases); + concentration_.resize(number_of_cells, 0.0); + cmax_.resize(number_of_cells, 0.0); } enum ExtremalSat { MinSat = TwophaseState::MinSat, MaxSat = TwophaseState::MaxSat }; From 3a6d989d5eeb40c4b8679872b48dfb437a7fad06 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Sat, 26 Apr 2014 11:09:43 +0200 Subject: [PATCH 11/15] move the code away from EclipsGridParser to opm-parser --- examples/sim_poly2p_comp_reorder.cpp | 64 +++++++++--------------- examples/sim_poly2p_incomp_reorder.cpp | 62 +++++++++-------------- examples/test_singlecellsolves.cpp | 2 - opm/polymer/PolymerInflow.cpp | 19 ++++--- opm/polymer/PolymerInflow.hpp | 8 +-- opm/polymer/PolymerProperties.cpp | 2 + opm/polymer/PolymerProperties.hpp | 69 ++++++++++++++++---------- 7 files changed, 104 insertions(+), 122 deletions(-) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index 2a24dfbba..e91d9d13c 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -86,10 +86,10 @@ try // If we have a "deck_filename", grid and props will be read from that. bool use_deck = param.has("deck_filename"); - boost::scoped_ptr deck; boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; + Opm::DeckConstPtr deck; EclipseStateConstPtr eclipseState; PolymerBlackoilState state; Opm::PolymerProperties poly_props; @@ -99,28 +99,28 @@ try if (use_deck) { std::string deck_filename = param.get("deck_filename"); ParserPtr parser(new Opm::Parser()); - eclipseState.reset(new Opm::EclipseState(parser->parseFile(deck_filename))); + deck = parser->parseFile(deck_filename); + eclipseState.reset(new Opm::EclipseState(deck)); - deck.reset(new EclipseGridParser(deck_filename)); // Grid init - grid.reset(new GridManager(*deck)); + grid.reset(new GridManager(deck)); // Rock and fluid init - props.reset(new BlackoilPropertiesFromDeck(*deck, *grid->c_grid())); + props.reset(new BlackoilPropertiesFromDeck(deck, *grid->c_grid())); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. - rock_comp.reset(new RockCompressibility(*deck)); + rock_comp.reset(new RockCompressibility(deck)); // Gravity. - gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity; + gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). if (param.has("init_saturation")) { initStateBasic(*grid->c_grid(), *props, param, gravity[2], state); } else { - initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state); + initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state); } initBlackoilSurfvol(*grid->c_grid(), *props, state); // Init polymer properties. - poly_props.readFromDeck(*deck); + poly_props.readFromDeck(deck); } else { // Grid init. const int nx = param.getDefault("nx", 100); @@ -246,8 +246,7 @@ try std::cout << "\n\n================ Starting main simulation loop ===============\n" - << " (number of epochs: " - << (use_deck ? deck->numberOfEpochs() : 1) << ")\n\n" << std::flush; + << std::flush; SimulatorReport rep; if (!use_deck) { @@ -277,49 +276,34 @@ try // With a deck, we may have more epochs etc. WellState well_state; int step = 0; + Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck)); SimulatorTimer simtimer; - // Use timer for last epoch to obtain total time. - deck->setCurrentEpoch(deck->numberOfEpochs() - 1); - simtimer.init(*deck); - const double total_time = simtimer.totalTime(); - // Check for WPOLYMER presence in last epoch to decide + simtimer.init(timeMap); + // Check for WPOLYMER presence in last report step to decide // polymer injection control type. - const bool use_wpolymer = deck->hasField("WPOLYMER"); + const bool use_wpolymer = deck->hasKeyword("WPOLYMER"); if (use_wpolymer) { if (param.has("poly_start_days")) { OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. " "You seem to be trying to control it via parameter poly_start_days (etc.) as well."); } } - for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) { - // Set epoch index. - deck->setCurrentEpoch(epoch); + for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) { + simtimer.setCurrentStepNum(reportStepIdx); - // Update the timer. - if (deck->hasField("TSTEP")) { - simtimer.init(*deck); - } else { - if (epoch != 0) { - OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch); - } - simtimer.init(param); - } - simtimer.setCurrentStepNum(step); - simtimer.setTotalTime(total_time); - - // Report on start of epoch. - std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------" - << "\n (number of steps: " + // Report on start of report step. + std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------" + << "\n (number of remaining steps: " << simtimer.numSteps() - step << ")\n\n" << std::flush; // Create new wells, polymer inflow controls. - WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability()); + WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability()); boost::scoped_ptr polymer_inflow; if (use_wpolymer) { if (wells.c_wells() == 0) { OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells."); } - polymer_inflow.reset(new PolymerInflowFromDeck(*deck, *wells.c_wells(), props->numCells())); + polymer_inflow.reset(new PolymerInflowFromDeck(deck, *wells.c_wells(), props->numCells())); } else { polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day, param.getDefault("poly_end_days", 800.0)*Opm::unit::day, @@ -327,9 +311,9 @@ try } // @@@ HACK: we should really make a new well state and - // properly transfer old well state to it every epoch, + // properly transfer old well state to it every report step, // since number of wells may change etc. - if (epoch == 0) { + if (reportStepIdx == 0) { well_state.init(wells.c_wells(), state); } @@ -345,7 +329,7 @@ try bcs.c_bcs(), linsolver, grav); - if (epoch == 0) { + if (reportStepIdx == 0) { warnIfUnusedParams(param); } SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state); diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index bdd1797e6..98400a578 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -86,7 +86,7 @@ try // If we have a "deck_filename", grid and props will be read from that. bool use_deck = param.has("deck_filename"); - boost::scoped_ptr deck; + Opm::DeckConstPtr deck; boost::scoped_ptr grid; boost::scoped_ptr props; boost::scoped_ptr rock_comp; @@ -99,27 +99,27 @@ try if (use_deck) { std::string deck_filename = param.get("deck_filename"); ParserPtr parser(new Opm::Parser()); - eclipseState.reset(new Opm::EclipseState(parser->parseFile(deck_filename))); + deck = parser->parseFile(deck_filename); + eclipseState.reset(new Opm::EclipseState(deck)); - deck.reset(new EclipseGridParser(deck_filename)); // Grid init - grid.reset(new GridManager(*deck)); + grid.reset(new GridManager(deck)); // Rock and fluid init - props.reset(new IncompPropertiesFromDeck(*deck, *grid->c_grid())); + props.reset(new IncompPropertiesFromDeck(deck, *grid->c_grid())); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. - rock_comp.reset(new RockCompressibility(*deck)); + rock_comp.reset(new RockCompressibility(deck)); // Gravity. - gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity; + gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). if (param.has("init_saturation")) { initStateBasic(*grid->c_grid(), *props, param, gravity[2], state); } else { - initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state); + initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state); } // Init polymer properties. - poly_props.readFromDeck(*deck); + poly_props.readFromDeck(deck); } else { // Grid init. const int nx = param.getDefault("nx", 100); @@ -250,8 +250,7 @@ try std::cout << "\n\n================ Starting main simulation loop ===============\n" - << " (number of epochs: " - << (use_deck ? deck->numberOfEpochs() : 1) << ")\n\n" << std::flush; + << std::flush; SimulatorReport rep; if (!use_deck) { @@ -282,49 +281,34 @@ try WellState well_state; int step = 0; + Opm::TimeMapPtr timeMap(new Opm::TimeMap(deck)); SimulatorTimer simtimer; - // Use timer for last epoch to obtain total time. - deck->setCurrentEpoch(deck->numberOfEpochs() - 1); - simtimer.init(*deck); - const double total_time = simtimer.totalTime(); + simtimer.init(timeMap); // Check for WPOLYMER presence in last epoch to decide // polymer injection control type. - const bool use_wpolymer = deck->hasField("WPOLYMER"); + const bool use_wpolymer = deck->hasKeyword("WPOLYMER"); if (use_wpolymer) { if (param.has("poly_start_days")) { OPM_MESSAGE("Warning: Using WPOLYMER to control injection since it was found in deck. " "You seem to be trying to control it via parameter poly_start_days (etc.) as well."); } } - for (int epoch = 0; epoch < deck->numberOfEpochs(); ++epoch) { - // Set epoch index. - deck->setCurrentEpoch(epoch); + for (size_t reportStepIdx = 0; reportStepIdx < timeMap->numTimesteps(); ++reportStepIdx) { + simtimer.setCurrentStepNum(reportStepIdx); - // Update the timer. - if (deck->hasField("TSTEP")) { - simtimer.init(*deck); - } else { - if (epoch != 0) { - OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch); - } - simtimer.init(param); - } - simtimer.setCurrentStepNum(step); - simtimer.setTotalTime(total_time); - - // Report on start of epoch. - std::cout << "\n\n-------------- Starting epoch " << epoch << " --------------" - << "\n (number of steps: " + // Report on start of report step. + std::cout << "\n\n-------------- Starting report step " << reportStepIdx << " --------------" + << "\n (number of remaining steps: " << simtimer.numSteps() - step << ")\n\n" << std::flush; // Create new wells, polymer inflow controls. - WellsManager wells(eclipseState , epoch , *grid->c_grid(), props->permeability()); + WellsManager wells(eclipseState , reportStepIdx , *grid->c_grid(), props->permeability()); boost::scoped_ptr polymer_inflow; if (use_wpolymer) { if (wells.c_wells() == 0) { OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells."); } - polymer_inflow.reset(new PolymerInflowFromDeck(*deck, *wells.c_wells(), props->numCells())); + polymer_inflow.reset(new PolymerInflowFromDeck(deck, *wells.c_wells(), props->numCells())); } else { polymer_inflow.reset(new PolymerInflowBasic(param.getDefault("poly_start_days", 300.0)*Opm::unit::day, param.getDefault("poly_end_days", 800.0)*Opm::unit::day, @@ -332,9 +316,9 @@ try } // @@@ HACK: we should really make a new well state and - // properly transfer old well state to it every epoch, + // properly transfer old well state to it every report step, // since number of wells may change etc. - if (epoch == 0) { + if (reportStepIdx == 0) { well_state.init(wells.c_wells(), state); } @@ -350,7 +334,7 @@ try bcs.c_bcs(), linsolver, grav); - if (epoch == 0) { + if (reportStepIdx == 0) { warnIfUnusedParams(param); } SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state); diff --git a/examples/test_singlecellsolves.cpp b/examples/test_singlecellsolves.cpp index 4ff5fb1d4..90f402a76 100644 --- a/examples/test_singlecellsolves.cpp +++ b/examples/test_singlecellsolves.cpp @@ -69,8 +69,6 @@ try param.disableOutput(); // std::cout << "--------------- Reading parameters ---------------" << std::endl; - // If we have a "deck_filename", grid and props will be read from that. - boost::scoped_ptr deck; boost::scoped_ptr grid; boost::scoped_ptr props; PolymerState state; diff --git a/opm/polymer/PolymerInflow.cpp b/opm/polymer/PolymerInflow.cpp index 7c4e4b507..7f8a440dc 100644 --- a/opm/polymer/PolymerInflow.cpp +++ b/opm/polymer/PolymerInflow.cpp @@ -18,8 +18,8 @@ */ #include -#include #include +#include #include namespace Opm @@ -60,19 +60,19 @@ namespace Opm /// Constructor. /// @param[in] deck Input deck expected to contain WPOLYMER. - PolymerInflowFromDeck::PolymerInflowFromDeck(const EclipseGridParser& deck, + PolymerInflowFromDeck::PolymerInflowFromDeck(Opm::DeckConstPtr deck, const Wells& wells, const int num_cells) : sparse_inflow_(num_cells) { - if (!deck.hasField("WPOLYMER")) { + if (!deck->hasKeyword("WPOLYMER")) { OPM_MESSAGE("PolymerInflowFromDeck initialized without WPOLYMER in current epoch."); return; } // Extract concentrations and put into cell->concentration map. - const std::vector& wpl = deck.getWPOLYMER().wpolymer_; - const int num_wpl = wpl.size(); + Opm::DeckKeywordConstPtr wpolymerKeyword = deck->getKeyword("WPOLYMER"); + const int num_wpl = wpolymerKeyword->size(); std::map perfcell_conc; for (int i = 0; i < num_wpl; ++i) { // Only use well name and polymer concentration. @@ -80,16 +80,19 @@ namespace Opm // names. int wix = 0; for (; wix < wells.number_of_wells; ++wix) { - if (wpl[i].well_ == wells.name[wix]) { + if (wpolymerKeyword->getRecord(i)->getItem("WELL")->getString(0) == wells.name[wix]) { break; } } if (wix == wells.number_of_wells) { - OPM_THROW(std::runtime_error, "Could not find a match for well " << wpl[i].well_ << " from WPOLYMER."); + OPM_THROW(std::runtime_error, "Could not find a match for well " + << wpolymerKeyword->getRecord(i)->getItem("WELL")->getString(0) + << " from WPOLYMER."); } for (int j = wells.well_connpos[wix]; j < wells.well_connpos[wix+1]; ++j) { const int perf_cell = wells.well_cells[j]; - perfcell_conc[perf_cell] = wpl[i].polymer_concentration_; + perfcell_conc[perf_cell] = + wpolymerKeyword->getRecord(i)->getItem("POLYMER_CONCENTRATION")->getSIDouble(0); } } diff --git a/opm/polymer/PolymerInflow.hpp b/opm/polymer/PolymerInflow.hpp index f40348ec3..7f512c8ee 100644 --- a/opm/polymer/PolymerInflow.hpp +++ b/opm/polymer/PolymerInflow.hpp @@ -21,17 +21,13 @@ #define OPM_POLYMERINFLOW_HEADER_INCLUDED #include +#include #include struct Wells; namespace Opm { - - class EclipseGridParser; - - - /// @brief Interface for classes encapsulating polymer inflow information. class PolymerInflowInterface { @@ -90,7 +86,7 @@ namespace Opm /// \param[in] deck Input deck expected to contain WPOLYMER. /// \param[in] wells Wells structure. /// \param[in] num_cells Number of cells in grid. - PolymerInflowFromDeck(const EclipseGridParser& deck, + PolymerInflowFromDeck(Opm::DeckConstPtr deck, const Wells& wells, const int num_cells); diff --git a/opm/polymer/PolymerProperties.cpp b/opm/polymer/PolymerProperties.cpp index c2e1c4438..f11902836 100644 --- a/opm/polymer/PolymerProperties.cpp +++ b/opm/polymer/PolymerProperties.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include namespace Opm { diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp index 0482fd46b..4ee4ba9fd 100644 --- a/opm/polymer/PolymerProperties.hpp +++ b/opm/polymer/PolymerProperties.hpp @@ -20,10 +20,15 @@ #ifndef OPM_POLYMERPROPERTIES_HEADER_INCLUDED #define OPM_POLYMERPROPERTIES_HEADER_INCLUDED +#include +#include +#include +#include +#include +#include #include #include -#include namespace Opm @@ -81,9 +86,9 @@ namespace Opm { } - PolymerProperties(const EclipseGridParser& gridparser) + PolymerProperties(Opm::DeckConstPtr deck) { - readFromDeck(gridparser); + readFromDeck(deck); } void set(double c_max, @@ -116,38 +121,48 @@ namespace Opm shear_vrf_vals_ = shear_vrf_vals; } - void readFromDeck(const EclipseGridParser& gridparser) + void readFromDeck(Opm::DeckConstPtr deck) { - // We assume NTMISC=1 - const std::vector& plymax = gridparser.getPLYMAX().plymax_; - c_max_ = plymax[0]; - const std::vector& tlmixpar = gridparser.getTLMIXPAR().tlmixpar_; - mix_param_ = tlmixpar[0]; + Opm::PlymaxTable plymaxTable(deck->getKeyword("PLYMAX"), /*tableIdx=*/0); + Opm::TlmixparTable tlmixparTable(deck->getKeyword("TLMIXPAR"), /*tableIdx=*/0); + + // We also assume that each table has exactly one row... + assert(plymaxTable.numRows() == 1); + assert(tlmixparTable.numRows() == 1); + + c_max_ = plymaxTable.getPolymerConcentrationColumn()[0]; + mix_param_ = tlmixparTable.getViscosityParameterColumn()[0]; // We assume NTSFUN=1 - const std::vector& plyrock = gridparser.getPLYROCK().plyrock_; - assert(plyrock.size() == 5); - dead_pore_vol_ = plyrock[0]; - res_factor_ = plyrock[1]; - rock_density_ = plyrock[2]; - ads_index_ = static_cast(plyrock[3]); - c_max_ads_ = plyrock[4]; + Opm::PlyrockTable plyrockTable(deck->getKeyword("PLYROCK"), /*tableIdx=*/0); + + // We also assume that each table has exactly one row... + assert(plyrockTable.numRows() == 1); + + dead_pore_vol_ = plyrockTable.getDeadPoreVolumeColumn()[0]; + res_factor_ = plyrockTable.getResidualResistanceFactorColumn()[0]; + rock_density_ = plyrockTable.getRockDensityFactorColumn()[0]; + ads_index_ = static_cast(plyrockTable.getAdsorbtionIndexColumn()[0]); + c_max_ads_ = plyrockTable.getMaxAdsorbtionColumn()[0]; // We assume NTPVT=1 - const PLYVISC& plyvisc = gridparser.getPLYVISC(); - c_vals_visc_ = plyvisc.concentration_; - visc_mult_vals_ = plyvisc.factor_; + Opm::PlyviscTable plyviscTable(deck->getKeyword("PLYVISC"), /*tableIdx=*/0); + + // We also assume that each table has exactly one row... + assert(plyviscTable.numRows() == 1); + + c_vals_visc_[0] = plyviscTable.getPolymerConcentrationColumn()[0]; + visc_mult_vals_[0] = plyviscTable.getViscosityMultiplierColumn()[0]; // We assume NTSFUN=1 - const PLYADS& plyads = gridparser.getPLYADS(); - c_vals_ads_ = plyads.local_concentration_; - ads_vals_ = plyads.adsorbed_concentration_; - - // We assume NTPVT=1 - const PLYSHEAR& plyshear = gridparser.getPLYSHEAR(); - water_vel_vals_ = plyshear.water_velocity_; - shear_vrf_vals_ = plyshear.vrf_; + Opm::PlyadsTable plyadsTable(deck->getKeyword("PLYADS"), /*tableIdx=*/0); + + // We also assume that each table has exactly one row... + assert(plyadsTable.numRows() == 1); + + c_vals_ads_[0] = plyadsTable.getPolymerConcentrationColumn()[0]; + ads_vals_[0] = plyadsTable.getAdsorbedPolymerColumn()[0]; } double cMax() const; From 67b5cb263e4268f48dafc57e67b51f4e7e953f6c Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 5 Jun 2014 14:39:11 +0200 Subject: [PATCH 12/15] fix a pretty simple compile issue This was caused by the new multi-region PVT support in opm-core. --- opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp b/opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp index fbe0e5863..652899b4c 100644 --- a/opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp +++ b/opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp @@ -1259,7 +1259,7 @@ namespace Opm assert(np == 2); const int dim = grid_.dimensions; density_.resize(nc*np); - props_.density(grid_.number_of_cells, &A_[0], &density_[0]); + props_.density(grid_.number_of_cells, &A_[0], grid_.global_cell, &density_[0]); std::fill(gravflux_.begin(), gravflux_.end(), 0.0); for (int f = 0; f < nf; ++f) { const int* c = &grid_.face_cells[2*f]; From 0dfa8680f75ae1e441710f86880325f0549aca57 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Sat, 7 Jun 2014 18:44:11 +0200 Subject: [PATCH 13/15] use the EclipseState instead of the raw deck this is needed to enable property modifiers... --- examples/sim_poly2p_comp_reorder.cpp | 2 +- examples/sim_poly2p_incomp_reorder.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index e91d9d13c..20bd16df7 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -105,7 +105,7 @@ try // Grid init grid.reset(new GridManager(deck)); // Rock and fluid init - props.reset(new BlackoilPropertiesFromDeck(deck, *grid->c_grid())); + props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, *grid->c_grid())); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index 98400a578..e1cbc23a5 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -105,7 +105,7 @@ try // Grid init grid.reset(new GridManager(deck)); // Rock and fluid init - props.reset(new IncompPropertiesFromDeck(deck, *grid->c_grid())); + props.reset(new IncompPropertiesFromDeck(deck, eclipseState, *grid->c_grid())); // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. From 9fbf4b2b3baf35b8f5a2f8b7e09f81539627976a Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 17 Sep 2014 13:28:39 +0200 Subject: [PATCH 15/15] adapt the the table related API changes of opm-parser --- examples/sim_poly2p_comp_reorder.cpp | 4 ++-- examples/sim_poly2p_incomp_reorder.cpp | 4 ++-- opm/polymer/PolymerProperties.hpp | 22 +++++++++------------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/examples/sim_poly2p_comp_reorder.cpp b/examples/sim_poly2p_comp_reorder.cpp index 20bd16df7..fba329e68 100644 --- a/examples/sim_poly2p_comp_reorder.cpp +++ b/examples/sim_poly2p_comp_reorder.cpp @@ -109,7 +109,7 @@ try // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. - rock_comp.reset(new RockCompressibility(deck)); + rock_comp.reset(new RockCompressibility(deck, eclipseState)); // Gravity. gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). @@ -120,7 +120,7 @@ try } initBlackoilSurfvol(*grid->c_grid(), *props, state); // Init polymer properties. - poly_props.readFromDeck(deck); + poly_props.readFromDeck(eclipseState); } else { // Grid init. const int nx = param.getDefault("nx", 100); diff --git a/examples/sim_poly2p_incomp_reorder.cpp b/examples/sim_poly2p_incomp_reorder.cpp index e1cbc23a5..5e427af2d 100644 --- a/examples/sim_poly2p_incomp_reorder.cpp +++ b/examples/sim_poly2p_incomp_reorder.cpp @@ -109,7 +109,7 @@ try // check_well_controls = param.getDefault("check_well_controls", false); // max_well_control_iterations = param.getDefault("max_well_control_iterations", 10); // Rock compressibility. - rock_comp.reset(new RockCompressibility(deck)); + rock_comp.reset(new RockCompressibility(deck, eclipseState)); // Gravity. gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity; // Init state variables (saturation and pressure). @@ -119,7 +119,7 @@ try initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state); } // Init polymer properties. - poly_props.readFromDeck(deck); + poly_props.readFromDeck(eclipseState); } else { // Grid init. const int nx = param.getDefault("nx", 100); diff --git a/opm/polymer/PolymerProperties.hpp b/opm/polymer/PolymerProperties.hpp index 4ee4ba9fd..aee061fae 100644 --- a/opm/polymer/PolymerProperties.hpp +++ b/opm/polymer/PolymerProperties.hpp @@ -21,11 +21,7 @@ #define OPM_POLYMERPROPERTIES_HEADER_INCLUDED #include -#include -#include -#include -#include -#include +#include #include #include @@ -86,9 +82,9 @@ namespace Opm { } - PolymerProperties(Opm::DeckConstPtr deck) + PolymerProperties(Opm::EclipseStateConstPtr eclipseState) { - readFromDeck(deck); + readFromDeck(eclipseState); } void set(double c_max, @@ -121,11 +117,11 @@ namespace Opm shear_vrf_vals_ = shear_vrf_vals; } - void readFromDeck(Opm::DeckConstPtr deck) + void readFromDeck(Opm::EclipseStateConstPtr eclipseState) { // We assume NTMISC=1 - Opm::PlymaxTable plymaxTable(deck->getKeyword("PLYMAX"), /*tableIdx=*/0); - Opm::TlmixparTable tlmixparTable(deck->getKeyword("TLMIXPAR"), /*tableIdx=*/0); + const auto& plymaxTable = eclipseState->getPlymaxTables()[0]; + const auto& tlmixparTable = eclipseState->getTlmixparTables()[0]; // We also assume that each table has exactly one row... assert(plymaxTable.numRows() == 1); @@ -135,7 +131,7 @@ namespace Opm mix_param_ = tlmixparTable.getViscosityParameterColumn()[0]; // We assume NTSFUN=1 - Opm::PlyrockTable plyrockTable(deck->getKeyword("PLYROCK"), /*tableIdx=*/0); + const auto& plyrockTable = eclipseState->getPlyrockTables()[0]; // We also assume that each table has exactly one row... assert(plyrockTable.numRows() == 1); @@ -147,7 +143,7 @@ namespace Opm c_max_ads_ = plyrockTable.getMaxAdsorbtionColumn()[0]; // We assume NTPVT=1 - Opm::PlyviscTable plyviscTable(deck->getKeyword("PLYVISC"), /*tableIdx=*/0); + const auto& plyviscTable = eclipseState->getPlyviscTables()[0]; // We also assume that each table has exactly one row... assert(plyviscTable.numRows() == 1); @@ -156,7 +152,7 @@ namespace Opm visc_mult_vals_[0] = plyviscTable.getViscosityMultiplierColumn()[0]; // We assume NTSFUN=1 - Opm::PlyadsTable plyadsTable(deck->getKeyword("PLYADS"), /*tableIdx=*/0); + const auto& plyadsTable = eclipseState->getPlyadsTables()[0]; // We also assume that each table has exactly one row... assert(plyadsTable.numRows() == 1);