variableState: Defer r{s,v}Sat calculation

Quantities rsSat and rvSat are not needed unless we have an active
Gas phase.  Don't calculate them until we know that they are
actually needed.
This commit is contained in:
Bård Skaflestad 2014-05-27 16:51:54 +02:00
parent 35d883319b
commit f69530a7d4

View File

@ -528,11 +528,11 @@ namespace {
so = so - sw;
}
// Define Sg Rs and Rv in terms of xvar.
std::vector<int> all_cells = buildAllCells(nc);
ADB rsSat = fluidRsSat(state.pressure,all_cells);
ADB rvSat = fluidRvSat(state.pressure,all_cells);
if (active_[ Gas]) {
// Define Sg Rs and Rv in terms of xvar.
std::vector<int> all_cells = buildAllCells(nc);
ADB rsSat = fluidRsSat(state.pressure,all_cells);
ADB rvSat = fluidRvSat(state.pressure,all_cells);
ADB xvar = vars[ nextvar++ ];
ADB sg = isSg*xvar + isRv* so;
state.saturation[ pu.phase_pos[ Gas ] ] = sg;