# PhreeqcUsers Discussion Forum

## Processes => Mixing => Topic started by: ehsan on October 27, 2021, 10:32:18 AM

Title: solubility of two gas in a solution
Post by: ehsan on October 27, 2021, 10:32:18 AM
Hi dears
I want to dissolve two gases(CO2 and H2S) in a solution but Can not be used for hydrogen sulfide from Keyword Gas_Phase
How can I dissolve CO2 and H2S in solution?
Title: Re: solubility of two gas in a solution
Post by: dlparkhurst on October 27, 2021, 03:58:58 PM
You can define two gases in GAS_PHASE or two gases in EQUILIBRIUM_PHASES.
Title: Re: solubility of two gas in a solution
Post by: Leo on October 28, 2021, 07:26:41 AM
Ehsan, have a look at example 7 from the PHREEQC manual. You will need the keywords SOLUTION and GAS_PHASE from the given input file for a basic gas phase calculation. Both CO2(g) and H2S(g) are pre-defined in the database phreeqc.dat.
Title: Re: solubility of two gas in a solution
Post by: ehsan on October 28, 2021, 10:23:58 AM
Thanks a lot Mr. David and Mr. Leo
I have a question
Have you worked on a hydrogen sulfide dissolution project?
Why does a fracture occur in a range of pressure and temperature?

DC: The picture is in Attachments.
Title: Re: solubility of two gas in a solution
Post by: Leo on October 28, 2021, 11:29:27 AM
I have not worked on the problem. Also, I think you should provide more information about what you are modeling. From the graph, it is unclear what you were doing.
Title: Re: solubility of two gas in a solution
Post by: dlparkhurst on October 28, 2021, 06:51:04 PM
I assume you mean H2S, not hydrogen dioxide. Please be more careful in formulating your questions and describing your simulation.

The jumps in the curves are due to the Peng-Robinson equation of state (EOS) for gases. Both the fugacity coefficient and the molar volume are discontinuous as shown by the calculation below at 30 C. You will have to study the the Peng-Robinson equations to know the exact cause. The calculations in PHREEQC are generated in the method calc_PR in the file gases.cpp.

The primary reference is Peng, D.-Y., and Robinson, D.B., 1976, A new two-constant equation of state: Industrial and Engineering Chemistry Fundamentals, v. 15, p. 59-64.

Code: [Select]
`SOLUTION 1; -water 1; pH 7 charge; Sg 9e3; temp 30GAS_PHASE 1; -fixed_pr; -vol 0.01;H2Sg(g) 0;H2O(g) 0USER_GRAPH 1    -headings               P Sg f(H2Sg(g)) Gas_Vm    -axis_titles            "Pressure, atm" "Molality" "Fugacity coefficient or Molar volume"    -initial_solutions      false    -connect_simulations    true    -plot_concentration_vs  x  -start10 GRAPH_X PRESSURE20 GRAPH_Y LOG10(TOT("Sg"))30 GRAPH_SY PR_PHI("H2Sg(g)"), GAS_VM  -end    -active                 trueREACTION_PRESSURE10 70 in 61END`
Title: Re: solubility of two gas in a solution
Post by: ehsan on October 29, 2021, 11:51:31 AM
I read the relevant paper that you said and the part that caught my attention is related to the a(T)
Here he says that for temperatures other than critical temperature, a dimensionless function is multiplied by the a(T).
a(T) = a(T) * alpha(Tr, W)
In phreeqc for H2S solubility in water, a jump occurs when the simulation is not at a critical temperature, and this jump does not exist at a critical temperature.
Title: Re: solubility of two gas in a solution
Post by: dlparkhurst on October 29, 2021, 06:30:06 PM
I did not code the Peng-Robinson EOS, so I do not know all the details. However, I believe there is a cubic equation that needs to be solved. The attached file has the code for the calculation. The jumps in the molar volume, solubility, and fugacity coefficient occur when a different root of the cubic is used.

In the attached H2S_jump file, the "complex plane" root is used for the first temperature, and "Cardano's method" is used for the second temperature.
Title: Re: solubility of two gas in a solution
Post by: ehsan on November 03, 2021, 04:33:16 PM
Thanks David
I developed a model to simulate the dissolution of carbon dioxide and hydrogen sulfate in water with PHREEQC
In terms of one mole of water and one mole of carbon dioxide and one mole of hydrogen sulfide.
temperature is 120 C press is 20 atm.
When the simulation is performed, carbon dioxide and hydrogen sulfide dissolve equally in water, while the dissolution of dioxide carbon from hydrogen sulfide should be less.
What is the simulation problem?

my code is
Code: [Select]
`PHASES 1SOLUTION 1SELECTED_OUTPUT 1; -reset false; -file CO2_H2S.prnUSER_PUNCH 1     1  i = 20     10 s\$ = s\$ + 'SOLUTION 1' + EOL\$     20 s\$ = s\$ + '-temp 120'+ EOL\$     30 s\$ = s\$ + '-pressure ' + str\$(i) + EOL\$     40 s\$ = s\$ + '-water    5.56 '  + EOL\$     50 s\$ = s\$ + 'EQUILIBRIUM_PHASES 1' + EOL\$     60 s\$ = s\$ + 'H2S(g)' + STR\$(LOG10(i)) +' 1' + EOL\$     70 s\$ = s\$ + 'CO2(g)' + STR\$(LOG10(i)) +' 1' + EOL\$     #60 s\$ = s\$ + 'Calcite   0 0.2'+ EOL\$     #70 s\$ = s\$ + 'Halite    0 2'+ EOL\$     80 s\$ = s\$ +'END'+ EOL\$    # 90 next i     100 PUNCH s\$ENDSELECTED_OUTPUT 1; -active falseINCLUDE\$ CO2_H2S.prnEND`
result
Code: [Select]
`C(4)          1.799e-01`
Code: [Select]
`S(-2)         1.799e-01`
Title: Re: solubility of two gas in a solution
Post by: dlparkhurst on November 03, 2021, 05:33:37 PM
As usual, I cannot understand your question. Here is my interpretation of your description of the calculation:

Code: [Select]
`SOLUTION 1-pressure 20-temperature 120-water 1.8016e-02 # (1 mol) *(GFW("H2O") g/mol) / (1000 g/kg)ENDEQUILIBRIUM_PHASES 1Halite 0 10ENDGAS_PHASE 1-fixed_pressure -pressure 20H2S(g) 0CO2(g) 0ENDREACTION 1H2S(g) 1CO2(g) 11 molENDUSE solution 1USE gas_phase 1USE equilibrium_phases 1USE reaction 1END`
To have 1 mole of water, you need a mass of water of about 18 g of H2O. Hence -water 0.018 in the SOLUTION definition.

I define a fixed_pressure GAS_PHASE with no moles of gas, but the pressure set to 20 atm. The volume of gas will be determined in the reaction calculation.

Equilibrium phases defines 10 moles of Halite available to react.

A REACTION definition is used to add 1 mol of H2S(g) and 1 mol of CO2(g) to the system.

The USE statements put all of these reactants together and equilibrium is calculated.

The resulting solution composition is as follows:

Code: [Select]
` C                 1.808e-02   3.257e-04 Cl                6.930e+00   1.249e-01 Na                6.930e+00   1.249e-01 S                 5.916e-02   1.066e-03 `
so, 3.257e-4 moles of CO2 and 1.066e-3 moles of H2S dissolved into the solution; because the mass of water is 0.018 kg, the resulting solubilities in terms of mol/kgw are 1.8e-2 and 5.9e-2 mol/kgw. 1.249e-1 moles of halite dissolved for a molality of 6.93 for Na and Cl.

The gas phase has a pressure of 20 atm and a volume of 3.03 liters. The pressure of each gas is approximately 10 atm. Virtually all of the CO2 and H2S is in the gas phase--0.9997 moles of CO2 and 0.9989 moles of H2S.

Title: Re: solubility of two gas in a solution
Post by: ehsan on November 05, 2021, 07:14:10 AM
Thanks David
Is the phi of H2S and CO2 obtained here in the gas or aqua phase?

Code: [Select]
`CO2(g)            0.98     -1.06   -2.04  CO2 Pressure  10.0 atm, phi 0.957`
Code: [Select]
`H2S(g)            0.97     -7.12   -8.09  H2S Pressure  10.0 atm, phi 0.928`
Title: Re: solubility of two gas in a solution
Post by: dlparkhurst on November 05, 2021, 02:36:14 PM
Gas.
Title: Re: solubility of two gas in a solution
Post by: ehsan on November 06, 2021, 06:48:12 AM
Is there phi output for the aqueous phase? Where can it be obtained?
Title: Re: solubility of two gas in a solution
Post by: dlparkhurst on November 06, 2021, 02:32:38 PM
Phi is the fugacity coefficient in gases. The equivalent in solutions is usually called the activity coefficient. You have asked about  activity coefficients repeatedly, so I'm not sure why you are asking again.