Skip to content

Condensation failed in parcel environment #1103

@mikhailmints

Description

@mikhailmints

For some input parameters, the condensation solver is failing in the parcel environment. Here is a minimal example using PySDM_examples.Pyrcel:

from PySDM import Formulae
from PySDM.initialisation.spectra import Lognormal
from PySDM.physics import si

from PySDM_examples.Pyrcel import Settings, Simulation

settings = Settings(
    dz = 1 * si.m,
    n_sd_per_mode = (1000,),
    aerosol_modes_by_kappa = {
        0.1885611585360898: Lognormal(
            norm_factor=40233789.92354 / si.m ** 3,
            m_mode=1.1669322087438114e-09 * si.m,
            s_geom=1.7322676373747328
        ),
    },
    vertical_velocity = 0.0143756504108188 * si.m / si.s,
    initial_pressure = 76309.09460546204 * si.Pa,
    initial_temperature = 296.50590490254416 * si.K,
    initial_relative_humidity = 1,
    displacement = 1000 * si.m,
    formulae = Formulae(constants={'MAC': 1})
)

simulation = Simulation(settings, products=[])

results = simulation.run()

Produces the following output (first and last part shown):

failed to find interval
	file: /home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/backends/impl_numba/methods/condensation_methods.py
	context:
		 T
		 296.50096771736526
		 p
		 76304.6452879693
		 RH
		 1.0002393891789032
		 a
		 -65.6888252946611
		 b
		 -70.29399548064919
		 fa
		 -5445.374951706045
		 fb
		 -146020.70967949124
failed to find interval
	file: /home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/backends/impl_numba/methods/condensation_methods.py
	context:
		 T
		 296.50096771736173
		 p
		 76304.64528796851
		 RH
		 1.0002393891791526
		 a
		 -65.6888252946611
		 b
		 -70.29399548064919
		 fa
		 -5445.374951705585
		 fb
		 -146020.7096794852
failed to find interval
	file: /home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/backends/impl_numba/methods/condensation_methods.py
	context:
		 T
		 296.50096771736173
		 p
		 76304.64528796851
		 RH
		 1.0002393891791526
		 a
		 -65.6888252946611
		 b
		 -70.29399548064919
		 fa
		 -5445.374951705585
		 fb
		 -146020.7096794852


...


failed to find interval
	file: /home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/backends/impl_numba/methods/condensation_methods.py
	context:
		 T
		 296.50096771736173
		 p
		 76304.64528796851
		 RH
		 1.0002393891791526
		 a
		 -65.6888252946611
		 b
		 -70.29399548064919
		 fa
		 -5445.374951705585
		 fb
		 -146020.7096794852
failed to find interval
	file: /home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/backends/impl_numba/methods/condensation_methods.py
	context:
		 T
		 296.50096771736173
		 p
		 76304.64528796851
		 RH
		 1.0002393891791526
		 a
		 -65.6888252946611
		 b
		 -70.29399548064919
		 fa
		 -5445.374951705585
		 fb
		 -146020.7096794852
Traceback (most recent call last):
  File "/central/home/mmints/CliMA/AerosolActivationEmulation/CondFailedIssueMinExample.py", line 27, in <module>
    results = simulation.run()
  File "/home/mmints/anaconda3/lib/python3.10/site-packages/PySDM_examples/Pyrcel/simulation.py", line 85, in run
    output_products = super()._run(
  File "/home/mmints/anaconda3/lib/python3.10/site-packages/PySDM_examples/utils/basic_simulation.py", line 19, in _run
    self.particulator.run(steps=steps_per_output_interval)
  File "/home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/particulator.py", line 48, in run
    dynamic()
  File "/home/mmints/anaconda3/lib/python3.10/site-packages/PySDM/dynamics/condensation.py", line 104, in __call__
    raise RuntimeError("Condensation failed")
RuntimeError: Condensation failed

I tried changing rtol_thd, rtol_x, and dt_cond_range to different values, but the error still appeared. In this particular example, changing the number of superdroplets to 100 instead of 1000 makes the error disappear. However, if Logarithmic is used for the spectral sampling instead of ConstantMultiplicity, the issue appears even for low numbers of superdroplets.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions