Open mjs271 opened 1 year ago
constexpr Real mol_to_kmol = 1e-3;
auto my_val = mol_to_kmol * constant_with_si_units;
Ok, so... I've down some follow-up digging on this and the related issue #157, as well as the comments in PR #155. My goals were:
In the comments in response to the cancelled PR #155, there was a lack of agreement as to the units associated with mixing ratios. So, I did a (very much non-exhaustive) lit search of googling around and looking into any books on my shelf that are atmoshperic-ish, and found the following. If anyone can provide better answers from better references, I'd welcome them.
As this is far from a comprehensive lit search, and largely based on gaseous quantities, rather than aerosols, I think these are the questions to be answered:
/haero/constants.hpp
, but there's a nonzero chance that this could cause issues in already-ported code.
conversions.hpp
, and computed them myself, to ensure units align correctly.
haero/constants.hpp
).mmr_from_number_conc()
and number_conc_from_mmr()
, we need to be sure that the species' molecular weight that is passed as an argument has the same units as the directly-referenced haero::Constants::avogadro
(currently #/mol).mmr_from_vmr()
and vmr_from_mmr()
, we need to be sure that the species' molecular weight that is passed as an argument has the same units as Constants::molec_weight_dry_air
.@odiazib @pressel @jeff-cohere @pbosler @singhbalwinder
Thanks for the rundown, @mjs271 !
Here are my thoughts regarding the molecular weight:
- Do we embrace the kg/kmol units, as that seems to be the preference within MAM4?
- How much does the molar/molecular and mass/weight syntactical distinction matter to us? i.e., Do we keep the term molecular weight in MAM4xx?
I think we should continue using "molecular weight," since that's what MAM4 uses, and I feel like we should try to keep things the same until we can get some expert opinions on switching terminology (e.g. to "molar mass"). And if we're using molecular weight, we should change Haero's molecular weights so that they are in SI units [kg/kmol]. If this breaks things, we can fix them in the same PR in which we make the change. Mike, you don't have to do this if you don't want to, but we should do this soon if everyone agrees this is the best approach.
- Do we make note of this convention/distinction anywhere other than here and within source code?
The above approach lets us adhere to SI units, which I believe we do say we do in the documentation. We should document the molecular weight units in the constants file where they're declared, at the very least, though.
What do others think?
I agree with @jeff-cohere. Let's use "molecular weight" with units of kg/kmol.
Thanks @mjs271 for the well-written summary! I haven't looked at the parts of the MAM4xx code that deals with converting kg/mol to kg/kmol. Are there many places where we do this conversion?
It looks like rename.hpp
is the only one currently using one of the functions in question. And I believe rename
uses internally defined molecular weights, so I'd say the chances of a units conflict with Constants::molec_weight_dry_air
is somewhere between possible and probable, though I haven't verified it yet. As well, I haven't looked hard enough to see if any of these types of conversion done within processes without the use of the conversion functions, though. Will certainly look into all of this subsequently, though, assuming everyone's on board with molecular weight := kg/kmol
.
Thanks! Yes, let's use kg/kmol
for the molecular weights.
It appears we are off by a factor of 1000 in our volume mixing ratio $\leftrightarrow$ mass mixing ratio conversion.
In
mam4xx/conversions.hpp
the units are all kilo- and appear to line up properly:However the value of
Constants::molec_weight_dry_air
fromhaero/constants.hpp
has units of kg/mol, which lines up with what I found with a google (28.96 g/mol == 0.02896 kg/mol). However, this is not in line with what is shown inconversions.hpp
.So, a couple questions:
conversions.hpp
.@pressel @jeff-cohere @pbosler @odiazib