hitranonline / hapi

HITRAN Application Programming Interface (HAPI)
Other
75 stars 35 forks source link

The question about partial volume concentration of gas used in calculting the Abosrption Coefficient #14

Closed cin619 closed 2 years ago

cin619 commented 4 years ago

Function NATURAL_ABUNDANCES & ABUNDANCES The values of these two functions are the same, so the equation in line_19116 Xsect[BoundIndexLower:BoundIndexUpper]+= factor / NATURAL_ABUNDANCES[(MoleculeNumberDB,IsoNumberDB)] * \ ABUNDANCES[(MoleculeNumberDB,IsoNumberDB)] * \ LineIntensity * lineshape_vals is same with Xsect[BoundIndexLower:BoundIndexUpper] += factor * LineIntensity * lineshape_vals I am not sure whether it is a bug or the misunderstanding

Futhermore, when calculate the absorption coefficient with HITRAN_units = False the codes in line_18991 if HITRAN_units: factor = __FloatType__(1.0) else: factor = volumeConcentration(p,T) is uses the Environment parameters 'p' as the gas pressure to calculate the absorption coefficient. In this case, the parameters Diluent={'air': , 'self': , ... } is seems uesless in the calculation of partial concentration.

By the way, i am a newer with HITRAN_HAPI, please correct me if i misunderstanding the codes. Hope your reply.

GibClark commented 4 years ago

@cin619 I have come to the same problem with HITRAN_units = False, it seems that it does not make any use of the partial pressures provided in Diluent dictionary to properly compute the absorption coefficients. Have you been able to resolve this since posting your comment?

I would like to take advantage of the Diluent and HITRAN_units parameters, but they have produced erroneous results when I try to. The only time everything works out smoothly is when the partial pressure of the absorbing species = total pressure = 1 atm and I leave the Diluent parameter as its default (air).

GibClark commented 4 years ago

Update and answers to my previous question: @cin619 , this answer is linked to #3 (Partial Pressures).

Per your first comment, the dictionaries ABUNDANCES and NATURAL_ABUNDANCES are controlled by the Components parameter in your call to the absorption coefficient function you are using. If you do not specify an abundance in the Componentsparameter; (Components=[(M,I,D)]) where D is the abundance of molecule with molec_ID M and iso_ID I, then both the ABUNDANCES and NATURAL_ABUNDANCES dictionaries contain the same value, and your comment is true

The values of these two functions are the same, so the equation in line_19116 Xsect[BoundIndexLower:BoundIndexUpper]+= factor / NATURAL_ABUNDANCES[(MoleculeNumberDB,IsoNumberDB)] \ ABUNDANCES[(MoleculeNumberDB,IsoNumberDB)] \ LineIntensity lineshape_vals is same with Xsect[BoundIndexLower:BoundIndexUpper] += factor LineIntensity * lineshape_vals I am not sure whether it is a bug or the misunderstanding

By specifying an abundance D in the Components parameter, the ABUNDANCES dictionary will receive this value for its associated key (M,I) , while the NATURAL_ABUNDANCES dictionary will still retrieve the natural abundance for your chosen isotopologue from the built-in ISO dictionary.

Per your second comment, the Diluent parameter is useless for HAPI's built in unit conversion. The Components parameter is likely what you are looking for.

NB that if specifying abundances with the Components parameter, your final result will still be over the 'natural' isotopologue abundance, for which you can correct out manually if you wish.

erwanp commented 4 years ago

Hi @GibClark , thanks for clarifying this !

cin619 commented 4 years ago

Thanks for your clarification and useful suggestions. Actually, after that, i only calculate the absorption cross section (in unit cm^2/mole) as HITRAN_units=True where on hitran.org is named 'absorption coefficient' as well. And I use maltab as the main programming software while hapi as verifications. Thanks again.