particula.optics.gpu.shortwave_resident
Shortwave observations of live particles on the simulation stream.
Classes
| Name | Description |
|---|---|
ResidentShortwave | Observe spectral radiation between steps of a prepared Warp runnable. |
Functions
| Name | Description |
|---|---|
_combine | Add live aerosol to a fixed column using scattering-depth weights. |
_particle_depth_inputs | Reduce extinction, scattering and its first moment per box/wavelength. |
ResidentShortwaveclass#
class ResidentShortwave(simulation, config, columns, sun, surface, *, box_indices, streams=8, hg_order=32, coefficient_capacity=512, particle_tile=256, **transport_options)Observe spectral radiation between steps of a prepared Warp runnable.
Attributes
| Name | Type | Description |
|---|---|---|
workspace | ShortwaveWorkspace | Flux and broadband arrays on the simulation stream, available to subsequent device calculations. |
_casesattributeinstance attribute#
_cases = cases_combineattributeinstance attribute#
_combine = wp.launch(
_combine,
active.depth.shape,
inputs=[base, active, indices, dz, bulk, hg_order],
device=dev,
stream=stream,
record_cmd=True
)_mieattributeinstance attribute#
_mie = mie_ownerattributeinstance attribute#
_owner = simulation_particlesattributeinstance attribute#
_particles = particles_reduceattributeinstance attribute#
_reduce = wp.launch(
_particle_depth_inputs,
bulk.size,
inputs=[cases.radius, cases.weight, mie.efficiencies, mie.status, bulk],
device=dev,
stream=stream,
record_cmd=True
)_resourcesattributeinstance attribute#
_resources = (base, indices, dz, bulk)workspaceattributeinstance attribute#
workspace = prepare_shortwave(
backgrounds,
sun,
surface,
device=dev,
stream=stream,
streams=streams,
**transport_options
)__init__method#
def __init__(simulation, config, columns, sun, surface, *, box_indices, streams=8, hg_order=32, coefficient_capacity=512, particle_tile=256, **transport_options)Bind live particle buffers and freeze atmospheric boundary inputs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
simulation | PreparedSimulation | required | Active Warp PreparedSimulation with discrete or particle-resolved counts and a positive fixed timestep. |
config | OpticalConfig | required | OpticalConfig for native particle Mie cross sections. |
columns | SpectralColumn | Sequence[SpectralColumn] | required | Background SpectralColumn(s) excluding the live aerosol. |
sun | SolarInput | Sequence[SolarInput] | required | Shared SolarInput or one per column. |
surface | Surface | Sequence[Surface] | required | Shared surface boundary or one per column. |
box_indices | ArrayLike | required | Integer (case, layer) map from top-first layers to simulation boxes. A value of -1 leaves that layer unchanged. |
streams | int | 8 | Angular ordinates per hemisphere. |
hg_order | int | 32 | Highest aerosol Henyey–Greenstein Legendre degree. |
coefficient_capacity | int | 512 | Maximum Mie series order in device scratch. |
particle_tile | int | 256 | Maximum particle/wavelength cases in Mie scratch. |
**transport_options | dict | {} | Additional prepare_shortwave options such as view_zenith_deg, case_tile and sensor_response. |
Raises
ValueError- If particle layout, indices or optical inputs conflict.
RuntimeError- If the owner is closed or inside CUDA capture.
checkmethod#
def check()Synchronize the simulation and inspect optical status on its stream.
Raises
RuntimeError- If no observation exists or physics or optics failed.
downloadmethod#
def download()Synchronize physics and optics and return detached ShortwaveFluxes.
Returns
tuple[ShortwaveFlux, ...]- One result per column for the latest enqueue call.
Raises
RuntimeError- An owner, Mie or radiation calculation failed.
enqueuemethod#
def enqueue()Sample current particle state without advancing or downloading it.
Raises
RuntimeError- The simulation is closed, replaced or capturing.
_combinefunction#
def _combine(base: LayerData, active: LayerData, mapping: wp.array2d(dtype=int), thickness: wp.array2d(dtype=F), bulk: wp.array(dtype=wp.vec3d), order: int)Add live aerosol to a fixed column using scattering-depth weights.
_particle_depth_inputsfunction#
def _particle_depth_inputs(radius: wp.array2d(dtype=F), weight: wp.array2d(dtype=F), efficiencies: wp.array2d(dtype=F), status: wp.array(dtype=int), bulk: wp.array(dtype=wp.vec3d))Reduce extinction, scattering and its first moment per box/wavelength.