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.
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
To view this discussion on the web visit https://groups.google.com/d/msgid/pflotran-users/1421c535-cee5-4db9-bbf7-1efac0882016n%40googlegroups.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:
Another option is to allocate rt_auxvar%auxiliary_data(:)
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
To view this discussion on the web visit https://groups.google.com/d/msgid/pflotran-users/cdbf132d-4ace-4c6c-bdca-5331ed6beb9an%40googlegroups.com.
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,
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
To view this discussion on the web visit https://groups.google.com/d/msgid/pflotran-users/CADueaXVzY28XkJBXyoYYskyUC%2BcZbdWyciP79_BFUYXRT6g4AA%40mail.gmail.com.