Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate MCM to our configuration #175

Open
K20shores opened this issue Jul 19, 2024 · 2 comments
Open

Translate MCM to our configuration #175

K20shores opened this issue Jul 19, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@K20shores
Copy link
Collaborator

K20shores commented Jul 19, 2024

Figure out how to export the database that MCM has into our format

The MCM web developer has been kind enough to respond to some questions for us: wacl-york/mcm-web#337

Note

There is an existing branch with some exploratory work, including useful SQL statements linked to this issue. There is a folder, etc with a python script and the mcm database

etc
├── data
│   └── mcm.db
└── translate_mcm.py

Acceptance Criteria

  • All 17224 reactions available in MCM can be run in music box. The total count of each type is below
Rate Type Count
Null 7645
Photolysis 3123
Tokenized 6456
Total 17224

Ideas

Photolysis Reactions

  • They uses parameterized photolysis rates
  • Implement a new photolysis rate whose rate is determined by this equation
    • $J=l\cos(X)^m\exp(-n\sec(X))$
    • $l$, $m$, and $n$ all come from the mcm database
    • These rates can still have a scaling factor as many rates are just one rate times a multiple of another
    • $X$ is the solar zenith angle. So, add solar zenith angle as an option for both initial and evolving conditions
  • The table below shows the two general categories. Multiples are rates like J<22>*0.5 which are a multiple of a base photolysis rate. Non multiples would be like J<22> which can be calculated directly from the equation above
Photolysis Type Count
Multiples 319
Non Multiples 2804
Total 3123

Tokenized

  • Tokenized rates are tricky. Many likely match rate types we already have but maybe only after being rearranged. To get the final rate, all tokens need to eventually be replaced. MCM has some code that may help here
  • All equations are written in compliance with FACSIMILE
  • Maybe we could reduce all of the equations to equations after replacing all tokens and simplify them with sympy somehow?
  • If we can't get down to our set of equations, we could add another reaction type that allows equations to be placed into our configuration and we could parse and evaluate them with muparser

https://github.com/wacl-york/mcm-web/blob/5c9b29445672ea5e92f226118ba928edc9311b4a/lib/mcm/db.rb#L124-L181

Null

  • Null is generally going to fall mostly under our arrhenius types, but some will need to be one of the other types
  • Some reactions use concentrations of other species that aren't listed in the list of reactants. When forming the reactions, use them as reactants
    • For example, this reaction rate 5.6D-34*N2*(TEMP/300)@(-2.6)*O2 translates to this equation: $5.6\cdot10^{-34} \cdot [\mathbf{N2}] (\frac{\mathbf{TEMP}}{300})^{-2.6} \cdot [\mathbf{O2}]$
    • The reaction, (from the mcm database) is O -> O3. To put this into our format, we could write this as O + O2 + N2 -> O3. It would be an arrhenius reaction with D set to 300 and B set to -2.6
  • There are three general forms of reactions here. Temperature dependent will be the most annoying to parse and look like this 5.6D-34*N2*(TEMP/300)@(-2.6)*O2, but could also include EXP. RO2 dependent look like 1.30D-12*0.6*RO2 and would only need to have RO2 added as a rectant (it does't already exist as a reactant) and could use the arrhenius type, or maybe the user defined reaction type with a constant value. Non RO2 Dependent seem to be constant valued reaction rates like 5.85D-12 and can again use the user defined reaction rate.
Null Type Count
Temperature Dependent 763
RO2 Dependent 2488
Non RO2 Dependent 4394
Total 7645
@boulderdaze
Copy link
Collaborator

boulderdaze commented Jul 25, 2024

I like your ideas and they make sense to me. (sympy looks an interesting tool). A couple questions I have:

  1. Would it be straightforward to translate some of their reactions into the corresponding reactions in our taxonomy? With an example, 5.6D-34*N2*(TEMP/300)@(-2.6)*O2 -> O + O2 + N2 -> O3, you mentioned that you got that from their database. Was it easy to figure it out?
  2. Is this task specific to music-box? We talked about supporting parser for multiple configurations in the musica. Might musica be responsible for parsing work?

@K20shores
Copy link
Collaborator Author

@boulderdaze all of the equations are easily accessible from their database. Everything but the tokenized reactions will be easy to translate

This is really a one time task that will generate a configuration. We still need to think about our parsing stuff overall. We do have a task to handle parsing in musica, but that's sort of separate from this since first we need a configuration. Also, the photolysis stuff may be a new way to do this for us and would require an update in music box.

@K20shores K20shores added the enhancement New feature or request label Aug 9, 2024
@mattldawson mattldawson added this to the Sancy's MusicBox Paper milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants