Add a facility for checking/assigning presence of free phases
This is intentionally black-oil specific because we presently do no know how to handle other cases (e.g., more phases or number of phases different from number of components).
This commit is contained in:
parent
ee456f9851
commit
a033329b14
@ -40,6 +40,40 @@ namespace Opm
|
||||
int phase_pos[MaxNumPhases];
|
||||
};
|
||||
|
||||
/// Check or assign presence of a formed, free phase. Limited to
|
||||
/// the 'BlackoilPhases'.
|
||||
///
|
||||
/// Use a std::vector<PhasePresence> to represent the conditions
|
||||
/// in an entire model.
|
||||
class PhasePresence
|
||||
{
|
||||
public:
|
||||
PhasePresence()
|
||||
: present_(0)
|
||||
{}
|
||||
|
||||
bool hasFreeWater() const { return present(BlackoilPhases::Aqua ); }
|
||||
bool hasFreeOil () const { return present(BlackoilPhases::Liquid); }
|
||||
bool hasFreeGas () const { return present(BlackoilPhases::Vapour); }
|
||||
|
||||
void setFreeWater() { insert(BlackoilPhases::Aqua ); }
|
||||
void setFreeOil () { insert(BlackoilPhases::Liquid); }
|
||||
void setFreeGas () { insert(BlackoilPhases::Vapour); }
|
||||
|
||||
private:
|
||||
unsigned char present_;
|
||||
|
||||
bool present(const BlackoilPhases::PhaseIndex i) const
|
||||
{
|
||||
return present_ & (1 << i);
|
||||
}
|
||||
|
||||
void insert(const BlackoilPhases::PhaseIndex i)
|
||||
{
|
||||
present_ |= (1 << i);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_BLACKOILPHASES_HEADER_INCLUDED
|
||||
|
Loading…
Reference in New Issue
Block a user