spectral_galerkin_heat.core.laser
Laser path and state definitions.
Classes
A beam profile: spatial shape and its energy-conserving normalization. |
|
Immutable snapshot of the laser at one time point. |
|
Abstract laser trajectory: position and power as a function of time. |
Functions
|
Dimensionless |
|
Super-Gaussian flux |
|
Return the cell-mean Gaussian flux, integrated analytically over each cell. |
|
Resolve a profile name to a |
Module Contents
- spectral_galerkin_heat.core.laser.super_gaussian_area_factor(order)
Dimensionless
fsuch that∬ s dA = f · r_x · r_yfor the super-Gaussians = exp(-2 ρⁿ):f(n) = π · 2^(1-2/n) · Γ(2/n) / n(f(2) = π/2Gaussian,f(n→∞) → πflat-top).- Parameters:
order (float)
- Return type:
float
- spectral_galerkin_heat.core.laser.super_gaussian_flux(xp, x, y, x0, y0, r_x, r_y, order, peak_intensity)
Super-Gaussian flux
I₀ · exp(-2 ρⁿ),ρ² = ((x-x0)/r_x)² + ((y-y0)/r_y)².Backend-agnostic via
xp(numpy/cupy);order = 2is the Gaussian.
- spectral_galerkin_heat.core.laser.gaussian_cell_integrated_flux(xp, x, y, x0, y0, r_x, r_y, hx, hy, peak_intensity)
Return the cell-mean Gaussian flux, integrated analytically over each cell.
Each node
(x_i, y_j)stores the mean ofq = I₀·exp(-2 ρ²)over its cell[x_i ± hx/2] × [y_j ± hy/2]instead of the point sample. The integral separates into 1-D factors∫_a^b exp(-2 u²/r²) du = r·√(π/8)·[erf(√2·b/r) − erf(√2·a/r)].
Done so a beam narrower than the grid (
r ≪ h) still deposits its full power.hx/hyare the cell sizes (geom.d.x/geom.d.y). Gaussian only; other-order super-Gaussians have no elementary integral.
- class spectral_galerkin_heat.core.laser.LaserProfile
A beam profile: spatial shape and its energy-conserving normalization.
Both the area factor
fand the spatial shape derive fromorder.- property area_factor: float
Dimensionless
fsuch that∬ s dA = f · r_x · r_y.- Return type:
float
- peak_intensity(power, absorptivity, ref_area)
Energy-conserving peak
I₀ = A·P / (f · ref_area)(ref_area = r_x·r_y).- Parameters:
power (float)
absorptivity (float)
ref_area (float)
- Return type:
float
- flux(xp, x, y, x0, y0, r_x, r_y, peak_intensity, hx=None, hy=None)
Spatial flux field
I₀ · s(x, y)for this profile.With
cell_integratedset (Gaussian only) and the cell sizeshx/hysupplied, returns the exact cell-averaged flux so the total deposited power equalsA·Pindependent of beam position; otherwise point-samples the shape at the cell centres.
- spectral_galerkin_heat.core.laser.build_laser_profile(name, order=2.0, cell_integrated=False)
Resolve a profile name to a
LaserProfile.orderis used only for"super_gaussian"; raisesValueErroron an unknown name.cell_integratedenables exact analytic cell-averaging of the Gaussian flux (seegaussian_cell_integrated_flux()).- Parameters:
name (str)
order (float)
cell_integrated (bool)
- Return type:
- class spectral_galerkin_heat.core.laser.LaserState
Immutable snapshot of the laser at one time point.
- Variables:
y (x,) – Laser position in metres (within the domain
[0, L]).power (float) – Laser power in watts.
is_on (bool) – True while the laser is emitting.
v (tuple[float, float], optional) – Velocity
(vx, vy)in m/s, by default(0.0, 0.0).
- class spectral_galerkin_heat.core.laser.LaserPath
Bases:
abc.ABCAbstract laser trajectory: position and power as a function of time.
Implementations return a
LaserStateper time step (consistent units: metres, watts, m/s). Setis_on=False(or power 0) once the laser leaves the domain.Example
>>> class ConstantVelocityLaser(LaserPath): ... def __init__(self, x0, y0, vx, power): ... self.x0, self.y0, self.vx, self.power = x0, y0, vx, power ... def get_state(self, time, dt): ... return LaserState(self.x0 + self.vx * time, self.y0, ... self.power, is_on=True, v=(self.vx, 0.0))
- abstractmethod get_state(time, dt)
Return the
LaserStateat time (called once per time step).- Parameters:
time (float) – Current simulation time in seconds (monotonically increasing).
dt (float) – Current time-step length in seconds.
- Return type: