Change interface for (blackoil) computeInjectedProduced().

Also use new computeInjectedProduced() and computeTransportSource()
functions in SimulatorCompressibleTwophase.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-10-02 11:12:23 +02:00
parent 17c1be6541
commit 017663cc5b
2 changed files with 42 additions and 36 deletions

View File

@ -41,31 +41,33 @@ namespace Opm
/// gives the mobilities used for the preceding timestep. /// gives the mobilities used for the preceding timestep.
/// Note 3: Gives surface volume values, not reservoir volumes /// Note 3: Gives surface volume values, not reservoir volumes
/// (as the incompressible version of the function does). /// (as the incompressible version of the function does).
/// Also, assumes that src is given in surface volumes /// Also, assumes that transport_src is given in surface volumes
/// for injector terms! /// for injector terms!
/// @param[in] props fluid and rock properties. /// @param[in] props fluid and rock properties.
/// @param[in] p pressure (one value per cell) /// @param[in] state state variables (pressure, sat, surfvol)
/// @param[in] z surface-volume values (for all P phases) /// @param[in] transport_src if < 0: total resv outflow, if > 0: first phase surfv inflow
/// @param[in] s saturation values (for all P phases) /// @param[in] dt timestep used
/// @param[in] src if < 0: total outflow, if > 0: first phase inflow /// @param[out] injected must point to a valid array with P elements,
/// @param[in] dt timestep used /// where P = s.size()/src.size().
/// @param[out] injected must point to a valid array with P elements, /// @param[out] produced must also point to a valid array with P elements.
/// where P = s.size()/src.size().
/// @param[out] produced must also point to a valid array with P elements.
void computeInjectedProduced(const BlackoilPropertiesInterface& props, void computeInjectedProduced(const BlackoilPropertiesInterface& props,
const std::vector<double>& press, const BlackoilState& state,
const std::vector<double>& z, const std::vector<double>& transport_src,
const std::vector<double>& s,
const std::vector<double>& src,
const double dt, const double dt,
double* injected, double* injected,
double* produced) double* produced)
{ {
const int num_cells = src.size(); const int num_cells = transport_src.size();
const int np = s.size()/src.size(); if (props.numCells() != num_cells) {
if (int(s.size()) != num_cells*np) { THROW("Size of transport_src vector does not match number of cells in props.");
THROW("Sizes of s and src vectors do not match.");
} }
const int np = props.numPhases();
if (int(state.saturation().size()) != num_cells*np) {
THROW("Sizes of state vectors do not match number of cells.");
}
const std::vector<double>& press = state.pressure();
const std::vector<double>& s = state.saturation();
const std::vector<double>& z = state.surfacevol();
std::fill(injected, injected + np, 0.0); std::fill(injected, injected + np, 0.0);
std::fill(produced, produced + np, 0.0); std::fill(produced, produced + np, 0.0);
std::vector<double> visc(np); std::vector<double> visc(np);
@ -74,10 +76,10 @@ namespace Opm
std::vector<double> prod_resv_phase(np); std::vector<double> prod_resv_phase(np);
std::vector<double> prod_surfvol(np); std::vector<double> prod_surfvol(np);
for (int c = 0; c < num_cells; ++c) { for (int c = 0; c < num_cells; ++c) {
if (src[c] > 0.0) { if (transport_src[c] > 0.0) {
injected[0] += src[c]*dt; injected[0] += transport_src[c]*dt;
} else if (src[c] < 0.0) { } else if (transport_src[c] < 0.0) {
const double flux = -src[c]*dt; const double flux = -transport_src[c]*dt;
const double* sat = &s[np*c]; const double* sat = &s[np*c];
props.relperm(1, sat, &c, &mob[0], 0); props.relperm(1, sat, &c, &mob[0], 0);
props.viscosity(1, &press[c], &z[np*c], &c, &visc[0], 0); props.viscosity(1, &press[c], &z[np*c], &c, &visc[0], 0);

View File

@ -28,31 +28,34 @@ namespace Opm
{ {
class BlackoilPropertiesInterface; class BlackoilPropertiesInterface;
class BlackoilState;
class WellState; class WellState;
/// @brief Computes injected and produced volumes of all phases.
/// @brief Computes injected and produced surface volumes of all phases.
/// Note 1: assumes that only the first phase is injected. /// Note 1: assumes that only the first phase is injected.
/// Note 2: assumes that transport has been done with an /// Note 2: assumes that transport has been done with an
/// implicit method, i.e. that the current state /// implicit method, i.e. that the current state
/// gives the mobilities used for the preceding timestep. /// gives the mobilities used for the preceding timestep.
/// @param[in] props fluid and rock properties. /// Note 3: Gives surface volume values, not reservoir volumes
/// @param[in] p pressure (one value per cell) /// (as the incompressible version of the function does).
/// @param[in] z surface-volume values (for all P phases) /// Also, assumes that transport_src is given in surface volumes
/// @param[in] s saturation values (for all P phases) /// for injector terms!
/// @param[in] src if < 0: total outflow, if > 0: first phase inflow. /// @param[in] props fluid and rock properties.
/// @param[in] dt timestep used /// @param[in] state state variables (pressure, sat, surfvol)
/// @param[out] injected must point to a valid array with P elements, /// @param[in] transport_src if < 0: total resv outflow, if > 0: first phase surfv inflow
/// where P = s.size()/src.size(). /// @param[in] dt timestep used
/// @param[out] produced must also point to a valid array with P elements. /// @param[out] injected must point to a valid array with P elements,
/// where P = s.size()/src.size().
/// @param[out] produced must also point to a valid array with P elements.
void computeInjectedProduced(const BlackoilPropertiesInterface& props, void computeInjectedProduced(const BlackoilPropertiesInterface& props,
const std::vector<double>& p, const BlackoilState& state,
const std::vector<double>& z, const std::vector<double>& transport_src,
const std::vector<double>& s,
const std::vector<double>& src,
const double dt, const double dt,
double* injected, double* injected,
double* produced); double* produced);
/// @brief Computes total mobility for a set of saturation values. /// @brief Computes total mobility for a set of saturation values.
/// @param[in] props rock and fluid properties /// @param[in] props rock and fluid properties
/// @param[in] cells cells with which the saturation values are associated /// @param[in] cells cells with which the saturation values are associated
@ -67,6 +70,7 @@ namespace Opm
const std::vector<double>& s, const std::vector<double>& s,
std::vector<double>& totmob); std::vector<double>& totmob);
/// @brief Computes total mobility and omega for a set of saturation values. /// @brief Computes total mobility and omega for a set of saturation values.
/// @param[in] props rock and fluid properties /// @param[in] props rock and fluid properties
/// @param[in] cells cells with which the saturation values are associated /// @param[in] cells cells with which the saturation values are associated