Skip to content

EXPERIMENTAL: Adding probabalistic mass conversion to the PDE, no longer a hard boolean.

Choose a tag to compare

@Cgyc20 Cgyc20 released this 16 Mar 17:47
· 8 commits to main since this release

Updated Continuous → Discrete (CD) Conversion Logic

The CD conversion logic in apply_event has been revised to relax the previous strict admissibility condition that prevented conversion when any PDE grid point in a compartment had concentration below $1/h$.

Previously, conversion required all fine-grid PDE cells within a compartment to satisfy

$$ u_i(t) \geq \frac{1}{h} $$

in order to safely remove one particle of mass uniformly across the compartment. This restriction was enforced through the sufficient_pde_concentration_mask.

New behaviour

Conversion events are now allowed whenever the stochastic event fires. The removal of PDE mass is handled dynamically inside apply_event.

Let

$$ Y_k(t) = \sum_{i=Pk}^{P(k+1)-1} u_i(t),dx $$

denote the integrated PDE mass in compartment $k$.

Two cases are considered:


1. Sub–unit mass: $Y_k(t) < 1$

If the compartment contains less than one particle of mass:

  • All PDE mass in the compartment is cleared:

$$ u_i(t+\tau) = 0 $$

  • A discrete particle is added probabilistically:

$$ X_k(t+\tau) = X_k(t) + 1 \quad \text{with probability } Y_k(t) $$

Otherwise no discrete particle is added.


2. At least one particle: $Y_k(t) \geq 1$

If the compartment contains at least one particle of mass:

Uniform removal attempt

If

$$ u_i(t) \geq \frac{1}{h} \quad \forall i $$

then one particle is removed uniformly from the PDE profile:

$$ u_i(t+\tau) = u_i(t) - \frac{1}{h} $$

and

$$ X_k(t+\tau) = X_k(t) + 1 $$


Redistribution removal

If uniform removal would make some cells negative, the algorithm removes one particle of mass using an equal redistribution scheme:

  1. Cells that cannot support an equal mass share are set to zero.
  2. The remaining mass to be removed is redistributed equally across the remaining active cells.
  3. This process repeats until exactly one particle of mass has been removed.

This guarantees:

  • exactly one unit of mass removed
  • no negative PDE concentrations
  • symmetric redistribution across the remaining PDE cells

Result

This update removes the need for the sufficient_pde_concentration_mask gating condition while preserving physical constraints on the PDE profile. Conversion events can now occur more naturally even when the fine-grid concentration profile is heterogeneous.