Changing kinetic reactant with SOLUTION_MODIFY

147 views
Skip to first unread message

Ivan M

unread,
Jan 21, 2013, 2:52:18 PM1/21/13
to phreeqpy-users
Dear all,

How can I change the concentration of a kinetic reactant using SOLUTION_MODIFY? -totals doesn't work, it crashes with 


ERROR: RunAccumulated: An unhandled exception occured.

Also, there's the problem of trying to change the concentration of oxygen. With a initial oxygen concentration of 0.312513E-03 mol, when calling SOLUTION_MODIFY to change it:

SOLUTION_MODIFY 1
   -total_h 1.0e-3
   -total_O 1.0e-4
   -totals
      Xylene     1.0e-3

 ERROR EHandler 
ERROR:               A(H2O) Activity of water has not converged.        Residual: 5.067528e-05

ERROR:                   pH Charge balance has not converged.   Residual: 2.089533e-03

ERROR:             Hydrogen Mass of hydrogen has not converged.         Residual: 2.885556e-03

ERROR:               Oxygen Mass of oxygen has not converged.   Residual: -2.105515e-03

ERROR: Numerical method failed on all combinations of convergence parameters


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,
Jan 21, 2013, 9:16:51 PM1/21/13
to phreeqp...@googlegroups.com
A kinetic reactant would be modified with KINETICS_MODIFY, but I guess I need  to see what you are doing.

Version 3, which I hope will be out this week, has some better error checking for the _MODIFY keywords.

David

--
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 found at http://www.phreeqpy.com.
 
 

Ivan M

unread,
Jan 22, 2013, 10:40:43 AM1/22/13
to phreeqpy-users
Hi David,

Thanks for your answer. What I'm trying to do is to couple Phreeqc with a transport code, and for that I'll need to change the concentrations of all elements and kinetics reactants present. I have some geochemistry in solution and Monod reactions modeled with RATES and KINETICS Basic code. I can show you the Fortran code if it helps.

I tried to find in the documentation for the keyword KINETICS_MODIFY for version 2 but I couldn't. Is it present in version 3?

Cheers


2013/1/21 Parkhurst, David <dlp...@usgs.gov>
KINETICS_MODIFY

Parkhurst, David

unread,
Jan 22, 2013, 11:08:38 AM1/22/13
to phreeqp...@googlegroups.com
If you dump a kinetics data block, you will get the format. I think the one below is appropriate for version 2. Version 3 is slightly different. Hopefully we will get version 3 out in the next week or two.

David


KINETICS_MODIFY      1 
  -step_divide       1
  -rk                1
  -bad_step_max      500
  -use_cvode         0
  -cvode_steps       100
  -cvode_order       5
  -component
    -rate_name             Calcite
      -tol                   1e-008
      -m                     0.9999999999991           *
      -m0                    1
      -moles                 8.9805940461929e-013
      -namecoef
        CaCO3   1
      -d_params
        1 1 1 1                                        *
  -totals         
    C   8.9801193858101e-013
    Ca   8.9801193858101e-013
    O   2.694035815743e-012
  -steps                

--

Ivan M

unread,
Jan 24, 2013, 12:42:22 PM1/24/13
to phreeqpy-users
Hi David,

Thanks again for your answers. I managed to use a KINETICS_MODIFY block, but the concentration of the kinetic component didn't change:

ierr = AccumulateLine(id, "KINETICS_MODIFY 1")
        ierr = AccumulateLine(id, "   -total  ")
        ierr = AccumulateLine(id, "  Biomass   " // conc_array(5))


        CALL OutputAccumulatedLines(id)

        if (RunAccumulated(id) /= 0) then
            call EHandler(id)
        end if

Not sure how to proceed. I'm starting to dig into iphreeqc code to see if I can understand its behavior.

On a related question, is it possible to output the temperature in the SELECTED_OUTPUT, but can it be changed using a SOLUTION_MODIFY or other keyword? Can it also be used in a KINETIC block?

Thanks again for your patience.

_________________________________________
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


2013/1/22 Parkhurst, David <dlp...@usgs.gov>

Parkhurst, David

unread,
Jan 24, 2013, 1:11:13 PM1/24/13
to phreeqp...@googlegroups.com
I misunderstood. KINETICS_MODIFY allows you to change the amount of kinetic reactant that is available to react, but it does not directly change solution concentration.

Your original adjustment of the concentration of Xylene with SOLUTION_MODIFY is OK, assuming you transported Xylene and want to update the solution moles. However, -total_H and -total_O are the total number of moles of H and O in solution, usually about 111 moles for H and 55.5 for O related to the solvent H2O, but also all other forms, like OH-, HCO3-, O2(aq), etc. You cannot arbitrarily change these numbers. You can change them as a result of transporting total_H and total_O, or you could take the old values and add an increment to them, but you need to be careful. The values determine the redox state of the solution and the moles of water present, and they need to be known to many (>8) decimal places.

On Mon, Jan 21, 2013 at 12:52 PM, Ivan M <ispm...@gmail.com> wrote:

--

Ivan M

unread,
Jan 24, 2013, 1:42:15 PM1/24/13
to phreeqpy-users
Hello again David, thanks for your answer. I have some other questions below.

2013/1/24 Parkhurst, David <dlp...@usgs.gov>

I misunderstood. KINETICS_MODIFY allows you to change the amount of kinetic reactant that is available to react, but it does not directly change solution concentration.

Your original adjustment of the concentration of Xylene with SOLUTION_MODIFY is OK, assuming you transported Xylene and want to update the solution moles.

That's what I'm trying to do. A transport step, outside Phreeqc, will change the concentrations, and I'll update them with the new values, react inside Phreeqc, and transport again, etc.

 
However, -total_H and -total_O are the total number of moles of H and O in solution, usually about 111 moles for H and 55.5 for O related to the solvent H2O, but also all other forms, like OH-, HCO3-, O2(aq), etc. You cannot arbitrarily change these numbers. You can change them as a result of transporting total_H and total_O, or you could take the old values and add an increment to them, but you need to be careful. The values determine the redox state of the solution and the moles of water present, and they need to be known to many (>8) decimal places.

As I plan to couple the transport code that I have with Phreeqc, I understood that I would need to transport everything, including total_O and total_H. I'm not planning to change arbitrarily the concentrations, but what changed from the adjacent cells from the transport simulation, as HCO3, CO3 and other species will be present. Following a previous discussion I'm planning to transport elements and use them in the SOLUTION_MODIFY part. What do you recommend to be done in this case?  

Thanks again.

Parkhurst, David

unread,
Jan 24, 2013, 3:41:39 PM1/24/13
to phreeqp...@googlegroups.com
If you transport total_H, total_O, and charge, plus all other elements, you can use SOLUTION_MODIFY to specify the new moles for each cell. You have to deal with the fact that the values are moles in SOLUTION_MODIFY, whereas your transport values may be concentrations.

I was simply pointing out that values like 1e-3 and 1e-4 for total_H and total_O are almost certainly wrong.


SOLUTION_MODIFY 1
   -total_h 1.0e-3
   -total_O 1.0e-4
Reply all
Reply to author
Forward
0 new messages