particula.dynamics.chemistry.resolved
Closed gas, bulk particle and collision-limited uptake in resolved boxes.
Classes
| Name | Description |
|---|---|
ResolvedChemistry | Couple a version-2 mechanism across gas and resolved particle masses. |
_BoxKinetics | Scale each particle's integrated moles by its initial volume. |
ResolvedChemistryclass#
class ResolvedChemistry(bound: ResolvedBinding, solver=_DEFAULT_SOLVER, *, name='resolved_chemistry')Bases: BoxProcess
Couple a version-2 mechanism across gas and resolved particle masses.
Bulk rates use mol/m³ of instantaneous particle material. Uptake uses a spherical collision area, prescribed net uptake probability and mean molecular speed. RK23 absolute tolerances use mol/m³ of air for gas and mol/m³ of the initial particle volume for each process interval.
_namespaceattributeclass attributeinstance attribute#
_namespace = 'resolved_chemistry'boundattributeinstance attribute#
bound = boundsolverattributeinstance attribute#
solver = solver__init__method#
def __init__(bound: ResolvedBinding, solver=_DEFAULT_SOLVER, *, name='resolved_chemistry')Select the immutable layout and per-box adaptive controls.
advancemethod#
def advance(aerosol, *, time, time_step, context)Integrate one simultaneous closed material balance within a box.
configurationmethod#
def configuration()Return restart identity including densities, mappings and solver.
validatemethod#
def validate(aerosol)Validate current representation, layout and inventories.
Inherited from particula.box_process.BoxProcess
extension_idattributeinstance attribute#
particula.box_process.BoxProcessView sourceextension_id = extension_id or namenameattributeinstance attribute#
particula.box_process.BoxProcessView sourcename = nameparametersattributeinstance attribute#
particula.box_process.BoxProcessView sourceparameters = parametersreadsattributeinstance attribute#
particula.box_process.BoxProcessView sourcereads = tuple(reads)representationsattributeinstance attribute#
particula.box_process.BoxProcessView sourcerepresentations = tuple(representations)stochasticattributeinstance attribute#
particula.box_process.BoxProcessView sourcestochastic = stochasticversionattributeinstance attribute#
particula.box_process.BoxProcessView sourceversion = versionwritesattributeinstance attribute#
particula.box_process.BoxProcessView sourcewrites = tuple(writes)executemethod#
particula.box_process.BoxProcessView sourcedef execute(aerosol, time_step, sub_steps=1, *, context=None, time=0.0)Publish a successful process substep atomically across boxes.
Inherited from particula.runnable.RunnableABC
__or__method#
particula.runnable.RunnableABCView sourcedef __or__(other: RunnableABC) -> RunnableSequenceChain this Runnable with another using the ’|’ operator.
This method enables an easy way to sequence processes, so they can be executed in a defined order.
Parameters
| Name | Type | Description |
|---|---|---|
other | RunnableABC | Another Runnable to append after this one. |
Returns
RunnableSequence- A sequence containing both processes.
Examples
combined_process = process1 | process2final_aerosol = combined_process.execute(aerosol, time_step=1.0)_advance_boxmethod#
particula.runnable.RunnableABCView sourcedef _advance_box(aerosol, time_step)Dispatch one staged interval through the native extension seam.
_box_workermethod#
particula.runnable.RunnableABCView sourcedef _box_worker(box, boxes, transaction)Create isolated hook state for a single box.
_execute_boxmethod#
particula.runnable.RunnableABCView sourcedef _execute_box(aerosol, time_step, sub_steps=1)Execute the single-box numerical building block.
_is_stochasticmethod#
particula.runnable.RunnableABCView sourcedef _is_stochastic(aerosol)Report whether this process requires independent box streams.
_prepare_commitmethod#
particula.runnable.RunnableABCView sourcedef _prepare_commit(workers, uses_context)Prepare a non-failing diagnostics publisher before numeric writes.
_rate_boxmethod#
particula.runnable.RunnableABCView sourcedef _rate_box(aerosol)Evaluate the single-box numerical building block.
_validate_batchmethod#
particula.runnable.RunnableABCView sourcedef _validate_batch(aerosol)Validate process-wide controls before staging boxes.
_writer_fieldsmethod#
particula.runnable.RunnableABCView sourcedef _writer_fields(aerosol)Declare numeric destinations for transactional publication.
preparemethod#
particula.runnable.RunnableABCView sourcedef prepare(aerosol: Aerosol, *, time_step: float, backend: Backend | None = None, device: str = 'cuda:0', root_seed: int = 0, logical_box_ids=None, process_registry=None, coagulation_work_config=None, coagulation_subcycling=None, time: float = 0.0) -> PreparedSimulationUpload native state once and prepare supported resident GPU physics.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
aerosol | Aerosol | required | Initial native particle, gas and environment state. |
time_step | float | required | Fixed duration of each complete process cycle [s]. |
backend | Backend | None | None | Backend.WARP by default; CPU execution uses execute(). |
device | str | 'cuda:0' | Explicit Warp device, default CUDA device zero. |
root_seed | int | 0 | Root seed for persistent independent process/box streams. |
logical_box_ids | None | Optional stable identities in physical box order. | |
process_registry | None | Exact-type custom GPU adapter registrations. | |
coagulation_work_config | None | Optional coagulation resource budgets. | |
coagulation_subcycling | None | Optional bounded adaptive policy. | |
time | float | 0.0 | Absolute initial simulation time [s]. |
Returns
PreparedSimulation- An owned PreparedSimulation. Use its context manager or close().
PreparedSimulation- snapshot() returns detached CPU state for analysis and plotting.
Raises
ValueError- If process physics or state cannot be represented.
RuntimeError- If the requested runtime/device is unavailable.
ratemethod#
particula.runnable.RunnableABCView sourcedef rate(aerosol: Aerosol) -> AnyEvaluate detached box hooks and retain a leading box axis.
resumemethod#
particula.runnable.RunnableABCView sourcedef resume(checkpoint: SimulationCheckpoint, *, backend: Backend | None = None, device: str | None = None, process_registry=None, retry_subcycling=None) -> PreparedSimulationResume exact saved state using the same process configuration.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
checkpoint | SimulationCheckpoint | required | SimulationCheckpoint from a prepared owner. |
backend | Backend | None | None | Backend.WARP by default. |
device | str | None | None | Exact checkpoint device by default; migration rejects. |
process_registry | None | Compatible caller-supplied GPU implementations. | |
retry_subcycling | None | Explicitly relax a saved adaptive coagulation policy while retaining the outer timestep and random streams. |
Returns
PreparedSimulation- A new owner preserving state, RNG words, timestep and counters.
PreparedSimulation- Capture is explicit again; native graph handles are never restored.
Raises
ValueError- If configuration, order, schema or device differs, or current population cannot be admitted (e.g. unequal Brownian counts after a later process injected new particles).
_BoxKineticsclass#
class _BoxKinetics(bound, aerosol)Scale each particle’s integrated moles by its initial volume.
activeattributeinstance attribute#
active = particles.population[0] > 0gmattributeinstance attribute#
gm = np.asarray(bound.gas_masses)initialattributeinstance attribute#
initial = np.concatenate(
(aerosol.gas.concentration[0] / self.gm, masses / self.pm / reference[:, None].ravel())
)kattributeinstance attribute#
k = a * temp / t_ref ** exponent * np.exp(-energy / GAS_CONSTANT * temp)kindsattributeinstance attribute#
kinds = bound.kindsnetattributeinstance attribute#
net = np.asarray(bound.net)ngattributeinstance attribute#
ng = self.gm.sizeordersattributeinstance attribute#
orders = np.asarray(bound.orders)partial_volumeattributeinstance attribute#
partial_volume = self.pm / particles.densitypmattributeinstance attribute#
pm = np.asarray(bound.particle_masses)referenceattributeinstance attribute#
reference = masses / particles.density.sum(axis=1)sourcesattributeinstance attribute#
sources = bound.sourcesspeedattributeinstance attribute#
speed = np.sqrt(8 * GAS_CONSTANT * temp / np.pi * self.gm)weightsattributeinstance attribute#
weights = slot_density(particles)[0]__init__method#
def __init__(bound, aerosol)admissiblemethod#
def admissible(state)Reject a negative concentration or an emptied active slot.
publishmethod#
def publish(aerosol, final)Publish changed lanes and preserve inactive and inert values.
ratemethod#
def rate(time, state)Return gas mol/m³-air/s and material mol/m³-initial-particle/s.