wacl-york / mcm-web

Code for the MCM web application
1 stars 2 forks source link

Include the chemical composition (i.e., the formula) in the KPP export #257

Closed RolfSander closed 3 months ago

RolfSander commented 9 months ago

Based on the discussion at https://github.com/wacl-york/mcm-web/issues/248, I'd like to make a feature request:

I wonder if it would be possible to replace the IGNORE in the MCM-generated KPP file by the real composition. For example, the formula of IPROPOL is C3H8O. The corresponding line in the #DEFVAR section of the KPP file should be:

IPROPOL = 3C + 8H + O ;

The format conversion from C3H8O to 3C + 8H + O could be done with a regexp like this:

formula_for_kpp = formula.gsub(/([A-Z][a-z]?)(\d+)?/, '\2\1 + ')

and then deleting the final + sign.

stulacy commented 9 months ago

Thanks Rolf, I'll try and find time for this next week.

stulacy commented 8 months ago

Hi @RolfSander , I've picked this up over in #264