Skip to content

Conversation

@AgnieszkaZaba
Copy link
Collaborator

@AgnieszkaZaba AgnieszkaZaba commented Dec 13, 2025

Changes taken from #1757

@slayoo
Copy link
Member

slayoo commented Dec 13, 2025

thanks!

@slayoo slayoo changed the title new droplet attribute: diffusional_growth_mass_change new droplet attribute: diffusional_growth_mass_change (a temporary kludge without support for collisional processes) Dec 13, 2025
@slayoo slayoo changed the title new droplet attribute: diffusional_growth_mass_change (a temporary kludge without support for collisional processes) new droplet attribute: diffusional_growth_mass_change (a temporary kludge without support for collisional processes); new initialisers mechanism in Particulator Dec 13, 2025
@AgnieszkaZaba
Copy link
Collaborator Author

I got this error:

FAILED [ 50%]
tests/unit_tests/attributes/test_diffusional_growth_mass_change.py:9 (test_diffusional_growth_mass_change[CPU])
backend_instance = <PySDM.backends.numba.Numba object at 0x108dbd490>

    def test_diffusional_growth_mass_change(backend_instance):
        """check diffusional growth mass change updated after Condensation"""
        # arrange
        n_sd = 1
        dt = 1 * si.s
    
        builder = Builder(
            backend=backend_instance, n_sd=n_sd, environment=MoistBox(dt=dt, dv=np.nan)
        )
        builder.add_dynamic(AmbientThermodynamics())
        builder.add_dynamic(Condensation())
        builder.request_attribute("diffusional growth mass change")
        particulator = builder.build(
            attributes={
                "water mass": np.ones(n_sd) * si.ng,
                "multiplicity": np.ones(n_sd),
                "dry volume": (dry_volume := np.ones(n_sd) * si.nm**3),
                "kappa times dry volume": np.ones(n_sd) * dry_volume * 0.6,
            }
        )
        particulator.environment["rhod"] = 1 * si.kg / si.m**3
        particulator.environment["thd"] = 300 * si.K
        particulator.environment["water_vapour_mixing_ratio"] = 10 * si.g / si.kg
    
        # act
>       particulator.run(steps=1)

tests/unit_tests/attributes/test_diffusional_growth_mass_change.py:35: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
PySDM/particulator.py:59: in run
    dynamic()
PySDM/dynamics/condensation.py:104: in __call__
    self.particulator.condensation(
PySDM/particulator.py:153: in condensation
    v_cr=self.attributes["critical volume"],
PySDM/impl/particle_attributes.py:93: in __getitem__
    return self.__attributes[item].get()
PySDM/attributes/impl/attribute.py:32: in get
    self.update()
PySDM/attributes/impl/derived_attribute.py:23: in update
    self.recalculate()
PySDM/attributes/physics/critical_volume.py:35: in recalculate
    else self.environment["T"]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit_tests.dynamics.test_vapour_deposition_on_ice.MoistBox object at 0x112b73cb0>
item = 'T'

    def __getitem__(self, item):
>       return self._ambient_air[item]
E       KeyError: 'T'

PySDM/environments/box.py:20: KeyError

@slayoo Do you know what else I should fix/update?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants