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

Reconcile Units With Calculations in gas_chem.hpp #232

Open
mjs271 opened this issue Aug 23, 2023 · 3 comments
Open

Reconcile Units With Calculations in gas_chem.hpp #232

mjs271 opened this issue Aug 23, 2023 · 3 comments

Comments

@mjs271
Copy link
Contributor

mjs271 commented Aug 23, 2023

There are several places in gas_chem.hpp and gas_chem_mechanism.hpp that appear to have inconsistent units (e.g., additions of 2 quantities with differing units). This is based on comments specifying the following units for arrays containing chemical species qoi and reaction rates (paraphrased):

solution := species volume mixing ratio [kmol species/kmol dry air]
rxt := reaction rates in 1D array [1/cm^3/s]
het_rates := washout rates [1/s]

It's entirely possible, if not likely, that the calculations are correct and only comments need to be updated, but we do need to investigate and reconcile this. Additionally, I would argue in favor of separating different physical quantities into separate arrays for the sake of clarity.

Related to #229.

@odiazib @brigaudet @singhbalwinder @jeff-cohere

@pbosler
Copy link
Contributor

pbosler commented Aug 23, 2023

It might be worth considering variable names that have units, e.g., rx_rates_per_cc_per_s, washout_rates_per_s.

@brigaudet
Copy link

Just to follow up on this some -- I went through the Fortran version of the code more carefully (specifically subroutine gas_phase_chemdr, variable reaction_rates), tracking down the origin of the relevant equations. I found the following: 1) at least all of the chemical reaction elements of this array seem to have the same units with each other at any given time; 2) however, the units of all these elements do change multiple times over the coarse of this subroutine. Specifically, they start off (after the call to setrxt) as cm^3 / (molecule -- s) (i.e., like a reaction rate constant for a second-order reaction), but after the call to adjrxt they become s^{-1}; then during the call to rate_diags_calc they become molecules / (cm^3 - s).

@mjs271
Copy link
Contributor Author

mjs271 commented Aug 30, 2023

Thank you for looking into this, Brian! That certainly provides some peace of mind.

And, based on this, it appears that the arrays carrying quantities and rates likely contain entries with heterogeneous units. As such, this should be looked into after porting is complete/validated and we can modify/improve the code.

edit: follow-up thoughts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants