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 »
  • Is there a way to get EDL_Species for specific species in the diffuse layer
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Is there a way to get EDL_Species for specific species in the diffuse layer  (Read 981 times)

KHeppner

  • Contributor
  • Posts: 5
Is there a way to get EDL_Species for specific species in the diffuse layer
« on: 22/10/24 14:57 »
Hello,

I have used EDL_Species and it is great.  David, thank you for showing me this, as well as the EDL functionality.  However, I am wondering if there is a way to get these in a specific order?  Alternately, can you ask for a specific species by its ion in the diffuse layer?

Something like this to get the amount of sulphate in the diffuse layer of hydrous ferric oxide:
EDL_Species_i("SO4-2","Hfo")

In this way, it would be similar to the EDL functionality.

thanks,
Kevin
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4034
Re: Is there a way to get EDL_Species for specific species in the diffuse layer
« Reply #1 on: 22/10/24 17:25 »
The results of EDL_SPECIES are sorted by number of moles. You could simply sort alphabetically with a bubble sort as follows.

Code: [Select]
SOLUTION
pH 7
Na 1
P  1 charge
END
SURFACE 1
    -donnan
    -equilibrate with solution 1
    Hfo_s      0.001     600       1
    Hfo_w      0.01
END
USE solution 1
USE surface 1
USER_PRINT
10 t = EDL_SPECIES("Hfo", count, name$, moles, area, thickness)
20 GOSUB 1000
30 FOR i = 1 TO count
40   PRINT pad$(name$(i), 10), moles(i)
50 NEXT i
100 END

1000 REM sort alphabetical
1010 sorted = 0
1020 WHILE (sorted = 0)
1030   sorted = 1
1040   FOR i = 2 TO count
1050     if (name$(i) < name$(i-1)) THEN GOSUB 2000
1060   NEXT i
1070 WEND
1110 RETURN


2000 REM Swap
2010 temp$ = name$(i)
2020 temp = moles(i)
2030 name$(i) = name$(i - 1)
2040 moles(i) = moles(i - 1)
2050 name$(i -1) = temp$
2060 moles(i - 1) = temp
2070 sorted = 0
2080 RETURN
END


Another alternative is to use CALCULATE_VALUES to write a new function to extract the concentration that you want. A CALCULATE_VALUES function is defined for the name "EDL_SPECIES". Two arguments must be stored to calculate the value: the surface name is stored with PUT$("Hfo", 0), and the desired species is stored with PUT$("OH-", 1). CALC_VALUE("EDL_SPECIES") then returns the desired number of moles.

Code: [Select]
SOLUTION
pH 7
Na 1
P  1 charge
END
SURFACE 1
    -donnan
    -equilibrate with solution 1
    Hfo_s      0.001     600       1
    Hfo_w      0.01
END
CALCULATE_VALUES
EDL_SPECIES
-start
10 t = EDL_SPECIES(GET$(0), count, name$, moles, area, thickness)
20 FOR i = 1 TO count
30   if (name$(i) <> GET$(1)) THEN GOTO 100
40   moles_edl_species = moles(i)
50   GOTO 110
100 NEXT i
110 SAVE moles_edl_species
120 END
END
USE solution 1
USE surface 1
USER_PRINT
10 PUT$("Hfo", 0)
20 PUT$("OH-", 1)
30 moles_edl_species = CALC_VALUE("EDL_SPECIES")
100 t = EDL_SPECIES("Hfo", count, name$, moles, area, thickness)
110 FOR i = 1 TO count
120   PRINT pad$(name$(i), 10), moles(i)
130 NEXT i
140 PRINT
150 PRINT "CALC_VALUE: ", pad$(GET$(1), 10), moles_edl_species
160 END
END
Logged

KHeppner

  • Contributor
  • Posts: 5
Re: Is there a way to get EDL_Species for specific species in the diffuse layer
« Reply #2 on: 22/10/24 22:00 »
Thanks for this quick response David!  I will look at this further and determine how to best move forward.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Processes »
  • Surface Complexation »
  • Is there a way to get EDL_Species for specific species in the diffuse layer
 

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