PhreeqcUsers Discussion Forum

Registrations currently disabled due to excessive spam. Please email phreeqcusers at gmail.com to request an account.
Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Surface Complexation »
  • Assistance with Defining SURFACE Keyword Datablock for TLM in PHREEQC
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Assistance with Defining SURFACE Keyword Datablock for TLM in PHREEQC  (Read 264 times)

Sen

  • Frequent Contributor
  • Posts: 12
Assistance with Defining SURFACE Keyword Datablock for TLM in PHREEQC
« on: 28/04/25 08:35 »
Dear Parkhurst,

I am developing a Python-based template program to calculate the pKa of oxides and clay minerals across various surface complexation models (NEM, CCM, DDLM, TLM, BS, CD-MUSIC). The program integrates PHREEQC for pKa calculations and PEST for uncertainty analysis, with Python serving as the "glue" to connect these tools. I have successfully implemented templates for NEM, CCM, and DDLM, and I am currently working on the TLM template.

In the TLM framework, I need to define two capacitances, C1 and C2. I attempted to use CD-MUSIC identifiers (C1 and C2) in my Python code, but this resulted in various errors. Alternatively, when assuming C1 and C2 directly in TLM, the program produces mostly null values, with only a few valid results.

Could you please advise on how to correctly define the SURFACE keyword datablock in PHREEQC to calculate pKa for the TLM model? Specifically, I am unsure how to incorporate the capacitance parameters (C1 and C2) in the datablock.

Below is the relevant portion of my Python code for the SURFACE keyword datablock, which works for other models:
Code: [Select]
#===================Script for SURFACE Keyword datablock for Phreeqc======================================#
t.write('SURFACE %d' %(n+1) + '\n')
## NEM does not consider the electric double layer, while other models calculate it.
if SCM_type == "NEM":
    t.write('   ' + '-no_edl' + '\n')
else:
    t.write('   ' + '#-no_edl' + '\n')  ## Comment out -no_edl to indicate the retention of the electric double layer.

## Specify which SOLUTION module to balance with
t.write('   ' + '-equilibrate with SOLUTION %d' %(n+1) + '\n')
## The unit of surface sites adopts the density system (mol/m2).
t.write('   ' + '-site_units    density' + '\n')
# Write the information of surface complexation sites.
t.write('   ' + 'Fe_wOH ' +
        ' %0.5f' % orgdata_temp.Mineralsites[n] +
        ' %0.5f' % orgdata_temp.MineralSA[n] +
        ' %0.5f' % orgdata_temp.Mineral_val[n] + '\n\n')

if SCM_type == "CCM":
    t.write('   ' + '-ccm !capac! ' + '\n')

I attempted to extend this for TLM with the following approaches, both of which were unsuccessful:

Approach 1:
Code: [Select]
if SCM_type == "CCM":
    t.write('   ' + '-ccm !capac! ' + '\n') 
elif SCM_type == "TLM":
    t.write('   ' + '-cd_music' + '\n')
    t.write('   ' + '-capacitance !capac1! !capac2!' + '\n')  # Using defined capac1 and capac2 placeholders

Approach 2:
Code: [Select]
if SCM_type == "CCM":
    t.write('   ' + '-ccm !capac! ' + '\n') 
elif SCM_type == "TLM":
    t.write('   ' + '-capacitances !capac1! !capac2!' + '\n')

Could you clarify the correct syntax and approach for defining the TLM capacitances in the SURFACE datablock? Any guidance would be greatly appreciated.

Thank you for your time and expertise.

Best regards,
Sen
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4036
Re: Assistance with Defining SURFACE Keyword Datablock for TLM in PHREEQC
« Reply #1 on: 28/04/25 15:30 »
PHREEQC does not have a native triple-layer model. It does allow CD-MUSIC calculations, and CD-MUSIC does have two capacitances. The only way you could do triple-layer calculations is to trick the CD-MUSIC definitions to be equivalent to a triple-layer model.

I have no idea whether that is possible; it's been too long since I looked at the inner workings of these models. There is a section of the manual for SURFACE that describes how to convert CD-MUSIC definitions to simulate no-edl and DDL calculations. I think the only possibility is if you can do some manipulation of the CD-MUSIC parameters to represent a triple-layer model.

I suggest that you first implement CD-MUSIC, and then consider whether it is possible to implement TLM.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Surface Complexation »
  • Assistance with Defining SURFACE Keyword Datablock for TLM in PHREEQC
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2