idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Geochemistry: add time-dependency #15330

Closed WilkAndy closed 4 years ago

WilkAndy commented 4 years ago

Reason

Need to be able to simulate equilibrium reactions with time-dependency

Design

Probably need to employ a NodalUserObject that uses coupledVars for temperature, etc, and does the initial solve in initialize() and subsequent solves in execute(). Whatever the design, here is some functionality that is required:

Impact

Ability to model common time-dependent geochemical systems.

Notifying @rpodgorney and @cpgr

WilkAndy commented 4 years ago

The "restore" should happen before doing the swaps. Then the user can choose a different basis to a previous solve - advantageous if they want to fix fugacity of a gas that was previously a secondary species, for instance.

WilkAndy commented 4 years ago

Probably the "save" should mean that we need an AuxVariable for each species (basis, secondary, etc) and should save into an Exodus file. Then restore should happen via a SolutionUserObject, etc. I wonder whether an Action can add AuxVariables that specified by the GeochemicalModelDefinition UserObject?

rpodgorney commented 4 years ago

@andywilkins, I worry having AuxVariables for each species will become overly cumbersome without some overlying Action

-- Robert Podgorney, PhD, PG Geothermal Program Manager, Idaho National Laboratory Modeling and Simulation Lead, Utah FORGE Program Thermal Systems Co-Lead, INL Integrated Energy Systems Initiative

Office: 208-526-1524 Cell: 208-520-9361 email: robert.podgorney@inl.govmailto:robert.podgorney@inl.gov Statement of Confidentiality The contents of this e-mail message and any attachments are confidential and are intended solely for addressee. The information may also be legally privileged. This transmission is sent in trust, for the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply e-mail or phone and delete this message and its attachments, if any.

From: Andy Wilkins notifications@github.com Reply-To: idaholab/moose reply@reply.github.com Date: Wednesday, May 20, 2020 at 11:59 PM To: idaholab/moose moose@noreply.github.com Cc: Robert Podgorney Robert.Podgorney@inl.gov, Mention mention@noreply.github.com Subject: [EXTERNAL] Re: [idaholab/moose] Geochemistry: add time-dependency (#15330)

Probably the "save" should mean that we need an AuxVariable for each species (basis, secondary, etc) and should save into an Exodus file. Then restore should happen via a SolutionUserObject, etc. I wonder whether an Action can add AuxVariables that specified by the GeochemicalModelDefinition UserObject?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fidaholab%2Fmoose%2Fissues%2F15330%23issuecomment-631898277&data=02%7C01%7Crobert.podgorney%40inl.gov%7Ca7b669a6b2f04a0c21e708d7fd4c15da%7C4cf464b7869a42368da2a98566485554%7C0%7C0%7C637256375531049055&sdata=FxmPYD3sN63xLBC7WpSKMW0zJiXyhEryehdJd8AZYJo%3D&reserved=0, or unsubscribehttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACWGDT43GZWX3INZALXFYULRSS7KZANCNFSM4NGRZOJA&data=02%7C01%7Crobert.podgorney%40inl.gov%7Ca7b669a6b2f04a0c21e708d7fd4c15da%7C4cf464b7869a42368da2a98566485554%7C0%7C0%7C637256375531049055&sdata=NGu2%2FJx3r62FDo5WS5wcyvLc%2FLRrFNQfDRpaCQ77ZCU%3D&reserved=0.

WilkAndy commented 4 years ago

Yea, you're absolutely right. There are usually at least 10 primary species and probably 100 secondary species. We need an Action!

YaqiWang commented 4 years ago

Another possibly solution could be array variable/auxkernel. You may have one single array variable for all 100 species.

WilkAndy commented 4 years ago

Oh, can you give me an example, @YaqiWang ?

YaqiWang commented 4 years ago

https://github.com/idaholab/moose/blob/next/test/tests/kernels/array_kernels/array_diffusion_reaction.i is a test using array kernels. When I added array variable capability, I was not in needs of aux array kernels, so I did not added (but can be added easily). The number of components of a array variable can be any number.

rpodgorney commented 4 years ago

I like this approach, need to look a bit closer at the code

-- Robert Podgorney, PhD, PG Geothermal Program Manager, Idaho National Laboratory Modeling and Simulation Lead, Utah FORGE Program Thermal Systems Co-Lead, INL Integrated Energy Systems Initiative

Office: 208-526-1524 Cell: 208-520-9361 email: robert.podgorney@inl.govmailto:robert.podgorney@inl.gov Statement of Confidentiality The contents of this e-mail message and any attachments are confidential and are intended solely for addressee. The information may also be legally privileged. This transmission is sent in trust, for the sole purpose of delivery to the intended recipient. If you have received this transmission in error, any use, reproduction or dissemination of this transmission is strictly prohibited. If you are not the intended recipient, please immediately notify the sender by reply e-mail or phone and delete this message and its attachments, if any.

From: Yaqi notifications@github.com Reply-To: idaholab/moose reply@reply.github.com Date: Thursday, May 21, 2020 at 3:31 PM To: idaholab/moose moose@noreply.github.com Cc: Robert Podgorney Robert.Podgorney@inl.gov, Mention mention@noreply.github.com Subject: [EXTERNAL] Re: [idaholab/moose] Geochemistry: add time-dependency (#15330)

https://github.com/idaholab/moose/blob/next/test/tests/kernels/array_kernels/array_diffusion_reaction.ihttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fidaholab%2Fmoose%2Fblob%2Fnext%2Ftest%2Ftests%2Fkernels%2Farray_kernels%2Farray_diffusion_reaction.i&data=02%7C01%7Crobert.podgorney%40inl.gov%7C700b357615a4447c0fe108d7fdce57cf%7C4cf464b7869a42368da2a98566485554%7C0%7C0%7C637256934995833332&sdata=%2BE7TXvSxQrfvF8sUdxTqE%2B1Fzr4GQ%2B%2FP8k61iiJ4F1I%3D&reserved=0 is a test using array kernels. When I added array variable capability, I was not in needs of aux array kernels, so I did not added (but can be added easily). The number of components of a array variable can be any number.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fidaholab%2Fmoose%2Fissues%2F15330%23issuecomment-632357068&data=02%7C01%7Crobert.podgorney%40inl.gov%7C700b357615a4447c0fe108d7fdce57cf%7C4cf464b7869a42368da2a98566485554%7C0%7C0%7C637256934995843325&sdata=1W4l1N0mHIa2HhWLNP3rNN%2BwINDECYUFEI%2BDpNcUJnY%3D&reserved=0, or unsubscribehttps://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACWGDT2HHIS23DWODJUETJDRSWMTNANCNFSM4NGRZOJA&data=02%7C01%7Crobert.podgorney%40inl.gov%7C700b357615a4447c0fe108d7fdce57cf%7C4cf464b7869a42368da2a98566485554%7C0%7C0%7C637256934995843325&sdata=YHSkDqLtqlj4GXxfPQUHnaabw5G6td%2FaiJUSOTWOLAE%3D&reserved=0.

WilkAndy commented 4 years ago

Cool, thanks @YaqiWang . I'll consider it. The disadvantage is that i won't know the names of the species, so will somehow have to record that. I'll have a think....

WilkAndy commented 4 years ago

The "restore" should happen before doing the swaps. Then the user can choose a different basis to a previous solve - advantageous if they want to fix fugacity of a gas that was previously a secondary species, for instance.

Actually, i don't think this ordering of "restore" is necessary (or even desirable). The "restore" can happen at any time because it is just setting molalities. Just have to be careful with constraints

WilkAndy commented 4 years ago

Woohoo, @rpodgorney and @cpgr, i just did my first time-dependent simulation and it all went really well.

https://mooseframework.org/modules/geochemistry/tests_and_examples/adding_feldspar.html

Lots of work to go, but the core machinery seems behave itself really nicely, so i'm quite pleased.

rpodgorney commented 4 years ago

well done @WilkAndy!

WilkAndy commented 4 years ago

OK, coding is basically done. Need to spend a few days tidying.