本文整理汇总了C++中FluidState::pressure方法的典型用法代码示例。如果您正苦于以下问题:C++ FluidState::pressure方法的具体用法?C++ FluidState::pressure怎么用?C++ FluidState::pressure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidState
的用法示例。
在下文中一共展示了FluidState::pressure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Sw
static Evaluation Sw(const Params& params, const FluidState& fs)
{
const Evaluation& pC =
Opm::decay<Evaluation>(fs.pressure(Traits::nonWettingPhaseIdx))
- Opm::decay<Evaluation>(fs.pressure(Traits::wettingPhaseIdx));
return twoPhaseSatSw(params, pC);
}
示例2: Sw
static Evaluation Sw(const Params ¶ms, const FluidState &fs)
{
typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
Evaluation pC =
FsToolbox::template toLhs<Evaluation>(fs.pressure(Traits::nonWettingPhaseIdx))
- FsToolbox::template toLhs<Evaluation>(fs.pressure(Traits::wettingPhaseIdx));
return twoPhaseSatSw(params, pC);
}
示例3: heatCapacity
static Scalar heatCapacity(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx)
{
if(phaseIdx == lPhaseIdx)
return H2O::liquidHeatCapacity(fluidState.temperature(phaseIdx),
fluidState.pressure(phaseIdx));
else
return CO2::gasHeatCapacity(fluidState.temperature(phaseIdx),
fluidState.pressure(phaseIdx));
}
示例4: completeReferenceFluidState
void completeReferenceFluidState(FluidState &fs,
typename MaterialLaw::Params &matParams,
int refPhaseIdx)
{
enum { numPhases = FluidSystem::numPhases };
typedef Dune::FieldVector<Scalar, numPhases> PhaseVector;
int otherPhaseIdx = 1 - refPhaseIdx;
// calculate the other saturation
fs.setSaturation(otherPhaseIdx, 1.0 - fs.saturation(refPhaseIdx));
// calulate the capillary pressure
PhaseVector pC;
MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(otherPhaseIdx,
fs.pressure(refPhaseIdx)
+ (pC[otherPhaseIdx] - pC[refPhaseIdx]));
// set all phase densities
typename FluidSystem::ParameterCache paramCache;
paramCache.updateAll(fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
Scalar rho = FluidSystem::density(fs, paramCache, phaseIdx);
fs.setDensity(phaseIdx, rho);
}
}
示例5: 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;
}
}
示例6: 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);
}
示例7: thermalConductivity
static Scalar thermalConductivity(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){// liquid phase
return H2O::liquidThermalConductivity(temperature, pressure);
}
else{// gas phase
Scalar lambdaDryAir = Air::gasThermalConductivity(temperature, pressure);
if (useComplexRelations){
Scalar xAir = fluidState.moleFraction(phaseIdx, AirIdx);
Scalar xH2O = fluidState.moleFraction(phaseIdx, H2OIdx);
Scalar lambdaAir = xAir * lambdaDryAir;
// Assuming Raoult's, Daltons law and ideal gas
// in order to obtain the partial density of water in the air phase
Scalar partialPressure = pressure * xH2O;
Scalar lambdaH2O =
xH2O
* H2O::gasThermalConductivity(temperature, partialPressure);
return lambdaAir + lambdaH2O;
}
else
return lambdaDryAir; // conductivity of Nitrogen [W / (m K ) ]
}
}
示例8: completeReferenceFluidState
void completeReferenceFluidState(FluidState &fs,
typename MaterialLaw::Params &matParams,
int refPhaseIdx)
{
enum { numPhases = FluidSystem::numPhases };
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> ComputeFromReferencePhase;
typedef Dune::FieldVector<Scalar, numPhases> PhaseVector;
int otherPhaseIdx = 1 - refPhaseIdx;
// calculate the other saturation
fs.setSaturation(otherPhaseIdx, 1.0 - fs.saturation(refPhaseIdx));
// calulate the capillary pressure
PhaseVector pC;
MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(otherPhaseIdx,
fs.pressure(refPhaseIdx)
+ (pC[otherPhaseIdx] - pC[refPhaseIdx]));
// make the fluid state consistent with local thermodynamic
// equilibrium
typename FluidSystem::ParameterCache paramCache;
ComputeFromReferencePhase::solve(fs,
paramCache,
refPhaseIdx,
/*setViscosity=*/false,
/*setEnthalpy=*/false);
}
示例9: 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);
}
示例10: heatCapacity
static LhsEval heatCapacity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/,
unsigned phaseIdx)
{
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
assert(0 <= phaseIdx && phaseIdx < numPhases);
const auto& T = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
const auto& p = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
return Fluid::heatCapacity(T, p);
}
示例11: thermalConductivity
static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx)
{
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
assert(0 <= phaseIdx && phaseIdx < numPhases);
const auto& T = FsToolbox::template toLhs<LhsEval>(fluidState.temperature(phaseIdx));
const auto& p = FsToolbox::template toLhs<LhsEval>(fluidState.pressure(phaseIdx));
return Fluid::thermalConductivity(T, p);
}
示例12: diffusionCoefficient
static Scalar diffusionCoefficient(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx,
int compIdx)
{
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
if (phaseIdx == lPhaseIdx)
return BinaryCoeffBrineCO2::liquidDiffCoeff(temperature, pressure);
assert(phaseIdx == gPhaseIdx);
return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure);
}
示例13: binaryDiffusionCoefficient
static Scalar binaryDiffusionCoefficient(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx,
int compIdx)
{
Scalar T = fluidState.temperature(phaseIdx);
Scalar p = fluidState.pressure(phaseIdx);
if (phaseIdx == lPhaseIdx)
return BinaryCoeff::H2O_Air::liquidDiffCoeff(T, p);
assert(phaseIdx == gPhaseIdx);
return BinaryCoeff::H2O_Air::gasDiffCoeff(T, p);
}
示例14: fugacityCoefficient
static Scalar fugacityCoefficient(const FluidState &fluidState,
const ParameterCache ¶mCache,
int phaseIdx,
int compIdx)
{
assert(0 <= phaseIdx && phaseIdx < numPhases);
assert(0 <= compIdx && compIdx < numComponents);
if (phaseIdx == gPhaseIdx)
// use the fugacity coefficients of an ideal gas. the
// actual value of the fugacity is not relevant, as long
// as the relative fluid compositions are observed,
return 1.0;
Scalar temperature = fluidState.temperature(phaseIdx);
Scalar pressure = fluidState.pressure(phaseIdx);
assert(temperature > 0);
assert(pressure > 0);
// calulate the equilibrium composition for the given
// temperature and pressure. TODO: calculateMoleFractions()
// could use some cleanup.
Scalar xlH2O, xgH2O;
Scalar xlCO2, xgCO2;
BinaryCoeffBrineCO2::calculateMoleFractions(temperature,
pressure,
Brine_IAPWS::salinity,
/*knownPhaseIdx=*/-1,
xlCO2,
xgH2O);
// normalize the phase compositions
xlCO2 = std::max(0.0, std::min(1.0, xlCO2));
xgH2O = std::max(0.0, std::min(1.0, xgH2O));
xlH2O = 1.0 - xlCO2;
xgCO2 = 1.0 - xgH2O;
if (compIdx == BrineIdx) {
Scalar phigH2O = 1.0;
return phigH2O * xgH2O / xlH2O;
}
else {
assert(compIdx == CO2Idx);
Scalar phigCO2 = 1.0;
return phigCO2 * xgCO2 / xlCO2;
};
}
示例15: checkSame
void checkSame(const FluidState &fsRef, const FluidState &fsFlash)
{
enum { numPhases = FluidState::numPhases };
enum { numComponents = FluidState::numComponents };
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
Scalar error;
// check the pressures
error = 1 - fsRef.pressure(phaseIdx)/fsFlash.pressure(phaseIdx);
if (std::abs(error) > 1e-6) {
std::cout << "pressure error phase " << phaseIdx << ": "
<< fsFlash.pressure(phaseIdx) << " flash vs "
<< fsRef.pressure(phaseIdx) << " reference"
<< " error=" << error << "\n";
}
// check the saturations
error = fsRef.saturation(phaseIdx) - fsFlash.saturation(phaseIdx);
if (std::abs(error) > 1e-6)
std::cout << "saturation error phase " << phaseIdx << ": "
<< fsFlash.saturation(phaseIdx) << " flash vs "
<< fsRef.saturation(phaseIdx) << " reference"
<< " error=" << error << "\n";
// check the compositions
for (int compIdx = 0; compIdx < numComponents; ++ compIdx) {
error = fsRef.moleFraction(phaseIdx, compIdx) - fsFlash.moleFraction(phaseIdx, compIdx);
if (std::abs(error) > 1e-6)
std::cout << "composition error phase " << phaseIdx << ", component " << compIdx << ": "
<< fsFlash.moleFraction(phaseIdx, compIdx) << " flash vs "
<< fsRef.moleFraction(phaseIdx, compIdx) << " reference"
<< " error=" << error << "\n";
}
}
}