Skip to content

particula.optics.gpu.shortwave_resident

Shortwave observations of live particles on the simulation stream.

Attributes

NameDescription
FNo description.
_PINo description.

Classes

NameDescription
ResidentShortwaveObserve spectral radiation between steps of a prepared Warp runnable.

Functions

NameDescription
_combineAdd live aerosol to a fixed column using scattering-depth weights.
_particle_depth_inputsReduce extinction, scattering and its first moment per box/wavelength.

Fattributemodule attribute#

F = wp.float64

_PIattributemodule attribute#

_PI = wp.constant(F(pi))

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

NameTypeDescription
workspaceShortwaveWorkspaceFlux 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

NameTypeDefaultDescription
simulationPreparedSimulationrequiredActive Warp PreparedSimulation with discrete or particle-resolved counts and a positive fixed timestep.
configOpticalConfigrequiredOpticalConfig for native particle Mie cross sections.
columnsSpectralColumn | Sequence[SpectralColumn]requiredBackground SpectralColumn(s) excluding the live aerosol.
sunSolarInput | Sequence[SolarInput]requiredShared SolarInput or one per column.
surfaceSurface | Sequence[Surface]requiredShared surface boundary or one per column.
box_indicesArrayLikerequiredInteger (case, layer) map from top-first layers to simulation boxes. A value of -1 leaves that layer unchanged.
streamsint8Angular ordinates per hemisphere.
hg_orderint32Highest aerosol Henyey–Greenstein Legendre degree.
coefficient_capacityint512Maximum Mie series order in device scratch.
particle_tileint256Maximum particle/wavelength cases in Mie scratch.
**transport_optionsdict{}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.