Conceptual Models > Design of conceptual models
Model samplings in a closed reactor
(1/1)
jeanM:
Hello,
I use Phreeqc to model a reactor containing gas, liquid and solid phases. The basic principle of my model is to declare these three phase, with SOLUTION, GAS_PHASE and EQUILIBRIUM_PHASES keywords datablocks respectively and then apply KINETICS to model the evolution of the system. The purpose of this was to fit kinetics parameters ("by hand") based on the experimental data.
I have succesfully performed this part.
The problem I am facing now is to model the (many) liquid and gas phase samplings performed during this experiment, which basically results in a loss of mass in the liquid phase and a drop of pressure in the gas phase. The reactor volume a modulable, which translate to a contant gas phase volume even with liquid sampling.
Samplings being numerous , and as i'm adjusting parameters by hands, I have to automate the declaration of samplings.
I achieved to do that with the liquid phase by using a MIX keyword datablock. However, can't find a solution for GAS_PHASE and KINETICS datablocks. The only solution i can think for GAS_PHASE is to re-declares a new block at each step and copy the composition of the gas phase before sampling and aplly the new pressure. Also i think that I should redeclare a KINETICS block each time with the reaction advance .
Is there a way to automate these steps ?
Thanks in advance !
dlparkhurst:
I can give you a couple of leads on simplifying your calculations.
First, if you use the keyword data block RUN_CELLS, you can run a reaction for all of the reactants with a specified user number, everything numbered 1, for example. MIX 1 will be used in preference to SOLUTION 1 in the reaction. You can also specify the start time and time step in RUN_CELLS. RUN_CELLS is basically an automatic set of USE and SAVE statements.
Second, there are data blocks EQUILIBRIUM_PHASES_MIX, GAS_PHASE_MIX, KINETICS_MIX, and SOLUTION_MIX. The mixing fractions are defined in the same way as MIX. To simply reduce the amount of a gas phase, you could use something like GAS_PHASE_MIX 1; 1 0.9; END. Note that GAS_PHASE 1 will change as soon as this data block is executed; you do not need RUN_CELLS for the mix to happen. In addition, ENDs could get confusing. To keep everything clear, I think you should define the _MIX data blocks followed by an END; then RUN_CELLS...END.
SOLUTION_MIX differs from MIX in that no output is generated, and while MIX is used in preference to SOLUTION in RUN_CELLS, SOLUTION_MIX would not be used (but as above, separate the _MIX blocks from RUN_CELLS with an END; the _MIXes are performed after RUN_CELLS if they are in the same END block, I think).
You will have to figure out the appropriate mixing fractions for each phase, but you have to do something similar regardless. The _MIX approach would not work if, for example, you preferentially remove one mineral relative to another.
Finally, there would still be a lot of sequential data blocks. You may want to consider doing the calculations under scripting or program control. IPhreeqcCOM can be used in Excel to run PHREEQC with Visual Basic. I think you can also use it in Matlab. There is an R version of PHREEQC that could be used. IPhreeqc (not COM) can be used with C++ or Fortran. I'm not sure about the state of PhreeqPy, but it may be possible to use Python.
Another approach, that is a bit more complicated, but does not require learning IPhreeqc, is to use USER_PUNCH to write the data blocks that are needed, and the use INCLUDE$ to run the data blocks that you generated. See Example 8 in the Version 3 manual for an example.
dlparkhurst:
The _MIX data blocks are documented in the Appendix of the Version 3 manual.
There are also _MODIFY data blocks that could be useful to you. You can change individual items in the reactant state. For example, you could decrease the number of moles of just CO2(g) in the GAS_PHASE state.
Navigation
[0] Message Index
Go to full version