paleolimbot / tidyphreeqc

Tidy geochemical modeling using PHREEQC
22 stars 3 forks source link

how to programmatically design the input for tidyphreeqc::phr_run? #17

Closed AlvaroMCMC closed 2 years ago

AlvaroMCMC commented 2 years ago

Do you have an example of this but programmatically done as with paste0 .

tidyphreeqc::phr_run("
SOLUTION 1
-Temp 23
-units mg/L
-pH 7.79
-water 0.9
Alkalinity 3218
Amm 960
Ca 165
Mg 27.7
K 1 charge_balance

REACTION 1
CO2(g) 1
-2.5e-3 moles

SELECTED_OUTPUT
-file 1-centratYLB_filiereClassique.csv
-pH
-molalities Ca+2 Mg+2 CO2 HCO3- CO3-2 Amm H+ OH-
-totals Ca Mg C(4) S(6)
-alkalinity
-equilibrium_phases Calcite Dolomite
-saturation_indices Calcite Dolomite

SAVE solution 1
END

REACTION 2
NaOH 1
0.0415 moles
USE solution 1
END
                     ")

example of the desired situation:

code_1 <- "aaa"

code_2 <- "bbb"

code_3 <- "ccc"

code_4 <- "DESIRED_OUTPUT..."
code_all <- paste0(code_1, code_2, code_3, code_4)

tidyphreeqc::phr_run(code_all)