Minerals with different rates for dissolution and precipitation

203 views
Skip to first unread message

A Palacios

unread,
Jul 7, 2022, 9:15:50 AM7/7/22
to pflotran-users
Dear PFLOTRAN users,

My team is looking to set up a reactive transport model with several mineral's kinetic parameters such that some minerals will only dissolve or have different rates of dissolution and precipitation.

Is there any way to do this with what's implemented already, or a reaction sandbox is needed? 

Thank you in advance for your time and help. 

Best regards, 
Andrea

Hammond, Glenn E

unread,
Jul 8, 2022, 11:34:52 AM7/8/22
to pflotra...@googlegroups.com

Andrea,

 

The Reaction Sandbox is ideally suited for what you need. https://gmd.copernicus.org/articles/15/1659/2022/

 

You might also reach out to Ben Tutolo or Adedapo Awolayo (https://ucalgary.ca/reactive-transport/group-members) for their perspective.

 

Glenn

 

From: pflotra...@googlegroups.com <pflotra...@googlegroups.com> On Behalf Of A Palacios
Sent: Thursday, July 7, 2022 6:16 AM
To: pflotran-users <pflotra...@googlegroups.com>
Subject: [pflotran-users: 6734] Minerals with different rates for dissolution and precipitation

 

Check twice before you click! This email originated from outside PNNL.

 

--
You received this message because you are subscribed to the Google Groups "pflotran-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pflotran-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pflotran-users/7512175f-768b-407b-91c1-954c01e91cfbn%40googlegroups.com.

A Palacios

unread,
Jul 20, 2022, 5:54:31 AM7/20/22
to pflotran-users
Hello Glenn,

I'm programming the Reaction Sandbox for changing the minerals' kinetic rates.

Inside the subroutine EVALUATE, I:

- Compute the new kinetic rate for the m-th mineral "Im", by accessing all mineral parameters:
  • Surface Area: rt_auxvar%mnrl_area
  • Volume Fraction_ rt_auxvar%volfrac
  • Mineral Log K from Database: reaction%mineral%kinmnrl_logK(imnrl)
  • Aqueous Species of the mineral reaction: reaction%mineral%kinmnrlspecID
  • etc...
- Store new rate Im in "rt_auxvar%mnrl_rate(imnrl)", where imnrl is the ID number of the m-th mineral. 
- Change RESIDUAL for primary species. 
- Compute Jacobian "d_Im/d_PrimarySpecies"

What should I program in UpdateKineticState? I understand that this subroutine follows the Newton iteration but variable "rt_auxvar%mnrl_rate(imnrl)" doesn't seem to be reading my new kinetic rate from Evaluate. 
I have read the Reaction Sandbox article many times but I'm stuck here...

Could I get some help with this subroutine, please? 

Thank you in advance for your time! 

Andrea

A Palacios

unread,
Jul 20, 2022, 6:09:01 AM7/20/22
to pflotran-users
Hello again,

I'm just reading the RUpdateKineticState subroutine of "reaction.F90". Should I be inspired by this subroutine for the subroutine with the same name in the Reaction Sandbox? 

Regards,

Andrea

Hammond, Glenn E

unread,
Jul 20, 2022, 7:30:41 PM7/20/22
to pflotra...@googlegroups.com

Andrea,

 

Please see my comments below.

 

From: pflotra...@googlegroups.com <pflotra...@googlegroups.com> On Behalf Of A Palacios
Sent: Wednesday, July 20, 2022 3:09 AM
To: pflotran-users <pflotra...@googlegroups.com>
Subject: Re: [pflotran-users: 6750] Minerals with different rates for dissolution and precipitation

 

Hello again,

 

I'm just reading the RUpdateKineticState subroutine of "reaction.F90". Should I be inspired by this subroutine for the subroutine with the same name in the Reaction Sandbox? 

 

Yes.

 

Regards,

 

Andrea

 

On Wednesday, July 20, 2022 at 11:54:31 AM UTC+2 A Palacios wrote:

Hello Glenn,

 

I'm programming the Reaction Sandbox for changing the minerals' kinetic rates.

 

Inside the subroutine EVALUATE, I:

 

- Compute the new kinetic rate for the m-th mineral "Im", by accessing all mineral parameters:

  • Surface Area: rt_auxvar%mnrl_area
  • Volume Fraction_ rt_auxvar%volfrac
  • Mineral Log K from Database: reaction%mineral%kinmnrl_logK(imnrl)
  • Aqueous Species of the mineral reaction: reaction%mineral%kinmnrlspecID
  • etc...

- Store new rate Im in "rt_auxvar%mnrl_rate(imnrl)", where imnrl is the ID number of the m-th mineral. 

- Change RESIDUAL for primary species. 

- Compute Jacobian "d_Im/d_PrimarySpecies"

 

In order to use the existing data structures employed by the default (transition state theory) mineral precipitation-dissolution capability in PFLOTRAN in the reaction sandbox, you must set the RATE_CONSTANT under MINERAL_KINETICS to zero. Otherwise, PFLOTRAN will calculate two rates: one based on the default mineral precipitation-dissolution reaction in PFLOTRAN and another based on what you calculate in the sandbox. By setting the RATE_CONSTANT to zero, the default rate will be zero. 

 

You then specify all your custom mineral kinetics parameters within the REACTION_SANDBOX block of the input deck. This provides for maximum flexibility. At first, you can hardwire the parameters within the EVALUATE routine, and to increase flexibility later on, add reading and setup routines. Git commit often so that you have access to earlier versions!

 

I also recommend initially calculating derivatives numerically (NUMERICAL_JACOBIAN under the NUMERICAL_METHODS TRANPSPORT -> NEWTON_SOLVER block). Once the sandbox is running with numerical derivatives, you can switch to analytical and compare the two.

 

What should I program in UpdateKineticState? I understand that this subroutine follows the Newton iteration but variable "rt_auxvar%mnrl_rate(imnrl)" doesn't seem to be reading my new kinetic rate from Evaluate. 

I have read the Reaction Sandbox article many times but I'm stuck here...

 

UpdateKineticState is calculated at the end of the time step for the explicit update of mineral volume fractions. Volume fractions are only updated at the end of the time step based on the rate calculated in the last residual evaluation. See RUpdateKineticState as discussed above.

 

Glenn

A Palacios

unread,
Jul 25, 2022, 8:14:42 AM7/25/22
to pflotran-users
Dear Glenn,

Thank you for your replies, they are being very helpful.

I'm having a problem with subroutine UpdateKineticState. 

Inside Evaluate I compute a rate "I" and I store it in "rt_auxvar%mnrl_rate(imnrl)" by doing: 
rt_auxvar%mnrl_rate(imnrl) = I

Once the Evaluate subroutine is over, inside UpdateKineticState, the variable "rt_auxvar%mnrl_rate(imnrl)" has a value associated with the MINERAL_KINETICS card and not the Reaction Sandbox Evaluate subroutine. When I set RATE_CONSTANT in the MINERAL KINETICS card to 0.d0 as you mentioned in your previous email, the variable rt_auxvar%mnrl_rate(imnrl) in UpdateKineticState is Zero. 

I noticed that the call to the Sandbox is at the end of the UpdateKineticState subroutine inside reaction.F90, so I suppose the value of rt_auxvar%mnrl_rate(imnrl) is changed before the call happens.

Do you have any suggestion to fix this? 

Thank you in advance for your help!

Regards,
Andrea

Hammond, Glenn E

unread,
Jul 26, 2022, 2:36:08 AM7/26/22
to pflotra...@googlegroups.com

Andrea,

 

I have to admit that I have never attempted overwriting %mnrl_rate myself.  If using %mnrl_rate, the non-Sandbox call to UpdateKineticState should work without overriding that routine in the Sandbox. But this will only work if the reaction sandbox routines are called after RKineticMineral(), which appears to be the case:

 

https://bitbucket.org/pflotran/pflotran/src/186bd0f6aed20d3319d148a03ccbf315d0e25ac1/src/pflotran/reactive_transport_aux.F90#lines-74

 

Another option is to allocate rt_auxvar%auxiliary_data(:)

 

https://bitbucket.org/pflotran/pflotran/src/186bd0f6aed20d3319d148a03ccbf315d0e25ac1/src/pflotran/reactive_transport_aux.F90#lines-74

 

in the reaction sandbox Setup routine and store the rates there.  In that case, you can update the states in the extended ReactionSandbox UpdateKineticState routine.

 

Feel free to create a fork of the PFLOTRAN repository on Bitbucket and share it with me.  That will make it easier to provide feedback.

 

Glenn

 

A Palacios

unread,
Jul 28, 2022, 3:12:07 AM7/28/22
to pflotra...@googlegroups.com
Dear Glenn, 

I've forked the repository and created a branch to share the reaction sandbox with you. 
We're trying to reproduce the Calcite Dissolution problem that we can find in PFLOTRAN tutorials. 

At the moment I've just created a Sandbox that computes a Mineral Rate in Evaluate, stores it in several variables, and then I try to read those variables inside UpdateKineticState. 

Please, let me know if you received the invitation to access the repository. It's a first time. 

Best, 
Andrea

You received this message because you are subscribed to a topic in the Google Groups "pflotran-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pflotran-users/A8x9Z6IMizo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pflotran-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pflotran-users/PH0PR09MB78367DE72A31A313354A9C339A949%40PH0PR09MB7836.namprd09.prod.outlook.com.


--
Andrea Palacios 

Hammond, Glenn E

unread,
Jul 28, 2022, 12:41:42 PM7/28/22
to pflotra...@googlegroups.com

Andrea,

 

I made comments on your fork.  Please address these comments (feel free to respond to the comments and ask clarifying questions through Bitbucket).  Bitbucket is a better location for discussing implementation details, either there or pflotr...@googlegroups.com, to avoid spamming users with niche discussion.

 

Thanks,


Glenn

 

Reply all
Reply to author
Forward
0 new messages