Now computePorevolume() takes a porosity array instead of a property object.

This is to make it compatible with blackoil properties.
An alternative would be to give [Incomp|Blackoil]PropertiesInterface a
common base class (RockInterface?) with the common rock-related methods.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-05-14 21:47:10 +02:00
parent b33ce1ca1a
commit 67e3d38bec
5 changed files with 21 additions and 23 deletions

View File

@ -265,6 +265,8 @@ typedef Opm::ImplicitTransport<TransportModel,
int
main(int argc, char** argv)
{
using namespace Opm;
std::cout << "\n================ Test program for incompressible two-phase flow ===============\n\n";
Opm::parameter::ParameterGroup param(argc, argv, false);
std::cout << "--------------- Reading parameters ---------------" << std::endl;
@ -395,9 +397,9 @@ main(int argc, char** argv)
// Extra rock init.
std::vector<double> 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<double> initial_pressure = state.pressure();
std::vector<double> 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<double> pressure_increment(num_cells + num_wells);
std::vector<double> 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();

View File

@ -92,9 +92,9 @@ int main(int argc, char** argv)
const int num_cells = grid.c_grid()->number_of_cells;
std::vector<double> 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<double> 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);

View File

@ -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<double>& 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<double>());
@ -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<double>& pressure,
std::vector<double>& 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]);
}
}

View File

@ -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<double>& 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<double>& pressure,
std::vector<double>& porevol);

View File

@ -319,7 +319,7 @@ int main ()
/// \details We compute the pore volume
/// \code
std::vector<double> porevol;
computePorevolume(*grid.c_grid(), props, porevol);
Opm::computePorevolume(*grid.c_grid(), props.porosity(), porevol);
/// \endcode
/// \page tutorial3