Config.py Reference
export JAXALFA_RUNDIR=/path/to/run_directory
python -m src.Main
Parameters are grouped below in the same order they appear in Config.py.
1. Platform
Parameter |
Values |
Default |
Description |
|---|---|---|---|
|
|
|
Enable 64-bit (double) floating-point arithmetic throughout |
|
|
— |
|
|
integer ≥ 0 |
|
Which GPU to use on a multi-GPU machine (0-indexed) |
Recommendations
Use
use_double_precision = Truefor production runs and benchmarking. Single precision (False) can be used for exploratory runs and is ~2× faster on consumer GPUs, but may accumulate rounding error in long integrations or fine grids.On a SLURM cluster,
CUDA_VISIBLE_DEVICESis set by the scheduler;GPU_IDis only used for interactive/local runs.
# Recommended production settings
use_double_precision = True
optGPU = 1
GPU_ID = 0
2. Domain
Parameter |
Unit |
Description |
|---|---|---|
|
m |
Domain length in x (streamwise) |
|
m |
Domain length in y (spanwise) |
|
m |
Domain height in z |
|
— |
Number of grid points in x |
|
— |
Number of grid points in y |
|
— |
Number of grid points in z |
Recommendations
Keep
nx = nyand use powers of 2 (64, 128, 256, 384, 512) for maximum FFT efficiency. Non-powers-of-2 work but are slower.The horizontal grid spacing is
dx = l_x / nx. For standard ABL simulations, aim fordx ≈ dy ≈ dz(isotropic grid).l_zshould comfortably contain the full boundary-layer depth plus a damping layer above.
# Example: 5 km × 5 km × 2 km domain at 128³
l_x, l_y, l_z = 5000, 5000, 2000
nx, ny, nz = 128, 128, 128
3. Time Integration
Parameter |
Unit |
Default |
Description |
|---|---|---|---|
|
— |
|
Starting step number; set > 1 only for restart runs (not yet implemented) |
|
s |
— |
Time-step size |
|
s |
— |
Total physical simulation time |
|
m/s |
— |
Galilean transformation velocity (subtracted from the mean wind before advancing) |
Recommendations
Choose
dtso the CFL number `U_max * dt / dx < 0.2 (conservative).Set
Ugalto the mean wind speed (e.g.,Ug2) to reduce the advective CFL and allow a largerdt.For a restart run, set
istepto the last saved step number from the previous run.
istep = 1 # fresh start
dt = 0.5 # s — adjust for your CFL
SimTime = 36000 # s (10 hours)
Ugal = 8 # m/s — match approximate mean wind
4. Surface Boundary Conditions
Parameter |
Values / Unit |
Default |
Description |
|---|---|---|---|
|
|
— |
|
|
|
|
|
|
m |
— |
Aerodynamic roughness length for momentum |
|
m |
— |
Scalar (thermal) roughness length |
|
m |
|
Screen-height for heat-flux denominator; |
|
K m/s |
— |
Constant surface heat flux; used only when |
|
path |
|
Path to time-varying surface BC file (relative to run directory) |
Recommendations
For most idealized cases,
optSurfFlux = 0andoptSurfBC = 0(constant, homogeneous flux).For real-case simulations (e.g., GABLS3, Wangara), use
optSurfBC = 2with prescribed surface temperatures.zTemperature > 0is needed when the observational temperature is at a screen height (e.g., 1.2 m for Wangara, 0.25 m for GABLS3) rather than atz0T.Positive
SensibleHeatFlux= upward heat flux (unstable/convective); negative = downward (stable).
# Idealized stable BL (constant cooling)
optSurfFlux = 0
optSurfBC = 0
z0m, z0T = 0.1, 0.1
SensibleHeatFlux = -0.03 # K m/s downward
# Real-case with observed surface temperatures (GABLS3-style)
optSurfBC = 2
zTemperature = 0.25 # m
SurfaceBCFile = 'input/SurfaceBC.npz'
5. Forcing
Parameter |
Values / Unit |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
m/s |
— |
Geostrophic wind component in x |
|
m/s |
— |
Geostrophic wind component in y |
|
path |
|
Path to time/height-varying geostrophic wind file |
|
1/s |
— |
Coriolis parameter (typically |
|
K/m |
— |
Potential temperature lapse rate above domain top (free-atmosphere stratification) |
|
|
— |
|
|
K |
— |
Reference temperature for buoyancy (used when |
Recommendations
Use
optBuoyancy = 1for all simulations.optBuoyancy = 0is rarely used.Set
inversion > 0to cap convective boundary layers.
optGeoWind = 0
Ug2, Vg2 = 8.0, 0.0 # m/s
f_coriolis = 1.0e-4 # 1/s
inversion = 3.0 / 1000 # 3 K/km
optBuoyancy = 1
T_0 = 300.0 # K
6. Subgrid-Scale (SGS) Model
Parameter |
Values |
Default |
Description |
|---|---|---|---|
|
|
— |
SGS model selection (see table below) |
|
integer ≥ 1 |
— |
Recompute dynamic SGS coefficients every N steps |
|
|
— |
Filter-to-grid ratio: |
|
float |
— |
Initial |
|
float |
— |
Initial |
|
float |
— |
Initial |
|
float |
— |
Initial |
SGS model options
|
Model |
Best for |
|---|---|---|
|
LASDD-SM (Locally-Averaged Scale-Dependent Dynamic Smagorinsky) |
General ABL; most thoroughly validated |
|
LASDD-WL (Wong–Lilly variant) |
Alternative to LASDD-SM |
|
LAD-SM (Locally-Averaged Dynamic Smagorinsky) |
Simpler dynamic procedure; faster per step |
|
LAD-WL |
Wong–Lilly variant of LAD |
Recommendations
optSgs = 1(LASDD-SM) is the recommended default for all stable and neutral BL simulations.FGR = 1(implicit filtering) is standard. Dealiasing is activated automatically. UseFGR = 2only if you need explicit filtering (dealiasing is not needed).dynamicSGS_call_time = 1(every step) is standard. Increase to 5–10 for faster runs where the SGS field evolves slowly.The initial values
Cs2 = 0.01andCwl = 0.01(0.1²) are reasonable warm-start guesses; they are replaced after the first dynamic update.
optSgs = 1 # LASDD-SM
dynamicSGS_call_time = 1
FGR = 1
Cs2 = 0.1 ** 2
Cwl = 0.1 ** 2
Cs2PrRatio = Cs2 / 1.0
CwlPrRatio = Cwl / 1.0
7. Rayleigh Damping Layer
Parameter |
Values / Unit |
Default |
Description |
|---|---|---|---|
|
|
— |
|
|
m |
— |
Height above which damping starts |
|
s |
— |
Damping relaxation time scale (larger = weaker damping) |
Recommendations
Always enable the damping layer (
optDamping = 1) to absorb upward-propagating disturbances and prevent artificial reflections from the rigid lid.Set
z_dampingto roughly the top of the boundary layer (or ~60–70% ofl_z), leaving at least 20–30% of the domain depth as the absorbing sponge.
optDamping = 1
z_damping = 1500 # m — top of the ABL
RelaxTime = 300 # s
8. Statistics and Output
Parameter |
Unit |
Description |
|---|---|---|
|
s |
Collect one instantaneous horizontal-average sample every N seconds |
|
s |
Write time-averaged statistics to disk every N seconds |
|
s |
Write full 3-D field snapshots every N seconds |
Recommendations
OutputInterval_secshould be a multiple ofSampleInterval_sec; averages accumulate from individual samples.3-D field output is expensive in both compute and storage. For long runs, set
Output3DInterval_sec = SimTimeto write only at the end, or to a multiple of the boundary-layer turnover time (~l_z / u_star).Typical values for a 10-hour ABL run:
SampleInterval_sec = 15,OutputInterval_sec = 300.
SampleInterval_sec = 15.0 # s
OutputInterval_sec = 300.0 # s
Output3DInterval_sec = SimTime # write once at end
9. Large-Scale Advection Forcing
Parameter |
Values |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
path |
|
Path to advection forcing file |
Recommendations
Most idealized cases need no advection forcing (
optAdvection = 0).Enable for real-case simulations where mesoscale horizontal advection of temperature or moisture is significant (e.g., GABLS3, Wangara diurnal cycle).
optAdvection = 0 # most idealized cases
optAdvection = 1 # real-case with advection
AdvectionFile = 'input/AdvForcing.npz'
10. Moisture
Parameter |
Values / Unit |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
m |
|
Screen height for moisture-flux denominator; |
|
kg/kg m/s |
|
Constant surface moisture flux; used when |
|
|
|
|
|
path |
|
Path to time-varying moisture BC file |
|
kg/kg/m |
|
Specific humidity lapse rate above domain top; |
Recommendations
Most ABL benchmarks (GABLS1, GABLS2, NBL_A94) are dry; leave
optMoisture = 0.Enable moisture for the diurnal cycle (Wangara) or when dew formation matters (GABLS3).
zMoisturefollows the same logic aszTemperature: set to the screen height of the moisture observation whenoptMoistureSurfBC = 2.
# Dry run (default for most idealized cases)
optMoisture = 0
# Moist real-case
optMoisture = 1
zMoisture = 0.25
optMoistureSurfBC = 2
MoistureSurfaceBCFile = 'input/MoistureSurfaceBC.npz'
11. Pressure Solver
Parameter |
Values |
Default |
Description |
|---|---|---|---|
|
|
|
|
Recommendations
Always use
optPressureSolver = 1(Thomas algorithm). It is ~2× faster overall on a 128³ double-precision run because it exploits the tridiagonal structure of the pressure Poisson system instead of applying a dense O(N³) LU solve per horizontal wavenumber pair.The Thomas solver produces bit-for-bit identical results to the LU solver for all non-singular modes.
optPressureSolver = 0is retained only for regression testing and backward compatibility.
optPressureSolver = 1 # Thomas — use this in all production runs
Generated for JAX-ALFA — see theGitHub repositoryfor source code and issue tracking.