System of equations for EOS4
Hello,
I am trying to write the system of equations for EOS4. But one equation is missing. I think it is the relation between mass fraction of water in gas phase (or mass fraction of air in gas phase) and pressure. Do we need Raoult law? If yes, we need molecular weight for gas (air and vapor). In this case, how can we express this molecular weight knowing that it depends on mass fraction?
Thanks,
Anthony

Antony,
The system of equations in EOS4 is complete.
The molecular weight of air and water (28.96 and 18.016 g/mol) are hardwired in TOUGH2  they are constants (the molecular weight does not depend on the mass fraction, as you seem to suggest). EOS4 uses Henry's law, the ideal gas law, local thermodynamic equilibrium, and Kelvin's equation to calculate the mass fractions (as a function of pressure and temperature, or saturated vapor pressure) if twophase conditions prevail. Under singlephase (gas or liquid) conditions, mass fraction (or air partial pressure) is a primary variable. Mass fractions in each phase add up to 1.0.
Hope this helps,
Stefan

Stefan,
Thank you very much for your help.
Ok. I forgot mass fraction related to RH.
I have written the system of equations for isothermal conditions (see attachment). If this helps someone (if it is correct :)).
I have another question, if I can. In the figure 3 in section 4.2 of the Tough2 manual, it is written that one of secondary parameters is the capillary pressure. How does that mean for gas? One can see the expression in equation A.6 but I cannot see an expression for gas in annexe H.
Anthony

Anthony,
Thanks. I hope the TOUGH user community will review your equations and comment on them here in the forum.
Regarding capillary pressures. They are not defined for a phase (gas or liquid or oil); instead, they are defined as the pressure difference across the interface of two immiscible fluid phases (e.g., liquidgas; liquidoil; oilgas). Consequently, there are only (NPH1) capillary pressures, where NPH is the number of phases. I hope you had this understanding when developing the equations, as otherwise your system would indeed not be closed (but trust me: it is!).
Stefan

Hello Stefan,
There is a mistake in my system of equations (cf. pdf file). The relation between RH and mass fraction is false. Can you tell me how you wrote it ? Do you express it as follows:
Mv/Ma = 0.62 *pv / (Pg  pv )
where Mv, Ma, pv and Pg are mass fraction of water vapor and "dry" air, water vapor pressure and gas pressure ?
Anthony
Ps: don't worry, I'm convinced the system is closed.

In TOUGH, vapor mass fraction is not defined as Mv/Ma, but as Mv/Mg=Mv/(Ma+Mv)=X^v_g, where Mk indicates mass of component k (not "mass fraction") in the gas phase. Therefore:
X^v_g=(18.016 * Pv) / (18.016 * Pv + 28.96 * (PgPv))
which is only marginally different from your value under atmospheric conditions as Pg>>Pv.
You may replace Pv=RH*Psat(T) in the above equation to get the relation between vapor mass fraction X^v_g and relative humidity RH. Here, Psat is the temperature dependent saturated vapor pressure.
Hope somebody proficient in thermodynamics can confirm this!

Dear colleagues (@stefan_finsterle)
I am trying to model a vapor dominated reservoir which has liquid in matrix and the vapor in fractures. The initial pressure of the vapor reservoir is lower than the saturation pressure at the reservoir temperature (240 degree C and 6 bar pressure). I was trying first with EOS3 which makes the initial condition automatically to another pressure (saturation pressure). So, now I am using EOS4, however, in this one as I set the initial condition as, 240 degree C and 6 bar pressure, in FOFT file after a very short time in the order of 10^5 seconds (to see the initial condition), the first column after the name of the element there is pressure which is 6 bar but the temperature reduces to 158 degree C and the air partial pressure is significantly high.
I was wondering how I could set the initial condition as 240 degree C and 6 bar?
Is this air partial pressure part of the reservoir pressure (6 bar)?How can I set the air fraction zero?
My model is a cylinder and I am trying to inject cold water at the center.

Dear Ali,
As you correctly state, a total pressure of 6 bar is below the saturated vapor pressure at 240 C. This means that your reservoir has to be initialized as singlephase gas. You state that EOS3 automatically changed the initial pressure to the saturated vapor pressure (of 33.5 bar). This tells me that you tried to initialize it as being under twophase conditions (you specified the second primary variable X2 with a value >10).
To initialize singlephase conditions, the second primary variable is airmass fraction (in either the liquid or gas phase, depending on temperature!), and since it seems you want it all steam, just set X2=0.0, which automatically sets the vapormass fraction to 1.0.
If you never want to consider air in the system, why don't you use EOS1?
Stefan
PS: By the way, this is an example where airmass fraction can assume any value between 0 and 1 (even 0!) and still indicate singlephase gas conditions. Under nearatmospheric pressure and temperature conditions, singlephase gas is usually associated with an airmass fraction very close to 1, with values less than about 0.98 thermodynamically impossible, leading TOUGH2 to issue the error message "WRONG DATA INITIALIZATION".

Dear Stefan
Thank you for your reply. I am not using EOS1, since I believe that the vapor pressure lowering effects is not included in this EOS.
I could set the initial condition as I intend by assuming the air mass fraction 0.0.Now the main problem is, as I am injecting the solution convergence is failed. It cannot reach the maximum time I have set (regardless the injection rate and the permeabilityI tried to change them to higher and lower valuethe calculation stops with an error that the convergence is failed).
I have attached the output and input files for my simple model. This model is a cylindrical model which has 1 layer by the thickness of 200 meters, and the injection element has the radius of 2 m, and volume around 2500 m3 and it is in the center (A1 1). It would be a great help, if you are able to take a look at the model and results (using EOS4).
Thank you in advance.
Regards,
Ali

PS: The temperature in Save file for some element is even higher than the initial condition (around 0.001 degree C), and also in the COFT file the injection rate at time 0.0 or at the time step 1 second is 0.0, however, it has been set as 2000.0 kg/s at time 0.0 in GENER file. Strange point is that at 3 second the injection rate is higher than the set value in GENER (around 210 kg/s higher). I am not sure how I could explain such a differences??, although, I think maybe this is related to the fact that the initial condition for A1 1 element at which water is being injected at the center the fluid is completely vapor and the injection fluid is liquid but due to these initial conditions the injected liquid is changing the phase to vapor?
Maybe if the simulation runs for longer time after a while the temperature will drop and the liquid would be injected?
Another questions:
In FOFT file after the name of the element the first column is element pressure (exactly the summation of whole fluid pressureconsists of different fractions), the second column is the temperature, the third column is the saturation of the vapor or gas?, which I am not sure, the 4th column I have no idea what is that for?
In COFT, the first column is the mass flux (kg/s), the second is for?, would be happy if you are able to guide me what it is for?, and the third column is the heat flux or energy flux (which is j/s.m2?, I am not sure).I would be really thankful if you are able to guide me with these unknowns.

Hi Ali,
Sorry, I don't have the time to respond to this post in full (hopefully somebody else will!). I am still unclear what it is you want to do (e.g., for VPL to make sense, you need to specify capillary pressure curves, which you don't, and why you think VPL matters in the situation you try to model, where you inject cold water into a very highly permeable aquifer), and I'm very confident that the (gigantic!) injection rate of 2000 kg/s is correctly used in the model (I suspect you are not looking at the relevant number when you reach the opposite conclusion).
Your PARAM block has some errors, but if you remove them and run with EOS3, it gets to the end time without any problems, generating reasonable results (I did not analyze them in detail, but you start out with a hot steam field and end up with a cold liquiddominated reservoir).
I highly recommend you look at the output file (not the COFT, FOFT, GOFT files) to figure out what is going on.
I attach the corrected input file.
Good luck!
Stefan

Dear Stefan
Thank you for your reply. I am insisting to use VPL, since if it ignored the injectedwater would be evaporated completely as it is being injected, however, based on the
(Pruess, K. (1995). Numerical simulation of water injection into vapordominated reservoirs, Lawrence Berkeley Lab., CA (United States)) the injected water should be evaporated partially. Thus, I need to use VPL, thank you for your comment, I will look for how to use RPCAP.Regarding the editedfinalfi which you have updated, I could not run it longer than 400 seconds (ERROR was the convergence failure, or would there be any other possibilitiesmaybe because of the different version of TOUGH2 or etc. for the simulation to stop?), I think if this worked for you the problem is arising from the executable file (EOS4 or 3.exe), the version I am using is "VERSION 1.0, MARCH 1991", which was lastly updated by Jonny Rutqvist in 2005 (the EOS files cannot be attached, however, we can share it through email), we have access to the source code.
I was wondering if this EOS files are different from the one you run the aforementioned file? We suspect that the different results between yours and ours is because of the different versions of EOS source code, but we are not sure. Do you think the reason for the different results was the different source codes, or any other causes?
Thank you in advance, we do appreciate it.

Ali,
Please read Karten's 1995 paper carefully and compare the conditions he is looking at (specifically regarding permeability and capillarity) with the ones you have (they are literally different by factors of millions!). Also consider your injection rate, time scale etc. I have to maintain that VPL has no impact on your system at all.
I cannot speculate on the reasons why your run does not converge; you obviously use a very old version of the code. I attach my output file (run using iTOUGH2 V7.1.1), so you can compare and start the process of figuring out what the reason is for the convergence issue using the suggestions I make frequently in this forum.
All the best,
Stefan

Dear Stefan,
I could finally solve the problem which was mainly due to the PARAM block as well as assigning the Rel. Perm. and Cap. Press.
Now I wanna make a boundary element layer at the bottom of my cylindrical mesh, I was wondering if you are able to give me a hand.
I want to have an inactive boundary element by which I would be able to assign a heat flux.
I have attached the MESH.dat file I am not sure how to set the input.
I think the layer will be assigned from the top to the bottom, but how TOUGH2 will distinguish the top and bottom layers?I have also attached a GENER file, the element must be the boundary element from the mesh file generating from the MESH.dat, however, I just put an example name for the element name to make sure if I wrote the GENER file for heat flux as it must be.

Dear all,
I am modeling the TH using TOUGHFLAC (using FLAC for visualization purposes). My simulation is about cold water injection into a formation which has a temperature of 240 and a pressure of 1.7 MPa (low pressure). The reservoir is filled with steam. The model geometry is a cube which has 53884 elements, the size of the whole domain is 2,164 m (X direction), 2,640 m (Y), 2,540 m (Z).
As the injection goes on there is a continuous phase change.
My current problem is the calculation time. The simulation goes pretty slow, and I am wondering about the solution. For instance, for simulation of injection for 36 hours, the simulation needs to run for 33 hours, which makes it impossible to have some insights into longterm injection (in the order of years).
I am using relative permeability function proposed as Corvey's curve (1954), the residual liquid saturation is considered as 0.3 and the similar parameter for the gas as 0.05.I am using EOS3.
What could possibly increase the calculation pace? Any similar experience?
Regards,Ali