本文整理汇总了C++中FluidState::massFraction方法的典型用法代码示例。如果您正苦于以下问题:C++ FluidState::massFraction方法的具体用法?C++ FluidState::massFraction怎么用?C++ FluidState::massFraction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidState
的用法示例。
在下文中一共展示了FluidState::massFraction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enthalpy
static Scalar enthalpy(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
if (phaseIdx == lPhaseIdx) {
Scalar XlCO2 = fluidState.massFraction(phaseIdx, CO2Idx);
Scalar result = liquidEnthalpyBrineCO2_(temperature,
pressure,
Brine_IAPWS::salinity,
XlCO2);
Valgrind::CheckDefined(result);
return result;
}
else {
Scalar XCO2 = fluidState.massFraction(gPhaseIdx, CO2Idx);
Scalar XBrine = fluidState.massFraction(gPhaseIdx, BrineIdx);
Scalar result = 0;
result += XBrine * Brine::gasEnthalpy(temperature, pressure);
result += XCO2 * CO2::gasEnthalpy(temperature, pressure);
Valgrind::CheckDefined(result);
return result;
}
}
示例2: enthalpy
static Scalar enthalpy(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx)
{
Scalar T = fluidState.temperature(phaseIdx);
Scalar p = fluidState.pressure(phaseIdx);
Valgrind::CheckDefined(T);
Valgrind::CheckDefined(p);
if (phaseIdx == lPhaseIdx)
{
// TODO: correct way to deal with the solutes???
return H2O::liquidEnthalpy(T, p);
}
else if (phaseIdx == gPhaseIdx)
{
Scalar result = 0.0;
result +=
H2O::gasEnthalpy(T, p) *
fluidState.massFraction(gPhaseIdx, H2OIdx);
result +=
Air::gasEnthalpy(T, p) *
fluidState.massFraction(gPhaseIdx, AirIdx);
return result;
}
OPM_THROW(std::logic_error, "Invalid phase index " << phaseIdx);
}
示例3: enthalpy
static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/,
unsigned phaseIdx)
{
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
const auto& T = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
const auto& p = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
Valgrind::CheckDefined(T);
Valgrind::CheckDefined(p);
if (phaseIdx == liquidPhaseIdx)
{
// TODO: correct way to deal with the solutes???
return H2O::liquidEnthalpy(T, p);
}
else if (phaseIdx == gasPhaseIdx)
{
LhsEval result = 0.0;
result +=
H2O::gasEnthalpy(T, p) *
FsToolbox::template toLhs<LhsEval>(fluidState.massFraction(gasPhaseIdx, H2OIdx));
result +=
Air::gasEnthalpy(T, p) *
FsToolbox::template toLhs<LhsEval>(fluidState.massFraction(gasPhaseIdx, AirIdx));
return result;
}
OPM_THROW(std::logic_error, "Invalid phase index " << phaseIdx);
}