PhreeqcUsers Discussion Forum
Click here to donate to keep PhreeqcUsers open

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Incorporation PHREEQC in programming languages »
  • Define a gas phase with a solution
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Define a gas phase with a solution  (Read 216 times)

ahmadreza_shojaee

  • Frequent Contributor
  • Posts: 12
Define a gas phase with a solution
« on: October 17, 2022, 04:12:10 PM »
Dear all

Hi
I am coupling IPHREEQC with MATLAB; I want to define a gas phase (GAS_PHASE keyword) with a solution. How can I access the initial gas moles? Using the SELECTED_OUTPUT only report the amount of gases after equilibrium reactions; however, it shows zero (0) for each gas component for the i_soln state. Is there anyway to find the initial moles of each component?
In the GAS_PHASE keyword, we specify the partial pressure of each component. Should I calculate the initial mole of each component manually, or there is way to access them?

Thanks
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Define a gas phase with a solution
« Reply #1 on: October 18, 2022, 02:59:33 AM »
If you equilibrate the GAS_PHASE with a very small amount of water, the moles of the gas phase is essentially unchanged.

Code: [Select]
SOLUTION 1
-water 1e-8
END
USE solution 1
USER_PRINT
10 PRINT GAS("CO2(g)")
GAS_PHASE
-fixed_pressure
CO2(g) 1
END
Logged

ahmadreza_shojaee

  • Frequent Contributor
  • Posts: 12
Re: Define a gas phase with a solution
« Reply #2 on: October 18, 2022, 01:20:57 PM »
Dear David

Thanks for your quick response. It seems it is a nice trick! I tried and it worked for my calculations.
I think it will be a proper update if the initial moles of each gas component is accessible in i-soln step.

Thanks
Logged

ahmadreza_shojaee

  • Frequent Contributor
  • Posts: 12
Re: Define a gas phase with a solution
« Reply #3 on: November 16, 2022, 01:44:53 PM »
Dear David

Hi
I found another problem in this approach of finding the initial moles of a each gas component in a gas mixture. As an example, If there is a mixture of CO2 and H2 in the gas phase, this code will show the equilibrium value of CO2/H2 in the gas phase; in the below code, all of hydrogen will be consumed.
Code: [Select]
SOLUTION 1
-water 1e-8
END
USE solution 1
USER_PRINT
10 PRINT gas("CO2(g)")
GAS_PHASE
-fixed_pressure
CO2(g) 0.5
H2(g)  0.5
END

Also, this approach does not work in high pressure condition. If we conduct the above test in P = 100 atm, the solution will not converge.
Code: [Select]
SOLUTION 1
-pressure 100
-water 1e-8
END
USE solution 1
USER_PRINT
10 PRINT gas("CO2(g)")
GAS_PHASE
-fixed_pressure
-pressure 100
CO2(g) 50
H2(g)   50
END
==========
#Error
ERROR:               A(H2O) Activity of water has not converged. Residual: 3.300000e-07
ERROR: Model failed to converge for initial solution  1.
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2736
Re: Define a gas phase with a solution
« Reply #4 on: November 16, 2022, 02:46:35 PM »
Worked for me with PhreeqcI 3.7.3.15968 and phreeqc.dat, but the calculation causes the formation of CH4 by the reduction of CO2. It also may be helpful to use an unreactive version of H2; phreeqc.dat has Hdg and Hdg(g) defined, which will treat H2 as an inert gas. If you use Hdg(g), CO2 will not be reduced.

Logged

ahmadreza_shojaee

  • Frequent Contributor
  • Posts: 12
Re: Define a gas phase with a solution
« Reply #5 on: November 21, 2022, 10:16:55 AM »
I found that many things we can do with the inert Hdg!
Thank you for your response.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Incorporation PHREEQC in programming languages »
  • Define a gas phase with a solution
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2