Apply the swatinit scaling to new_props

The capillary pressure function in new_props is scaled to match the
capillary pressure function in props.

This is a temporary workaround while the simulator uses two different
property object.
This commit is contained in:
Tor Harald Sandve 2015-02-18 08:23:17 +01:00
parent 46cfaa1432
commit 013d1d3499
6 changed files with 55 additions and 0 deletions

View File

@ -170,6 +170,16 @@ try
initBlackoilStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
}
// The capillary pressure is scaled in new_props to match the scaled capillary pressure in props.
if (deck->hasKeyword("SWATINIT")) {
const int nc = grid->c_grid()->number_of_cells;
std::vector<int> cells(nc);
for (int c = 0; c < nc; ++c) { cells[c] = c; }
std::vector<double> pc = state.saturation();
props->capPress(nc, state.saturation().data(), cells.data(), pc.data(),NULL);
new_props->swatinit(state.saturation(),pc);
}
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
const double *grav = use_gravity ? &gravity[0] : 0;

View File

@ -936,5 +936,14 @@ namespace Opm
OPM_THROW(std::logic_error, "BlackoilPropsAd class does not support this functionality.");
}
/// Update capillary pressure scaling according to pressure diff. and initial water saturation.
/// \param[in] saturation Array of n*numPhases cell indices to be associated with the saturation values.
/// \param[in] pc Array of n*numPhases cell indices to be associated with the capillary pressure values.
void BlackoilPropsAd::swatinit(const std::vector<double>& /*saturation*/,
const std::vector<double>& /*pc*/)
{
OPM_THROW(std::logic_error, "BlackoilPropsAd class does not support this functionality.");
}
} // namespace Opm

View File

@ -387,6 +387,12 @@ namespace Opm
/// Update for max oil saturation.
void updateSatOilMax(const std::vector<double>& saturation);
/// Update capillary pressure scaling according to pressure diff. and initial water saturation.
/// \param[in] saturation Array of n*numPhases cell indices to be associated with the saturation values.
/// \param[in] pc Array of n*numPhases cell indices to be associated with the capillary pressure values.
void swatinit(const std::vector<double>& saturation,
const std::vector<double>& pc);
private:
const BlackoilPropertiesInterface& props_;
PhaseUsage pu_;

View File

@ -1166,6 +1166,22 @@ BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck&
}
}
}
/// Update capillary pressure scaling according to pressure diff. and initial water saturation.
/// \param[in] saturation Array of n*numPhases cell indices to be associated with the saturation values.
/// \param[in] pc Array of n*numPhases cell indices to be associated with the capillary pressure values.
void BlackoilPropsAdFromDeck::swatinit(const std::vector<double>& saturation,
const std::vector<double>& pc)
{
const int nc = rock_.numCells();
const int numActivePhases = numPhases();
for (int i = 0; i < nc; ++i) {
double pcow = pc[numActivePhases*i + phase_usage_.phase_pos[Water]];
double swat = saturation[numActivePhases*i + phase_usage_.phase_pos[Water]];
satprops_->swatInitScaling(i,pcow,swat);
}
}
/// Apply correction to rs/rv according to kw VAPPARS
/// \param[in/out] r Array of n rs/rv values.

View File

@ -425,6 +425,13 @@ namespace Opm
/// Update for max oil saturation.
void updateSatOilMax(const std::vector<double>& saturation);
/// Update capillary pressure scaling according to pressure diff. and initial water saturation.
/// \param[in] saturation Array of n*numPhases cell indices to be associated with the saturation values.
/// \param[in] pc Array of n*numPhases cell indices to be associated with the capillary pressure values.
void swatinit(const std::vector<double>& saturation,
const std::vector<double>& pc);
private:
/// Initializes the properties.
template <class CentroidIterator>

View File

@ -400,6 +400,13 @@ namespace Opm
/// Update for max oil saturation.
virtual
void updateSatOilMax(const std::vector<double>& saturation) = 0;
/// Update capillary pressure scaling according to pressure diff. and initial water saturation.
/// \param[in] saturation Array of n*numPhases cell indices to be associated with the saturation values.
/// \param[in] pc Array of n*numPhases cell indices to be associated with the capillary pressure values.
virtual
void swatinit(const std::vector<double>& saturation,
const std::vector<double>& pc ) = 0;
};
} // namespace Opm