Dear Beatrix and Etienne,
Thank you for your answers. I think I have grasped now how fugacity
coefficients work. I have implemented fugacityCoefficient() in my
FluidSystem and it seems to produce the mole fractions that I am expecting.
I am facing another problem, though: as soon as there is enough gas for
it to form a gas + oil phases (as opposed to just oil phase initially),
I have to switch primary variables, similarly to what Etienne said, from
secondPhaseOnly to bothPhases. So I implemented my own
PrimaryVariableSwitch. It makes sense on one step (I get a solution with
a small positive value of saturation of the gas phase), but the next
step encounters negative value of the saturation (causing it to switch
back to only oil phase) and eventually diverges.
I realize that it is nearly impossible for people on this mailing list
to figure out what happened basing on the description that I give, so I
am trying to narrow the problem down.
But if you happen to know that some other changes must be made in the
program that are linked to a custom imlementation of
PrimaryVariableSwitch, I will be happy to know.
Best regards,
Dmitry
On 26.03.2021 17:06, Etienne Ahusborde wrote:
Hello everyone,
From my understanding, the main difference between the CO2 model and
2p2cmodel is the management of phase appearance/disappearance and the
criterion on which is based the switch of variables.
In a old version of the handbook (2.6), we could read
*The CO2 model: CO2Model*
See TwoPTwoCModel for reference to the equations used. The CO2 model
is derived from the 2p2c
model. In the CO2 model the phase switch criterion is different from
the 2p2c model. The phase
switch occurs when the equilibrium concentration of a component in a
phase is exceeded, instead
of the sum of the components in the virtual phase (the phase which is
not present) being greater
that unity as done in the 2p2c model. The CO2VolumeVariables do not
use a constraint solver for
calculating the mole fractions as is the case in the 2p2c model.
Instead mole fractions are calculated
in the FluidSystem with a given temperature, pressure and salinity.
The model is able to use either
mole or mass fractions. The property useMoles can be set to either
true or false in the problem file.
Make sure that the according units are used in the problem setup.
useMoles is set to false by default.
I hope it can help
Regards
Etienne
Le 26/03/2021 à 14:59, Beatrix Becker a écrit :
Dear Dmitry,
I am not sure about the reasons for the separate implementation in
the CO2 model. Maybe someone else can shed light on this? The phase
equilibrium at least seems to me equivalent to the fugacity method,
provided BrineCO2 is used.
In any case, you want to use the 2p2c or 2pnc model, am I right? As
long as you make sure that useConstraintSolver is set to true in the
2p2c model, the MiscibleMultiPhaseComposition::solve() will call the
FluidSystem::fugacityCoefficient(), as you correctly remarked. As a
first step, I would recommend trying to use BrineCO2 as it is, with
the 2p2c model (use constant salinity) on a test case of your choice.
Only remove the call to Brine_CO2::calculateMoleFractions() in
fugacityCoefficient() and instead set xlCO2 and xgH2O to constant
values. In addition, you may have to set isIdealMixture() to true.
Check if the results are as expected. Then copy the content of
fugacityCoefficient() over into your custom fluidsystem.
Let me know if this helps or not!
Best regards,
Beatrix
On 26.03.21 1:38 PM, Dmitry Pavlov wrote:
Dear Beatrix,
Sorry, I got a bit confused and here I am, again asking for advice.
I took a look on BrineCO2. I learned that it is used in
tests/porousmediumflow/co2/implicit/problem.hh. That problem also
uses TwoPTwoCCO2 model.
The TwoPTwoCCO2 model has its own implementation of VolumeVariables:
TwoPTwoCCO2VolumeVariables.
The completeFluidState() method in that model calculates the mole
fractions and sets them directly. I do not see calls to
fugacityCoefficient() there, either direct or indirect, am I missing
something?
I do see that a similar (but more general) TwoPNCVolumeVariables
class calls MiscibleMultiPhaseComposition::solve(), which in turn
calls FluidSystem::fugacityCoefficient(), but, I guess, there was a
reason to override that behavior in TwoPTwoCCO2VolumeVariables?
Best regards,
Dmitry
On 17.03.2021 15:30, Dmitry Pavlov wrote:
Dear Beatrix,
Thank you, your answer is very useful, I will take a look at brineco2.
Best regards,
Dmitry
On 17.03.2021 15:28, Beatrix Becker wrote:
Dear Dmitry,
2p2c can handle gas, yes. As for the equilibrium (I suppose you
want to fix mass fractions), you can have a look at the
fluidsystem brineco2 and how the fugacityCoefficient() method can
be manipulated to fix mass fractions to a certain value:
https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/material/fluidsystems/brineco2.hh
Dumux calculates equilibrium mole fractions by setting the
fugacity of a component in one phase equal to the fugacity of the
same component in the other phase. For two components that results
in two equations with four unknowns (i.e., the mole fractions). To
close the system of equation the sum of the mole fractions of a
phase has to be one.
I hope that answers your question.
Best wishes,
Beatrix
On 17.03.21 11:50 AM, Dmitry Pavlov wrote:
Hello,
After a series of useful simulations of oil + water + some
soluble components, I am now facing a task of oil + gas
simulation. It is a simplification, but, as far as I understand,
a more-or-less common one: water is considered immobile (hence
nonexistent), gas in injected into oil; some gas gets immediately
dissolved in oil, and the ratio of "gas in gas phase" / "gas in
oil phase" is constant everywhere at all times. I call this an
equilibrium, hoping this is the correct term. No temperature is
considered.
I would be very grateful for pointers as to what DuMux models and
classes I can use for this task.
Can 2p2c model handle gas? Is there an easy way to naturally
write the aforementioned equilibrium into the equations? Should I
deal with the fugacityCoefficient() method (which I honestly do
not fully understand now) to have the equilibrium maintained?
Best regards,
Dmitry
_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux