本文整理汇总了C++中FluidState::fugacity方法的典型用法代码示例。如果您正苦于以下问题:C++ FluidState::fugacity方法的具体用法?C++ FluidState::fugacity怎么用?C++ FluidState::fugacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidState
的用法示例。
在下文中一共展示了FluidState::fugacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateDefect_
static Scalar calculateDefect_(const FluidState ¶ms,
int phaseIdx,
const ComponentVector &targetFug)
{
Scalar result = 0.0;
for (int i = 0; i < numComponents; ++i) {
// sum of the fugacity defect weighted by the inverse
// fugacity coefficient
result += std::abs(
(targetFug[i] - params.fugacity(phaseIdx, i))
/
params.fugacityCoefficient(phaseIdx, i) );
};
return result;
}
示例2: solve
static void solve(FluidState& fluidState,
typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
unsigned refPhaseIdx,
bool setViscosity,
bool setEnthalpy)
{
typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
// compute the density and enthalpy of the
// reference phase
paramCache.updatePhase(fluidState, refPhaseIdx);
fluidState.setDensity(refPhaseIdx,
FluidSystem::density(fluidState,
paramCache,
refPhaseIdx));
if (setEnthalpy)
fluidState.setEnthalpy(refPhaseIdx,
FluidSystem::enthalpy(fluidState,
paramCache,
refPhaseIdx));
if (setViscosity)
fluidState.setViscosity(refPhaseIdx,
FluidSystem::viscosity(fluidState,
paramCache,
refPhaseIdx));
// compute the fugacities of all components in the reference phase
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
fluidState.setFugacityCoefficient(refPhaseIdx,
compIdx,
FluidSystem::fugacityCoefficient(fluidState,
paramCache,
refPhaseIdx,
compIdx));
}
// compute all quantities for the non-reference phases
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (phaseIdx == refPhaseIdx)
continue; // reference phase is already calculated
ComponentVector fugVec;
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
const auto& fug = fluidState.fugacity(refPhaseIdx, compIdx);
fugVec[compIdx] = FsToolbox::template decay<Evaluation>(fug);
}
CompositionFromFugacities::solve(fluidState, paramCache, phaseIdx, fugVec);
if (setViscosity)
fluidState.setViscosity(phaseIdx,
FluidSystem::viscosity(fluidState,
paramCache,
phaseIdx));
if (setEnthalpy)
fluidState.setEnthalpy(phaseIdx,
FluidSystem::enthalpy(fluidState,
paramCache,
phaseIdx));
}
}