Create more than one instance of IPhreeqc

82 views
Skip to first unread message

Ivan M

unread,
Feb 6, 2013, 5:01:08 PM2/6/13
to phreeqpy-users
Hi all,

I'm trying to create more than one instance of IPhreeqc with CreatePhreeqc call, but it seems that this does not work - only one instance of IPhreeqc seems to be able to be created in the same program. Is this correct? 

If so, what is the best approach to create several solutions, each one with the same elements and species but with different concentrations, and the concentrations changing by external calls?

Cheers
_________________________________________
Ivan S.P. Marin, PhD
 
Postdoctoral Associate
Département de géologie et de génie géologique
Pavillon Adrien-Pouliot, local 3744
1065. ave de la Médecine
Université Laval
Québec (Québec) Canada
G1V 0A6
418-656-2131 poste 7246

Parkhurst, David

unread,
Feb 6, 2013, 5:49:30 PM2/6/13
to phreeqp...@googlegroups.com
No, that should not be correct.

When you create an IPhreeqc (for C, id = CreateIPhreeqc(); or for Fortran, id = CreateIPhreeqc()), you get an id number. You must reference the different IPhreeqc instances with the different id values that are returned.

That said, you normally use one IPhreeqc instance to contain multiple solutions. There is quite a bit of overhead in each IPhreeqc instance, so you probably want to limit the number of them to say 10 or less, unless you have a good reason for more. For instance, I use one for each processor to parallelize in PHAST. 

--
You received this message because you are subscribed to the Google Groups ""phreeqpy-users" group.
To post to this group, send email to phreeqp...@googlegroups.com.
To unsubscribe from this group, send email to phreeqpy-user...@googlegroups.com.
For more options, visit this group at https://groups.google.com/d/forum/phreeqpy-users?hl=en.
 
More information about PhreeqPy can be found at http://www.phreeqpy.com.
---
You received this message because you are subscribed to the Google Groups "phreeqpy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phreeqpy-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dr. Mike Mueller

unread,
Feb 6, 2013, 6:34:09 PM2/6/13
to phreeqp...@googlegroups.com
Am 06.02.13 23:01, schrieb Ivan M:
> Hi all,
>
> I'm trying to create more than one instance of IPhreeqc with CreatePhreeqc
> call, but it seems that this does not work - only one instance of IPhreeqc
> seems to be able to be created in the same program. Is this correct?

With PhreeqPy you can make several instances of phreeqpy.phreeqc_dll.IPhreeqc.
Each instance uses a different IPhreeqc instance in the background and
keeps track of the id. For example:

from phreeqpy.iphreeqc.phreeqc_dll import IPhreeqc

ipc1 = IPhreeqc()
ipc2 = IPhreeqc()
ipc1.load_database('databases1.dat')
ipc2.load_database('databases2.dat')

HTH,
Mike

>
> If so, what is the best approach to create several solutions, each one with the
> same elements and species but with different concentrations, and the
> concentrations changing by external calls?
>
> Cheers
> _________________________________________
> Ivan S.P. Marin, PhD
>
> Postdoctoral Associate
> D�partement de g�ologie et de g�nie g�ologique
> Pavillon Adrien-Pouliot, local 3744
> 1065. ave de la M�decine
> Universit� Laval
> Qu�bec (Qu�bec) Canada
> G1V 0A6
> 418-656-2131 poste 7246
> ivan.silvestre-...@ulaval.ca
> <mailto:ivan.silvestre-...@ulaval.ca>

Ivan M

unread,
Feb 6, 2013, 6:37:38 PM2/6/13
to phreeqpy-users
Hi Mike,

Thanks for your answer.

2013/2/6 Dr. Mike Mueller <mmue...@hydrocomputing.com>
Am 06.02.13 23:01, schrieb Ivan M:
> Hi all,
>
> I'm trying to create more than one instance of IPhreeqc with CreatePhreeqc
> call, but it seems that this does not work - only one instance of IPhreeqc
> seems to be able to be created in the same program. Is this correct?

With PhreeqPy you can make several instances of phreeqpy.phreeqc_dll.IPhreeqc.
Each instance uses a different IPhreeqc instance in the background and
keeps track of the id. For example:

from phreeqpy.iphreeqc.phreeqc_dll import IPhreeqc

ipc1 = IPhreeqc()
ipc2 = IPhreeqc()
ipc1.load_database('databases1.dat')
ipc2.load_database('databases2.dat')

HTH,
Mike

This is the approach that I'm using with the Python version of the code that I'm developing and it seems to be working quite alright. 

Cheers
 

>
> If so, what is the best approach to create several solutions, each one with the
> same elements and species but with different concentrations, and the
> concentrations changing by external calls?
>
> Cheers
> _________________________________________
> Ivan S.P. Marin, PhD
>
> Postdoctoral Associate
> Département de géologie et de génie géologique
> Pavillon Adrien-Pouliot, local 3744

> 1065. ave de la Médecine
> Université Laval
> Québec (Québec) Canada
Reply all
Reply to author
Forward
0 new messages