diff --git a/examples/spu_2p.cpp b/examples/spu_2p.cpp index 4ab36887..e34d0441 100644 --- a/examples/spu_2p.cpp +++ b/examples/spu_2p.cpp @@ -265,6 +265,8 @@ typedef Opm::ImplicitTransport porevol; if (rock_comp->isActive()) { - computePorevolume(*grid->c_grid(), *props, *rock_comp, state.pressure(), porevol); + computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol); } else { - computePorevolume(*grid->c_grid(), *props, porevol); + computePorevolume(*grid->c_grid(), props->porosity(), porevol); } double tot_porevol_init = std::accumulate(porevol.begin(), porevol.end(), 0.0); @@ -560,7 +562,7 @@ main(int argc, char** argv) rc.resize(num_cells); std::vector initial_pressure = state.pressure(); std::vector initial_porevolume(num_cells); - computePorevolume(*grid->c_grid(), *props, *rock_comp, initial_pressure, initial_porevolume); + computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, initial_pressure, initial_porevolume); std::vector pressure_increment(num_cells + num_wells); std::vector prev_pressure(num_cells + num_wells); for (int iter = 0; iter < nl_pressure_maxiter; ++iter) { @@ -568,7 +570,7 @@ main(int argc, char** argv) for (int cell = 0; cell < num_cells; ++cell) { rc[cell] = rock_comp->rockComp(state.pressure()[cell]); } - computePorevolume(*grid->c_grid(), *props, *rock_comp, state.pressure(), porevol); + computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol); std::copy(state.pressure().begin(), state.pressure().end(), prev_pressure.begin()); std::copy(well_bhp.begin(), well_bhp.end(), prev_pressure.begin() + num_cells); // prev_pressure = state.pressure(); diff --git a/examples/wells_example.cpp b/examples/wells_example.cpp index 159e43ac..2c070991 100644 --- a/examples/wells_example.cpp +++ b/examples/wells_example.cpp @@ -92,9 +92,9 @@ int main(int argc, char** argv) const int num_cells = grid.c_grid()->number_of_cells; std::vector porevol; if (rock_comp.isActive()) { - computePorevolume(*grid.c_grid(), incomp_properties, rock_comp, state.pressure(), porevol); + computePorevolume(*grid.c_grid(), incomp_properties.porosity(), rock_comp, state.pressure(), porevol); } else { - computePorevolume(*grid.c_grid(), incomp_properties, porevol); + computePorevolume(*grid.c_grid(), incomp_properties.porosity(), porevol); } if (rock_comp.isActive()) { std::vector initial_pressure = state.pressure(); @@ -116,7 +116,7 @@ int main(int argc, char** argv) break; } } - computePorevolume(*grid.c_grid(), incomp_properties, rock_comp, state.pressure(), porevol); + computePorevolume(*grid.c_grid(), incomp_properties.porosity(), rock_comp, state.pressure(), porevol); } else { pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), state.pressure(), state.faceflux(), well_bhp, well_rate_per_cell); @@ -152,7 +152,7 @@ int main(int argc, char** argv) break; } } - computePorevolume(*grid.c_grid(), incomp_properties, rock_comp, state.pressure(), porevol); + computePorevolume(*grid.c_grid(), incomp_properties.porosity(), rock_comp, state.pressure(), porevol); } else { pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), state.pressure(), state.faceflux(), well_bhp, well_rate_per_cell); diff --git a/opm/core/utility/miscUtilities.cpp b/opm/core/utility/miscUtilities.cpp index d2276689..b84f94e6 100644 --- a/opm/core/utility/miscUtilities.cpp +++ b/opm/core/utility/miscUtilities.cpp @@ -35,17 +35,15 @@ namespace Opm /// @brief Computes pore volume of all cells in a grid. /// @param[in] grid a grid - /// @param[in] props rock and fluid properties + /// @param[in] porosity array of grid.number_of_cells porosity values /// @param[out] porevol the pore volume by cell. void computePorevolume(const UnstructuredGrid& grid, - const Opm::IncompPropertiesInterface& props, + const double* porosity, std::vector& porevol) { int num_cells = grid.number_of_cells; - ASSERT(num_cells == props.numCells()); porevol.resize(num_cells); - const double* poro = props.porosity(); - std::transform(poro, poro + num_cells, + std::transform(porosity, porosity + num_cells, grid.cell_volumes, porevol.begin(), std::multiplies()); @@ -54,22 +52,20 @@ namespace Opm /// @brief Computes pore volume of all cells in a grid, with rock compressibility effects. /// @param[in] grid a grid - /// @param[in] props rock and fluid properties + /// @param[in] porosity array of grid.number_of_cells porosity values /// @param[in] rock_comp rock compressibility properties /// @param[in] pressure pressure by cell /// @param[out] porevol the pore volume by cell. void computePorevolume(const UnstructuredGrid& grid, - const IncompPropertiesInterface& props, + const double* porosity, const RockCompressibility& rock_comp, const std::vector& pressure, std::vector& porevol) { int num_cells = grid.number_of_cells; - ASSERT(num_cells == props.numCells()); porevol.resize(num_cells); - const double* poro = props.porosity(); for (int i = 0; i < num_cells; ++i) { - porevol[i] = poro[i]*grid.cell_volumes[i]*rock_comp.poroMult(pressure[i]); + porevol[i] = porosity[i]*grid.cell_volumes[i]*rock_comp.poroMult(pressure[i]); } } diff --git a/opm/core/utility/miscUtilities.hpp b/opm/core/utility/miscUtilities.hpp index 131580a6..40fe0059 100644 --- a/opm/core/utility/miscUtilities.hpp +++ b/opm/core/utility/miscUtilities.hpp @@ -34,21 +34,21 @@ namespace Opm /// @brief Computes pore volume of all cells in a grid. /// @param[in] grid a grid - /// @param[in] props rock and fluid properties + /// @param[in] porosity array of grid.number_of_cells porosity values /// @param[out] porevol the pore volume by cell. void computePorevolume(const UnstructuredGrid& grid, - const Opm::IncompPropertiesInterface& props, + const double* porosity, std::vector& porevol); /// @brief Computes pore volume of all cells in a grid, with rock compressibility effects. /// @param[in] grid a grid - /// @param[in] props rock and fluid properties + /// @param[in] porosity array of grid.number_of_cells porosity values /// @param[in] rock_comp rock compressibility properties /// @param[in] pressure pressure by cell /// @param[out] porevol the pore volume by cell. void computePorevolume(const UnstructuredGrid& grid, - const IncompPropertiesInterface& props, + const double* porosity, const RockCompressibility& rock_comp, const std::vector& pressure, std::vector& porevol); diff --git a/tutorials/tutorial3.cpp b/tutorials/tutorial3.cpp index 0ad1d606..0e9f4362 100644 --- a/tutorials/tutorial3.cpp +++ b/tutorials/tutorial3.cpp @@ -319,7 +319,7 @@ int main () /// \details We compute the pore volume /// \code std::vector porevol; - computePorevolume(*grid.c_grid(), props, porevol); + Opm::computePorevolume(*grid.c_grid(), props.porosity(), porevol); /// \endcode /// \page tutorial3