PyPartMC icon indicating copy to clipboard operation
PyPartMC copied to clipboard

setting kappa for aero species with ions will fail

Open jcurtis2 opened this issue 3 years ago • 9 comments

Looking at the notebook condense.ipynb, it seems to crash if you change some of the values of kappa. I noticed this as I tried to set the values of kappa to the correct values but was met with some surprise.

Appears to have to do with species that have ions specified. For example:

aero_data = ppmc.AeroData(( {"SO4": [1800 * si.kg/si.m**3, 1, 96.0 * si.g/si.mol, 0.00]}, ))

will work. The following will fail where kappa is set to non-zero:

aero_data = ppmc.AeroData(( {"SO4": [1800 * si.kg/si.m**3, 1, 96.0 * si.g/si.mol, 0.65]}, ))

but if I set the number of ions to 0 and set kappa to .65

aero_data = ppmc.AeroData(( {"SO4": [1800 * si.kg/si.m**3, 0, 96.0 * si.g/si.mol, 0.65]}, ))

will work fine.

jcurtis2 avatar Jun 24 '22 21:06 jcurtis2

Evidently this is caused in PartMC. Appears in aero_data.dat we haven't been specifying ions like this default aero_data was set up in the notebook. Note:

!> \page input_format_aero_data Input File Format: Aerosol Material Data
!!
!! A aerosol material data file must consist of one line per
!! aerosol species, with each line having:
!!   - species name (string)
!!   - density (real, unit kg/m^3)
!!   - ions per fully dissociated molecule (integer) - used to
!!     compute kappa value if the corresponding kappa value is
!!     zero
!!   - molecular weight (real, unit kg/mol)
!!   - kappa hygroscopicity parameter (real, dimensionless) - if
!!     zero, then inferred from the ions value
!!
!! This specifies both which species are to be recognized as
!! aerosol consituents, as well as their physical properties. For
!! example, an aerosol material data file could contain:
!! <pre>
!! # species  dens (kg/m^3)   ions (1)    molec wght (kg/mole)   kappa (1)
!! SO4        1800            0           96e-3                  0.65
!! NO3        1800            0           62e-3                  0.65
!! Cl         2200            1           35.5e-3                0
!! NH4        1800            0           18e-3                  0.65
!! </pre>
!!
!! Note that it is an error to specify a non-zero number of ions
!! and a non-zero kappa value for a species. If both values are
!! zero then that species has zero hygroscopicity parameter. If
!! exactly one of kappa or ions is non-zero then the non-zero
!! value is used and the zero value is ignored.

And this is acceptable behavior as when the kappa is computed on a per particle basis, it can use the species kappa value (if non zero) or the ions and molecular weight to determine a species kappa of a species with ions. (Although obviously these values aren't the same for all the inorganics as it takes into account species molecular weight.) See: https://github.com/compdyn/partmc/blob/2aed8ca37a350ae86b7ee281797107f33fde48e7/src/aero_particle.F90#L672-L704

So the real issue.. is we need to make it so it doesn't cause the crashing (by not allowing non-zero values for both the ions and kappa of each species). Note that PartMC code itself does give an assertion (ERROR (PartMC-232362742): ions and kappa both non-zero for species SO4 in aero_data.dat)

jcurtis2 avatar Jun 24 '22 22:06 jcurtis2

Stale issue message

github-actions[bot] avatar Aug 24 '22 13:08 github-actions[bot]

Stale issue message

github-actions[bot] avatar Oct 24 '22 14:10 github-actions[bot]

Stale issue message

github-actions[bot] avatar Jan 01 '23 13:01 github-actions[bot]

Stale issue message

github-actions[bot] avatar Mar 03 '23 13:03 github-actions[bot]

Stale issue message

github-actions[bot] avatar May 03 '23 13:05 github-actions[bot]

Stale issue message

github-actions[bot] avatar Jul 10 '23 13:07 github-actions[bot]

Stale issue message

github-actions[bot] avatar Sep 19 '23 13:09 github-actions[bot]

Stale issue message

github-actions[bot] avatar Jan 23 '24 14:01 github-actions[bot]