adding polymer molecular weight to BlackoilPhases and phaseUsageFromDeck

This commit is contained in:
Kai Bao 2018-11-27 15:04:21 +01:00
parent 93fb5a2c52
commit e1ede3c9d5
2 changed files with 17 additions and 3 deletions

View File

@ -33,11 +33,11 @@ namespace Opm
// sense that they can be active or not and canonical indices can be translated
// to and from active ones. That said, they are not considered by num_phases or
// MaxNumPhases. The crypto phases which are currently implemented are solvent,
// polymer and energy.
static const int NumCryptoPhases = 3;
// polymer, energy and polymer molecular weight.
static const int NumCryptoPhases = 4;
// enum ComponentIndex { Water = 0, Oil = 1, Gas = 2 };
enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2, Solvent = 3, Polymer = 4, Energy = 5 };
enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2, Solvent = 3, Polymer = 4, Energy = 5, PolymerMW = 6 };
};
struct PhaseUsage : public BlackoilPhases
@ -48,6 +48,8 @@ namespace Opm
bool has_solvent;
bool has_polymer;
bool has_energy;
// polymer molecular weight
bool has_polymermw;
};
/// Check or assign presence of a formed, free phase. Limited to

View File

@ -107,6 +107,18 @@ namespace Opm
else
pu.phase_pos[BlackoilPhases::Energy] = -1;
// Add polymer molecular weight related
pu.has_polymermw = phase.active(Phase::POLYMW);
if (pu.has_polymermw) {
if (!pu.has_polymer) {
OPM_THROW(std::runtime_error, "pu.has_polymermw is true while pu.has_polymer is false");
}
pu.phase_pos[BlackoilPhases::PolymerMW] = numActivePhases;
++ numActivePhases;
}
else
pu.phase_pos[BlackoilPhases::PolymerMW] = -1;
return pu;
}