adapt to the recent renames of the phase indices in opm-material

This commit is contained in:
Andreas Lauser 2014-04-03 16:59:48 +02:00
parent acde984a5a
commit 7b41447b04
15 changed files with 287 additions and 289 deletions

View File

@ -100,13 +100,13 @@ SET_PROP(Co2InjectionBaseProblem, MaterialLaw)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { lPhaseIdx = FluidSystem::lPhaseIdx };
enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { liquidPhaseIdx = FluidSystem::liquidPhaseIdx };
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
/*wettingPhaseIdx=*/FluidSystem::liquidPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gasPhaseIdx>
Traits;
// define the material law which is parameterized by effective
@ -200,8 +200,8 @@ class Co2InjectionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
// copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { numPhases = FluidSystem::numPhases };
enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { lPhaseIdx = FluidSystem::lPhaseIdx };
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
enum { liquidPhaseIdx = FluidSystem::liquidPhaseIdx };
enum { CO2Idx = FluidSystem::CO2Idx };
enum { BrineIdx = FluidSystem::BrineIdx };
enum { conti0EqIdx = Indices::conti0EqIdx };
@ -267,10 +267,10 @@ public:
coarsePorosity_ = 0.3;
// residual saturations
fineMaterialParams_.setResidualSaturation(lPhaseIdx, 0.2);
fineMaterialParams_.setResidualSaturation(gPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(lPhaseIdx, 0.2);
coarseMaterialParams_.setResidualSaturation(gPhaseIdx, 0.0);
fineMaterialParams_.setResidualSaturation(liquidPhaseIdx, 0.2);
fineMaterialParams_.setResidualSaturation(gasPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(liquidPhaseIdx, 0.2);
coarseMaterialParams_.setResidualSaturation(gasPhaseIdx, 0.0);
// parameters for the Brooks-Corey law
fineMaterialParams_.setEntryPressure(1e4);
@ -463,14 +463,14 @@ public:
massRate[contiCO2EqIdx] = -1e-3; // [kg/(m^3 s)]
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
fs.setSaturation(gPhaseIdx, 1.0);
fs.setPressure(gPhaseIdx,
fs.setSaturation(gasPhaseIdx, 1.0);
fs.setPressure(gasPhaseIdx,
context.volVars(spaceIdx, timeIdx).fluidState().pressure(
gPhaseIdx));
gasPhaseIdx));
fs.setTemperature(temperature(context, spaceIdx, timeIdx));
typename FluidSystem::ParameterCache paramCache;
paramCache.updatePhase(fs, gPhaseIdx);
Scalar h = FluidSystem::enthalpy(fs, paramCache, gPhaseIdx);
paramCache.updatePhase(fs, gasPhaseIdx);
Scalar h = FluidSystem::enthalpy(fs, paramCache, gasPhaseIdx);
// impose an forced inflow boundary condition
values.setMassRate(massRate);
@ -532,8 +532,8 @@ private:
//////
// set saturations
//////
fs.setSaturation(FluidSystem::lPhaseIdx, 1.0);
fs.setSaturation(FluidSystem::gPhaseIdx, 0.0);
fs.setSaturation(FluidSystem::liquidPhaseIdx, 1.0);
fs.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
//////
// set pressures
@ -547,20 +547,20 @@ private:
= this->materialLawParams(context, spaceIdx, timeIdx);
MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(lPhaseIdx, pl + (pC[lPhaseIdx] - pC[lPhaseIdx]));
fs.setPressure(gPhaseIdx, pl + (pC[gPhaseIdx] - pC[lPhaseIdx]));
fs.setPressure(liquidPhaseIdx, pl + (pC[liquidPhaseIdx] - pC[liquidPhaseIdx]));
fs.setPressure(gasPhaseIdx, pl + (pC[gasPhaseIdx] - pC[liquidPhaseIdx]));
//////
// set composition of the liquid phase
//////
fs.setMoleFraction(lPhaseIdx, CO2Idx, 0.005);
fs.setMoleFraction(lPhaseIdx, BrineIdx,
1.0 - fs.moleFraction(lPhaseIdx, CO2Idx));
fs.setMoleFraction(liquidPhaseIdx, CO2Idx, 0.005);
fs.setMoleFraction(liquidPhaseIdx, BrineIdx,
1.0 - fs.moleFraction(liquidPhaseIdx, CO2Idx));
typename FluidSystem::ParameterCache paramCache;
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
CFRP::solve(fs, paramCache,
/*refPhaseIdx=*/lPhaseIdx,
/*refPhaseIdx=*/liquidPhaseIdx,
/*setViscosity=*/true,
/*setEnthalpy=*/true);
}
@ -586,8 +586,8 @@ private:
* std::pow(lambdaWater, poro);
Scalar lambdaDry = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(gPhaseIdx, lambdaDry);
params.setFullySaturatedLambda(lPhaseIdx, lambdaWet);
params.setFullySaturatedLambda(gasPhaseIdx, lambdaDry);
params.setFullySaturatedLambda(liquidPhaseIdx, lambdaWet);
params.setVacuumLambda(lambdaDry);
}

View File

@ -81,9 +81,9 @@ private:
typedef Opm::ThreePhaseMaterialTraits<
Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gPhaseIdx> Traits;
/*wettingPhaseIdx=*/FluidSystem::waterPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::naplPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gasPhaseIdx> Traits;
public:
typedef Opm::ThreePhaseParkerVanGenuchten<Traits> type;
@ -163,9 +163,9 @@ class CuvetteProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { numPhases = FluidSystem::numPhases };
enum { numComponents = FluidSystem::numComponents };
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
enum { naplPhaseIdx = FluidSystem::naplPhaseIdx };
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
enum { H2OIdx = FluidSystem::H2OIdx };
enum { airIdx = FluidSystem::airIdx };
enum { NAPLIdx = FluidSystem::NAPLIdx };
@ -229,28 +229,28 @@ public:
coarseMaterialParams_.setSgr(0.0101);
#else
// linear material law
fineMaterialParams_.setPcMinSat(gPhaseIdx, 0);
fineMaterialParams_.setPcMaxSat(gPhaseIdx, 0);
fineMaterialParams_.setPcMinSat(nPhaseIdx, 0);
fineMaterialParams_.setPcMaxSat(nPhaseIdx, -1000);
fineMaterialParams_.setPcMinSat(wPhaseIdx, 0);
fineMaterialParams_.setPcMaxSat(wPhaseIdx, -10000);
fineMaterialParams_.setPcMinSat(gasPhaseIdx, 0);
fineMaterialParams_.setPcMaxSat(gasPhaseIdx, 0);
fineMaterialParams_.setPcMinSat(naplPhaseIdx, 0);
fineMaterialParams_.setPcMaxSat(naplPhaseIdx, -1000);
fineMaterialParams_.setPcMinSat(waterPhaseIdx, 0);
fineMaterialParams_.setPcMaxSat(waterPhaseIdx, -10000);
coarseMaterialParams_.setPcMinSat(gPhaseIdx, 0);
coarseMaterialParams_.setPcMaxSat(gPhaseIdx, 0);
coarseMaterialParams_.setPcMinSat(nPhaseIdx, 0);
coarseMaterialParams_.setPcMaxSat(nPhaseIdx, -100);
coarseMaterialParams_.setPcMinSat(wPhaseIdx, 0);
coarseMaterialParams_.setPcMaxSat(wPhaseIdx, -1000);
coarseMaterialParams_.setPcMinSat(gasPhaseIdx, 0);
coarseMaterialParams_.setPcMaxSat(gasPhaseIdx, 0);
coarseMaterialParams_.setPcMinSat(naplPhaseIdx, 0);
coarseMaterialParams_.setPcMaxSat(naplPhaseIdx, -100);
coarseMaterialParams_.setPcMinSat(waterPhaseIdx, 0);
coarseMaterialParams_.setPcMaxSat(waterPhaseIdx, -1000);
// residual saturations
fineMaterialParams_.setResidSat(wPhaseIdx, 0.1201);
fineMaterialParams_.setResidSat(nPhaseIdx, 0.0701);
fineMaterialParams_.setResidSat(gPhaseIdx, 0.0101);
fineMaterialParams_.setResidSat(waterPhaseIdx, 0.1201);
fineMaterialParams_.setResidSat(naplPhaseIdx, 0.0701);
fineMaterialParams_.setResidSat(gasPhaseIdx, 0.0101);
coarseMaterialParams_.setResidSat(wPhaseIdx, 0.1201);
coarseMaterialParams_.setResidSat(nPhaseIdx, 0.0701);
coarseMaterialParams_.setResidSat(gPhaseIdx, 0.0101);
coarseMaterialParams_.setResidSat(waterPhaseIdx, 0.1201);
coarseMaterialParams_.setResidSat(naplPhaseIdx, 0.0701);
coarseMaterialParams_.setResidSat(gasPhaseIdx, 0.0101);
#endif
fineMaterialParams_.finalize();
@ -388,16 +388,16 @@ public:
for (int compIdx = 0; compIdx < numComponents; ++compIdx)
molarRate[conti0EqIdx + compIdx]
= -molarInjectionRate
* injectFluidState_.moleFraction(gPhaseIdx, compIdx);
* injectFluidState_.moleFraction(gasPhaseIdx, compIdx);
// calculate the total mass injection rate [kg / (m^2 s)
Scalar massInjectionRate
= molarInjectionRate
* injectFluidState_.averageMolarMass(gPhaseIdx);
* injectFluidState_.averageMolarMass(gasPhaseIdx);
// set the boundary rate vector
values.setMolarRate(molarRate);
values.setEnthalpyRate(-injectFluidState_.enthalpy(gPhaseIdx)
values.setEnthalpyRate(-injectFluidState_.enthalpy(gasPhaseIdx)
* massInjectionRate); // [J / (m^2 s)]
}
else
@ -479,9 +479,9 @@ private:
Scalar pw = 1e5;
if (isContaminated_(pos)) {
fs.setSaturation(wPhaseIdx, 0.12);
fs.setSaturation(nPhaseIdx, 0.07);
fs.setSaturation(gPhaseIdx, 1 - 0.12 - 0.07);
fs.setSaturation(waterPhaseIdx, 0.12);
fs.setSaturation(naplPhaseIdx, 0.07);
fs.setSaturation(gasPhaseIdx, 1 - 0.12 - 0.07);
// set the capillary pressures
const auto &matParams
@ -489,7 +489,7 @@ private:
Scalar pc[numPhases];
MaterialLaw::capillaryPressures(pc, matParams, fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, pw + (pc[phaseIdx] - pc[wPhaseIdx]));
fs.setPressure(phaseIdx, pw + (pc[phaseIdx] - pc[waterPhaseIdx]));
// compute the phase compositions
typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MMPC;
@ -498,9 +498,9 @@ private:
/*setEnthalpy=*/true);
}
else {
fs.setSaturation(wPhaseIdx, 0.12);
fs.setSaturation(gPhaseIdx, 1 - fs.saturation(wPhaseIdx));
fs.setSaturation(nPhaseIdx, 0);
fs.setSaturation(waterPhaseIdx, 0.12);
fs.setSaturation(gasPhaseIdx, 1 - fs.saturation(waterPhaseIdx));
fs.setSaturation(naplPhaseIdx, 0);
// set the capillary pressures
const auto &matParams
@ -508,7 +508,7 @@ private:
Scalar pc[numPhases];
MaterialLaw::capillaryPressures(pc, matParams, fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, pw + (pc[phaseIdx] - pc[wPhaseIdx]));
fs.setPressure(phaseIdx, pw + (pc[phaseIdx] - pc[waterPhaseIdx]));
// compute the phase compositions
typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MMPC;
@ -521,7 +521,7 @@ private:
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
fs.setMoleFraction(phaseIdx, NAPLIdx, 0.0);
if (phaseIdx == nPhaseIdx)
if (phaseIdx == naplPhaseIdx)
continue;
Scalar sumx = 0;
@ -573,21 +573,21 @@ private:
void initInjectFluidState_()
{
injectFluidState_.setTemperature(383.0); // [K]
injectFluidState_.setPressure(gPhaseIdx, 1e5); // [Pa]
injectFluidState_.setSaturation(gPhaseIdx, 1.0); // [-]
injectFluidState_.setPressure(gasPhaseIdx, 1e5); // [Pa]
injectFluidState_.setSaturation(gasPhaseIdx, 1.0); // [-]
Scalar xgH2O = 0.417;
injectFluidState_.setMoleFraction(gPhaseIdx, H2OIdx, xgH2O); // [-]
injectFluidState_.setMoleFraction(gPhaseIdx, airIdx, 1 - xgH2O); // [-]
injectFluidState_.setMoleFraction(gPhaseIdx, NAPLIdx, 0.0); // [-]
injectFluidState_.setMoleFraction(gasPhaseIdx, H2OIdx, xgH2O); // [-]
injectFluidState_.setMoleFraction(gasPhaseIdx, airIdx, 1 - xgH2O); // [-]
injectFluidState_.setMoleFraction(gasPhaseIdx, NAPLIdx, 0.0); // [-]
// set the specific enthalpy of the gas phase
typename FluidSystem::ParameterCache paramCache;
paramCache.updatePhase(injectFluidState_, gPhaseIdx);
paramCache.updatePhase(injectFluidState_, gasPhaseIdx);
Scalar h
= FluidSystem::enthalpy(injectFluidState_, paramCache, gPhaseIdx);
injectFluidState_.setEnthalpy(gPhaseIdx, h);
= FluidSystem::enthalpy(injectFluidState_, paramCache, gasPhaseIdx);
injectFluidState_.setEnthalpy(gasPhaseIdx, h);
}
DimMatrix fineK_;

View File

@ -81,8 +81,8 @@ private:
"for this problem!");
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
/*wettingPhaseIdx=*/FluidSystem::liquidPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gasPhaseIdx>
Traits;
public:
@ -140,8 +140,8 @@ class DiffusionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
numPhases = FluidSystem::numPhases,
// phase indices
lPhaseIdx = FluidSystem::lPhaseIdx,
gPhaseIdx = FluidSystem::gPhaseIdx,
liquidPhaseIdx = FluidSystem::liquidPhaseIdx,
gasPhaseIdx = FluidSystem::gasPhaseIdx,
// component indices
H2OIdx = FluidSystem::H2OIdx,
@ -296,28 +296,28 @@ private:
leftInitialFluidState_.setTemperature(temperature_);
Scalar Sl = 0.0;
leftInitialFluidState_.setSaturation(lPhaseIdx, Sl);
leftInitialFluidState_.setSaturation(gPhaseIdx, 1 - Sl);
leftInitialFluidState_.setSaturation(liquidPhaseIdx, Sl);
leftInitialFluidState_.setSaturation(gasPhaseIdx, 1 - Sl);
Scalar p = 1e5;
leftInitialFluidState_.setPressure(lPhaseIdx, p);
leftInitialFluidState_.setPressure(gPhaseIdx, p);
leftInitialFluidState_.setPressure(liquidPhaseIdx, p);
leftInitialFluidState_.setPressure(gasPhaseIdx, p);
Scalar xH2O = 0.01;
leftInitialFluidState_.setMoleFraction(gPhaseIdx, H2OIdx, xH2O);
leftInitialFluidState_.setMoleFraction(gPhaseIdx, N2Idx, 1 - xH2O);
leftInitialFluidState_.setMoleFraction(gasPhaseIdx, H2OIdx, xH2O);
leftInitialFluidState_.setMoleFraction(gasPhaseIdx, N2Idx, 1 - xH2O);
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
typename FluidSystem::ParameterCache paramCache;
CFRP::solve(leftInitialFluidState_, paramCache, gPhaseIdx,
CFRP::solve(leftInitialFluidState_, paramCache, gasPhaseIdx,
/*setViscosity=*/false, /*setEnthalpy=*/false);
// create the initial fluid state for the right half of the domain
rightInitialFluidState_.assign(leftInitialFluidState_);
xH2O = 0.0;
rightInitialFluidState_.setMoleFraction(gPhaseIdx, H2OIdx, xH2O);
rightInitialFluidState_.setMoleFraction(gPhaseIdx, N2Idx, 1 - xH2O);
CFRP::solve(rightInitialFluidState_, paramCache, gPhaseIdx,
rightInitialFluidState_.setMoleFraction(gasPhaseIdx, H2OIdx, xH2O);
rightInitialFluidState_.setMoleFraction(gasPhaseIdx, N2Idx, 1 - xH2O);
CFRP::solve(rightInitialFluidState_, paramCache, gasPhaseIdx,
/*setViscosity=*/false, /*setEnthalpy=*/false);
}

View File

@ -94,8 +94,8 @@ SET_PROP(FingerBaseProblem, MaterialLaw)
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
/*wettingPhaseIdx=*/FluidSystem::wettingPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nonWettingPhaseIdx>
Traits;
// use the parker-lenhard hysteresis law
@ -171,11 +171,11 @@ class FingerProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
// number of phases
// phase indices
wPhaseIdx = FluidSystem::wPhaseIdx,
nPhaseIdx = FluidSystem::nPhaseIdx,
wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
// equation indices
contiWEqIdx = Indices::conti0EqIdx + wPhaseIdx,
contiWettingEqIdx = Indices::conti0EqIdx + wettingPhaseIdx,
// Grid and world dimension
dim = GridView::dimension,
@ -364,7 +364,7 @@ public:
// override the value for the liquid phase by forced
// imbibition of water on inlet boundary segments
if (onInlet_(pos)) {
values[contiWEqIdx] = -0.001; // [kg/(m^2 s)]
values[contiWettingEqIdx] = -0.001; // [kg/(m^2 s)]
}
}
@ -451,18 +451,18 @@ private:
void setupInitialFluidState_()
{
auto &fs = initialFluidState_;
fs.setPressure(wPhaseIdx, /*pressure=*/1e5);
fs.setPressure(wettingPhaseIdx, /*pressure=*/1e5);
Scalar Sw = EWOMS_GET_PARAM(TypeTag, Scalar, InitialWaterSaturation);
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1 - Sw);
fs.setTemperature(temperature_);
// set the absolute pressures
Scalar pn = 1e5;
fs.setPressure(nPhaseIdx, pn);
fs.setPressure(wPhaseIdx, pn);
fs.setPressure(nonWettingPhaseIdx, pn);
fs.setPressure(wettingPhaseIdx, pn);
}
DimMatrix K_;

View File

@ -95,13 +95,13 @@ SET_PROP(FractureProblem, MaterialLaw)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
/*wettingPhaseIdx=*/FluidSystem::wettingPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nonWettingPhaseIdx>
Traits;
// define the material law which is parameterized by effective
@ -180,8 +180,8 @@ class FractureProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
enum {
// phase indices
wPhaseIdx = MaterialLaw::wPhaseIdx,
nPhaseIdx = MaterialLaw::nPhaseIdx,
wettingPhaseIdx = MaterialLaw::wettingPhaseIdx,
nonWettingPhaseIdx = MaterialLaw::nonWettingPhaseIdx,
// number of phases
numPhases = FluidSystem::numPhases,
@ -222,10 +222,10 @@ public:
eps_ = 3e-6;
temperature_ = 273.15 + 20; // -> 20°C
matrixMaterialParams_.setResidualSaturation(wPhaseIdx, 0.0);
matrixMaterialParams_.setResidualSaturation(nPhaseIdx, 0.0);
fractureMaterialParams_.setResidualSaturation(wPhaseIdx, 0.0);
fractureMaterialParams_.setResidualSaturation(nPhaseIdx, 0.0);
matrixMaterialParams_.setResidualSaturation(wettingPhaseIdx, 0.0);
matrixMaterialParams_.setResidualSaturation(nonWettingPhaseIdx, 0.0);
fractureMaterialParams_.setResidualSaturation(wettingPhaseIdx, 0.0);
fractureMaterialParams_.setResidualSaturation(nonWettingPhaseIdx, 0.0);
#if 0 // linear
matrixMaterialParams_.setEntryPC(0.0);
@ -430,12 +430,12 @@ public:
FluidState fluidState;
fluidState.setTemperature(temperature_);
fluidState.setSaturation(wPhaseIdx, 0.0);
fluidState.setSaturation(nPhaseIdx,
1.0 - fluidState.saturation(wPhaseIdx));
fluidState.setSaturation(wettingPhaseIdx, 0.0);
fluidState.setSaturation(nonWettingPhaseIdx,
1.0 - fluidState.saturation(wettingPhaseIdx));
fluidState.setPressure(wPhaseIdx, 1e5);
fluidState.setPressure(nPhaseIdx, fluidState.pressure(wPhaseIdx));
fluidState.setPressure(wettingPhaseIdx, 1e5);
fluidState.setPressure(nonWettingPhaseIdx, fluidState.pressure(wettingPhaseIdx));
// set a free flow (i.e. Dirichlet) boundary
values.setFreeFlow(context, spaceIdx, timeIdx, fluidState);
@ -479,20 +479,20 @@ public:
FluidState fractureFluidState;
fractureFluidState.setTemperature(temperature_ + 10);
fractureFluidState.setSaturation(wPhaseIdx, 1.0);
fractureFluidState.setSaturation(nPhaseIdx,
fractureFluidState.setSaturation(wettingPhaseIdx, 1.0);
fractureFluidState.setSaturation(nonWettingPhaseIdx,
1.0 - fractureFluidState.saturation(
wPhaseIdx));
wettingPhaseIdx));
Scalar pCFracture[numPhases];
MaterialLaw::capillaryPressures(pCFracture, fractureMaterialParams_,
fractureFluidState);
fractureFluidState.setPressure(wPhaseIdx, /*pressure=*/1.0e5);
fractureFluidState.setPressure(nPhaseIdx,
fractureFluidState.pressure(wPhaseIdx)
+ (pCFracture[nPhaseIdx]
- pCFracture[wPhaseIdx]));
fractureFluidState.setPressure(wettingPhaseIdx, /*pressure=*/1.0e5);
fractureFluidState.setPressure(nonWettingPhaseIdx,
fractureFluidState.pressure(wettingPhaseIdx)
+ (pCFracture[nonWettingPhaseIdx]
- pCFracture[wettingPhaseIdx]));
constraints.setAllConstraint();
constraints.assignNaiveFromFracture(fractureFluidState,
@ -508,12 +508,12 @@ public:
{
FluidState fluidState;
fluidState.setTemperature(temperature_);
fluidState.setPressure(FluidSystem::wPhaseIdx, /*pressure=*/1e5);
fluidState.setPressure(nPhaseIdx, fluidState.pressure(wPhaseIdx));
fluidState.setPressure(FluidSystem::wettingPhaseIdx, /*pressure=*/1e5);
fluidState.setPressure(nonWettingPhaseIdx, fluidState.pressure(wettingPhaseIdx));
fluidState.setSaturation(wPhaseIdx, 0.0);
fluidState.setSaturation(nPhaseIdx,
1.0 - fluidState.saturation(wPhaseIdx));
fluidState.setSaturation(wettingPhaseIdx, 0.0);
fluidState.setSaturation(nonWettingPhaseIdx,
1.0 - fluidState.saturation(wettingPhaseIdx));
values.assignNaive(fluidState);
}

View File

@ -82,9 +82,9 @@ private:
typedef Opm::ThreePhaseMaterialTraits<
Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gPhaseIdx> Traits;
/*wettingPhaseIdx=*/FluidSystem::waterPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::naplPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gasPhaseIdx> Traits;
public:
typedef Opm::ThreePhaseParkerVanGenuchten<Traits> type;
@ -168,9 +168,9 @@ class InfiltrationProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
airIdx = FluidSystem::airIdx,
// phase indices
wPhaseIdx = FluidSystem::wPhaseIdx,
gPhaseIdx = FluidSystem::gPhaseIdx,
nPhaseIdx = FluidSystem::nPhaseIdx,
waterPhaseIdx = FluidSystem::waterPhaseIdx,
gasPhaseIdx = FluidSystem::gasPhaseIdx,
naplPhaseIdx = FluidSystem::naplPhaseIdx,
// Grid and world dimension
dim = GridView::dimension,
@ -409,9 +409,9 @@ private:
Valgrind::CheckDefined(Sw);
Valgrind::CheckDefined(Sg);
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(gPhaseIdx, Sg);
fs.setSaturation(nPhaseIdx, 0);
fs.setSaturation(waterPhaseIdx, Sw);
fs.setSaturation(gasPhaseIdx, Sg);
fs.setSaturation(naplPhaseIdx, 0);
// set temperature of all phases
fs.setTemperature(temperature_);
@ -423,22 +423,22 @@ private:
pg += 10e3;
MaterialLaw::capillaryPressures(pcAll, matParams, fs);
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, pg + (pcAll[phaseIdx] - pcAll[gPhaseIdx]));
fs.setPressure(phaseIdx, pg + (pcAll[phaseIdx] - pcAll[gasPhaseIdx]));
// set composition of gas phase
fs.setMoleFraction(gPhaseIdx, H2OIdx, 1e-6);
fs.setMoleFraction(gPhaseIdx, airIdx,
1 - fs.moleFraction(gPhaseIdx, H2OIdx));
fs.setMoleFraction(gPhaseIdx, NAPLIdx, 0);
fs.setMoleFraction(gasPhaseIdx, H2OIdx, 1e-6);
fs.setMoleFraction(gasPhaseIdx, airIdx,
1 - fs.moleFraction(gasPhaseIdx, H2OIdx));
fs.setMoleFraction(gasPhaseIdx, NAPLIdx, 0);
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
typename FluidSystem::ParameterCache paramCache;
CFRP::solve(fs, paramCache, gPhaseIdx,
CFRP::solve(fs, paramCache, gasPhaseIdx,
/*setViscosity=*/false,
/*setEnthalpy=*/false);
fs.setMoleFraction(wPhaseIdx, H2OIdx,
1 - fs.moleFraction(wPhaseIdx, H2OIdx));
fs.setMoleFraction(waterPhaseIdx, H2OIdx,
1 - fs.moleFraction(waterPhaseIdx, H2OIdx));
}
bool isFineMaterial_(const GlobalPosition &pos) const

View File

@ -98,13 +98,13 @@ SET_PROP(LensBaseProblem, MaterialLaw)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
/*wettingPhaseIdx=*/FluidSystem::wettingPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nonWettingPhaseIdx>
Traits;
// define the material law which is parameterized by effective
@ -197,11 +197,11 @@ class LensProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
numPhases = FluidSystem::numPhases,
// phase indices
wPhaseIdx = FluidSystem::wPhaseIdx,
nPhaseIdx = FluidSystem::nPhaseIdx,
wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
// equation indices
contiNEqIdx = Indices::conti0EqIdx + nPhaseIdx,
contiNEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx,
// Grid and world dimension
dim = GridView::dimension,
@ -423,14 +423,14 @@ public:
Opm::ImmiscibleFluidState<Scalar, FluidSystem,
/*storeEnthalpy=*/false> fs;
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1 - Sw);
fs.setTemperature(T);
Scalar pC[numPhases];
MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(wPhaseIdx, pw);
fs.setPressure(nPhaseIdx, pw + pC[nPhaseIdx] - pC[wPhaseIdx]);
fs.setPressure(wettingPhaseIdx, pw);
fs.setPressure(nonWettingPhaseIdx, pw + pC[nonWettingPhaseIdx] - pC[wettingPhaseIdx]);
// impose an freeflow boundary condition
values.setFreeFlow(context, spaceIdx, timeIdx, fs);
@ -467,17 +467,17 @@ public:
Scalar depth = this->boundingBoxMax()[1] - pos[1];
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
fs.setPressure(wPhaseIdx, /*pressure=*/1e5);
fs.setPressure(wettingPhaseIdx, /*pressure=*/1e5);
Scalar Sw = 1.0;
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1 - Sw);
fs.setTemperature(temperature_);
typename FluidSystem::ParameterCache paramCache;
paramCache.updatePhase(fs, wPhaseIdx);
Scalar densityW = FluidSystem::density(fs, paramCache, wPhaseIdx);
paramCache.updatePhase(fs, wettingPhaseIdx);
Scalar densityW = FluidSystem::density(fs, paramCache, wettingPhaseIdx);
// hydrostatic pressure (assuming incompressibility)
Scalar pw = 1e5 - densityW * this->gravity()[1] * depth;
@ -489,8 +489,8 @@ public:
MaterialLaw::capillaryPressures(pC, matParams, fs);
// make a full fluid state
fs.setPressure(wPhaseIdx, pw);
fs.setPressure(nPhaseIdx, pw + (pC[wPhaseIdx] - pC[nPhaseIdx]));
fs.setPressure(wettingPhaseIdx, pw);
fs.setPressure(nonWettingPhaseIdx, pw + (pC[wettingPhaseIdx] - pC[nonWettingPhaseIdx]));
// assign the primary variables
values.assignNaive(fs);

View File

@ -72,8 +72,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx>
/*wettingPhaseIdx=*/FluidSystem::liquidPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gasPhaseIdx>
MaterialTraits;
typedef Opm::LinearMaterial<MaterialTraits> EffMaterialLaw;
@ -156,8 +156,8 @@ class ObstacleProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
dim = GridView::dimension,
dimWorld = GridView::dimensionworld,
numPhases = GET_PROP_VALUE(TypeTag, NumPhases),
gPhaseIdx = FluidSystem::gPhaseIdx,
lPhaseIdx = FluidSystem::lPhaseIdx,
gasPhaseIdx = FluidSystem::gasPhaseIdx,
liquidPhaseIdx = FluidSystem::liquidPhaseIdx,
H2OIdx = FluidSystem::H2OIdx,
N2Idx = FluidSystem::N2Idx
};
@ -204,17 +204,17 @@ public:
coarsePorosity_ = 0.3;
// residual saturations
fineMaterialParams_.setResidualSaturation(lPhaseIdx, 0.0);
fineMaterialParams_.setResidualSaturation(gPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(lPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(gPhaseIdx, 0.0);
fineMaterialParams_.setResidualSaturation(liquidPhaseIdx, 0.0);
fineMaterialParams_.setResidualSaturation(gasPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(liquidPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(gasPhaseIdx, 0.0);
// parameters for the linear law, i.e. minimum and maximum
// pressures
fineMaterialParams_.setPcMinSat(lPhaseIdx, 0.0);
fineMaterialParams_.setPcMaxSat(lPhaseIdx, 0.0);
coarseMaterialParams_.setPcMinSat(lPhaseIdx, 0.0);
coarseMaterialParams_.setPcMaxSat(lPhaseIdx, 0.0);
fineMaterialParams_.setPcMinSat(liquidPhaseIdx, 0.0);
fineMaterialParams_.setPcMaxSat(liquidPhaseIdx, 0.0);
coarseMaterialParams_.setPcMinSat(liquidPhaseIdx, 0.0);
coarseMaterialParams_.setPcMaxSat(liquidPhaseIdx, 0.0);
/*
// entry pressures for Brooks-Corey
@ -452,33 +452,33 @@ private:
if (isInlet) {
// only liquid on inlet
refPhaseIdx = lPhaseIdx;
otherPhaseIdx = gPhaseIdx;
refPhaseIdx = liquidPhaseIdx;
otherPhaseIdx = gasPhaseIdx;
// set liquid saturation
fs.setSaturation(lPhaseIdx, 1.0);
fs.setSaturation(liquidPhaseIdx, 1.0);
// set pressure of the liquid phase
fs.setPressure(lPhaseIdx, 2e5);
fs.setPressure(liquidPhaseIdx, 2e5);
// set the liquid composition to pure water
fs.setMoleFraction(lPhaseIdx, N2Idx, 0.0);
fs.setMoleFraction(lPhaseIdx, H2OIdx, 1.0);
fs.setMoleFraction(liquidPhaseIdx, N2Idx, 0.0);
fs.setMoleFraction(liquidPhaseIdx, H2OIdx, 1.0);
}
else {
// elsewhere, only gas
refPhaseIdx = gPhaseIdx;
otherPhaseIdx = lPhaseIdx;
refPhaseIdx = gasPhaseIdx;
otherPhaseIdx = liquidPhaseIdx;
// set gas saturation
fs.setSaturation(gPhaseIdx, 1.0);
fs.setSaturation(gasPhaseIdx, 1.0);
// set pressure of the gas phase
fs.setPressure(gPhaseIdx, 1e5);
fs.setPressure(gasPhaseIdx, 1e5);
// set the gas composition to 99% nitrogen and 1% steam
fs.setMoleFraction(gPhaseIdx, N2Idx, 0.99);
fs.setMoleFraction(gPhaseIdx, H2OIdx, 0.01);
fs.setMoleFraction(gasPhaseIdx, N2Idx, 0.99);
fs.setMoleFraction(gasPhaseIdx, H2OIdx, 0.01);
};
// set the other saturation
@ -510,8 +510,8 @@ private:
* std::pow(lambdaWater, poro);
Scalar lambdaDry = std::pow(lambdaGranite, (1 - poro));
params.setFullySaturatedLambda(gPhaseIdx, lambdaDry);
params.setFullySaturatedLambda(lPhaseIdx, lambdaWet);
params.setFullySaturatedLambda(gasPhaseIdx, lambdaDry);
params.setFullySaturatedLambda(liquidPhaseIdx, lambdaWet);
params.setVacuumLambda(lambdaDry);
}

View File

@ -90,14 +90,14 @@ SET_PROP(PowerInjectionBaseProblem, MaterialLaw)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
/*wettingPhaseIdx=*/FluidSystem::wettingPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nonWettingPhaseIdx>
Traits;
// define the material law which is parameterized by effective
// saturations
@ -165,11 +165,11 @@ class PowerInjectionProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
// number of phases
// phase indices
wPhaseIdx = FluidSystem::wPhaseIdx,
nPhaseIdx = FluidSystem::nPhaseIdx,
wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
// equation indices
contiNEqIdx = Indices::conti0EqIdx + nPhaseIdx,
contiNEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx,
// Grid and world dimension
dim = GridView::dimension,
@ -368,12 +368,12 @@ private:
initialFluidState_.setTemperature(temperature_);
Scalar Sw = 1.0;
initialFluidState_.setSaturation(wPhaseIdx, Sw);
initialFluidState_.setSaturation(nPhaseIdx, 1 - Sw);
initialFluidState_.setSaturation(wettingPhaseIdx, Sw);
initialFluidState_.setSaturation(nonWettingPhaseIdx, 1 - Sw);
Scalar p = 1e5;
initialFluidState_.setPressure(wPhaseIdx, p);
initialFluidState_.setPressure(nPhaseIdx, p);
initialFluidState_.setPressure(wettingPhaseIdx, p);
initialFluidState_.setPressure(nonWettingPhaseIdx, p);
}
DimMatrix K_;

View File

@ -72,9 +72,9 @@ private:
typedef Opm::
ThreePhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::oPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gPhaseIdx> Traits;
/*wettingPhaseIdx=*/FluidSystem::waterPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::oilPhaseIdx,
/*gasPhaseIdx=*/FluidSystem::gasPhaseIdx> Traits;
public:
typedef Opm::LinearMaterial<Traits> type;
@ -143,12 +143,12 @@ class ReservoirProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
// copy some indices for convenience
enum { numPhases = FluidSystem::numPhases };
enum { numComponents = FluidSystem::numComponents };
enum { gPhaseIdx = FluidSystem::gPhaseIdx };
enum { oPhaseIdx = FluidSystem::oPhaseIdx };
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { gCompIdx = FluidSystem::gCompIdx };
enum { oCompIdx = FluidSystem::oCompIdx };
enum { wCompIdx = FluidSystem::wCompIdx };
enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
enum { gasCompIdx = FluidSystem::gasCompIdx };
enum { oilCompIdx = FluidSystem::oilCompIdx };
enum { waterCompIdx = FluidSystem::waterCompIdx };
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
@ -426,12 +426,12 @@ public:
auto fs = initialFluidState_;
Scalar pInj = pReservoir_ * 1.5;
fs.setPressure(wPhaseIdx, pInj);
fs.setPressure(oPhaseIdx, pInj);
fs.setPressure(gPhaseIdx, pInj);
fs.setSaturation(wPhaseIdx, 1.0);
fs.setSaturation(oPhaseIdx, 0.0);
fs.setSaturation(gPhaseIdx, 0.0);
fs.setPressure(waterPhaseIdx, pInj);
fs.setPressure(oilPhaseIdx, pInj);
fs.setPressure(gasPhaseIdx, pInj);
fs.setSaturation(waterPhaseIdx, 1.0);
fs.setSaturation(oilPhaseIdx, 0.0);
fs.setSaturation(gasPhaseIdx, 0.0);
// set the compositions to only water
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
@ -441,11 +441,11 @@ public:
// set the composition of the oil phase to the initial
// composition
for (int compIdx = 0; compIdx < numComponents; ++compIdx)
fs.setMoleFraction(oPhaseIdx, compIdx,
initialFluidState_.moleFraction(oPhaseIdx,
fs.setMoleFraction(oilPhaseIdx, compIdx,
initialFluidState_.moleFraction(oilPhaseIdx,
compIdx));
fs.setMoleFraction(wPhaseIdx, wCompIdx, 1.0);
fs.setMoleFraction(waterPhaseIdx, waterCompIdx, 1.0);
constraints.setAllConstraint();
constraints.assignNaive(fs);
@ -455,12 +455,12 @@ public:
auto fs = initialFluidState_;
Scalar pProd = pReservoir_ / 1.5;
fs.setPressure(wPhaseIdx, pProd);
fs.setPressure(oPhaseIdx, pProd);
fs.setPressure(gPhaseIdx, pProd);
fs.setSaturation(wPhaseIdx, 0.0);
fs.setSaturation(oPhaseIdx, 1.0);
fs.setSaturation(gPhaseIdx, 0.0);
fs.setPressure(waterPhaseIdx, pProd);
fs.setPressure(oilPhaseIdx, pProd);
fs.setPressure(gasPhaseIdx, pProd);
fs.setSaturation(waterPhaseIdx, 0.0);
fs.setSaturation(oilPhaseIdx, 1.0);
fs.setSaturation(gasPhaseIdx, 0.0);
// set the compositions to the initial composition
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
@ -499,9 +499,9 @@ private:
//////
// set saturations
//////
fs.setSaturation(FluidSystem::oPhaseIdx, 1.0);
fs.setSaturation(FluidSystem::wPhaseIdx, 0.0);
fs.setSaturation(FluidSystem::gPhaseIdx, 0.0);
fs.setSaturation(FluidSystem::oilPhaseIdx, 1.0);
fs.setSaturation(FluidSystem::waterPhaseIdx, 0.0);
fs.setSaturation(FluidSystem::gasPhaseIdx, 0.0);
//////
// set pressures
@ -512,9 +512,9 @@ private:
const auto &matParams = fineMaterialParams_;
MaterialLaw::capillaryPressures(pC, matParams, fs);
fs.setPressure(oPhaseIdx, pw + (pC[oPhaseIdx] - pC[wPhaseIdx]));
fs.setPressure(wPhaseIdx, pw + (pC[wPhaseIdx] - pC[wPhaseIdx]));
fs.setPressure(gPhaseIdx, pw + (pC[gPhaseIdx] - pC[wPhaseIdx]));
fs.setPressure(oilPhaseIdx, pw + (pC[oilPhaseIdx] - pC[waterPhaseIdx]));
fs.setPressure(waterPhaseIdx, pw + (pC[waterPhaseIdx] - pC[waterPhaseIdx]));
fs.setPressure(gasPhaseIdx, pw + (pC[gasPhaseIdx] - pC[waterPhaseIdx]));
// reset all mole fractions to 0
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
@ -524,8 +524,8 @@ private:
//////
// set composition of the gas and water phases
//////
fs.setMoleFraction(wPhaseIdx, wCompIdx, 1.0);
fs.setMoleFraction(gPhaseIdx, gCompIdx, 1.0);
fs.setMoleFraction(waterPhaseIdx, waterCompIdx, 1.0);
fs.setMoleFraction(gasPhaseIdx, gasCompIdx, 1.0);
//////
// set composition of the oil phase
@ -536,23 +536,23 @@ private:
Scalar pSat = pReservoir_; // the saturation pressure of the oil
Scalar Bo = FluidSystem::oilFormationVolumeFactor(pSat);
Scalar Rs = FluidSystem::gasDissolutionFactor(pSat);
Scalar rhoo = FluidSystem::surfaceDensity(oPhaseIdx) / Bo;
Scalar rhogref = FluidSystem::surfaceDensity(gPhaseIdx);
Scalar rhoo = FluidSystem::surfaceDensity(oilPhaseIdx) / Bo;
Scalar rhogref = FluidSystem::surfaceDensity(gasPhaseIdx);
// calculate composition of oil phase in terms of mass
// fractions.
Scalar XoG = Rs * rhogref / rhoo;
// convert mass to mole fractions
Scalar MG = FluidSystem::molarMass(gCompIdx);
Scalar MO = FluidSystem::molarMass(oCompIdx);
Scalar MG = FluidSystem::molarMass(gasCompIdx);
Scalar MO = FluidSystem::molarMass(oilCompIdx);
Scalar xoG = XoG * MO / ((MO - MG) * XoG + MG);
Scalar xoO = 1 - xoG;
// finally set the oil-phase composition
fs.setMoleFraction(oPhaseIdx, gCompIdx, xoG);
fs.setMoleFraction(oPhaseIdx, oCompIdx, xoO);
fs.setMoleFraction(oilPhaseIdx, gasCompIdx, xoG);
fs.setMoleFraction(oilPhaseIdx, oilCompIdx, xoO);
}
bool onLeftBoundary_(const GlobalPosition &pos) const

View File

@ -72,14 +72,14 @@ SET_PROP(RichardsLensProblem, MaterialLaw)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx>
Traits;
/*wettingPhaseIdx=*/FluidSystem::wettingPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nonWettingPhaseIdx>
Traits;
// define the material law which is parameterized by effective
// saturations
@ -158,8 +158,8 @@ class RichardsLensProblem : public GET_PROP_TYPE(TypeTag, BaseProblem)
// copy some indices for convenience
pressureWIdx = Indices::pressureWIdx,
contiWEqIdx = Indices::contiWEqIdx,
wPhaseIdx = GET_PROP_VALUE(TypeTag, LiquidPhaseIndex),
nPhaseIdx = 1 - wPhaseIdx,
wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
numPhases = FluidSystem::numPhases,
// Grid and world dimension
@ -303,13 +303,13 @@ public:
Scalar Sw = 0.0;
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1.0 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1.0 - Sw);
PhaseVector pC;
MaterialLaw::capillaryPressures(pC, materialParams, fs);
fs.setPressure(wPhaseIdx, pnRef_ + pC[wPhaseIdx] - pC[nPhaseIdx]);
fs.setPressure(nPhaseIdx, pnRef_);
fs.setPressure(wettingPhaseIdx, pnRef_ + pC[wettingPhaseIdx] - pC[nonWettingPhaseIdx]);
fs.setPressure(nonWettingPhaseIdx, pnRef_);
values.setFreeFlow(context, spaceIdx, timeIdx, fs);
}
@ -344,12 +344,12 @@ public:
Scalar Sw = 0.0;
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1.0 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1.0 - Sw);
PhaseVector pC;
MaterialLaw::capillaryPressures(pC, materialParams, fs);
values[pressureWIdx] = pnRef_ + (pC[wPhaseIdx] - pC[nPhaseIdx]);
values[pressureWIdx] = pnRef_ + (pC[wettingPhaseIdx] - pC[nonWettingPhaseIdx]);
}
/*!

View File

@ -55,7 +55,7 @@ SET_TYPE_PROP(Stokes2cTestProblem, FluidSystem,
//! Select the phase to be considered
SET_INT_PROP(Stokes2cTestProblem, StokesPhaseIndex,
GET_PROP_TYPE(TypeTag, FluidSystem)::gPhaseIdx);
GET_PROP_TYPE(TypeTag, FluidSystem)::gasPhaseIdx);
// Disable gravity
SET_BOOL_PROP(Stokes2cTestProblem, EnableGravity, false);

View File

@ -53,7 +53,7 @@ SET_TYPE_PROP(StokesNiTestProblem, FluidSystem,
//! Select the phase to be considered
SET_INT_PROP(StokesNiTestProblem, StokesPhaseIndex,
GET_PROP_TYPE(TypeTag, FluidSystem)::gPhaseIdx);
GET_PROP_TYPE(TypeTag, FluidSystem)::gasPhaseIdx);
// Enable gravity
SET_BOOL_PROP(StokesNiTestProblem, EnableGravity, true);

View File

@ -67,8 +67,8 @@ private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::lPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gPhaseIdx> Traits;
/*wettingPhaseIdx=*/FluidSystem::liquidPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::gasPhaseIdx> Traits;
// define the material law which is parameterized by effective
// saturations
@ -174,8 +174,8 @@ class WaterAirProblem
AirIdx = FluidSystem::AirIdx,
// phase indices
lPhaseIdx = FluidSystem::lPhaseIdx,
gPhaseIdx = FluidSystem::gPhaseIdx,
liquidPhaseIdx = FluidSystem::liquidPhaseIdx,
gasPhaseIdx = FluidSystem::gasPhaseIdx,
// equation indices
conti0EqIdx = Indices::conti0EqIdx,
@ -231,10 +231,10 @@ public:
coarsePorosity_ = 0.3;
// residual saturations
fineMaterialParams_.setResidualSaturation(lPhaseIdx, 0.2);
fineMaterialParams_.setResidualSaturation(gPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(lPhaseIdx, 0.2);
coarseMaterialParams_.setResidualSaturation(gPhaseIdx, 0.0);
fineMaterialParams_.setResidualSaturation(liquidPhaseIdx, 0.2);
fineMaterialParams_.setResidualSaturation(gasPhaseIdx, 0.0);
coarseMaterialParams_.setResidualSaturation(liquidPhaseIdx, 0.2);
coarseMaterialParams_.setResidualSaturation(gasPhaseIdx, 0.0);
// parameters for the Brooks-Corey law
fineMaterialParams_.setEntryPressure(1e4);
@ -374,8 +374,8 @@ public:
Opm::CompositionalFluidState<Scalar, FluidSystem> fs;
initialFluidState_(fs, context, spaceIdx, timeIdx);
Scalar hl = fs.enthalpy(lPhaseIdx);
Scalar hg = fs.enthalpy(gPhaseIdx);
Scalar hl = fs.enthalpy(liquidPhaseIdx);
Scalar hg = fs.enthalpy(gasPhaseIdx);
values.setEnthalpyRate(values[conti0EqIdx + AirIdx] * hg +
values[conti0EqIdx + H2OIdx] * hl);
}
@ -474,10 +474,10 @@ private:
const GlobalPosition &pos = context.pos(spaceIdx, timeIdx);
Scalar densityW = 1000.0;
fs.setPressure(lPhaseIdx, 1e5 + (maxDepth_ - pos[1])*densityW*9.81);
fs.setSaturation(lPhaseIdx, 1.0);
fs.setMoleFraction(lPhaseIdx, H2OIdx, 1.0);
fs.setMoleFraction(lPhaseIdx, AirIdx, 0.0);
fs.setPressure(liquidPhaseIdx, 1e5 + (maxDepth_ - pos[1])*densityW*9.81);
fs.setSaturation(liquidPhaseIdx, 1.0);
fs.setMoleFraction(liquidPhaseIdx, H2OIdx, 1.0);
fs.setMoleFraction(liquidPhaseIdx, AirIdx, 0.0);
if (inHighTemperatureRegion_(pos))
fs.setTemperature(380);
@ -485,15 +485,15 @@ private:
fs.setTemperature(283.0 + (maxDepth_ - pos[1])*0.03);
// set the gas saturation and pressure
fs.setSaturation(gPhaseIdx, 0);
fs.setSaturation(gasPhaseIdx, 0);
Scalar pc[numPhases];
const auto &matParams = materialLawParams(context, spaceIdx, timeIdx);
MaterialLaw::capillaryPressures(pc, matParams, fs);
fs.setPressure(gPhaseIdx, fs.pressure(lPhaseIdx) + (pc[gPhaseIdx] - pc[lPhaseIdx]));
fs.setPressure(gasPhaseIdx, fs.pressure(liquidPhaseIdx) + (pc[gasPhaseIdx] - pc[liquidPhaseIdx]));
typename FluidSystem::ParameterCache paramCache;
typedef Opm::ComputeFromReferencePhase<Scalar, FluidSystem> CFRP;
CFRP::solve(fs, paramCache, lPhaseIdx, /*setViscosity=*/false, /*setEnthalpy=*/true);
CFRP::solve(fs, paramCache, liquidPhaseIdx, /*setViscosity=*/false, /*setEnthalpy=*/true);
}
void computeHeatCondParams_(HeatConductionLawParams &params, Scalar poro)

View File

@ -92,11 +92,9 @@ private:
// two-phase capillary pressure law
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
typedef Opm::TwoPhaseMaterialTraits<Scalar,
/*wettingPhaseIdx=*/FluidSystem::wPhaseIdx,
/*nonWettingPhaseIdx=*/FluidSystem::nPhaseIdx> Traits;
enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
typedef Opm::TwoPhaseMaterialTraits<Scalar, wettingPhaseIdx, nonWettingPhaseIdx> Traits;
// define the material law which is parameterized by effective
// saturations
@ -157,12 +155,12 @@ class Tutorial1Problem
// phase indices
enum { numPhases = FluidSystem::numPhases };
enum { wPhaseIdx = FluidSystem::wPhaseIdx };
enum { nPhaseIdx = FluidSystem::nPhaseIdx };
enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
// Indices of the conservation equations
enum { contiWEqIdx = Indices::conti0EqIdx + wPhaseIdx };
enum { contiNEqIdx = Indices::conti0EqIdx + nPhaseIdx };
enum { contiWettingEqIdx = Indices::conti0EqIdx + wettingPhaseIdx };
enum { contiNonWettingEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx };
public:
//! The constructor of the problem
@ -184,8 +182,8 @@ public:
materialParams_.setLambda(2); // shape parameter
// Set the residual saturations
materialParams_.setResidualSaturation(wPhaseIdx, 0.0);
materialParams_.setResidualSaturation(nPhaseIdx, 0.0);
materialParams_.setResidualSaturation(wettingPhaseIdx, 0.0);
materialParams_.setResidualSaturation(nonWettingPhaseIdx, 0.0);
// wrap up the initialization of the material law's parameters
materialParams_.finalize();
@ -231,14 +229,14 @@ public:
Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
Scalar Sw = 1.0;
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1.0 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1.0 - Sw);
fs.setTemperature(temperature(context, spaceIdx, timeIdx));
Scalar pC[numPhases];
MaterialLaw::capillaryPressures(pC, materialParams, fs);
fs.setPressure(wPhaseIdx, 200e3);
fs.setPressure(nPhaseIdx, 200e3 + pC[nPhaseIdx] - pC[nPhaseIdx]);
fs.setPressure(wettingPhaseIdx, 200e3);
fs.setPressure(nonWettingPhaseIdx, 200e3 + pC[nonWettingPhaseIdx] - pC[nonWettingPhaseIdx]);
values.setFreeFlow(context, spaceIdx, timeIdx, fs);
}
@ -246,8 +244,8 @@ public:
// forced outflow at the right boundary
RateVector massRate(0.0);
massRate[contiWEqIdx] = 0.0; // [kg / (s m^2)]
massRate[contiNEqIdx] = 3e-2; // [kg / (s m^2)]
massRate[contiWettingEqIdx] = 0.0; // [kg / (s m^2)]
massRate[contiNonWettingEqIdx] = 3e-2; // [kg / (s m^2)]
values.setMassRate(massRate);
}
@ -262,8 +260,8 @@ public:
void source(RateVector &source, const Context &context, int spaceIdx,
int timeIdx) const
{
source[contiWEqIdx] = 0.0;
source[contiNEqIdx] = 0.0;
source[contiWettingEqIdx] = 0.0;
source[contiNonWettingEqIdx] = 0.0;
}
//! Evaluates the initial value at a given position in the domain.
@ -275,8 +273,8 @@ public:
// the domain is initially fully saturated by LNAPL
Scalar Sw = 0.0;
fs.setSaturation(wPhaseIdx, Sw);
fs.setSaturation(nPhaseIdx, 1.0 - Sw);
fs.setSaturation(wettingPhaseIdx, Sw);
fs.setSaturation(nonWettingPhaseIdx, 1.0 - Sw);
// the temperature is given by the temperature() method
fs.setTemperature(temperature(context, spaceIdx, timeIdx));
@ -286,8 +284,8 @@ public:
MaterialLaw::capillaryPressures(pC, materialLawParams(context, spaceIdx,
timeIdx),
fs);
fs.setPressure(wPhaseIdx, 200e3);
fs.setPressure(nPhaseIdx, 200e3 + pC[nPhaseIdx] - pC[nPhaseIdx]);
fs.setPressure(wettingPhaseIdx, 200e3);
fs.setPressure(nonWettingPhaseIdx, 200e3 + pC[nonWettingPhaseIdx] - pC[nonWettingPhaseIdx]);
values.assignNaive(fs);
}