|
21 | 21 | _Attributes = namedtuple( |
22 | 22 | typename="_Attributes", |
23 | 23 | field_names=( |
24 | | - "water_mass", |
| 24 | + "signed_water_mass", |
25 | 25 | "v_cr", |
26 | 26 | "multiplicity", |
27 | 27 | "vdry", |
@@ -60,7 +60,7 @@ def condensation(**kwargs): |
60 | 60 | n_cell=kwargs["n_cell"], |
61 | 61 | cell_start_arg=kwargs["cell_start_arg"].data, |
62 | 62 | attributes=_Attributes( |
63 | | - water_mass=kwargs["water_mass"].data, |
| 63 | + signed_water_mass=kwargs["signed_water_mass"].data, |
64 | 64 | v_cr=kwargs["v_cr"].data, |
65 | 65 | multiplicity=kwargs["multiplicity"].data, |
66 | 66 | vdry=kwargs["vdry"].data, |
@@ -273,7 +273,7 @@ def step_impl( # pylint: disable=too-many-arguments,too-many-locals |
273 | 273 | ): |
274 | 274 | timestep /= n_substeps |
275 | 275 | ml_old = calculate_ml_old( |
276 | | - attributes.water_mass, attributes.multiplicity, cell_idx |
| 276 | + attributes.signed_water_mass, attributes.multiplicity, cell_idx |
277 | 277 | ) |
278 | 278 | count_activating, count_deactivating, count_ripening = 0, 0, 0 |
279 | 279 | RH_max = 0 |
@@ -358,11 +358,11 @@ def step_impl( # pylint: disable=too-many-arguments,too-many-locals |
358 | 358 | @staticmethod |
359 | 359 | def make_calculate_ml_old(jit_flags): |
360 | 360 | @numba.njit(**jit_flags) |
361 | | - def calculate_ml_old(water_mass, multiplicity, cell_idx): |
| 361 | + def calculate_ml_old(signed_water_mass, multiplicity, cell_idx): |
362 | 362 | result = 0 |
363 | 363 | for drop in cell_idx: |
364 | | - if water_mass[drop] > 0: |
365 | | - result += multiplicity[drop] * water_mass[drop] |
| 364 | + if signed_water_mass[drop] > 0: |
| 365 | + result += multiplicity[drop] * signed_water_mass[drop] |
366 | 366 | return result |
367 | 367 |
|
368 | 368 | return calculate_ml_old |
@@ -429,12 +429,14 @@ def calculate_ml_new( # pylint: disable=too-many-branches,too-many-arguments,to |
429 | 429 | lambdaK = formulae.diffusion_kinetics__lambdaK(T, p) |
430 | 430 | lambdaD = formulae.diffusion_kinetics__lambdaD(DTp, T) |
431 | 431 | for drop in cell_idx: |
432 | | - if attributes.water_mass[drop] <= 0: |
| 432 | + if attributes.signed_water_mass[drop] <= 0: |
433 | 433 | continue |
434 | 434 | v_drop = formulae.particle_shape_and_density__mass_to_volume( |
435 | | - attributes.water_mass[drop] |
| 435 | + attributes.signed_water_mass[drop] |
| 436 | + ) |
| 437 | + x_old = formulae.diffusion_coordinate__x( |
| 438 | + attributes.signed_water_mass[drop] |
436 | 439 | ) |
437 | | - x_old = formulae.diffusion_coordinate__x(attributes.water_mass[drop]) |
438 | 440 | r_old = formulae.trivia__radius(v_drop) |
439 | 441 | x_insane = formulae.diffusion_coordinate__x( |
440 | 442 | formulae.particle_shape_and_density__volume_to_mass( |
@@ -559,13 +561,16 @@ def calculate_ml_new( # pylint: disable=too-many-branches,too-many-arguments,to |
559 | 561 | ) |
560 | 562 | result += attributes.multiplicity[drop] * mass_new |
561 | 563 | if not fake: |
562 | | - if mass_new > mass_cr and mass_new > attributes.water_mass[drop]: |
| 564 | + if ( |
| 565 | + mass_new > mass_cr |
| 566 | + and mass_new > attributes.signed_water_mass[drop] |
| 567 | + ): |
563 | 568 | n_activated_and_growing += attributes.multiplicity[drop] |
564 | | - if mass_new > mass_cr > attributes.water_mass[drop]: |
| 569 | + if mass_new > mass_cr > attributes.signed_water_mass[drop]: |
565 | 570 | n_activating += attributes.multiplicity[drop] |
566 | | - if mass_new < mass_cr < attributes.water_mass[drop]: |
| 571 | + if mass_new < mass_cr < attributes.signed_water_mass[drop]: |
567 | 572 | n_deactivating += attributes.multiplicity[drop] |
568 | | - attributes.water_mass[drop] = mass_new |
| 573 | + attributes.signed_water_mass[drop] = mass_new |
569 | 574 | n_ripening = n_activated_and_growing if n_deactivating > 0 else 0 |
570 | 575 | return result, success, n_activating, n_deactivating, n_ripening |
571 | 576 |
|
|
0 commit comments