Click here to donate to keep PhreeqcUsers open
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forum Home
Login
Register
PhreeqcUsers Discussion Forum
»
Beginners
»
PHREEQC basics
»
IPhreeqc/Matlab
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: IPhreeqc/Matlab (Read 768 times)
omarchaabi
Contributor
Posts: 5
IPhreeqc/Matlab
«
on:
September 26, 2019, 01:47:57 PM »
Dear all,
I am trying to run some PHREEQC simulations through matlab. To clarify my question I will propose the following example. Lets say I want to initialize the following solution as follows:
iphreeqc.AccumulateLine("SOLUTION 1");
iphreeqc.AccumulateLine(" temp 25");
iphreeqc.AccumulateLine(" pH 7");
iphreeqc.AccumulateLine(" pe 4");
iphreeqc.AccumulateLine(" redox pe");
iphreeqc.AccumulateLine(" units mg/l");
iphreeqc.AccumulateLine(" density 1");
iphreeqc.AccumulateLine(" Alkalinity 332 as HCO3");
iphreeqc.AccumulateLine(" Ca 13840");
iphreeqc.AccumulateLine(" Cl 96560");
iphreeqc.AccumulateLine(" Mg 1604");
iphreeqc.AccumulateLine(" Na 44261");
iphreeqc.AccumulateLine(" S(6) 885");
iphreeqc.AccumulateLine("END");
iphreeqc.RunAccumulated;
According to the default settings, it will use 1 Liter of water. My question is the following, can I set a different volume of water that is already defined as a variable in matlab. I was hoping maybe something as the following would work
iphreeqc.AccumulateLine(['-water ', Saturation]);
where Saturation is a variable calculated previously in my Matlab code. But unfortunately it doesn't work. I am using my simulations in loops so it is not possible for me to define the volume of water manually. I hope someone can help or guide me to possible solutions. Thanks in advance
Regards,
Omar
«
Last Edit: September 26, 2019, 02:47:02 PM by omarchaabi
»
Logged
dlparkhurst
Top Contributor
Posts: 2583
Re: IPhreeqc/Matlab
«
Reply #1 on:
September 26, 2019, 03:08:55 PM »
Just to be pedantic, PHREEQC uses 1 kg water for the default in SOLUTION definitions, which may vary from 1 L of SOLUTION, especially in brines. (PhreeqcRM has methods that convert from volume to mass of water and back again.)
The -water option in SOLUTION also defines a number of kilograms of water, but again, it is usually is within a percent or two of the volume in liters.
You can definitely use -water in SOLUTION, perhaps your syntax is not correct. AccumulateLine requires a string argument.
Logged
omarchaabi
Contributor
Posts: 5
Re: IPhreeqc/Matlab
«
Reply #2 on:
September 30, 2019, 08:13:08 AM »
Thanks for the prompt reply. It was indeed a syntax mistake. I used matlab function (num2str) to convert the Saturation to a string. It worked and for anyone who might face the issue here is how it was written:
iphreeqc.AccumulateLine(['-water ',num2str(Saturation)]);
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
PhreeqcUsers Discussion Forum
»
Beginners
»
PHREEQC basics
»
IPhreeqc/Matlab