@@ -48,7 +48,8 @@ try CemSpecies(Species("Ca(OH)")) catch; "ERROR: Ca(OH) cannot be decomposed in
4848CemSpecies(Species(" CaCO3" ; name= " Calcite" , aggregate_state= AS_CRYSTAL, class= SC_COMPONENT)) # ok here
4949
5050# Thermofun input
51- function extract_database(json_file, jls_file)
51+ function extract_database(json_file)
52+ jls_file = splitext(json_file)[1 ] * " .jls"
5253 df_substances, df_reactions = nothing , nothing
5354 try
5455 df_substances, df_reactions = deserialize(jls_file)
@@ -62,9 +63,9 @@ function extract_database(json_file, jls_file)
6263 dict_reactions = Dict(zip(df_reactions. symbol, df_reactions. reaction))
6364 return df_substances, df_reactions, dict_species, dict_reactions
6465end
65- df_substances, df_reactions, dict_species, dict_reactions = extract_database(" data/cemdata18-merged.json" , " data/cemdata18.jls " )
66- df_substances_psi, df_reactions_psi, dict_species_psi, dict_reactions_psi = extract_database(" data/psinagra-12-07-thermofun.json" , " data/psinagra.jls " )
67- df_substances_aq17, df_reactions_aq17, dict_species_aq17, dict_reactions_aq17 = extract_database(" data/aq17-thermofun.json" , " data/aq17.jls " )
66+ df_substances, df_reactions, dict_species, dict_reactions = extract_database(" data/cemdata18-merged.json" )
67+ df_substances_psi, df_reactions_psi, dict_species_psi, dict_reactions_psi = extract_database(" data/psinagra-12-07-thermofun.json" )
68+ df_substances_aq17, df_reactions_aq17, dict_species_aq17, dict_reactions_aq17 = extract_database(" data/aq17-thermofun.json" )
6869
6970# Extraction of primaries from .dat
7071df_primaries = extract_primary_species(" data/CEMDATA18-31-03-2022-phaseVol.dat" )
@@ -307,14 +308,18 @@ CSM = CanonicalStoichMatrix([H₂O, H⁺, OH⁻, CO₂, HCO₃⁻, CO₃²⁻]);
307308SM = StoichMatrix([H₂O, H⁺, OH⁻, CO₂, HCO₃⁻, CO₃²⁻]); pprint(SM)
308309
309310# Example from Miron et al. 2023, https://doi.org/10.21105/joss.04624
310- plot(xlabel= " Temperature [°C]" , ylabel= " log₁₀K⁰" , xticks= 0 : 50 : 250 , yticks= - 20 : 2 : 10 )
311+ p1 = plot(xlabel= " Temperature [°C]" , ylabel= " Cp⁰ [J K⁻¹]" , xticks= 0 : 50 : 250 , yticks= - 2000 : 200 : 2000 )
312+ for sp ∈ getindex.(Ref(dict_species_aq17), split(" Na+ Ca+2 SiO2@ CO3-2 OH-" ))
313+ plot!(p1, θ-> sp. Cp⁰(273.15 + θ), 0 : 0.1 : 250 , label= unicode(sp))
314+ end
315+ p2 = plot(xlabel= " Temperature [°C]" , ylabel= " log₁₀K⁰" , xticks= 0 : 50 : 250 , yticks= - 20 : 2 : 10 )
311316for lsp ∈ [
312317 " Calcite Ca+2 CO3-2" ,
313318 " H2O@ H+ OH-" ,
314319 " NaCl@ Na+ Cl-" ,
315320 " Al+3 H2O@ AlOH+2 H+" ,
316321 ]
317322 rr = Reaction(getindex.(Ref(dict_species_aq17), split(lsp)))
318- plot!(θ-> rr. logK⁰(273.15 + θ), 0 : 0.1 : 250 , label= rr. equation)
323+ plot!(p2, θ-> rr. logK⁰(273.15 + θ), 0 : 0.1 : 250 , label= rr. equation)
319324end
320- plot!( )
325+ plot(p1, p2, layout = ( 1 , 2 ) )
0 commit comments