gdtk-uq / gdtk

The Gas Dynamics Toolkit (GDTk) is a set of software tools for simulating high speed fluid flow, maintained at The University of Queensland and the University of Southern Queensland, Australia.
https://gdtk.uqcloud.net/
Other
59 stars 15 forks source link

Questions about source code quote #57

Closed KulaLAForU closed 5 months ago

KulaLAForU commented 5 months ago

Hi,

The problem I'm having really makes me despair, please forgive my rookie coding skill. I changed the folloing code in reaction.d to use Park's constants for equilibruim :

Screenshot 2024-04-02 at 04 31 12

And then in reaction.lua I changed here:

Screenshot 2024-04-02 at 04 30 58 Screenshot 2024-04-02 at 04 34 53

Finally I changed rate_constant.d :

Screenshot 2024-04-02 at 04 36 02

But,, how can I quote A1, A2, A3, A4, A5 as

Screenshot 2024-04-02 at 04 36 47

Sincerely thanks for your help, have a good day, Jianshu Wu

rjgollan-on-github commented 5 months ago

Hi Jianshu, I can point to the problem. Your "A1", "A2", etc values are given to a model for the rate constant. Due to our use of classes to encapsulate the concerns of various interacting parts, the "A1", "A2" values are NOT available when you attempt to call them in a reaction. The reaction needs only know about functions for k_f, k_b, K_eq etc. It does not know the details of the internals for those objects. Your constants are internal details.

I have some better suggestions for you.

  1. Don't use the Park equilibrium constant. It's too specific to one particular chemistry. This is why I have never implemented it. Why do you want to use Park so much? I prefer to use the general equilibrium constant computed from Gibbs free energy.
  2. If you really want the effect of the Park equilibrium constant, I would reverse engineer it. Outside the code, you could compute a bunch of k_b values based on k_f and K_eq_Park for a range of temperatures. Then using a fitting package, fit an Arrhenius form to your k_b. You should be able to control the error. Then you can use those Arrhenius parameters in the br={'Arrhenius', ... etc.}
KulaLAForU commented 5 months ago

Hi Rowan,

Thanks for your reply and suggestion~~

I want to use this condition to compare the shock stand-off distance with my old code, then change the chemical relaxation time to do further, but if I use the fitting package I think I may not have a way to compare so is there any possibility for me to write some code to the source code?

rjgollan-on-github commented 5 months ago

Hi Jianshu, My point is that using a fit to k_b does allow you to compare, but without modifying internal source code. Instead, you can just provide the appropriate backwards rate parameters to achieve the same effect. I think you could plot the actual k_b and your fit k_b and compare. I doubt any fitting discrepancy would propagate through as a discernible change in shock location.

If you do want to modify source code, I looked over our code. We do not provide an easy way to specialise the computation of equilibrium constant. There is only one function for K_eq and it presently cannot be substituted.

If you really want to try the direct computation of equilibrium constant as per Park, then I suggest a hard-code override in reaction.d. Replace the K_eq value with your computed K_eq value. Be sure to check units. You need an equilibrium constant based on concentrations, not on pressure. There are various definitions in the literature.

But, as mentioned above, I think the building of "effective" k_b curves is the least pain path and involves no source code modification, only modification to your chemistry input file.

KulaLAForU commented 5 months ago

Thanks very much Rowan,

This amazing software really great but I do want to change a little bit in source code, I'm learning D langguage a bit deeper to do so.

And appreciate about your advice about the chemistry input file, I'll read and learn that part too.

Have a good day / night

KulaLAForU commented 4 months ago

Hi,

I suddenly realized we would be meeting at the HiSST next week, so small world...... If you don't mind I'd like to say hello then.

Have a safe trip