Skip to content
Snippets Groups Projects
Commit 7a3e7297 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

Merge branch 'regulPartPress-3p3c' into 'master'

I introduced a regularization for the calculation of partial pressures.

This is necessary to fix a problem that occured in Taraneh's flumevegas3p3cni example

See merge request !154
parents f8421cf3 340bbfe2
No related branches found
No related tags found
1 merge request!154I introduced a regularization for the calculation of partial pressures.
...@@ -220,13 +220,18 @@ public: ...@@ -220,13 +220,18 @@ public:
/*setInternalEnergy=*/false); /*setInternalEnergy=*/false);
} }
// ... or calculated explicitly this way ... // ... or calculated explicitly this way ...
// please note that we experienced some problems with un-regularized
// partial pressures due to their calculation from fugacity coefficients -
// that's why they are regularized below "within physically meaningful bounds"
else { else {
Scalar partPressH2O = FluidSystem::fugacityCoefficient(fluidState_, Scalar partPressH2O = FluidSystem::fugacityCoefficient(fluidState_,
wPhaseIdx, wPhaseIdx,
wCompIdx) * pw_; wCompIdx) * pw_;
if (partPressH2O > pg_) partPressH2O = pg_;
Scalar partPressNAPL = FluidSystem::fugacityCoefficient(fluidState_, Scalar partPressNAPL = FluidSystem::fugacityCoefficient(fluidState_,
nPhaseIdx, nPhaseIdx,
nCompIdx) * pn_; nCompIdx) * pn_;
if (partPressNAPL > pg_) partPressNAPL = pg_;
Scalar partPressAir = pg_ - partPressH2O - partPressNAPL; Scalar partPressAir = pg_ - partPressH2O - partPressNAPL;
Scalar xgn = partPressNAPL/pg_; Scalar xgn = partPressNAPL/pg_;
...@@ -341,6 +346,7 @@ public: ...@@ -341,6 +346,7 @@ public:
// and temperature and the mole fraction of water in // and temperature and the mole fraction of water in
// the gas phase // the gas phase
Scalar partPressNAPL = fluidState_.fugacityCoefficient(nPhaseIdx, nCompIdx)*pn_; Scalar partPressNAPL = fluidState_.fugacityCoefficient(nPhaseIdx, nCompIdx)*pn_;
if (partPressNAPL > pg_) partPressNAPL = pg_;
Scalar xgw = priVars[switch1Idx]; Scalar xgw = priVars[switch1Idx];
Scalar xgn = partPressNAPL/pg_; Scalar xgn = partPressNAPL/pg_;
...@@ -362,11 +368,12 @@ public: ...@@ -362,11 +368,12 @@ public:
} }
else if (phasePresence == wnPhaseOnly) { else if (phasePresence == wnPhaseOnly) {
// only water and NAPL phases are present // only water and NAPL phases are present
Scalar pPartialC = fluidState_.fugacityCoefficient(nPhaseIdx,nCompIdx)*pn_; Scalar partPressNAPL = fluidState_.fugacityCoefficient(nPhaseIdx,nCompIdx)*pn_;
if (partPressNAPL > pg_) partPressNAPL = pg_;
Scalar henryC = fluidState_.fugacityCoefficient(wPhaseIdx,nCompIdx)*pw_; Scalar henryC = fluidState_.fugacityCoefficient(wPhaseIdx,nCompIdx)*pw_;
Scalar xwg = priVars[switch1Idx]; Scalar xwg = priVars[switch1Idx];
Scalar xwn = pPartialC/henryC; Scalar xwn = partPressNAPL/henryC;
Scalar xww = 1.-xwg-xwn; Scalar xww = 1.-xwg-xwn;
// write mole fractions in the fluid state // write mole fractions in the fluid state
...@@ -448,6 +455,7 @@ public: ...@@ -448,6 +455,7 @@ public:
// only water and gas phases are present // only water and gas phases are present
Scalar xgn = priVars[switch2Idx]; Scalar xgn = priVars[switch2Idx];
Scalar partPressH2O = fluidState_.fugacityCoefficient(wPhaseIdx, wCompIdx)*pw_; Scalar partPressH2O = fluidState_.fugacityCoefficient(wPhaseIdx, wCompIdx)*pw_;
if (partPressH2O > pg_) partPressH2O = pg_;
Scalar xgw = partPressH2O/pg_; Scalar xgw = partPressH2O/pg_;
Scalar xgg = 1.-xgn-xgw; Scalar xgg = 1.-xgn-xgw;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment