LA-UR-26-28567 Approved for public release; distribution is unlimited. Title: FIRETEC Bug Resolution Log Author(s): Fronk, Colby J. McDanold, Jenna Sjunneson Huckins, Matthew Kyle Brambilla, Sara Josephson, Alexander Jon Intended for: Report Issued: 2026-09-24 Los Alamos National Laboratory, an affirmative action/equal opportunity employer, is operated by Triad National Security, LLC for the National Nuclear Security Administration of U.S. Department of Energy under contract 89233218CNA000001. By approving this article, the publisher recognizes that the U.S. Government retains nonexclusive, royalty-free license to publish or reproduce the published form of this contribution, or to allow others to do so, for U.S. Government purposes. Los Alamos National Laboratory requests that the publisher identify this article as work performed under the auspices of the U.S. Department of Energy. Los Alamos National Laboratory strongly supports academic freedom and a researcher's right to publish; as an institution, however, the Laboratory does not endorse the viewpoint of a publication or guarantee its technical correctness. L O S A L A M O S N AT I O N A L L A B O R AT O R Y FIRETEC Bug Resolution Log May–September 2026 Consolidated record of FIRETEC bug investigations and resolved issues. AUTHORS AFFILIATI ONS 1 Colby Fronk1 A-1: Computational Intelligence & Modeling Jenna Sjunneson McDanold2 2 EES-16: Energy and Natural Resources Security Matthew Huckins1 Sara Brambilla1 Alexander Josephson2 DOCUMENT YEAR 2026 Contents May 2026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 BUG-2026-05-001: Inconsistent Z-Direction Pressure Gradient Scaling . . . . . . . . . . . . . . . . . . . 8 BUG-2026-05-002: Boundary Updates in MOA Time Extrapolation . . . . . . . . . . . . . . . . . . . . 11 BUG-2026-05-003: Heat-source behavior controls were global instead of per-source . . . . . . . . . . . . . 15 BUG-2026-05-004: Heat sources did not have independent start and end times . . . . . . . . . . . . . . . 18 BUG-2026-05-005: XY coverage was based on point tests rather than actual cell/source overlap . . . . . . 21 BUG-2026-05-006: Depth handling ignored terrain height and partial vertical-cell coverage . . . . . . . . . 24 BUG-2026-05-007: MLR/HRR input reading was fragile and not truly per-source . . . . . . . . . . . . . 27 BUG-2026-05-008: HRR and MLR file values were distributed incorrectly across source cells . . . . . . . . 30 BUG-2026-05-009: Interpolation and zero-time tolerance checks could divide by zero or use the wrong denominator 33 BUG-2026-05-010: Input documentation did not describe multi-source constraints or new array inputs . . . 36 June 2026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 BUG-2026-06-001: Symmetric/mirror velocity boundary flags are reversed across multiple routines . . . . . 39 BUG-2026-06-002: MPDATA assumes density is the last transported variable instead of using irho . . . . . 46 BUG-2026-06-003: tinit side relaxation/damper boundary setup uses inconsistent boundary indexing . . . 50 BUG-2026-06-004: ibcx / ibcy boundary-condition remapping appears swapped . . . . . . . . . . . . . . 62 BUG-2026-06-005: Non-periodic x-boundaries still communicate with periodic x-neighbors . . . . . . . . . 64 BUG-2026-06-006: Face-centered iperiod=1 handling for np+1 x-face arrays at non-periodic xmax . . . . . . 69 BUG-2026-06-007: Turbulence stress routine has likely sign errors in z-face y-gradients . . . . . . . . . . . 76 BUG-2026-06-008: MPI status variable has the wrong type in update . . . . . . . . . . . . . . . . . . . 79 BUG-2026-06-009: tempg halo update is repeated inside the variable loop . . . . . . . . . . . . . . . . . 81 BUG-2026-06-010: Vertical MPDATA divergence correction uses misleading temporary name . . . . . . . . 83 BUG-2026-06-011: update() physical edge halo fill order lets left/right boundaries overwrite corner ghost cells 85 BUG-2026-06-012: metric.F90 forces c13/c23 to zero at physical side boundaries, creating possible terrain- metric discontinuities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 BUG-2026-06-013: gradmoa() pressure perturbation halos use scalar copy/Neumann behavior at all non-cyclic side boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 BUG-2026-06-014: Mirror Radiation Boundary Conditions Let Photons Leave the Domain . . . . . . . . . 108 BUG-2026-06-015: Top/bottom symmetric-boundary checks are reversed in ray-tracing mirror logic . . . . . 112 BUG-2026-06-016: shoot_photons bottom-surface quadratic branch tests acoeftop instead of acoefbot . . . 114 BUG-2026-06-017: Missing cyclic-pair validation allows inconsistent MPI/domain boundary state . . . . . . 117 BUG-2026-06-018: Initialize integer MPI status array with integer literal . . . . . . . . . . . . . . . . . 121 BUG-2026-06-019: Symmetric BC support for radiation/solar is broken, and firebrands are not safe enough . 122 BUG-2026-06-020: Bottom-right corner uses topedge instead of botedge . . . . . . . . . . . . . . . . . . 126 BUG-2026-06-021: Upper-left corner send omits i0/j0 staggered-grid offsets . . . . . . . . . . . . . . . . 129 BUG-2026-06-022: Inconsistent DBL_PREC preprocessor guard . . . . . . . . . . . . . . . . . . . . . 132 BUG-2026-06-023: ibc=5 mirror/reflective boundary uses constant extrapolation instead of true mirrored ghost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . cells 135 BUG-2026-06-024: No proper build-time switch for precision mode . . . . . . . . . . . . . . . . . . . . 140 BUG-2026-06-025: Mixed-kind numeric literals caused precision loss and SP/DP inconsistencies . . . . . . 143 BUG-2026-06-026: Missing prec imports caused compile failures after prec-suffix conversion . . . . . . . . 146 BUG-2026-06-027: Hard-coded real(8) and default real declarations broke precision portability . . . . . . 149 1 FIRETEC Bug Resolution Log Contents BUG-2026-06-028: Inconsistent external function typing for zcart created interface mismatch risk . . . . . 152 BUG-2026-06-029: Precision-specific code paths were duplicated and inconsistent . . . . . . . . . . . . . 155 BUG-2026-06-030: MPI precision handling was fragile and sometimes precision-truncating . . . . . . . . . 158 BUG-2026-06-031: Integer-to-real conversion logic in initialization was not kind-safe . . . . . . . . . . . . 161 BUG-2026-06-032: Numerically sensitive physics constants were not precision-safe . . . . . . . . . . . . . 164 BUG-2026-06-033: Default-real initialization of arrays and scalars polluted precision consistency . . . . . . 167 BUG-2026-06-034: Mixed-kind intrinsic calls were unsafe . . . . . . . . . . . . . . . . . . . . . . . . . 170 BUG-2026-06-035: Core constants module depended on duplicated SP/DP branches . . . . . . . . . . . . 173 BUG-2026-06-036: Pressure-gradient helper code used fixed double-precision staging variables . . . . . . . 176 BUG-2026-06-037: Diagnostics truncated precision before printing and reporting . . . . . . . . . . . . . . 179 BUG-2026-06-038: Precision bugs existed in numerically critical advection and turbulence kernels . . . . . . 182 BUG-2026-06-039: Incorrect and inconsistent Stefan–Boltzmann constant values . . . . . . . . . . . . . . 185 BUG-2026-06-040: MPDATA y-face halo update appears to use botedge instead of topedge when updating f2o 189 BUG-2026-06-041: MPI broadcast type mismatch in source_defs . . . . . . . . . . . . . . . . . . . . . 194 BUG-2026-06-042: Non-portable precision definition in gridlist_variables.f90 . . . . . . . . . . . . . 198 BUG-2026-06-043: Firebrand exact top-boundary handling writes the x coordinate instead of y . . . . . . . 202 BUG-2026-06-044: Radiation bottom-face intersection uses the top-face coefficient . . . . . . . . . . . . . 205 BUG-2026-06-045: V-ramp environmental boundary target uses transposed loop bounds and skips boundary cells 207 BUG-2026-06-046: radiationSink receives a fuel-depth gas-force slice but loops over the full atmosphere depth 211 BUG-2026-06-047: Halo exchange MPI tags can exceed MPI_TAG_UB after only a few timesteps . . . . . . . 214 BUG-2026-06-048: Firebrands can be removed multiple times in one boundary pass . . . . . . . . . . . . 217 July 2026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 BUG-2026-07-001: Firebrand Output Is Called With Time Instead Of The Timestep . . . . . . . . . . . . 221 BUG-2026-07-002: Restart At Or Beyond nt Runs One Extra Step . . . . . . . . . . . . . . . . . . . . 224 BUG-2026-07-003: Restart Output Cadence Uses The Local Loop Counter . . . . . . . . . . . . . . . . 227 BUG-2026-07-004: NaN Guard Checks Only One Local Cell And Can Strand MPI Ranks . . . . . . . . . 230 BUG-2026-07-005: Optional Output Directories Are Not Created Before Use . . . . . . . . . . . . . . . 233 BUG-2026-07-006: ZBEST Aerosol Moment Pointers Stay Pointed At u . . . . . . . . . . . . . . . . . . 237 BUG-2026-07-007: No-Emission Runs Still Pass Emission Arrays To Thermodynamics . . . . . . . . . . . 241 BUG-2026-07-008: Aerosol xv_list Labels Can Be Wrong Or Crash On Long Species Names . . . . . . . . 246 BUG-2026-07-009: Fire And Fuel Heat Paths Use kb Even When It Was Never Added To xv . . . . . . . . 250 BUG-2026-07-010: iturb=1 Reaches Turbulence Initialization With Unallocated Arrays . . . . . . . . . . 253 BUG-2026-07-011: Implicit Domain Updates Leave Ground-Layer xvrho Stale . . . . . . . . . . . . . . . 256 BUG-2026-07-012: Explicit Ground xvrho Boundary Leaves Lateral Halos Stale . . . . . . . . . . . . . . 261 BUG-2026-07-013: Solid Temperatures Are Not Updated For Non-Fire isies Physics . . . . . . . . . . . 265 BUG-2026-07-014: Heat Source Fuel Burn Leaves Solid Temperatures Stale . . . . . . . . . . . . . . . . 269 BUG-2026-07-015: Sensor Wind Variation Uses The Vertical Index As A Terrain Index . . . . . . . . . . 274 BUG-2026-07-016: FORCE-002: Density can be clipped to exactly zero, then divided by on the next update 279 BUG-2026-07-017: FORCE-003: iturb=1 bypasses the existing unsupported-mode stop and leaves fire physics using the wrong field as kb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 BUG-2026-07-018: FORCE-004: Fuel-layer loops can read past the gas-column top . . . . . . . . . . . . 286 BUG-2026-07-019: FORCE-005: icorio > 2 can index outside the vertical column . . . . . . . . . . . . 290 BUG-2026-07-020: FORCE-006: Emission-factor aerosol sources are read but not applied . . . . . . . . . 293 BUG-2026-07-021: FORCE-007: idiffsies=1 can call diffusesies without a solid-energy field . . . . . . 297 BUG-2026-07-022: FORCE-008: Point-source emissions can write outside the forcing array for invalid height or species . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 2 FIRETEC Bug Resolution Log Contents BUG-2026-07-023: Large-scale PGF mass-flux reduction uses repeated scalar MPI_Allreduces . . . . . . . 305 BUG-2026-07-024: EMISSIONS-023: ZBEST can be selected without fire-enabled fuel state . . . . . . . . 308 BUG-2026-07-025: EMISSIONS-026: Unsupported iemissions values silently skip all emission forcing . . . 312 BUG-2026-07-026: FIREBRANDS-009: Default firebrand restart file points at an incompatible main-output file 316 BUG-2026-07-027: FIREBRANDS-012: ifbrand > 1 writes uninitialized firebrand arrays . . . . . . . . . 320 BUG-2026-07-028: FIREBRANDS-019: Nonpositive firebrand geometry inputs can produce divide-by-zero and NaNs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 BUG-2026-07-029: FIREBRANDS-021: Firebrands can run without the fuel temperature field they require . 326 BUG-2026-07-030: HEATSOURCE-001: Unsupported per-source option values silently change or disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . heat-source forcing 330 BUG-2026-07-031: HEATSOURCE-009: Heat-source geometry and time inputs are not validated . . . . . . 335 BUG-2026-07-032: INPUT-002: uswitch=1/vswitch=1 wind ramps can be disabled by later ixevariation parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 BUG-2026-07-033: INPUT-005: Cadence inputs are not validated before being used as mod divisors . . . . . 344 BUG-2026-07-034: INPUT-009: topofile is truncated to 60 characters before topo.F90 opens it . . . . . . 348 BUG-2026-07-035: INPUT-010: Relaxation inputs can trigger divisions by zero in tinit . . . . . . . . . . 351 BUG-2026-07-036: INPUT-011: Unsupported iheatsource values are accepted as enabled heat sources . . . 355 BUG-2026-07-037: INPUT-012: Xe-variation input ranges can cause divide-by-zero or out-of-bounds windfield access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 BUG-2026-07-038: RADIATION-007: icallrad is not validated before use as a MOD divisor . . . . . . . . 363 BUG-2026-07-039: RADIATION-010: Invalid radiation modes and options are silently accepted . . . . . . 366 BUG-2026-07-040: SUBGRIDTURB-006: Invalid isa leaves turbulence length scales undefined . . . . . . . 370 BUG-2026-07-041: SUBGRIDTURB-009: Negative rturbprandtl turns scalar turbulence diffusion into anti- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . diffusion 374 BUG-2026-07-042: TINIT-003: Invalid top-absorber settings silently disable or corrupt damping . . . . . . 378 BUG-2026-07-043: TINIT-008: Over-wide lateral sponge regions can cover the whole domain . . . . . . . . 381 BUG-2026-07-044: VARIABLES-008: icfmeflag promises slice-grid input but has no runtime consumer . . 385 BUG-2026-07-045: VARIABLES-009: isensor > 1 reads sensor input but never initializes or writes sensors . 388 BUG-2026-07-046: VEGETATION-007: Fire chemistry can use the u velocity slot as oxygen . . . . . . . . 392 BUG-2026-07-047: VEGETATION-009: Invalid ifuel leaves psif undefined . . . . . . . . . . . . . . . . 396 BUG-2026-07-048: VEGETATION-013: Ignition file coordinates are never bounds-checked before indexing fuel arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 BUG-2026-07-049: VEGETATION-020: nfuel is not validated before allocation and file-size arithmetic . . . 404 BUG-2026-07-050: VEGETATION-021: Negative moisture ratios initialize negative water density . . . . . . 408 BUG-2026-07-051: VEGETATION-023: Nonpositive vegetation material constants are accepted and used as divisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 BUG-2026-07-052: VEGETATION-025: Vegetation feature switches accept invalid values that silently change physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416 BUG-2026-07-053: XEVARIATION-009: Windfield Subdomain Bounds Are Accepted But Ignored . . . . . 420 BUG-2026-07-054: XEVARIATION-016: Overlapping Windfield Boundary Strips Leave Part Of The Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Buffer Unfilled 424 BUG-2026-07-055: XEVARIATION-017: windfieldin/out = 2 Is Documented But Ignored . . . . . . . . 428 BUG-2026-07-056: Top Absorption Layer Disabled by Invalid zab . . . . . . . . . . . . . . . . . . . . . 432 BUG-2026-07-057: Invalid Positive Boundary-Mode Values Silently Become Inconsistent Boundary Modes . 435 BUG-2026-07-058: Ground boundary loop writes past the xvrho variable dimension . . . . . . . . . . . . 440 BUG-2026-07-059: Windfield boundary writer leaves output files open . . . . . . . . . . . . . . . . . . . 443 BUG-2026-07-060: xevariation uses jl:ju as x-loop bounds in v-ramp and windfield input paths . . . . . 445 3 FIRETEC Bug Resolution Log Contents BUG-2026-07-061: EMISSIONS-001: Adding fire-required O2 drops existing efEmit values . . . . . . . . . 449 BUG-2026-07-062: EMISSIONS-003: Point sources use the lower vertical edge to choose a cell . . . . . . . 452 BUG-2026-07-063: EMISSIONS-004: Point-source horizontal mapping rounds into the wrong cell or MPI rank 456 BUG-2026-07-064: EMISSIONS-006: LagrangeInterp overwrites each interpolation term . . . . . . . . . . 460 BUG-2026-07-065: EMISSIONS-007: Aerosol routines declare module function LagrangeInterp as external . 463 BUG-2026-07-066: EMISSIONS-008: Stokes ground deposition divides by zero at the ground edge . . . . . 467 BUG-2026-07-067: EMISSIONS-011: Aerosol deposition and settling routines are never called . . . . . . . 470 BUG-2026-07-068: EMISSIONS-012: LagrangeInterp takes log10 of zero aerosol moments . . . . . . . . . 474 BUG-2026-07-069: EMISSIONS-021: Explicit O2 gets the default CO2 emission factor . . . . . . . . . . . 478 BUG-2026-07-070: INPUT-003: input_firebrands is called with an argument even though it accepts none . . 482 BUG-2026-07-071: INPUT-008: Auto-inserting O2 leaves fixed emission factors uninitialized . . . . . . . . 485 BUG-2026-07-072: METRIC-003: Time-varying power-law winds use the terrain height from cell (1,1) everywhere 489 BUG-2026-07-073: MOA-003: MOA advances global time before large explicit forcings are evaluated on the old state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 BUG-2026-07-074: VEGETATION-018: Upper canopy drag layers omit depth weighting for each fuel type . 497 BUG-2026-07-075: Safety check plan for accidental irst=1 . . . . . . . . . . . . . . . . . . . . . . . . 501 BUG-2026-07-076: Fuel-top wind interpolation is accidentally divided in half . . . . . . . . . . . . . . . 507 BUG-2026-07-077: Windfield .0 is post-step and can already contain the heat plume . . . . . . . . . . . . 511 BUG-2026-07-078: Firebrand wind interpolation omits the high-side x weight . . . . . . . . . . . . . . . 515 BUG-2026-07-079: Sensor-driven wind reconstruction gives larger weight to farther sensors . . . . . . . . . 518 BUG-2026-07-080: Turbulence initialization uses momentum squared as wind speed squared . . . . . . . . 522 BUG-2026-07-081: Turbulence length-scale option isa=5 uses stale saxy and mis-parenthesized saz . . . . . 525 BUG-2026-07-082: Windfield templates use keys that input.F90 no longer reads . . . . . . . . . . . . . . 529 BUG-2026-07-083: Delayed heat-source waveforms use absolute simulation time . . . . . . . . . . . . . . 532 BUG-2026-07-084: Ramped wind components are not initialized before xv is copied from xe . . . . . . . . 535 BUG-2026-07-085: Ambient velocity initialization can leave constant or vertical wind components unset . . . 539 BUG-2026-07-086: The normal output workflow does not write the initialized t=0 state . . . . . . . . . . 543 BUG-2026-07-087: Sensor-driven winds compute distances from local MPI coordinates . . . . . . . . . . . 546 BUG-2026-07-088: A fresh run extrapolates HRR/MLR before the first input timestamp . . . . . . . . . . 550 BUG-2026-07-089: Windfield File Cadence Uses Absolute Timesteps While File Names Use Relative Timesteps 553 BUG-2026-07-090: Bottom xvrho Plane Is Filled Only in the Interior, but Turbulence Reads Its Lateral Halos 556 BUG-2026-07-091: Gridlist Query Calls Can Erase Defaults When Keys Are Absent . . . . . . . . . . . . 561 BUG-2026-07-092: FIREBRANDS-015: Firebrand restart reader leaves unit 48 open . . . . . . . . . . . . 565 BUG-2026-07-093: IO-001: Restart reads pass an input-only buffer to MPI_Scatter . . . . . . . . . . . . 567 BUG-2026-07-094: READGRIDLIST-005: Duplicate gridlist keys silently use the first value . . . . . . . . 570 BUG-2026-07-095: READGRIDLIST-006: Gridlist key matching is case-sensitive . . . . . . . . . . . . . 573 BUG-2026-07-096: SENSORS-008: Sensor path buffers can truncate valid file names . . . . . . . . . . . . 576 BUG-2026-07-097: XEVARIATION-020: Dense Sensor File Base Name Is Never Read From The Gridlist . . 579 August 2026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .581 BUG-2026-08-001: POST-001: the no-emission state passes the wrong xvrho section to thermodynamics . . 582 BUG-2026-08-002: POST-002: initialization and the first thermodynamic update use different ambient gases 586 BUG-2026-08-003: POST-003: a dormant heat source still enters the timestep routine and allocates saved state 590 BUG-2026-08-004: POST-004: heatSource receives a noncontiguous forcing section as contiguous storage . . 594 BUG-2026-08-005: POST-005: radiation uses the u wind component as oxygen when O2 is not tracked . . . 597 BUG-2026-08-006: XEVARIATION-007: Dense Sensor Restart Skips One Record Too Few . . . . . . . . . 601 BUG-2026-08-007: XEVARIATION-010: Sensor Distance Uses Local MPI Indices Instead Of Global Coordinates 604 4 FIRETEC Bug Resolution Log Contents BUG-2026-08-008: XEVARIATION-011: Dense Sensor Records Advance One Large Step Too Early . . . . 607 BUG-2026-08-009: XEVARIATION-019: Fire Restarts Use The Simulated Field As The Old Windfield Target 610 BUG-2026-08-010: updateSolidThermProps divides by rhoFuel + rhoWater without a mass guard . . . . . 614 BUG-2026-08-011: IO-002: Restart timestep parsing only works for filenames containing out. . . . . . . . 616 BUG-2026-08-012: MOA-004: Fuel limits are applied with a 4-D limiter to 5-D fuel arrays . . . . . . . . . 619 BUG-2026-08-013: RADIATION-002: Monte Carlo convergence compares neighboring cells instead of iterations 623 BUG-2026-08-014: RADIATION-003: Photon batch splitting drops or over-assigns photons . . . . . . . . . 626 BUG-2026-08-015: RADIATION-008: Monte Carlo radiation reuses stale source terms when Etot < Emin . . 629 BUG-2026-08-016: RADIATION-012: Photon tracing can divide by zero for RNG endpoint directions . . . 632 BUG-2026-08-017: RADIATION-013: firerad_MC declares fuel arrays with the gas-layer count . . . . . . . 635 BUG-2026-08-018: RADIATION-014: kfindex is used as both fuel-rank and rank-to-fuel maps . . . . . . . 638 BUG-2026-08-019: RADIATION-015: zCartEdgeAZLocal(it,:,:,:) is a non-contiguous MPI send buffer . . 643 BUG-2026-08-020: RADIATION-017: Opacity threshold is recomputed inconsistently between source selection and update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646 BUG-2026-08-021: RADIATION-018: Monte Carlo convergence fraction is truncated by integer division . . 649 BUG-2026-08-022: RADIATION-019: Bottom gas absorption is scaled by AZ sublayer volume . . . . . . . 652 BUG-2026-08-023: SENSORS-002: Sensor cell search misses lower domain boundaries . . . . . . . . . . . 655 BUG-2026-08-024: SENSORS-003: Unmatched sensors fail silently . . . . . . . . . . . . . . . . . . . . 659 BUG-2026-08-025: SENSORS-004: Sensor CSV output inserts blank records and relies on close to end rows . 663 BUG-2026-08-026: SENSORS-007: Fresh sensor runs silently append to stale CSV files . . . . . . . . . . . 667 BUG-2026-08-027: SENSORS-009: Sensor location-file reads have no I/O error checks . . . . . . . . . . . 670 BUG-2026-08-028: SENSORS-010: ncycle start cycle is treated as exclusive . . . . . . . . . . . . . . . . 673 BUG-2026-08-029: SENSORS-013: Missing inline sensor coordinate arrays leave uninitialized locations . . . 676 BUG-2026-08-030: MPI speedup: replace repeated LSPGF gathers with one MPI_Allgather . . . . . . . . 680 BUG-2026-08-031: MPI speedup: replace repeated firebrand scatters with MPI_Alltoall . . . . . . . . . . 683 BUG-2026-08-032: MPI speedup: gather the complete firebrand record in one MPI_Gatherv . . . . . . . . 685 BUG-2026-08-033: MPI speedup: remove heap allocation from every halo update . . . . . . . . . . . . . 688 BUG-2026-08-034: MPI speedup: use MPI_Alltoallv to stop padding every firebrand exchange . . . . . . . 691 BUG-2026-08-035: MPI speedup: reuse the radiation allgather for total energy . . . . . . . . . . . . . . 694 BUG-2026-08-036: Put the contiguous Fortran index in the innermost hot loop . . . . . . . . . . . . . . 697 BUG-2026-08-037: Use move_alloc when compacting firebrands . . . . . . . . . . . . . . . . . . . . . 700 BUG-2026-08-038: Avoid the extra firebrand launch copy and no-op reallocation . . . . . . . . . . . . . . 702 BUG-2026-08-039: Remove full-array negation temporaries in emission models . . . . . . . . . . . . . . . 704 BUG-2026-08-040: Make the gradmoa pressure-gradient loop contiguous . . . . . . . . . . . . . . . . . . 707 BUG-2026-08-041: Make the main ZBEST loop cell-major . . . . . . . . . . . . . . . . . . . . . . . . . 709 BUG-2026-08-042: VEGETATION-004: solarHeating mixes local MPI indices with global AZ geometry . . 711 BUG-2026-08-043: VEGETATION-005: fuelDragCorrection uses one array as both sorted fuel list and inverse rank map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 BUG-2026-08-044: VEGETATION-006: Dry fuels do not cast solar shade . . . . . . . . . . . . . . . . . 720 BUG-2026-08-045: VEGETATION-012: solarHeating uses H2O density where it expects mass fraction . . . 724 BUG-2026-08-046: VEGETATION-017: sun_position reduces solar mean longitude modulo 90 degrees . . . 728 BUG-2026-08-047: BUG-June24-advectionScheme-001: ibctopopen cannot produce advective top outflow because vertical top flux is hard-coded closed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 BUG-2026-08-048: BUG-June24-advectionScheme-003: The nonos limiter still treats the vertical top as a mirrored wall even if top outflow is opened . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 BUG-2026-08-049: METRIC-004: Turbulence wall-length correction uses the wrong metric height . . . . . 738 5 FIRETEC Bug Resolution Log Contents BUG-2026-08-050: METRIC-005: Radiation east-flux update indexes gas heights as if they were Monte Carlo AZ levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741 BUG-2026-08-051: READGRIDLIST-002: Assignment parsing depends on spaces around = . . . . . . . . . 744 BUG-2026-08-052: RINIT-001: Humidity initialization mixes hPa vapor pressure with Pa ground pressure . 748 BUG-2026-08-053: RINIT-006: Pinwheel perturbations use hard-coded local indices and can write outside the local domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 BUG-2026-08-054: RINIT-007: Constant wind switches are never initialized unless a canopy profile is requested 757 BUG-2026-08-055: RINIT-008: Ramped wind switches update xe only after xv has already been initialized. 761 BUG-2026-08-056: RMAXMIN-001: Non-root ranks read undefined MPI_Reduce receive values . . . . . . 765 BUG-2026-08-057: RMAXMIN-002: Fuel-depth diagnostic passes a 2D slice to the 3D helper . . . . . . . . 769 BUG-2026-08-058: RMAXMIN-003: Fuel min/max diagnostics allocate hidden temporaries every timestep . 772 BUG-2026-08-059: SUBGRIDTURB-008: Scalar diffusion bottom-face cross terms ignore the ground ghost layer 776 BUG-2026-08-060: SUBGRIDTURB-010: calcForceTurb ignores its lls argument and forces kernels to global l 781 BUG-2026-08-061: SUBGRIDTURB-012: Scalar diffusion top face can leak horizontal gradients as vertical flux 785 BUG-2026-08-062: THERMODYNAMICS-001: Gas mixture molecular weight is averaged with the wrong weights 789 BUG-2026-08-063: TINIT-001: Exponential top absorber is strongest at the bottom of the sponge . . . . . 792 BUG-2026-08-064: VARIABLES-001: namefile builds invalid names when the base has no trailing blank . . 795 BUG-2026-08-065: VARIABLES-010: Dead forcings::force array is still allocated at full field size . . . . 798 BUG-2026-08-066: VARIABLES-011: xvfuelLim has an unallocated shadow copy in xvall . . . . . . . . . 801 September 2026 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804 BUG-2026-09-001: Firebrands landing exactly on upper/right edges skip boundary handling . . . . . . . . 805 BUG-2026-09-002: updateFB sends strided firebrand records as contiguous data . . . . . . . . . . . . . . 807 BUG-2026-09-003: writeio_fb gathers firebrand arrays into the wrong 2D layout . . . . . . . . . . . . . . 809 BUG-2026-09-004: writeio_fb uses an unallocated receive buffer on non-root ranks . . . . . . . . . . . . . 811 BUG-2026-09-005: Bulk evaporation has no active call site . . . . . . . . . . . . . . . . . . . . . . . . 813 BUG-2026-09-006: Aerosol Stokes drag divides by zero at the ground . . . . . . . . . . . . . . . . . . . 815 BUG-2026-09-007: windfieldin=1 skips xe-variation input parsing . . . . . . . . . . . . . . . . . . . . 817 BUG-2026-09-008: Unconditional emissions input can reach humidity-only efEmit use . . . . . . . . . . . 819 BUG-2026-09-009: Humidity-added H2O can use unallocated efEmit . . . . . . . . . . . . . . . . . . . 821 BUG-2026-09-010: Solar-only initialization enters rinitrad without radiation geometry . . . . . . . . . . 822 BUG-2026-09-011: rinitrad writes AZ geometry outside the Monte Carlo allocation path . . . . . . . . . 823 BUG-2026-09-012: Solar irradiance can become negative or NaN at night . . . . . . . . . . . . . . . . . 825 BUG-2026-09-013: Solar mirror reflection mutates the shared ray direction . . . . . . . . . . . . . . . . 827 BUG-2026-09-014: Open-top u3 stores raw vertical velocity . . . . . . . . . . . . . . . . . . . . . . . . 829 BUG-2026-09-015: Open-top flux uses the interior vertical face velocity . . . . . . . . . . . . . . . . . . 830 BUG-2026-09-016: Near-ground subgrid length-scale corrections square the denominator . . . . . . . . . . 831 BUG-2026-09-017: iab=2 top absorber exponential has the wrong sign . . . . . . . . . . . . . . . . . . 833 BUG-2026-09-018: Firebrand halo-padded arrays are remapped with interior-only bounds . . . . . . . . . 834 BUG-2026-09-019: GetWind reverses lower-side interpolation weights . . . . . . . . . . . . . . . . . . . 836 BUG-2026-09-020: Firebrand ground-impact test ignores terrain height . . . . . . . . . . . . . . . . . . 838 BUG-2026-09-021: Firebrand launch can combine hot fuel from one type with mass from another . . . . . . 840 BUG-2026-09-022: Disk height-burning branch uses the sphere drag coefficient . . . . . . . . . . . . . . . 842 BUG-2026-09-023: Firebrand launch lift test counts horizontal wind as upward drag . . . . . . . . . . . . 844 BUG-2026-09-024: Firebrand drag acceleration omits mass and uses ambient velocity direction . . . . . . . 846 6 May 2026 7 FIRETEC Bug Resolution Log May 2026 BUG-2026-05-001: Inconsistent Z-Direction Pressure Gradient Scaling File: higrad.F90 Lines: 161-162 Description The vertical pressure gradients at the bottom (k=1) and top (k=l) boundaries incorrectly include a 0.5 scaling factor, making them half of what they should be. Code Location ! Lines 161-162 in higrad.F90 pz(i,j,1)= 0.5*(pr(i,j,2)-pr(i,j,1))*dzi pz(i,j,l)= 0.5*(pr(i,j,l)-pr(i,j,l-1))*dzi Problem Analysis These are one-sided finite differences over one grid spacing (dz), so the gradient should be: • Forward difference at k=1: pz(i,j,1) = (pr(i,j,2)-pr(i,j,1))*dzi • Backward difference at k=l: pz(i,j,l) = (pr(i,j,l)-pr(i,j,l-1))*dzi The 0.5 factor is incorrect because: • Interior points (k=2 to l-1) use centered differences with 2*dz spacing, so 0.5 factor is correct there (line 154) • Boundary points use 1*dz spacing, so no 0.5 factor should be applied • This is inconsistent with how x and y boundaries are handled (lines 118, 124, 139, 146) where 0.5 is correctly omitted Impact • Vertical pressure forces are underestimated by 50% at top and bottom • Creates artificial vertical pressure imbalance • Contributes to vertical wave reflections at boundaries • With uniform dz=1, these errors accumulate faster • Compounds with other boundary errors to create instabilities Comparison with Correct X/Y Boundary Treatment X-direction boundaries (lines 118, 124): px(1,j,k)=(pr(2,j,k)-pr(1,j,k))*dxi ! Correct - no 0.5 factor px(np,j,k)=(pr(np,j,k)-pr(np-1,j,k))*dxi ! Correct - no 0.5 factor Z-direction boundaries (lines 161-162): 8 FIRETEC Bug Resolution Log May 2026 pz(i,j,1)= 0.5*(pr(i,j,2)-pr(i,j,1))*dzi ! WRONG - has 0.5 factor pz(i,j,l)= 0.5*(pr(i,j,l)-pr(i,j,l-1))*dzi ! WRONG - has 0.5 factor Recommended Fix Remove the 0.5 scaling factor: do j=1,mp do i=1,np pz(i,j,1) = (pr(i,j,2)-pr(i,j,1))*dzi pz(i,j,l) = (pr(i,j,l)-pr(i,j,l-1))*dzi enddo enddo Git evidence: 8093f01 (2026-05-21, higrad pressure-gradient endpoint update). The pressure-initialization code was changed in CODE-dev/higrad.F90 so the bottom and top vertical pressure-gradient endpoints use one-sided second-order finite differences rather than the earlier incon- sistent endpoint scaling. # 8093f01 Debugupdate # Full command: git show --find-renames --unified=3 8093f01 -- CODE-dev/higrad.F90 index 9dc07a3..85733d5 100644 +++ b/CODE-dev/higrad.F90 ... [diff excerpt truncated; run the command above for the full commit diff] @@ -103,50 +102,15 @@ subroutine gradmoa() enddo enddo call update(pr,pr,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0,0) - - do i=1+leftdedge,np-rightdedge - do k=1,l - do j=1,mp - px(i,j,k)=0.5*(pr(i+1,j,k)-pr(i-1,j,k))*dxi - enddo - if(leftdedge.eq.1) then - do k=1,l - do j=1,mp - px(1,j,k)=(pr(2,j,k)-pr(1,j,k))*dxi - endif - if(rightdedge.eq.1) then - do k=1,l - do j=1,mp - px(np,j,k)=(pr(np,j,k)-pr(np-1,j,k))*dxi 9 FIRETEC Bug Resolution Log May 2026 do k=1,l do i=1,np - do j=1+botdedge,mp-topdedge + do j=1,mp py(i,j,k)=0.5*(pr(i,j+1,k)-pr(i,j-1,k))*dyi + px(i,j,k)=0.5*(pr(i+1,j,k)-pr(i-1,j,k))*dxi enddo enddo enddo - if(botdedge.eq.1) then - do k=1,l - do i=1,np - py(i,1,k)=(pr(i,2,k)-pr(i,1,k))*dyi - enddo - enddo - if(topdedge.eq.1) then - do k=1,l - do i=1,np - py(i,mp,k)=(pr(i,mp,k)-pr(i,mp-1,k))*dyi - enddo - enddo do k=2,l-1 do j=1,mp @@ -158,8 +122,9 @@ subroutine gradmoa() do j=1,mp do i=1,np - pz(i,j,1)= 0.5*(pr(i,j,2)-pr(i,j,1))*dzi - pz(i,j,l)= 0.5*(pr(i,j,l)-pr(i,j,l-1))*dzi + ! Second-order one-sided difference (forward and backward) + pz(i,j,1)=0.5*(-pr(i,j,3)+4*pr(i,j,2)-3*pr(i,j,1))*dzi + pz(i,j,l)=0.5*(pr(i,j,l-2)-4*pr(i,j,l-1)+3*pr(i,j,l))*dzi enddo enddo ... [diff excerpt truncated; run the command above for the full commit diff] 10 FIRETEC Bug Resolution Log May 2026 BUG-2026-05-002: Boundary Updates in MOA Time Extrapolation File: MOA.F90 Lines: 68-77 Description Time-extrapolated velocities in the MOA inner loop are not properly updated at boundaries before being used in advection calculations, leading to uninitialized ghost cell values. Code Location ! Lines 68-70: Time extrapolation (interior points only) u(i,j,k,2)=0.5*(3.*u(i,j,k,1)-u(i,j,k,0)) v(i,j,k,2)=0.5*(3.*v(i,j,k,1)-v(i,j,k,0)) o(i,j,k,2)=0.5*(3.*o(i,j,k,1)-o(i,j,k,0)) ! Lines 76-77: These extrapolated arrays are passed with ghost cells call setAdvectiveVelocities(u(:,:,:,2),v(:,:,:,2),o(:,:,:,2), & 1-ih,np+ih,1-ih,mp+ih,l,dts,0) Problem Analysis 1. The time extrapolation loop only covers interior cells (i=1,np, j=1,mp, k=1,l) 2. Ghost cells (i.e., i<1, i>np, j<1, j>mp) in the time level "2" arrays remain uninitialized 3. These uninitialized arrays are passed to setAdvectiveVelocities 4. Inside setAdvectiveVelocities (advectionScheme.F90, lines 121, 161), update() is called: call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0) call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0) 5. The update() routine fills ghost cells with environmental values (ae) for boundary processors 6. However, at ymax (topdedge==1), the ghost cells are filled with: a(i,nyp+j,k)=ae(iref,nyp,k) ! update.F90 line 356 This uses the uninitialized ghost cell values from the extrapolated field Impact at ymax Boundary • Ghost cells at j>mp contain garbage/uninitialized values from time extrapolation • These get used in subsequent advection flux calculations • Errors propagate into the physical domain through the advection scheme • With uniform dz=1, vertical advection is more active, amplifying these errors • Compounds with aggressive relaxation to create explosive growth Call Chain Showing the Problem MOA.F90: u(:,:,:,2) extrapolated -> ghost cells UNINITIALIZED 11 FIRETEC Bug Resolution Log May 2026 => setAdvectiveVelocities() -> uses uninitialized ghost cells => update() -> fills ghost cells but uses uninitialized base values => Advection calculations -> use bad ghost cell values => Errors propagate into physical domain Recommended Fix Add proper boundary updates immediately after time extrapolation: ! After lines 68-70, add: call update(u(:,:,:,2),u(:,:,:,2),np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0) call update(v(:,:,:,2),v(:,:,:,2),np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0) call update(o(:,:,:,2),o(:,:,:,2),np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0) ! Then proceed with: call setAdvectiveVelocities(u(:,:,:,2),v(:,:,:,2),o(:,:,:,2), & 1-ih,np+ih,1-ih,mp+ih,l,dts,0) Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 0792741 (2026-06-15, mirrored-boundary corner rewrite); fd65110 (2026-08-11, metric/MOA fixes and fuel limits). The exact suggested immediate u/v/o halo update was not preserved as a standalone patch. The landed implementation rewrote the update interface and boundary flags, removed the unused ae argument, and later bundled MOA-related cleanup with the fuel-limit fixes. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/MOA.F90 CODE-dev/ ,→ advectionScheme.F90 CODE-dev/update.F90 index 27ee300..34553c3 100644 +++ b/CODE-dev/MOA.F90 @@ -23,7 +23,7 @@ subroutine MOA ! Local Variables - integer :: its,i,j,k,kv,topbot,leftright + integer :: its,i,j,k,kv,iuv real(prec),allocatable :: u(:,:,:,:),v(:,:,:,:),o(:,:,:,:) ! centered contravariant coordinates/gi ! Executable Code @@ -78,19 +78,9 @@ subroutine MOA ! computation of advective tendencies (donorcell scheme) do kv=1,nv - if(kv.eq.1) then - topbot = 1 - leftright = 0 12 FIRETEC Bug Resolution Log May 2026 - elseif(kv.eq.2) then - topbot = 0 - leftright = 1 - else - topbot = 0 - leftright = 0 - endif - + call loop_update_flags(kv,iuv) call update(xvtmp(1-ih,1-ih,1,kv),xvtmp(1-ih,1-ih,1,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,topbot,leftright) + 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(xvtmp(1-ih,1-ih,1,kv),1-ih,np+ih,1-ih,mp+ih,l) enddo +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif ... [diff excerpt truncated; run the command above for the full commit diff] # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/MOA.F90 CODE-dev/ ,→ advectionScheme.F90 CODE-dev/update.F90 index 34553c3..9b97a6c 100644 +++ b/CODE-dev/MOA.F90 @@ -79,8 +79,7 @@ subroutine MOA ! computation of advective tendencies (donorcell scheme) do kv=1,nv - call update(xvtmp(1-ih,1-ih,1,kv),xvtmp(1-ih,1-ih,1,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) + call update(xvtmp(:,:,:,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(xvtmp(1-ih,1-ih,1,kv),1-ih,np+ih,1-ih,mp+ih,l) enddo index 7e81131..382217e 100644 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) + call update(u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) 13 FIRETEC Bug Resolution Log May 2026 + call update(v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 14 BUG-2026-05-003: Heat-source behavior controls were global instead of per-source Files: variables_heat.F90, input_heat.F90, heatsource_heat.F90 The old module had scalar control variables such as isource_function, imass_source, and MLRHRRin- puts. In a multi-source run, every source therefore had to use the same source-function waveform, the same mass-source option, and the same MLR/HRR input mode. The code looped over itsource but read and used scalar configuration. That made nsource_hs only partially useful: geometric arrays were per-source, but important behavior switches were shared across all sources. Multi-source cases could not model sources with different waveforms, different mass-source methods, or only selected sources using time-series MLR/HRR input. A source that should have been constant could unintentionally inherit a pulsating or file-driven behavior intended for another source. Git evidence: 94a3ace (2026-06-04, comprehensive heat-source fixes); fa39917 (2026-06-04, multiple heat sources and end-time support). The heat-source input path was converted from mostly global controls to per-source arrays, including multiple heat sources and independent endtime_hs handling. Activation reporting was also added so the runtime announces source timing more clearly. # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & 15 - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # fa39917 Multiple heat sources, addition of endtime_hs, display of activation # Full command: git show --find-renames --unified=3 fa39917 -- CODE-dev/HeatSource/variables_heat.F90 ,→ CODE-dev/HeatSource/input_heat.F90 CODE-dev/HeatSource/heatsource_heat.F90 index 9ed4909..3ea01d9 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -4,9 +4,9 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & ,lls) use gridlist_variables, only : prec,dx,dy - use heatsource_gridlist_variables, only : nsource_hs,radius_hs, & - xcen_hs,ycen_hs,xl_hs,xu_hs,yl_hs,yu_hs + use heatsource_gridlist_variables, only : nsource_hs,starttime_hs, & + endtime_hs,radius_hs,xcen_hs,ycen_hs,xl_hs,xu_hs,yl_hs,yu_hs + use gridsetup, only : np,mp,time @@ -28,6 +28,7 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs + if(time.lt.starttime_hs(itsource) .or. time.ge.endtime_hs(itsource)) cycle xlo = (ia-1)*dx xhi = ia*dx ylo = (ja-1)*dy @@ -45,6 +46,7 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs + if(time.lt.starttime_hs(itsource) .or. time.ge.endtime_hs(itsource)) cycle xlo = (ia-1)*dx 16 FIRETEC Bug Resolution Log May 2026 xhi = ia*dx ylo = (ja-1)*dy @@ -67,7 +69,7 @@ end subroutine updateHeatSourcePosition !----------------------------------------------------------------------- - use gridlist_variables, only : dx,dy,prec,starttime_hs + use gridlist_variables, only : dx,dy,prec ... [diff excerpt truncated; run the command above for the full commit diff] 17 BUG-2026-05-004: Heat sources did not have independent start and end times Files: variables_heat.F90, input_heat.F90, heatsource_heat.F90 The previous heating routine only checked a scalar starttime_hs in the gridlist module and had no end-time gate. The fuel-burning update routine did not check time at all, so rhof could be reduced inside a source footprint even before activation or after deactivation. Time activation was not stored in the HeatSource variables as per-source state, and updateHeatSource- Position did not import the simulation time or any heat-source timing arrays. Sources could remain active forever after their start time and fuel could be consumed outside the intended active interval. Multi-source activation schedules were not representable. Git evidence: 94a3ace (2026-06-04, comprehensive heat-source fixes); fa39917 (2026-06-04, multiple heat sources and end-time support). The heat-source input path was converted from mostly global controls to per-source arrays, including multiple heat sources and independent endtime_hs handling. Activation reporting was also added so the runtime announces source timing more clearly. # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & + xlo = (ia-1)*dx 18 + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # fa39917 Multiple heat sources, addition of endtime_hs, display of activation # Full command: git show --find-renames --unified=3 fa39917 -- CODE-dev/HeatSource/variables_heat.F90 ,→ CODE-dev/HeatSource/input_heat.F90 CODE-dev/HeatSource/heatsource_heat.F90 index 9ed4909..3ea01d9 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -4,9 +4,9 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & ,lls) use gridlist_variables, only : prec,dx,dy - use heatsource_gridlist_variables, only : nsource_hs,radius_hs, & - xcen_hs,ycen_hs,xl_hs,xu_hs,yl_hs,yu_hs + use heatsource_gridlist_variables, only : nsource_hs,starttime_hs, & + endtime_hs,radius_hs,xcen_hs,ycen_hs,xl_hs,xu_hs,yl_hs,yu_hs + use gridsetup, only : np,mp,time @@ -28,6 +28,7 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs + if(time.lt.starttime_hs(itsource) .or. time.ge.endtime_hs(itsource)) cycle xlo = (ia-1)*dx xhi = ia*dx ylo = (ja-1)*dy @@ -45,6 +46,7 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs + if(time.lt.starttime_hs(itsource) .or. time.ge.endtime_hs(itsource)) cycle xlo = (ia-1)*dx xhi = ia*dx ylo = (ja-1)*dy 19 FIRETEC Bug Resolution Log May 2026 @@ -67,7 +69,7 @@ end subroutine updateHeatSourcePosition !----------------------------------------------------------------------- - use gridlist_variables, only : dx,dy,prec,starttime_hs + use gridlist_variables, only : dx,dy,prec ... [diff excerpt truncated; run the command above for the full commit diff] 20 FIRETEC Bug Resolution Log May 2026 BUG-2026-05-005: XY coverage was based on point tests rather than actual cell/source overlap Files: heatsource_heat.F90 Circular and rectangular sources were selected using different point conventions: sometimes ia*dx, sometimes ia*dx + dx/2, and rectangular heating required the whole cell to fit inside the rectangle. Partial cells on source boundaries were either ignored or treated as fully covered. The old code tested a single point or full-cell bounds rather than the intersection of the source footprint with each grid cell. For circular sources, a cell near the circle edge could be incorrectly included or excluded depending on where its center or corner fell. Boundary cells could cause grid-resolution-dependent source area, heat release, and fuel burn. Rectan- gular sources could shrink when a rectangle edge cut through cells. Circular sources could be jagged and inconsistent between fuel burn and heating. Git evidence: 94a3ace (2026-06-04, comprehensive heat-source fixes); 2a0e05f (2026-06-04, small heat-source fix); fa39917 (2026-06-04, multiple heat sources and end-time support). The heat-source geometry routines were revised so source forcing is distributed over the covered cells and depth interval rather than relying only on point-in-box tests. The follow-up commit tightened smaller edge cases in that implementation. # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & 21 - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # 2a0e05f small heat source fix # Full command: git show --find-renames --unified=3 2a0e05f -- CODE-dev/HeatSource/heatsource_heat.F90 index 75a3049..9ed4909 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -72,7 +72,7 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) - use metric_variables, only : zedge + use metric_variables, only : zedge,zs use msga_variables, only : npos,mpos,mpi_rank,mpi_comm_world,ierror,mpi_sum #ifdef DBL_PREC @@ -94,7 +94,7 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) real(prec) :: source_function=0.0 real(prec) :: energy,fi,frho real(prec) :: volume,source_volume,hrr_now - real(prec) :: xlo,xhi,ylo,yhi,zlo,zhi,overlap_area + real(prec) :: xlo,xhi,ylo,yhi,zlo,zhi,zlo_agl,zhi_agl,overlap_area real(prec) :: overlap_height,overlap_volume,coverfrac real(prec) :: source_volume_local real(prec),external :: zcart,hs_rect_area,hs_circle_rect_area @@ -160,13 +160,16 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) ja=(mpos-1)*mp+j zlo = zcart(zedge(k),i,j) zhi = zcart(zedge(k+1),i,j) - overlap_height = max(0.0_prec,min(zhi,depth_hs(itsource))-zlo) + zlo_agl = zlo - zs(i,j) + zhi_agl = zhi - zs(i,j) + overlap_height = max(0.0_prec, & + min(zhi_agl,depth_hs(itsource))-zlo_agl) if(overlap_height.le.0.0_prec) cycle 22 FIRETEC Bug Resolution Log May 2026 if(iheatsource.eq.1) then - xlo = ia*dx - xhi = (ia+1)*dx - ylo = ja*dy - yhi = (ja+1)*dy + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 23 FIRETEC Bug Resolution Log May 2026 BUG-2026-05-006: Depth handling ignored terrain height and partial vertical-cell coverage Files: heatsource_heat.F90 The old depth check used zcart(zedge(k),i,j) < depth_hs(itsource). That compares absolute vertical coordinate to source depth and only tests the lower cell face. A cell crossing the source top was counted fully, and terrain elevation zs was not subtracted. The code treated depth as an absolute z limit instead of depth above local ground/surface. It also did not compute the fraction of a vertical cell inside the source depth. On terrain-following or non-flat grids, a source depth intended to mean meters above ground could be applied at the wrong elevation. Cells that only partly intersected the heat-source depth could receive a full forcing contribution. Git evidence: 94a3ace (2026-06-04, comprehensive heat-source fixes); 2a0e05f (2026-06-04, small heat-source fix); fa39917 (2026-06-04, multiple heat sources and end-time support). The heat-source geometry routines were revised so source forcing is distributed over the covered cells and depth interval rather than relying only on point-in-box tests. The follow-up commit tightened smaller edge cases in that implementation. # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & 24 + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # 2a0e05f small heat source fix # Full command: git show --find-renames --unified=3 2a0e05f -- CODE-dev/HeatSource/heatsource_heat.F90 index 75a3049..9ed4909 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -72,7 +72,7 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) - use metric_variables, only : zedge + use metric_variables, only : zedge,zs use msga_variables, only : npos,mpos,mpi_rank,mpi_comm_world,ierror,mpi_sum #ifdef DBL_PREC @@ -94,7 +94,7 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) real(prec) :: source_function=0.0 real(prec) :: energy,fi,frho real(prec) :: volume,source_volume,hrr_now - real(prec) :: xlo,xhi,ylo,yhi,zlo,zhi,overlap_area + real(prec) :: xlo,xhi,ylo,yhi,zlo,zhi,zlo_agl,zhi_agl,overlap_area real(prec) :: overlap_height,overlap_volume,coverfrac real(prec) :: source_volume_local real(prec),external :: zcart,hs_rect_area,hs_circle_rect_area @@ -160,13 +160,16 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) ja=(mpos-1)*mp+j zlo = zcart(zedge(k),i,j) zhi = zcart(zedge(k+1),i,j) - overlap_height = max(0.0_prec,min(zhi,depth_hs(itsource))-zlo) + zlo_agl = zlo - zs(i,j) + zhi_agl = zhi - zs(i,j) + overlap_height = max(0.0_prec, & + min(zhi_agl,depth_hs(itsource))-zlo_agl) if(overlap_height.le.0.0_prec) cycle if(iheatsource.eq.1) then 25 FIRETEC Bug Resolution Log May 2026 - xlo = ia*dx - xhi = (ia+1)*dx - ylo = ja*dy - yhi = (ja+1)*dy + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 26 FIRETEC Bug Resolution Log May 2026 BUG-2026-05-007: MLR/HRR input reading was fragile and not truly per-source Files: rinit_heat.F90, variables_heat.F90, heatsource_heat.F90 The previous rinitHeatSource used a single MLRHRRinputs flag, opened/read files for all sources when that scalar was enabled, and used restart logic based on repeated backspace calls. Runtime advancement read at most one record per call and did not preserve an EOF state. Restart scanning and normal advancement assumed the file pointer and time-step cadence would cooperate. If a restart time was before the first record, after the last record, or if a step skipped over multiple records, the old logic could select the wrong bracket or fail to clamp cleanly. Read errors were not consistently distinguished from EOF. File-driven sources could use stale HRR/MLR values, fail on restart, or continue trying to read after EOF. Sources not intended to use MLR/HRR input were also tied to a global file-input choice. Git evidence: 61944bc (2026-06-08, MLR/HRR input fix); 94a3ace (2026-06-04, comprehensive heat- source fixes); fa39917 (2026-06-04, multiple heat sources and end-time support); ba0bb93 (2026-07-23, heat-source HRR/MLR initial value fix). The MLR/HRR input and interpolation path was repaired for multiple sources. A later July follow-up also clamps times before the first tabulated value to the first MLR/HRR entry instead of extrapolating backward from it. # 61944bc fixed MLRHRRinputs # Full command: git show --find-renames --unified=3 61944bc -- CODE-dev/HeatSource/rinit_heat.F90 CODE ,→ -dev/HeatSource/variables_heat.F90 CODE-dev/HeatSource/heatsource_heat.F90 index 3ea01d9..ab9cffb 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -166,19 +166,37 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) - if(TME(itsource,2).lt.time) then + do while((.not.MLRHRR_eof_hs(itsource)).and. & + TME(itsource,2).lt.time) + TME(itsource,1) = TME(itsource,2) MLR(itsource,1) = MLR(itsource,2) HRR(itsource,1) = HRR(itsource,2) 27 + read(7825+itsource,*,iostat=iostat) & TME(itsource,2),MLR(itsource,2),HRR(itsource,2) - if(mpi_rank.eq.0) print*,’Updating MLR/HRR data’ + if(iostat.lt.0) then ! iostat<0 means end of file + TME(itsource,2) = TME(itsource,1) MLR(itsource,2) = MLR(itsource,1) HRR(itsource,2) = HRR(itsource,1) + + MLRHRR_eof_hs(itsource) = .true. + + elseif(iostat.gt.0) then + + if(mpi_rank.eq.0) print*, & + ’ERROR reading MLR/HRR data for heat source ’,itsource + stop + + else + + if(mpi_rank.eq.0) print*,’Updating MLR/HRR data’ + endif + + enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo 28 @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 29 BUG-2026-05-008: HRR and MLR file values were distributed incorrectly across source cells Files: heatsource_heat.F90 When MLR/HRR input was enabled, the old code computed energy as HRR/cell_volume inside every selected cell. That applies the total HRR independently to each selected cell rather than distributing the total HRR over the whole source volume. The mass-source option had the same pattern when fm_hs was added cell-by-cell. The old code had no source_volume calculation. In parallel, no global reduction was performed, so a correct total source volume was not available across MPI ranks. Total injected heat and mass could scale with the number of selected cells or the decomposition, rather than matching the intended MLR/HRR time-series value. Boundary cells were also not weighted by fractional coverage. Git evidence: 61944bc (2026-06-08, MLR/HRR input fix); 94a3ace (2026-06-04, comprehensive heat- source fixes); fa39917 (2026-06-04, multiple heat sources and end-time support); ba0bb93 (2026-07-23, heat-source HRR/MLR initial value fix). The MLR/HRR input and interpolation path was repaired for multiple sources. A later July follow-up also clamps times before the first tabulated value to the first MLR/HRR entry instead of extrapolating backward from it. # 61944bc fixed MLRHRRinputs # Full command: git show --find-renames --unified=3 61944bc -- CODE-dev/HeatSource/heatsource_heat.F90 index 3ea01d9..ab9cffb 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -166,19 +166,37 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) - if(TME(itsource,2).lt.time) then + do while((.not.MLRHRR_eof_hs(itsource)).and. & + TME(itsource,2).lt.time) + TME(itsource,1) = TME(itsource,2) MLR(itsource,1) = MLR(itsource,2) HRR(itsource,1) = HRR(itsource,2) + 30 read(7825+itsource,*,iostat=iostat) & TME(itsource,2),MLR(itsource,2),HRR(itsource,2) - if(mpi_rank.eq.0) print*,’Updating MLR/HRR data’ + if(iostat.lt.0) then ! iostat<0 means end of file + TME(itsource,2) = TME(itsource,1) MLR(itsource,2) = MLR(itsource,1) HRR(itsource,2) = HRR(itsource,1) + + MLRHRR_eof_hs(itsource) = .true. + + elseif(iostat.gt.0) then + + if(mpi_rank.eq.0) print*, & + ’ERROR reading MLR/HRR data for heat source ’,itsource + stop + + else + + if(mpi_rank.eq.0) print*,’Updating MLR/HRR data’ + endif + + enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & 31 FIRETEC Bug Resolution Log May 2026 do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 32 FIRETEC Bug Resolution Log May 2026 BUG-2026-05-009: Interpolation and zero-time tolerance checks could divide by zero or use the wrong denominator Files: heatsource_heat.F90 The old interpolation guard checked abs((TME(1)-TME(2))/TME(1)) < tolerance. If TME(1) was zero, this could divide by zero. The check also measured relative difference against the first timestamp rather than directly checking whether the two bracketing timestamps were effectively identical. Time-series files commonly begin at time zero. A zero first timestamp is valid input, so using it as a denominator is unsafe. At best, this produced fragile floating-point behavior; at worst, it could trigger a divide-by-zero or choose the wrong interpolation path. Git evidence: 61944bc (2026-06-08, MLR/HRR input fix); 94a3ace (2026-06-04, comprehensive heat- source fixes); fa39917 (2026-06-04, multiple heat sources and end-time support); ba0bb93 (2026-07-23, heat-source HRR/MLR initial value fix). The MLR/HRR input and interpolation path was repaired for multiple sources. A later July follow-up also clamps times before the first tabulated value to the first MLR/HRR entry instead of extrapolating backward from it. # 61944bc fixed MLRHRRinputs # Full command: git show --find-renames --unified=3 61944bc -- CODE-dev/HeatSource/heatsource_heat.F90 index 3ea01d9..ab9cffb 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -166,19 +166,37 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) - if(TME(itsource,2).lt.time) then + do while((.not.MLRHRR_eof_hs(itsource)).and. & + TME(itsource,2).lt.time) + TME(itsource,1) = TME(itsource,2) MLR(itsource,1) = MLR(itsource,2) HRR(itsource,1) = HRR(itsource,2) + read(7825+itsource,*,iostat=iostat) & TME(itsource,2),MLR(itsource,2),HRR(itsource,2) - if(mpi_rank.eq.0) print*,’Updating MLR/HRR data’ 33 + if(iostat.lt.0) then ! iostat<0 means end of file + TME(itsource,2) = TME(itsource,1) MLR(itsource,2) = MLR(itsource,1) HRR(itsource,2) = HRR(itsource,1) + + MLRHRR_eof_hs(itsource) = .true. + + elseif(iostat.gt.0) then + + if(mpi_rank.eq.0) print*, & + ’ERROR reading MLR/HRR data for heat source ’,itsource + stop + + else + + if(mpi_rank.eq.0) print*,’Updating MLR/HRR data’ + endif + + enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 94a3ace Comprehenisve heat source fixes # Full command: git show --find-renames --unified=3 94a3ace -- CODE-dev/HeatSource/heatsource_heat.F90 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -16,6 +16,8 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & + real(prec) :: xlo,xhi,ylo,yhi,overlap_area + real(prec),external :: hs_rect_area,hs_circle_rect_area ! Executable Code ! here we update value of rhof in the heat source @@ -26,8 +28,13 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs - if((sqrt(((ia*dx) - xcen_hs(itsource))**2 + & - ((ja*dy) - ycen_hs(itsource))**2).lt.radius_hs(itsource))) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_circle_rect_area(xlo,xhi,ylo,yhi, & + xcen_hs(itsource),ycen_hs(itsource),radius_hs(itsource)) + if(overlap_area.gt.0.0_prec) & rhof(:,i,j,1) = 0.01 ! burn fuel (drag is very small) enddo enddo @@ -38,9 +45,14 @@ subroutine updateHeatSourcePosition(iheatsource,rhof,nfuel,il,iu,jl,ju & do i=il,iu ia=(npos-1)*np+i do itsource=1,nsource_hs 34 FIRETEC Bug Resolution Log May 2026 - if((ia*dx).ge.xl_hs(itsource).and.(ia*dx).le.xu_hs(itsource) & - .and.(ja*dy).ge.yl_hs(itsource) & - .and.(ja*dy).le.yu_hs(itsource)) & + xlo = (ia-1)*dx + xhi = ia*dx + ylo = (ja-1)*dy + yhi = ja*dy + overlap_area = hs_rect_area(xlo,xhi,ylo,yhi, & + xl_hs(itsource),xu_hs(itsource), & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 35 BUG-2026-05-010: Input documentation did not describe multi-source constraints or new array inputs Files: input_heat.F90 The original input routine contained no embedded instructions for the new multi-source array semantics. After moving settings to arrays, users need to know that all sources in a run share the same geometry type selected by iheatsource, while individual parameter arrays are indexed by source. Without documentation near the parser, it would be easy to supply mixed circular/rectangular inputs or scalar legacy keys that no longer control individual sources. Misconfigured inputs could appear to run but apply the wrong shape, timing, source function, or MLR/HRR behavior to one or more sources. Git evidence: 7861033 (2026-06-04, heat-source instructions); fa39917 (2026-06-04, multiple heat sources and end-time support). The input documentation was updated with the new heat-source controls and the implementation now expects the expanded per-source timing and configuration arrays. # 7861033 added heat source instructions # Full command: git show --find-renames --unified=3 7861033 -- CODE-dev/HeatSource/input_heat.F90 index 656f978..1e463bc 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -103,7 +103,8 @@ end subroutine input_heatsource ! !Heat source 1 is active from 0 to 60 s with a constant function. !Heat source 2 is active from 30 to 90 s with a sinusoidal function. -!Both are circular because iheatsource = 1. +!starttime_hs defaults to 0 sec start time +!endtime_hs defaults to inf (never turns off) ! !Example with two rectangular heat sources: ! # fa39917 Multiple heat sources, addition of endtime_hs, display of activation # Full command: git show --find-renames --unified=3 fa39917 -- CODE-dev/HeatSource/input_heat.F90 index 2f05454..656f978 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 36 FIRETEC Bug Resolution Log May 2026 @@ -3,20 +3,41 @@ !----------------------------------------------------------------------- subroutine input_heatsource(iheatsource) + use gridlist_variables, only : prec ! Local Variables + real(prec),allocatable :: tmp(:) ! Executable Code - call QueryGridlist_integer(’isource_function’,isource_function,48) call QueryGridlist_integer(’nsource_hs’,nsource_hs,48) + + allocate(tmp(nsource_hs)) + + allocate(isource_function_hs(nsource_hs)) + allocate(starttime_hs(nsource_hs)) + allocate(endtime_hs(nsource_hs)) + allocate(imass_source_hs(nsource_hs)) + allocate(MLRHRRinputs_hs(nsource_hs)) + + ! Handle case with no endtime_hs or starttime_hs + endtime_hs = 1.0e20_prec ! or HUGE(1.0_prec) + starttime_hs = 0.0_prec + + call QueryGridlist_real_array(’isource_function_hs’,tmp,nsource_hs,48) + isource_function_hs = nint(tmp) + + call QueryGridlist_real_array(’starttime_hs’,starttime_hs,nsource_hs,48) + call QueryGridlist_real_array(’endtime_hs’,endtime_hs,nsource_hs,48) + allocate(freq_hs(nsource_hs),av_hs(nsource_hs),flux_hs(nsource_hs), & depth_hs(nsource_hs)) call QueryGridlist_real_array(’av_hs’,av_hs,nsource_hs,48) call QueryGridlist_real_array(’flux_hs’,flux_hs,nsource_hs,48) call QueryGridlist_real_array(’freq_hs’,freq_hs,nsource_hs,48) ... [diff excerpt truncated; run the command above for the full commit diff] 37 June 2026 Overview This note summarizes likely bugs and suspicious patterns found in the velocity transport path across the Fortran source files. The main recurring theme is that x-direction and y-direction velocity boundary behavior appears to be swapped in several routines. In particular, u/x-direction quantities are being treated as normal to top/bottom boundaries, while v/y-direction quantities are being treated as normal to left/right boundaries. This appears reversed for conventional Cartesian velocity components. 38 FIRETEC Bug Resolution Log June 2026 BUG-2026-06-001: Symmetric/mirror velocity boundary flags are reversed across multiple routines Known or likely affected files include: • advectionScheme.F90 – mpdata – setAdvectiveVelocities • MOA.F90 • force.F90 – large-step force advection • domainUpdates.F90 – explicit_domain_updates – implicit_domain_updates – xvrho halo updates • rinit.F90 – rinit – setVelocityProfile • update.F90 – misleading explanatory comment • likely related turbulent-domain variants as well Summary For symmetric or mirror boundary conditions, the code appears to reverse the normal-velocity parity flags for the horizontal velocity components. The update() routine uses the arguments topbot and leftright to decide whether a variable should be odd-reflected, meaning sign-reversed, at a boundary. The meaning appears to be: topbot = 1 -> odd reflection at bottom/top j-boundaries leftright = 1 -> odd reflection at left/right i-boundaries For conventional Cartesian velocity components: u / iuvel -> x-direction velocity or x-momentum v / ivvel -> y-direction velocity or y-momentum Therefore the expected mirror/symmetric parity is: u is normal to left/right boundaries -> leftright = 1 v is normal to bottom/top boundaries -> topbot = 1 However, many call sites use the opposite mapping: 39 if(kv.eq.1) then topbot = 1 leftright = 0 elseif(kv.eq.2) then topbot = 0 leftright = 1 else topbot = 0 leftright = 0 endif Given that xvpointers defines: iuvel = 1 ivvel = 2 iwvel = 3 this means: u is being odd-reflected at top/bottom instead of left/right. v is being odd-reflected at left/right instead of top/bottom. Why this is likely wrong The advection setup treats: u -> x-direction face velocity / x-face flux v -> y-direction face velocity / y-face flux For example, in setAdvectiveVelocities(), u is used to form u1 with dxi, while v is used to form u2 with dyi. That strongly indicates: u / u1 / f1 -> x-direction, normal to left/right boundaries v / u2 / f2 -> y-direction, normal to bottom/top boundaries The current parity logic is therefore reversed. This affects symmetric or mirror boundaries, especially cases where one or more of the following are set to mirror/symmetric behavior: ibc_top ibc_bot ibc_left ibc_right wrong wall-normal velocity behavior, spurious normal fluxes near physical boundaries, 40 incorrect tangential velocity reflection, boundary-generated numerical artifacts, incorrect behavior near symmetric/mirror boundaries, bad velocity ghost cells in xv or xvrho, downstream corruption in turbulence, drag, firebrand, and convection-related calculations. At left/right boundaries: u, the normal component, is incorrectly even-reflected. v, the tangential component, is incorrectly odd-reflected. At bottom/top boundaries: v, the normal component, is incorrectly even-reflected. u, the tangential component, is incorrectly odd-reflected. Because the transported variables may be momentum-like quantities, for example rho*u and rho*v, the same parity logic still applies: the normal momentum component should be odd-reflected, while tangential momentum and scalar fields should be even-reflected. Replace repeated hard-coded logic such as: if(kv.eq.1) then topbot = 1 leftright = 0 elseif(kv.eq.2) then topbot = 0 leftright = 1 else topbot = 0 leftright = 0 endif with pointer-based logic: topbot = 0 leftright = 0 if(kv.eq.iuvel) then leftright = 1 elseif(kv.eq.ivvel) then topbot = 1 endif Make sure each affected routine has access to the symbolic velocity indices, for example: use xvall, only : iuvel, ivvel or add iuvel and ivvel to the existing use xvall, only : ... list. A cleaner long-term fix would be to centralize this in a helper routine: 41 subroutine symmetric_bc_flags(kv,topbot,leftright) use xvall, only : iuvel, ivvel implicit none integer,intent(in) :: kv integer,intent(out) :: topbot, leftright topbot = 0 leftright = 0 if(kv.eq.iuvel) then leftright = 1 elseif(kv.eq.ivvel) then topbot = 1 endif end subroutine symmetric_bc_flags Then callers can use: call symmetric_bc_flags(kv,topbot,leftright) Additional hard-coded cases in setAdvectiveVelocities setAdvectiveVelocities() contains hard-coded update() calls that appear to use the same reversed convention. Current pattern: call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1,0) call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,0,1) Since u is the x-direction component, it should be odd at left/right boundaries, not top/bottom. Since v is the y-direction component, it should be odd at top/bottom boundaries, not left/right. These should likely be: call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,0,1) call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,1,0) Face-centered advective velocity updates also appear reversed. Current pattern: call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,0,1) Since u1 is the x-face advective velocity, it should be odd at left/right boundaries. Since u2 is the y-face advective velocity, it should be odd at top/bottom boundaries. These should likely be: call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,0,1) call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,1,0) 42 Other hard-coded update() calls for x-face and y-face flux-like arrays in mpdata() should also be audited. Keep the explicit audit list searchable, including: u, v u1, u2, u3 f1, f2, f3 v1mp, v2mp, v3mp The large-step force-advection path in force.F90 should also be searched explicitly for forceLE_xv, because it appears to use the same hard-coded kv.eq.1 / kv.eq.2 boundary-flag convention before donor-cell advection. The xvrho halo-update path should be treated as a first-class affected case, not just a downstream consequence. Bad xvrho ghost cells can propagate into turbulence, drag, firebrand, and convection- related calculations even if the main transported xv array is corrected elsewhere. General rule: x-direction face quantities -> topbot = 0, leftright = 1 y-direction face quantities -> topbot = 1, leftright = 0 This applies when the quantity being updated represents a normal velocity or flux component for mirror boundary-condition purposes. Comment fix in update.F90 The explanatory comment in update.F90 appears to have the velocity directions reversed. The comment says that u is normal to the top and bottom of the domain and that v has the opposite settings. Given the code indexing and velocity pointers, this should be corrected to say: u is normal to left/right boundaries. v is normal to bottom/top boundaries. update() itself appears internally consistent. The bug is primarily in callers that assign the flags backwards, plus the misleading comment. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 4343edc (2026-06-10, top/bottom mirror- boundary fix); 0792741 (2026-06-15, mirrored-boundary corner rewrite). The boundary flag plumbing was rewritten around loop_update_flags and the mirror-boundary top/bot- tom swap was fixed explicitly. A later corner rewrite removed the old ae argument and reduced duplicated edge-condition branches. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/advectionScheme.F90 CODE-dev/ ,→ MOA.F90 CODE-dev/force.F90 index 27ee300..34553c3 100644 +++ b/CODE-dev/MOA.F90 @@ -23,7 +23,7 @@ subroutine MOA 43 ! Local Variables - integer :: its,i,j,k,kv,topbot,leftright + integer :: its,i,j,k,kv,iuv real(prec),allocatable :: u(:,:,:,:),v(:,:,:,:),o(:,:,:,:) ! centered contravariant coordinates/gi ! Executable Code @@ -78,19 +78,9 @@ subroutine MOA ! computation of advective tendencies (donorcell scheme) do kv=1,nv - if(kv.eq.1) then - topbot = 1 - leftright = 0 - elseif(kv.eq.2) then - topbot = 0 - leftright = 1 - else - topbot = 0 - leftright = 0 - endif - + call loop_update_flags(kv,iuv) call update(xvtmp(1-ih,1-ih,1,kv),xvtmp(1-ih,1-ih,1,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,topbot,leftright) + 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(xvtmp(1-ih,1-ih,1,kv),1-ih,np+ih,1-ih,mp+ih,l) enddo +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif ... [diff excerpt truncated; run the command above for the full commit diff] # 4343edc Fix for bug 2 from Colby list on June 9, top and bot were swapped in mirror boundary ,→ definitions. # Full command: git show --find-renames --unified=3 4343edc -- CODE-dev/Radiation/monteCarlo_rad.F90 ,→ CODE-dev/Vegetation/solarHeat_veg.F90 index cfae5f6..8333fb1 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -757,8 +757,8 @@ subroutine shoot_photons ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.xf.le.tolerance) dir(1) = -dir(1) if(ibc_right.eq.5.and.xf.ge.(n*dx-tolerance)) dir(1) = -dir(1) - if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) - if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) + if(ibc_bot.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) + if(ibc_top.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) enddo if(i1.ge.1.and.i1.le.n.and.j1.ge.1.and.j1.le.m.and. & k1.ge.1.and.k1.le.lmc) & index 52fb3c1..2b4744f 100644 44 +++ b/CODE-dev/Vegetation/solarHeat_veg.F90 @@ -203,8 +203,8 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.xf.le.tolerance) dir(1) = -dir(1) if(ibc_right.eq.5.and.xf.ge.(n*dx-tolerance)) dir(1) = -dir(1) - if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) - if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) + if(ibc_bot.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) + if(ibc_top.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) enddo endif enddo # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/advectionScheme.F90 CODE-dev/ ,→ MOA.F90 CODE-dev/force.F90 index 34553c3..9b97a6c 100644 +++ b/CODE-dev/MOA.F90 @@ -79,8 +79,7 @@ subroutine MOA ! computation of advective tendencies (donorcell scheme) do kv=1,nv - call update(xvtmp(1-ih,1-ih,1,kv),xvtmp(1-ih,1-ih,1,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) + call update(xvtmp(:,:,:,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(xvtmp(1-ih,1-ih,1,kv),1-ih,np+ih,1-ih,mp+ih,l) enddo index 7e81131..382217e 100644 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) + call update(u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo ... [diff excerpt truncated; run the command above for the full commit diff] 45 FIRETEC Bug Resolution Log June 2026 BUG-2026-06-002: MPDATA assumes density is the last transported variable instead of using irho File • advectionScheme.F90 Summary The MPDATA limiter and density correction logic appear to assume that the density variable is always the final transported variable, nvp. For example: a(i,j,k,kv) = x(i,j,k,kv) / x(i,j,k,nvp) The code also treats: f1(...,nvp) f2(...,nvp) f3(...,nvp) as density fluxes. However, elsewhere the code uses an explicit density pointer: irho This means MPDATA silently assumes: irho == nvp or, at the call site: irho == nv Additional related issue The density correction coefficients are initialized only when kv.eq.1: if (kv.eq.1) cpmp(i,j,k,nvp)=tmpp if (kv.eq.1) cnmp(i,j,k,nvp)=tmpn Then density limiter coefficients are minimized over all: kv = 1,nvp-1 This assumes: density is variable nvp, all variables before density should constrain the density anti-diffusive correction. 46 That may be intentional for a particular MPDATA/FCT formulation, but it is fragile and tightly coupled to variable ordering. If density is not the final transported variable, the limiter may compute ratios using the wrong denominator. This can corrupt: velocity transport, scalar transport, density correction, limiter behavior, boundedness. Pass irho explicitly into mpdata(): subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp,irho) Then replace density references to nvp with irho where appropriate. For example: a(i,j,k,kv) = x(i,j,k,kv) / x(i,j,k,irho) Replace loops such as: do kv = 1,nvp-1 with logic that loops over all transported variables except irho. At minimum, add a defensive check: if (irho .ne. nvp) stop ’mpdata␣assumes␣irho␣==␣nvp’ Also add comments explaining whether density anti-diffusive correction should be constrained by velocity and scalar extrema. Git evidence: 0325b25 (2026-07-14, MPDATA cleanup); ee83e79 (2026-06-09, zeta bug-list pass). MPDATA was cleaned up and its update calls were moved to the newer boundary-flag interface. I did not find a literal refactor replacing every last-variable density use with irho; the current limiter still relies on the transported density slot convention in several expressions. # 0325b25 Clean up of mpdata. # Full command: git show --find-renames --unified=3 0325b25 -- CODE-dev/advectionScheme.F90 47 +++ b/CODE-dev/advectionScheme.F90 @@ -1,9 +1,7 @@ !**********************************************************************! ! this routine computes the advection on the large time steps and ! the nv variables. It can use either donorcell or fct -! !**********************************************************************! - @@ -13,7 +11,7 @@ module advection_functions - pp = max(0.0_wp,y) + pp = max(0._wp,y) !************************************* @@ -22,7 +20,7 @@ module advection_functions - pn = -min(0.0_wp,y) + pn = -min(0._wp,y) !************************************* @@ -56,7 +54,7 @@ module advection_functions - rat2 = (z2-z1)*0.5_wp + rat2 = 0.5_wp*(z2-z1) !************************************* @@ -117,10 +115,6 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta) ... [diff excerpt truncated; run the command above for the full commit diff] # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/advectionScheme.F90 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1,0) + call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif 48 - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,0,1) + call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,0,1) + call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) + call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) endif @@ -210,13 +210,10 @@ subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp) - !real(prec),external :: donor,vcorr,vdiv1,vdiv2,vdyf,pn,pp - + integer :: n3,kv,i,j,k,ip,im,jp,jm,kp,km,itrfct,iuv ... [diff excerpt truncated; run the command above for the full commit diff] 49 BUG-2026-06-003: tinit side relaxation/damper boundary setup uses inconsistent boundary indexing File • tinit.F90 Summary The side relaxation/damper setup in tinit appears to have two related indexing problems: 1. Boundary coordinate checks appear swapped between x and y directions. 2. relb is populated by boundary number but later accessed by boundary-condition type. Together, these can apply damping or relaxation to the wrong physical side of the domain or with the wrong profile. 3.1 Boundary coordinate checks appear swapped The code labels boundaries as top, bottom, left, and right, but appears to check the opposite coordinate direction. Assuming: i = x index j = y index n = global x extent m = global y extent ia = global x index ja = global y index the expected mapping is: top boundary -> ymax -> ja.gt.m-nr bottom boundary -> ymin -> ja.le.nr left boundary -> xmin -> ia.le.nr right boundary -> xmax -> ia.gt.n-nr The current mapping appears to be: bcs(1), top -> checks xmax bcs(2), bottom -> checks xmin bcs(3), left -> checks ymin bcs(4), right -> checks ymax This can apply relaxation or damping on the wrong physical sides of the domain. spurious relaxation near xmin when bottom damping was intended, 50 spurious relaxation near ymin when left damping was intended, a weird line at xmin, another artifact near ymin, missing or weakened relaxation near intended top/bottom/left/right sides, artificial source-like behavior in the first few cells of the wrong coordinate direction, long boundary-aligned artifacts unrelated to the intended physical boundary condition. Suggested correction The logic should be closer to: ia = (npos-1)*np + i ja = (mpos-1)*mp + j ! top boundary: ymax if(bcs(1).ge.1.and.bcs(1).lt.5) then if(ja.gt.m-nr) then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it), relb(1,m-ja+1)) enddo endif endif ! bottom boundary: ymin if(bcs(2).ge.1.and.bcs(2).lt.5) then if(ja.le.nr) then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it), relb(2,ja)) enddo endif endif ! left boundary: xmin if(bcs(3).ge.1.and.bcs(3).lt.5) then if(ia.le.nr) then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it), relb(3,ia)) enddo endif endif ! right boundary: xmax if(bcs(4).ge.1.and.bcs(4).lt.5) then if(ia.gt.n-nr) then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it), relb(4,n-ia+1)) enddo endif endif 3.2 relb appears indexed by boundary-condition type instead of boundary number relb is allocated with the first index representing the boundary number: allocate(relb(4,nr+1)) 51 It is populated using j, where j = 1..4 corresponds to the physical boundary: do j=1,4 if(bcs(j).ge.1.and.bcs(j).lt.5) then select case(bcs(j)) case(4) relb(j,i)=... case(3) relb(j,i)=... case(2) relb(j,i)=... case(1) relb(j,i)=... endif enddo So: relb(1,:) -> profile for boundary 1 relb(2,:) -> profile for boundary 2 relb(3,:) -> profile for boundary 3 relb(4,:) -> profile for boundary 4 However, later the code appears to access relb using the boundary-condition type as the first index: relb(bcs(1), ...) relb(bcs(2), ...) relb(bcs(3), ...) relb(bcs(4), ...) If bcs(1)=3, this reads from relb(3,:) instead of relb(1,:). This can apply the wrong relaxation strength or profile to a boundary. In some configurations, it may read from a row that was not populated for that boundary, producing missing, zero, or incorrect relaxation. Index relb by boundary number, not by boundary-condition type. Replace accesses like: relb(bcs(1), ...) relb(bcs(2), ...) relb(bcs(3), ...) relb(bcs(4), ...) with: relb(1, ...) relb(2, ...) relb(3, ...) relb(4, ...) 52 Enable only one boundary relaxation/damper at a time and confirm that nonzero relaxxv appears only near the corresponding physical side. Example checks: enable only bcs(1) / top expected nonzero relaxxv only near ymax enable only bcs(2) / bottom expected nonzero relaxxv only near ymin enable only bcs(3) / left expected nonzero relaxxv only near xmin enable only bcs(4) / right expected nonzero relaxxv only near xmax This should be checked in global coordinates using: ia = (npos-1)*np + i ja = (mpos-1)*mp + j so the test also covers decomposed-domain behavior. 3.3 relaxxv may be used before being explicitly initialized relaxxv is imported from xvall and then assigned selectively in the vertical absorber and side-damper logic. However, the routine does not explicitly zero relaxxv before using it in expressions such as: relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(...)) This is unsafe unless relaxxv is guaranteed to have been initialized elsewhere before every call to tinit. The max() pattern is especially risky because an uninitialized or stale value can survive and become the final relaxation coefficient. Why this matters The relaxation coefficient is later applied directly as a tendency in boundary.F90: force(i,j,k,kv)=force(i,j,k,kv)+relaxxv(i,j,k,min(kv,4))* & (xe(i,j,k,kv)-xv(i,j,k,kv))/dt Therefore any garbage, stale, or unintended nonzero value in relaxxv becomes a direct forcing term. This is a strong candidate for spurious velocities at or near relaxation boundaries. Explicitly initialize the full relaxation array at the start of tinit, before any vertical or side-damper assignments: relaxxv = 0.0_prec 53 If relaxxv is allocatable and may not be allocated yet, place the initialization immediately after its allocation point instead, or add a defensive allocation/initialization check in the owning module. Before applying the relaxation force, print or assert the min/max of relaxxv for each component and verify that nonzero values appear only in intended damping/relaxation regions. Example diagnostic: write(*,*) ’relaxxv␣min/max␣comp␣1:’, minval(relaxxv(:,:,:,1)), maxval(relaxxv(:,:,:,1)) write(*,*) ’relaxxv␣min/max␣comp␣2:’, minval(relaxxv(:,:,:,2)), maxval(relaxxv(:,:,:,2)) write(*,*) ’relaxxv␣min/max␣comp␣3:’, minval(relaxxv(:,:,:,3)), maxval(relaxxv(:,:,:,3)) write(*,*) ’relaxxv␣min/max␣comp␣4:’, minval(relaxxv(:,:,:,4)), maxval(relaxxv(:,:,:,4)) 3.4 The first two side-relaxation cells are forced to coefficient 1.0 After constructing the side relaxation profiles, tinit overrides the first two cells for every boundary profile: relb(:,1:2)=1. ! Mass conservation and Neumann boundary conditions This creates a hard two-cell relaxation layer, independent of the smoother profile selected by the boundary-condition type. Because boundary.F90 applies relaxation as: force = force + relaxxv * (xe - xv) / dt using relaxxv = 1 means the affected variable is driven toward the environmental state over one timestep, assuming the time integrator later multiplies the tendency by dt. That is effectively a hard local reset, not a gradual sponge layer. Such a discontinuity in relaxation strength can generate sharp momentum, pressure, density, or scalar gradients adjacent to the relaxation region. This can plausibly create spurious velocities near the relaxation BCs even if the side and profile indexing bugs are fixed. Suggested fix or test Do not hard-set the first two cells to 1.0 unless that behavior is required by the numerical method and has been verified not to create artifacts. A minimal diagnostic test is to comment out the override: ! relb(:,1:2)=1. or replace it with a capped value: 54 relb(:,1:2) = min(relb(:,1:2), 0.1_prec) A cleaner approach is to incorporate any special near-boundary behavior into the selected relaxation profile so that the coefficient varies smoothly. Run a case with only one side relaxation boundary enabled and compare velocity magnitude near the first several relaxation cells with: relb(:,1:2)=1. enabled versus disabled or capped. If the artifact collapses when the hard reset is removed, this is a direct contributor. 3.5 Top theta-relaxation profile likely uses the wrong vertical offset The iab.eq.4 theta relaxation branch uses zabt in the activation condition and denominator, but uses zab in the numerator: if(iab.eq.4.and.zl.ge.zabt) & relaxxv(i,j,k,4)=0.66*0.25*(1.-cos(pi*(zl-zab)/(zb-zabt)))/tow This appears inconsistent. If theta relaxation starts at zabt, the profile argument should likely also start from zabt. If zab and zabt differ, the theta-relaxation profile may be discontinuous at the activation height or may start with an unintended nonzero value. It could also become negative or otherwise mis-scaled depending on the relative values of zab, zabt, and zb. This is less directly tied to side relaxation BC artifacts than the relaxxv initialization and relb issues, but it can still produce unintended vertical forcing in potential temperature near the top absorber. Use a consistent offset for the theta absorber: if(iab.eq.4.and.zl.ge.zabt) & relaxxv(i,j,k,4)=0.66*0.25*(1.-cos(pi*(zl-zabt)/(zb-zabt)))/tow Also guard against zb == zabt. 55 3.6 Side relaxation and top absorber share relaxxv, so lateral boundary mistakes can appear inside the top relaxation domain File • tinit.F90 • Related application path: – boundary.F90 – small_implicit_forcings in force.F90 Summary The vertical/top absorber and the lateral side relaxation/damper appear to write into the same relaxation coefficient array: relaxxv(i,j,k,it) The side-damper logic appears to merge its coefficients with whatever is already present in relaxxv using a pattern like: relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(...)) This means relaxxv is not purely a top-absorber mask or purely a side-relaxation mask. It is a combined relaxation mask used later as a direct forcing coefficient. That is fine if both masks are built correctly. However, if the lateral side-relaxation indexing is wrong, or if relb is indexed incorrectly, then side-boundary damping can be merged into regions that visually appear to belong to the top relaxation domain. This is a plausible explanation for artifacts where y-boundary behavior appears reflected, projected, or painted into the upper/top relaxation layer. boundary.F90 applies relaxxv directly as a tendency: force(i,j,k,kv)=force(i,j,k,kv)+relaxxv(i,j,k,min(kv,4))* & (xe(i,j,k,kv)-xv(i,j,k,kv))/dt Therefore, any unintended nonzero value in relaxxv becomes an actual relaxation force. Since the side-damper construction uses max() rather than assignment, a bad lateral mask can survive and combine with the vertical absorber instead of being overwritten. This makes the final relaxation field harder to interpret: an artifact visible in the top absorber may actually originate from the side-relaxation setup. This issue is closely related to the earlier tinit concerns: 3.1 boundary coordinate checks appear swapped 3.2 relb appears indexed by boundary-condition type instead of boundary number 3.3 relaxxv may be used before being explicitly initialized 3.4 hard two-cell relb(:,1:2)=1.0 side-relaxation region 3.5 top theta-relaxation vertical-profile issue 56 The key additional point here is that these effects may be visually or diagnostically misattributed to the top absorber because side relaxation and top relaxation are stored in the same array. y-boundary relaxation pattern appearing in the top relaxation domain, top absorber showing horizontal structure that should only belong to side boundaries, apparent reflection of bottom/top lateral boundary behavior into the upper domain, relaxation forcing applied in unintended regions, spurious velocity, theta, density, or scalar forcing near the upper sponge layer, confusing diagnostics where the artifact appears vertical/top-related but is caused by lateral mask ,→ construction, sensitivity to which side boundary condition is enabled, sensitivity to bcs(1:4) values and to nr. This is especially suspicious if: the top absorber should be horizontally uniform, but relaxxv varies in x or y inside the top absorber, or enabling/disabling a y-side boundary changes the relaxation pattern near the top. Suggested diagnostic Output or inspect relaxxv immediately after tinit, before time stepping begins and before boundary.F90 applies it. At minimum, print component min/max values: write(*,*) ’relaxxv␣min/max␣comp␣1:’, & minval(relaxxv(:,:,:,1)), maxval(relaxxv(:,:,:,1)) write(*,*) ’relaxxv␣min/max␣comp␣2:’, & minval(relaxxv(:,:,:,2)), maxval(relaxxv(:,:,:,2)) write(*,*) ’relaxxv␣min/max␣comp␣3:’, & minval(relaxxv(:,:,:,3)), maxval(relaxxv(:,:,:,3)) write(*,*) ’relaxxv␣min/max␣comp␣4:’, & minval(relaxxv(:,:,:,4)), maxval(relaxxv(:,:,:,4)) More useful diagnostics are horizontal slices of relaxxv: near the bottom of the top absorber, inside the middle of the top absorber, near the top of the top absorber, near each lateral side boundary, and outside all intended relaxation regions. Recommended test matrix: 1. top absorber only, all side relaxation disabled 2. top/ymax side relaxation only 3. bottom/ymin side relaxation only 4. left/xmin side relaxation only 5. right/xmax side relaxation only 6. top absorber plus one side relaxation at a time 57 Expected behavior: top absorber: relaxxv should vary primarily with vertical position and should not inherit side-boundary-shaped ,→ horizontal patterns unless intentionally designed. top/ymax side relaxation: nonzero lateral relaxxv should occur only near ja > m - nr. bottom/ymin side relaxation: nonzero lateral relaxxv should occur only near ja <= nr. left/xmin side relaxation: nonzero lateral relaxxv should occur only near ia <= nr. right/xmax side relaxation: nonzero lateral relaxxv should occur only near ia > n - nr. Use global indices when checking decomposed-domain behavior: ia = (npos-1)*np + i ja = (mpos-1)*mp + j Suspicious behavior: enabling a y-side boundary changes relaxxv in an x-side region, enabling a y-side boundary creates structure inside the top absorber, top absorber relaxxv has a lateral side-damper footprint, relaxxv remains nonzero outside intended vertical or lateral relaxation zones, relaxxv changes depending on bcs values in a way that follows boundary-condition type rather than ,→ physical boundary number. Suggested fix or hardening The best fix is to make the vertical/top relaxation and lateral side relaxation construction explicit and separately diagnosable. A minimal hardening approach is: relaxxv = 0.0_prec before any top or side relaxation coefficients are assigned. Then, if possible, build separate temporary arrays: relax_top(:,:,:,:) relax_side(:,:,:,:) or at least separate diagnostic fields, and combine only after both masks are known to be correct: relaxxv = max(relax_top, relax_side) This would make it much easier to determine whether an artifact originates in the vertical absorber or the lateral side damper. 58 If separate arrays are too invasive, add temporary diagnostics around the two construction phases: ! after vertical/top absorber construction write(*,*) ’after␣top␣absorber␣relaxxv␣min/max:’, minval(relaxxv), maxval(relaxxv) ! after side relaxation construction write(*,*) ’after␣side␣relaxation␣relaxxv␣min/max:’, minval(relaxxv), maxval(relaxxv) Also fix or verify the side-relaxation indexing issues from Sections 3.1 and 3.2 before interpreting the merged relaxxv field. The side-relaxation mapping should be checked against: top boundary -> ymax -> ja > m - nr bottom boundary -> ymin -> ja <= nr left boundary -> xmin -> ia <= nr right boundary -> xmax -> ia > n - nr and relb should be indexed by physical boundary number: relb(1,...) relb(2,...) relb(3,...) relb(4,...) not by boundary-condition type: relb(bcs(1),...) relb(bcs(2),...) relb(bcs(3),...) relb(bcs(4),...) After implementing the above diagnostics or fixes, verify that: 1. With side relaxation disabled, the top absorber is horizontally smooth/uniform as expected. 2. With top absorber disabled, each side relaxation appears only on its intended physical side. 3. With both enabled, the merged relaxxv field equals the expected max/top-plus-side combination. 4. No y-boundary-shaped structure appears in the top absorber unless it is physically intended. 5. The relaxation forcing in boundary.F90 is nonzero only where the final relaxxv mask is ,→ intentionally nonzero. If the observed top-domain artifact disappears when side relaxation is disabled, or if it follows a single enabled side boundary, then the root cause is likely in the side-relaxation mask construction rather than in the vertical top absorber itself. This issue may not be a separate root bug from Sections 3.1 through 3.3, but it explains how those bugs can present as a top-relaxation-domain artifact. It should be treated as the main diagnostic link between the observed y-boundary reflection and the tinit side-relaxation indexing problems. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 4233690 (2026-06-15, tinit indexing fix). 59 The side-relaxation indexing in CODE-dev/tinit.F90 was corrected to use the appropriate global/local edge indexing, and the follow-up commit fixed a remaining processor-boundary indexing issue. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/tinit.F90 CODE-dev/force.F90 index 7199652..99b944f 100644 +++ b/CODE-dev/force.F90 @@ -14,7 +14,7 @@ subroutine forcing ! Local Variables - integer :: kv,topbot,leftright + integer :: kv,iuv ! Executable Code call setAdvectiveVelocities(uavg,vavg,oavg,1-ih,np+ih,1-ih,mp+ih,l, & @@ -23,25 +23,15 @@ subroutine forcing do kv=1,nv !!!!! Transported Forcings !!!!!! - if(kv.eq.1) then - topbot = 1 - leftright = 0 - elseif(kv.eq.2) then - topbot = 0 - leftright = 1 - else - topbot = 0 - leftright = 0 - endif - + call loop_update_flags(kv,iuv) call update(forceLE_xv(:,:,:,kv),forceLE_xv(:,:,:,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,topbot,leftright) + 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(forceLE_xv(:,:,:,kv),1-ih,np+ih,1-ih,mp+ih,l) xv(1:np,1:mp,:,kv)=xv(1:np,1:mp,:,kv)+forceLE_xv(1:np,1:mp,:,kv)*dt call forcingLimits(xv(:,:,:,kv),xvLim(:,kv), & 1-ih,np+ih,1-ih,mp+ih,l,1) call update(xv(:,:,:,kv),xv(:,:,:,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,topbot,leftright) + 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) enddo !!!!! Fuel Forcings !!!!! ... [diff excerpt truncated; run the command above for the full commit diff] # 4233690 Fixed indexing issue in tinit that solves wind and processor problems. # Full command: git show --find-renames --unified=3 4233690 -- CODE-dev/tinit.F90 index 490f511..86d8fb0 100644 +++ b/CODE-dev/tinit.F90 @@ -74,7 +74,7 @@ subroutine tinit ! Side dampers 60 FIRETEC Bug Resolution Log June 2026 if(bcs(1).ge.1.and.bcs(1).lt.5)then !top boundary - ja=(mpos-1)*mp+i + ja=(mpos-1)*mp+j if(ja.gt.m-nr)then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(1,m-ja+1)) @@ -83,7 +83,7 @@ subroutine tinit endif if(bcs(2).ge.1.and.bcs(2).lt.5)then !bottom boundary - ja=(mpos-1)*mp+i + ja=(mpos-1)*mp+j if(ja.le.nr)then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(2,ja)) @@ -92,7 +92,7 @@ subroutine tinit endif if(bcs(3).ge.1.and.bcs(3).lt.5) then !left boundary - ia=(npos-1)*np+j + ia=(npos-1)*np+i if(ia.le.nr)then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(3,ia)) @@ -101,7 +101,7 @@ subroutine tinit endif if(bcs(4).ge.1.and.bcs(4).lt.5) then !right boundary - ia=(npos-1)*np+j + ia=(npos-1)*np+i if(ia.gt.n-nr)then do it=1,4 relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(4,n-ia+1)) 61 BUG-2026-06-004: ibcx / ibcy boundary-condition remapping appears swapped File • Input/grid boundary-condition handling code Summary The boundary-condition remapping appears to assign ibcx to top/bottom boundaries and ibcy to left/right boundaries: if(ibc_top.eq.7825) ibc_top = ibcx if(ibc_bot.eq.7825) ibc_bot = ibcx if(ibc_left.eq.7825) ibc_left = ibcy if(ibc_right.eq.7825) ibc_right = ibcy If ibcx is intended to control x-direction boundaries, it should apply to left/right boundaries. Likewise, ibcy should apply to bottom/top boundaries. The current mapping could cause the x-domain or y-domain to appear cyclic or non-cyclic incorrectly, depending on the gridlist values being used. This may be connected to observed weird cycling of the x-domain when non-periodic boundary conditions are set. Swap the mapping so that ibcx controls left/right boundaries and ibcy controls bottom/top boundaries: if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_top.eq.7825) ibc_top = ibcy Git evidence: ee83e79 (2026-06-09, zeta bug-list pass). The input remapping was corrected so default left/right settings map to the x-boundary array and top/bottom settings map to the y-boundary array. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/update.F90 index d401979..0fbeaff 100644 +++ b/CODE-dev/update.F90 @@ -29,19 +29,15 @@ 62 ! (topedge, ...), an additionnal treatment is done using the env ! field : the ghost cells are forced with xe values in ! [1,nxp][1,nyp][1,nzp] -! -! "topbot" and "leftright" inputs in the subroutine dictate +! +! "iuv" inputs in the subroutine dictate ! Dirichlet(1) or Neumann(0) for the top and sides if the boundary ! conditions are symmetric (ibc_* = 5). For symmetric or mirror ! purposes, all variables will be Neumann except for the velocities -! normal to the particular boundary. For instance, u is normal to the -! top and bottom of the domain, so if ibc_top or ibc_bottom = 5, we -! will have topbot = 1 and leftright = 0. -! v will have the opposite settings. +! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & - topbot,leftright) +subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & @@ -56,8 +52,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & ! Local Variables - integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod - integer,intent(in) :: topbot,leftright + integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) @@ -65,8 +60,9 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & integer :: icnt,itag,iref,jref,ncount ... [diff excerpt truncated; run the command above for the full commit diff] 63 BUG-2026-06-005: Non-periodic x-boundaries still communicate with periodic x-neighbors • msga.F90 • update.F90 – update • advectionScheme.F90 – setAdvectiveVelocities – related MPDATA face-flux updates • related halo-update call sites that rely on peleft and peright • related x-face or x-flux arrays: – u1 – f1 – v1mp – other arrays with local x extent np+1 Summary The MPI setup identifies physical left/right domain edges using leftedge and rightedge, but the x-direction neighbor ranks still appear to be assigned with wraparound behavior. The relevant logic is equivalent to: peleft = mpi_rank - 1 if (peleft < ((mpos-1)*nprocx)) peleft = mpi_rank + (nprocx-1) peright = mpi_rank + 1 if (peright > (mpos*nprocx-1)) peright = mpi_rank - (nprocx-1) This means that a rank on the global left x-edge still treats the global right x-edge rank as its left neighbor, and a rank on the global right x-edge still treats the global left x-edge rank as its right neighbor. Later, update.F90 performs x-direction halo exchanges whenever icorner.ne.3: call MPI_Sendrecv(... peleft ... peright ...) call MPI_Sendrecv(... peright ... peleft ...) Only after the MPI exchange does update() overwrite physical ghost cells for non-periodic boundaries. A focused subcase is the iperiod=1 path for x-face arrays with local extent np+1; at a non-periodic xmax, a(np+1) is a physical boundary face, not a periodic duplicate of the neighbor's a(1), so u1 and related x-face flux arrays should be explicitly checked. For a non-periodic x-domain, ranks on physical left/right edges should not exchange halo data across the global x-boundary. Physical ghost cells at those edges should be filled only by non-periodic boundary-condition logic. 64 The current behavior makes the MPI topology periodic even when the boundary condition is non- periodic. The later ghost-cell overwrite may hide the issue for ordinary cell-centered arrays, but the communication itself is still inconsistent with the requested boundary condition. It also assumes every array passed through update() has a complete and correct physical-boundary repair step after the exchange. That assumption is fragile for face-flux arrays, corner-update paths, and future update paths. This can produce apparent x-domain cycling in non-periodic runs. apparent wraparound or cycling of x-domain data despite non-periodic boundary settings, stale or invalid edge data entering halo buffers, boundary artifacts near global left/right edges, inconsistent behavior between fields that are corrected after update() and fields that are not, fragile behavior for face-flux arrays or corner-update paths, spurious xmax artifacts, apparent wraparound of x-face velocities or x-fluxes, bad antidiffusive velocities near the right physical boundary, incorrect x-face fluxes in MPDATA near xmax, boundary-aligned numerical noise near i=np or i=np+1, sensitivity to processor decomposition in x. The most suspicious arrays to inspect are: u1 f1 v1mp and any other x-face or x-flux arrays with effective x extent np+1. Do not wrap x-neighbor ranks across physical non-periodic boundaries. A minimal fix is to set physical-edge x-neighbors to MPI_PROC_NULL after computing leftedge, rightedge, peleft, and peright: if (leftedge.eq.1) then peleft = MPI_PROC_NULL endif if (rightedge.eq.1) then peright = MPI_PROC_NULL endif If diagonal or corner neighbor ranks are also wrapped periodically, they should be handled consistently. Any neighbor relationship that crosses a physical non-periodic x-boundary should either be set to MPI_PROC_NULL or skipped in the corresponding communication path. 65 More robust fix Make update() locally safe by guarding the x-direction exchange against physical non-periodic edges, even if the global neighbor setup changes elsewhere. For example: xleft_neighbor = peleft xright_neighbor = peright if (leftedge.eq.1) then xleft_neighbor = MPI_PROC_NULL endif if (rightedge.eq.1) then xright_neighbor = MPI_PROC_NULL endif Then use xleft_neighbor and xright_neighbor in the x-direction MPI_Sendrecv calls instead of using peleft and peright directly. For face-centered arrays, also add defensive checks or comments clarifying that: a(np+1,j,k) is a physical xmax face on rightedge ranks when x is non-periodic. a(np+2:np+ih+1,j,k) are right ghost faces and must be filled from physical boundary logic, not ,→ periodic wraparound. A safer long-term design would be to make update() aware of whether the domain direction is actually periodic, instead of relying only on iperiod, which currently describes array indexing periodicity rather than physical boundary periodicity. Additional hardening Some face-flux arrays appear to be passed through update() before their physical boundary flux values are filled. For example, in advectionScheme.F90, the left-edge flux construction can skip f1(1,j,k,kv) on a left-edge rank, call update(f1,...), and only afterward fill the physical boundary value. That ordering is fragile. A safer pattern is: ! Fill physical boundary fluxes before halo update if (leftedge.eq.1) then f1(1,j,k,kv) = donor(...) endif call update(f1(...), ...) This is secondary to fixing the periodic MPI neighbor mapping, but it reduces the chance that stale or invalid physical-boundary data enters halo communication. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 0792741 (2026-06-15, mirrored-boundary corner rewrite); 869ead7 (2026-06-25, boundary-error pass). 66 The halo-update path was reworked so physical side boundaries and periodic/cyclic exchanges are selected through explicit per-direction flags rather than always communicating with periodic neighbors. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/update.F90 CODE-dev/ ,→ advectionScheme.F90 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1,0) + call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,0,1) + call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,0,1) + call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) + call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) endif @@ -210,13 +210,10 @@ subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp) - !real(prec),external :: donor,vcorr,vdiv1,vdiv2,vdyf,pn,pp - + integer :: n3,kv,i,j,k,ip,im,jp,jm,kp,km,itrfct,iuv ... [diff excerpt truncated; run the command above for the full commit diff] # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/update.F90 CODE-dev/ ,→ advectionScheme.F90 index 7e81131..382217e 100644 +++ b/CODE-dev/advectionScheme.F90 67 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) + call update(u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) + call update(v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) + call update(u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) + call update(u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) endif @@ -249,8 +249,7 @@ subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp) do kv=1,nvp - call update(x(:,:,:,kv),x(:,:,:,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,1,0,iuv) + call update(x(:,:,:,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,iuv) do k=1,l+1 ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 68 BUG-2026-06-006: Face-centered iperiod=1 handling for np+1 x-face arrays at non-periodic xmax • update.F90 – update • advectionScheme.F90 – setAdvectiveVelocities – related MPDATA face-flux updates • Related arrays: – u1 – f1 – v1mp – other x-face or x-flux arrays with local x extent np+1 Summary The update() routine has special iperiod logic for face-centered arrays whose local x-size is np+1. The comment in update.F90 explains that iperiod=1 was introduced for arrays defined on x-faces: ! For arrays defined on cell face dim [1-ih, np+1+ih], ! il=1-ih,iu=np+1+ih, nxp=np+1 and i0=1 ... ! because a(np+1) of current proc is equal to a(1) of peright and ! a(1) of current proc to a(np+1) of peleft. (period is np and not ! np+1) That reasoning is valid for periodic x-face arrays. However, at a non-periodic physical xmax boundary, the face a(np+1,j,k) is not a periodic duplicate of the neighbor's a(1,j,k). It is the physical right boundary face. Therefore, for x-face arrays on a rank with: rightedge.eq.1 and non-cyclic ibc_right, a(np+1,j,k) should be treated as a physical boundary face. It should not be treated as an interior-equivalent periodic face or as a copy of the global xmin side. setAdvectiveVelocities() updates the x-face advective velocity u1 using: call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) Here: 69 nxp = np+1 iperiod = 1 Inside update(), iperiod=1 sets: i0 = 1 The x-direction MPI exchange then fills right ghost faces as: a(nxp+i,j,k) which, for nxp=np+1, means: a(np+2:np+ih+1,j,k) At a physical right boundary, the later right-edge boundary fill repairs those ghost cells with: a(nxp+i,j,k)=ae(nxp,jref,k) so for nxp=np+1: a(np+2:np+ih+1,j,k) = ae(np+1,jref,k) This means update() does not obviously overwrite a(np+1,j,k) itself in the physical-edge repair section. The physical boundary face appears to remain intact. However, the broader Issue 5 problem still applies: before physical-edge repair, the MPI exchange can still communicate with a wrapped periodic neighbor because peright and peleft are assigned periodically. Thus, for np+1 face arrays, the right ghost faces may first receive values from the global xmin side and only later be overwritten by the physical boundary repair. This ordering is fragile. It assumes that: 1. all non-periodic physical ghost cells are fully repaired after communication, 2. no code reads the temporary periodic ghost values before repair, 3. all face-centered arrays use correct nxp, iperiod, and edge-fill conventions, 4. corner and face-flux update paths are also fully repaired. That assumption should be explicitly tested for np+1 x-face arrays. Important nuance This is not yet proven to be a direct overwrite of: a(np+1,j,k) For the standard right-edge fill, update() writes: a(np+2:np+ih+1,j,k) not: 70 a(np+1,j,k) So the suspected failure mode is not necessarily: a(np+1) is overwritten by periodic data but rather: x-face ghost cells beyond np+1 may temporarily or incorrectly contain periodic wrapped data, and some face-flux or antidiffusive-velocity path may use that data before or instead of the physical ,→ boundary repair. This should be treated as a focused subcase of Issue 5, not as a completely separate confirmed bug. If the iperiod=1, np+1 face-array path leaks periodic neighbor data at a non-periodic xmax, possible symptoms include: spurious xmax artifacts, apparent wraparound of x-face velocities or x-fluxes, bad antidiffusive velocities near the right physical boundary, incorrect x-face fluxes in MPDATA near xmax, boundary-aligned numerical noise near i=np or i=np+1, sensitivity to processor decomposition in x. The most suspicious arrays to inspect are: u1 f1 v1mp and any other x-face or x-flux arrays with effective x extent np+1. Recommended diagnostic On a rank with: rightedge.eq.1 and non-periodic ibc_right, print or check the physical boundary face and right ghost faces before and after update(). For u1, around this call in setAdvectiveVelocities(): call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) check: u1(np+1,j,k) u1(np+2:np+ih+1,j,k) 71 before and after the call. Expected behavior: u1(np+1,j,k) should remain the physical xmax face value. u1(np+2:np+ih+1,j,k) should be filled from the physical boundary face, usually copied or sign-reflected from u1(np+1,jref,k), depending on the BC. Suspicious behavior: u1(np+1,j,k) changes during update(). u1(np+2:np+ih+1,j,k) matches values from global xmin. u1(np+2:np+ih+1,j,k) matches another rank’s a(1,j,k) rather than local a(np+1,j,k). right ghost values differ before/after only because of periodic exchange and are read by later code ,→ before repair. A minimal debug pattern is: if(rightedge.eq.1) then write(*,*) ’BEFORE␣update␣u1␣rank/rightedge:’, & ’␣u1(np+1)=’, u1(np+1,j,k), & ’␣u1(np+2)=’, u1(np+2,j,k) endif call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) if(rightedge.eq.1) then write(*,*) ’AFTER␣update␣u1␣rank/rightedge:’, & ’␣u1(np+1)=’, u1(np+1,j,k), & ’␣u1(np+2)=’, u1(np+2,j,k) endif For broader coverage, use a fixed j,k, or loop over representative values: j = max(1,mp/2) k = max(1,l/2) and also inspect near corners: j = 1 j = mp because corner repair and side repair may interact. Related MPDATA arrays The MPDATA arrays f1 and v1mp are also x-face or x-flux-like arrays with np+1 behavior. Their update calls should be audited separately because they do not always use iperiod=1; some paths pass nxp=np+1 with iperiod=0. Examples to search for: call update(f1(...), ...) call update(v1mp(...), ...) 72 especially calls where the x upper bound is: np+ih+1 or where the effective nxp is conditionally changed from np to np+1 on rightedge. Even if these paths are not literally iperiod=1, they are part of the same face-centered boundary-risk class because they carry x-face flux information near xmax. Suggested fix or hardening The primary fix remains the broader Issue 5 fix: do not communicate across non-periodic physical x-boundaries. For example, use MPI_PROC_NULL or skip x-direction send/recv at physical non-periodic x-edges: xleft_neighbor = peleft xright_neighbor = peright if(leftedge.eq.1) xleft_neighbor = MPI_PROC_NULL if(rightedge.eq.1) xright_neighbor = MPI_PROC_NULL and use those local neighbor variables in the x-direction MPI_Sendrecv calls. For face-centered arrays, also add defensive checks or comments clarifying that: a(np+1,j,k) is a physical xmax face on rightedge ranks when x is non-periodic. a(np+2:np+ih+1,j,k) are right ghost faces and must be filled from physical boundary logic, not ,→ periodic wraparound. A safer long-term design would be to make update() aware of whether the domain direction is actually periodic, instead of relying only on iperiod, which currently describes array indexing periodicity rather than physical boundary periodicity. Run a small decomposed case with: nprocx > 1 rightedge = 1 on the xmax rank ibc_right > 0 ibc_left > 0 and initialize an easily recognizable non-periodic pattern, for example: global xmin values = 1000 + local pattern global xmax values = 2000 + local pattern Then verify after update() that xmax ghost cells for u1 and related x-face arrays do not contain the xmin pattern. Useful checks: u1(np+1,j,k) ! physical boundary face u1(np+2:np+ih+1,j,k) ! right ghost faces 73 f1(np+1,j,k,kv) f1(np+2:np+ih+1,j,k,kv) v1mp(np+1,j,k,kv) v1mp(np+2:np+ih+1,j,k,kv) If np+2:np+ih+1 contains global-xmin-like values after the final update() return, this is a confirmed bug. If those values only appear transiently inside update() before physical repair, then the main risk is ordering fragility and should be fixed by removing non-periodic wraparound communication. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 0325b25 (2026-07-14, MPDATA cleanup); 8db0fc7 (2026-07-14, advection boundary overwrite fix). Face-centered MPDATA/update calls were changed to pass the appropriate staggered-grid periodic flag, and a later advection fix stopped boundary values from being set to no-gradient and then overwritten by an exchange. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/update.F90 CODE-dev/ ,→ advectionScheme.F90 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1,0) + call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,0,1) + call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,0,1) + call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) + call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) endif 74 @@ -210,13 +210,10 @@ subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp) - !real(prec),external :: donor,vcorr,vdiv1,vdiv2,vdyf,pn,pp - + integer :: n3,kv,i,j,k,ip,im,jp,jm,kp,km,itrfct,iuv ... [diff excerpt truncated; run the command above for the full commit diff] # 0325b25 Clean up of mpdata. # Full command: git show --find-renames --unified=3 0325b25 -- CODE-dev/update.F90 CODE-dev/ ,→ advectionScheme.F90 +++ b/CODE-dev/advectionScheme.F90 @@ -1,9 +1,7 @@ !**********************************************************************! ! this routine computes the advection on the large time steps and ! the nv variables. It can use either donorcell or fct -! !**********************************************************************! - @@ -13,7 +11,7 @@ module advection_functions - pp = max(0.0_wp,y) + pp = max(0._wp,y) !************************************* @@ -22,7 +20,7 @@ module advection_functions - pn = -min(0.0_wp,y) + pn = -min(0._wp,y) !************************************* @@ -56,7 +54,7 @@ module advection_functions - rat2 = (z2-z1)*0.5_wp + rat2 = 0.5_wp*(z2-z1) !************************************* @@ -117,10 +115,6 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 75 BUG-2026-06-007: Turbulence stress routine has likely sign errors in z-face y-gradients File • stressrij_turb.F90 Summary In the z-face stress calculation, the y-gradient terms appear to use + where a central-difference stencil should use -. Current pattern: uy = 0.5*(xvrho(i,j+1,kk,iuvel)-xvrho(i,j-1,kk,iuvel)+ & xvrho(i,j+1,k-1,iuvel)+xvrho(i,j-1,k-1,iuvel))*hdyi The same pattern appears for vy and wy. Why this is likely wrong Analogous x-face and y-face gradient code uses difference terms at both adjacent planes. The z-face version should likely average two y-derivatives, not add one value from j+1 and one value from j-1. Use minus signs in the second plane contribution: uy = 0.5*(xvrho(i,j+1,kk,iuvel)-xvrho(i,j-1,kk,iuvel)+ & xvrho(i,j+1,k-1,iuvel)-xvrho(i,j-1,k-1,iuvel))*hdyi vy = 0.5*(xvrho(i,j+1,kk,ivvel)-xvrho(i,j-1,kk,ivvel)+ & xvrho(i,j+1,k-1,ivvel)-xvrho(i,j-1,k-1,ivvel))*hdyi wy = 0.5*(xvrho(i,j+1,kk,iwvel)-xvrho(i,j-1,kk,iwvel)+ & xvrho(i,j+1,k-1,iwvel)-xvrho(i,j-1,k-1,iwvel))*hdyi This affects velocity transport indirectly through turbulent momentum forcing. Git evidence: 1d6c99f (2026-06-09, stressrij scheme fixes); ee83e79 (2026-06-09, zeta bug-list pass). The turbulence stress routine was patched in CODE-dev/subGridTurb/stressrij_turb.F90 to correct the z-face y-gradient signs identified in the report. # 1d6c99f fixed stressrij schemes # Full command: git show --find-renames --unified=3 1d6c99f -- CODE-dev/subGridTurb/stressrij_turb.F90 diff --git a/CODE-dev/subGridTurb/stressrij_turb.F90 b/CODE-dev/subGridTurb/stressrij_turb.F90 index e96a657..2de1fcc 100644 --- a/CODE-dev/subGridTurb/stressrij_turb.F90 +++ b/CODE-dev/subGridTurb/stressrij_turb.F90 76 @@ -61,7 +61,7 @@ subroutine stressrij(fx,fy,fz,il,iu,jl,ju,lls) real(prec),intent(inout) :: fy(il:iu,jl:ju,lls) real(prec),intent(inout) :: fz(il:iu,jl:ju,lls) - integer :: i,j,k,kp1,kk,km1 + integer :: i,j,k,kp1,kk,km1,k0 real(prec) hdxi,hdyi,hdzi real(prec):: J31,J32 ! jacobians ! cell face quantities for Aijc @@ -252,8 +252,11 @@ subroutine stressrij(fx,fy,fz,il,iu,jl,ju,lls) ! computation of Ai3c, Bi3c and C in i,j,k-1/2 ! top boundary condition on u,v,w, for uz, vz and wz is burried here (kp1=l when k=l) do k=1,lls+1 - km1=max(k-1,1) - kk =min(k,lls) + ! km1 is for arrays defined only on 1:lls. + ! k0 is for fields intentionally defined on 0:lls, including bottom ghost/subground values. + km1 = max(k-1,1) + k0 = max(k-1,0) + kk = min(k,lls) do j=1,mp do i=1,np ! 0/ computation of required k-1/2 face averages: @@ -285,23 +288,23 @@ subroutine stressrij(fx,fy,fz,il,iu,jl,ju,lls) +sqrtG_Kxy(i,j,km1)*gi(i,j,km1)*c13(i,j)*gmul(km1)) Kxy_J32a=0.5*(sqrtG_Kxy(i,j,kk)*gi(i,j,kk)*c23(i,j)*gmul(kk) & +sqrtG_Kxy(i,j,km1)*gi(i,j,km1)*c23(i,j)*gmul(km1)) - rtke_abca = 0.5 * (rtke_abc(i,j,kk) + rtke_abc(i,j,km1)) + rtke_abca = 0.5 * (rtke_abc(i,j,kk) + rtke_abc(i,j,k0)) ux = 0.5*(xvrho(i+1,j,kk,iuvel)-xvrho(i-1,j,kk,iuvel)+ & - xvrho(i+1,j,k-1,iuvel)-xvrho(i-1,j,k-1,iuvel))*hdxi + xvrho(i+1,j,k0,iuvel)-xvrho(i-1,j,k0,iuvel))*hdxi vx = 0.5*(xvrho(i+1,j,kk,ivvel)-xvrho(i-1,j,kk,ivvel)+ & - xvrho(i+1,j,k-1,ivvel)-xvrho(i-1,j,k-1,ivvel))*hdxi + xvrho(i+1,j,k0,ivvel)-xvrho(i-1,j,k0,ivvel))*hdxi wx = 0.5*(xvrho(i+1,j,kk,iwvel)-xvrho(i-1,j,kk,iwvel)+ & - xvrho(i+1,j,k-1,iwvel)-xvrho(i-1,j,k-1,iwvel))*hdxi ... [diff excerpt truncated; run the command above for the full commit diff] # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/subGridTurb/stressrij_turb.F90 diff --git a/CODE-dev/subGridTurb/stressrij_turb.F90 b/CODE-dev/subGridTurb/stressrij_turb.F90 index ebdff77..e96a657 100644 --- a/CODE-dev/subGridTurb/stressrij_turb.F90 +++ b/CODE-dev/subGridTurb/stressrij_turb.F90 @@ -294,11 +294,11 @@ subroutine stressrij(fx,fy,fz,il,iu,jl,ju,lls) wx = 0.5*(xvrho(i+1,j,kk,iwvel)-xvrho(i-1,j,kk,iwvel)+ & xvrho(i+1,j,k-1,iwvel)-xvrho(i-1,j,k-1,iwvel))*hdxi uy = 0.5*(xvrho(i,j+1,kk,iuvel)-xvrho(i,j-1,kk,iuvel)+ & - xvrho(i,j+1,k-1,iuvel)+xvrho(i,j-1,k-1,iuvel))*hdyi + xvrho(i,j+1,k-1,iuvel)-xvrho(i,j-1,k-1,iuvel))*hdyi vy = 0.5*(xvrho(i,j+1,kk,ivvel)-xvrho(i,j-1,kk,ivvel)+ & - xvrho(i,j+1,k-1,ivvel)+xvrho(i,j-1,k-1,ivvel))*hdyi + xvrho(i,j+1,k-1,ivvel)-xvrho(i,j-1,k-1,ivvel))*hdyi wy = 0.5*(xvrho(i,j+1,kk,iwvel)-xvrho(i,j-1,kk,iwvel)+ & - xvrho(i,j+1,k-1,iwvel)+xvrho(i,j-1,k-1,iwvel))*hdyi + xvrho(i,j+1,k-1,iwvel)-xvrho(i,j-1,k-1,iwvel))*hdyi uz = (xvrho(i,j,kk,iuvel)-xvrho(i,j,k-1,iuvel))*hdzi vz = (xvrho(i,j,kk,ivvel)-xvrho(i,j,k-1,ivvel))*hdzi 77 FIRETEC Bug Resolution Log June 2026 wz = (xvrho(i,j,kk,iwvel)-xvrho(i,j,k-1,iwvel))*hdzi 78 BUG-2026-06-008: MPI status variable has the wrong type in update File • update.F90 Summary In update, the MPI status variable is declared as part of a real allocatable array list: real(prec),allocatable :: tmpxsnd(:),tmpxrcv(:),tmpysnd(:), & tmpyrcv(:),tmpcorsnd(:),tmpcorrcv(:),sndrcvStatus(:) However, MPI status objects should be integer arrays, not real arrays. Passing a real array where MPI expects a status object is undefined behavior. Depending on compiler and MPI implementation, this can produce memory corruption or other hard-to-diagnose runtime behavior. This may not be the most direct cause of boundary-line artifacts, but it is a real correctness issue. Remove sndrcvStatus from the real allocatable declaration and either declare it correctly: real(prec),allocatable :: tmpxsnd(:),tmpxrcv(:),tmpysnd(:), & integer :: sndrcvStatus(MPI_STATUS_SIZE) or, if the status is not used, replace the status argument in the relevant MPI call with: MPI_STATUS_IGNORE Use MPI_STATUS_IGNORE if returned status values are not needed later. Git evidence: 7c10434 (2026-06-11, integer MPI status initialization); ee83e79 (2026-06-09, zeta bug-list pass). The MPI status storage in CODE-dev/update.F90 was changed to an integer status array and initialized with the integer literal 0. # 7c10434 Bug 6 on Colbys list from June 9, initialize sndrcvStatus with integer 0 instead of 0.0 in ,→ update # Full command: git show --find-renames --unified=3 7c10434 -- CODE-dev/update.F90 index e1f2dee..5ddbe79 100644 79 +++ b/CODE-dev/update.F90 @@ -79,7 +79,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) allocate(tmpyrcv(nybuf)); tmpyrcv = 0.0 allocate(tmpcorsnd(ncorbuf)); tmpcorsnd = 0.0 allocate(tmpcorrcv(ncorbuf)); tmpcorrcv = 0.0 - allocate(sndrcvStatus(mpi_status_size)); sndrcvStatus = 0.0 + allocate(sndrcvStatus(mpi_status_size)); sndrcvStatus = 0 ... [diff excerpt truncated; run the command above for the full commit diff] # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/update.F90 index d401979..0fbeaff 100644 +++ b/CODE-dev/update.F90 @@ -29,19 +29,15 @@ ! (topedge, ...), an additionnal treatment is done using the env ! field : the ghost cells are forced with xe values in ! [1,nxp][1,nyp][1,nzp] -! -! "topbot" and "leftright" inputs in the subroutine dictate +! +! "iuv" inputs in the subroutine dictate ! Dirichlet(1) or Neumann(0) for the top and sides if the boundary ! conditions are symmetric (ibc_* = 5). For symmetric or mirror ! purposes, all variables will be Neumann except for the velocities -! normal to the particular boundary. For instance, u is normal to the -! top and bottom of the domain, so if ibc_top or ibc_bottom = 5, we -! will have topbot = 1 and leftright = 0. -! v will have the opposite settings. +! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & - topbot,leftright) +subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & @@ -56,8 +52,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & ! Local Variables - integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod - integer,intent(in) :: topbot,leftright + integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) @@ -65,8 +60,9 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & integer :: icnt,itag,iref,jref,ncount ... [diff excerpt truncated; run the command above for the full commit diff] 80 BUG-2026-06-009: tempg halo update is repeated inside the variable loop File • domainUpdates.F90 Summary tempg is updated inside a loop over: kv = 1,nv This is probably not a numerical bug, but it is wasteful and makes halo-update logic harder to reason about. Move the tempg update outside the kv loop. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass). The grouped zeta pass adjusted the gas-temperature update ordering around the variable loop so the redundant halo update is not performed with the old repeated-call structure. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/domainUpdates.F90 index eb16cea..700034d 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -38,7 +38,7 @@ subroutine implicit_domain_updates ! Local Variables - integer :: i,j,k,kv,ift,topbot,leftright + integer :: i,j,k,kv,iuv,ift ! Executable Code forceSI_xv=0. @@ -59,21 +59,11 @@ subroutine implicit_domain_updates enddo enddo do kv=1,nv - if(kv.eq.1) then - topbot = 1 - leftright = 0 - elseif(kv.eq.2) then 81 FIRETEC Bug Resolution Log June 2026 - topbot = 0 - leftright = 1 - else - topbot = 0 - leftright = 0 - endif - + call loop_update_flags(kv,iuv) call update(xvrho(:,:,1:l,kv),xvrho(:,:,1:l,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,1,0,topbot,leftright) - call update(tempg,tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0,0) + 1-ih,np+ih,1-ih,mp+ih,1,0,iuv) enddo + call update(tempg,tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0) if(ifire.eq.1)then do i=1,np @@ -114,7 +104,7 @@ subroutine explicit_domain_updates ! Local Variables ... [diff excerpt truncated; run the command above for the full commit diff] 82 BUG-2026-06-010: Vertical MPDATA divergence correction uses misleading temporary name File • advectionScheme.F90 Summary In the z-direction MPDATA divergence correction, the temporary is named v2d even though it is used for z-direction correction: v2d = -vdiv1(f3(...)) ... v3mp(i,j,k,kv) = v3mp(i,j,k,kv) + ... This is probably only a naming issue, but it increases the chance of future copy/paste or maintenance mistakes. Rename the temporary to: v3d in the z-direction block. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass). The vertical MPDATA divergence-correction temporary was renamed from the misleading 2-D name to the correct 3-D velocity temporary in CODE-dev/advectionScheme.F90. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/advectionScheme.F90 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1,0) + call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) 83 enddo endif - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,0,1) + call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,0,1) + call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) + call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) endif @@ -210,13 +210,10 @@ subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp) - !real(prec),external :: donor,vcorr,vdiv1,vdiv2,vdyf,pn,pp - + integer :: n3,kv,i,j,k,ip,im,jp,jm,kp,km,itrfct,iuv ... [diff excerpt truncated; run the command above for the full commit diff] 84 BUG-2026-06-011: update() physical edge halo fill order lets left/right boundaries overwrite corner ghost cells File • update.F90 – update Summary At physical domain boundaries, update() fills the top and bottom edge halos first, then fills the right and left edge halos afterward. The top/bottom loops cover the full halo-extended x range: if(topedge.eq.1)then do k=1,nzp do j=1,ih do i=1-ih,nxp+ih ... a(i,nyp+j,k)=... enddo enddo enddo endif if(botedge.eq.1)then do k=1,nzp do j=1,ih do i=1-ih,nxp+ih ... a(i,1-j,k)=... enddo enddo enddo endif Later, the right/left loops cover the full halo-extended y range: do k=1,nzp do j=1-ih,nyp+ih do i=1,ih ... a(nxp+i,j,k)=... enddo enddo enddo endif do k=1,nzp do j=1-ih,nyp+ih do i=1,ih ... a(1-i,j,k)=... enddo enddo 85 enddo endif Because the top/bottom loops include: i = 1-ih : nxp+ih and the left/right loops include: j = 1-ih : nyp+ih both sets of logic write the physical corner ghost cells. The final corner value is therefore determined by the later right/left boundary fill, not by a combined or explicitly defined corner boundary condition. For example, on a top-right physical corner, topedge first writes: a(nxp+i,nyp+j,k) = ... but rightedge later overwrites the same cells: a(nxp+i,nyp+j,k) = ... For simple copy or Neumann-style boundary conditions, the two writes often produce the same value, so the issue can remain hidden. However, for symmetric or mirror boundary conditions, the sign depends on the topbot and leftright flags. The top-edge symmetric rule can apply one sign convention: if (ibc_top.eq.5) then iref=max(1,min(i,nxp)) if(topbot.eq.1) a(i,nyp+j,k)=-ae(iref,nyp,k) if(topbot.eq.0) a(i,nyp+j,k)= ae(iref,nyp,k) endif while the later right-edge logic can apply a different rule: if (ibc_right.eq.5) then jref=max(1,min(j,nyp)) if(leftright.eq.1) a(nxp+i,j,k)=-ae(nxp,jref,k) if(leftright.eq.0) a(nxp+i,j,k)= ae(nxp,jref,k) endif Thus a corner ghost cell may be written once according to the top/bottom symmetric rule and then overwritten according to the right/left symmetric rule. The final corner ghost value depends on implementation order rather than on an explicitly defined corner condition. This can produce inconsistent corner ghost cells when one or more of the following are true: 86 ibc_top, ibc_bot, ibc_left, or ibc_right use symmetric BCs, i.e. ibc_* = 5 different variables use different topbot / leftright mirror flags the boundary condition type differs between adjacent physical edges a stencil reads diagonal/corner halo cells the affected feature originates near a physical corner, especially near xmax/rightedge For an artifact near xmax, the most relevant regions to inspect are: i = np+1:np+ih j = 1-ih:0 and: i = np+1:np+ih j = mp+1:mp+ih These should be compared against the pure right-side halo strip: i = np+1:np+ih j = 1:mp If the artifact starts at an xmax corner and then propagates into the domain, this overwrite order is a plausible source. This may be harmless for ordinary copy-style boundary conditions, but it is a real latent bug for mixed or mirror/symmetric boundary conditions. Avoid defining corner ghost cells implicitly through overlapping edge loops. One option is to restrict the right/left physical edge fills to the non-corner j range: do j=1,nyp instead of: do j=1-ih,nyp+ih and similarly restrict top/bottom fills to the non-corner i range: do i=1,nxp instead of using the halo-extended x range. Then fill the four physical corner halo blocks explicitly afterward. For symmetric or mirror boundary conditions, the corner sign should be determined by the combination of the two relevant boundary reflections. Conceptually: sgn = 1.0_prec if(top corner .and. ibc_top.eq.5 .and. topbot.eq.1) & sgn = -sgn 87 if(bot corner .and. ibc_bot.eq.5 .and. topbot.eq.1) & sgn = -sgn if(right corner .and. ibc_right.eq.5 .and. leftright.eq.1) & sgn = -sgn if(left corner .and. ibc_left.eq.5 .and. leftright.eq.1) & sgn = -sgn a(corner ghost) = sgn * ae(nearest interior corner) That makes the corner behavior explicit and independent of fill order. If the intended behavior is instead that right/left boundaries always dominate at physical corners, that should be documented clearly. Otherwise, the current behavior is order-dependent and likely unintended. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 0792741 (2026-06-15, mirrored-boundary corner rewrite). The physical-edge halo fill in CODE-dev/update.F90 was reorganized to separate side faces from corner cells, preventing left/right handling from clobbering corner ghost values. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/update.F90 index d401979..0fbeaff 100644 +++ b/CODE-dev/update.F90 @@ -29,19 +29,15 @@ ! (topedge, ...), an additionnal treatment is done using the env ! field : the ghost cells are forced with xe values in ! [1,nxp][1,nyp][1,nzp] -! -! "topbot" and "leftright" inputs in the subroutine dictate +! +! "iuv" inputs in the subroutine dictate ! Dirichlet(1) or Neumann(0) for the top and sides if the boundary ! conditions are symmetric (ibc_* = 5). For symmetric or mirror ! purposes, all variables will be Neumann except for the velocities -! normal to the particular boundary. For instance, u is normal to the -! top and bottom of the domain, so if ibc_top or ibc_bottom = 5, we -! will have topbot = 1 and leftright = 0. -! v will have the opposite settings. +! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & - topbot,leftright) +subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & @@ -56,8 +52,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & 88 ! Local Variables - integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod - integer,intent(in) :: topbot,leftright + integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) @@ -65,8 +60,9 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod, & integer :: icnt,itag,iref,jref,ncount ... [diff excerpt truncated; run the command above for the full commit diff] # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/update.F90 index 5ddbe79..e357b19 100644 +++ b/CODE-dev/update.F90 @@ -37,12 +37,13 @@ ! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) +subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove + rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & + MPI_Sendrecv #if DBL_PREC #else @@ -53,13 +54,12 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) ! Local Variables integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv - real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) - integer :: icnt,itag,iref,jref,ncount + integer :: itag,ncount real(prec),allocatable :: tmpxsnd(:),tmpxrcv(:),tmpysnd(:), & @@ -73,102 +73,125 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp - allocate(tmpxsnd(nxbuf)); tmpxsnd = 0.0 - allocate(tmpxrcv(nxbuf)); tmpxrcv = 0.0 - allocate(tmpysnd(nybuf)); tmpysnd = 0.0 89 FIRETEC Bug Resolution Log June 2026 ... [diff excerpt truncated; run the command above for the full commit diff] 90 BUG-2026-06-012: metric.F90 forces c13/c23 to zero at physical side boundaries, creating possible terrain-metric discontinuities • metric.F90 – metric • Related: – topo.F90 ∗ topo – MOA.F90 ∗ MOA – advectionScheme.F90 ∗ gradmoa – domainUpdates.F90 ∗ explicit_domain_updates – subGridTurb/turbFieldUpdate.F90 ∗ turbFieldUpdate Summary metric() computes the terrain-following horizontal/vertical coupling metrics c13 and c23 from go, where: go(i,j)=zb/(zb-zs(i,j)) The interior c13 metric is computed with a centered difference: do j=1,mp do i=1+leftedge,np-rightedge c13(i,j)=.5*(1./go(i+1,j)-1./go(i-1,j))*go(i,j)/dx enddo enddo but at physical left/right boundaries it is hard-set to zero: do j=1,mp c13(1,j)=0. enddo endif do j=1,mp c13(np,j)=0. enddo endif Similarly, c23 is computed with a centered difference in the interior: 91 FIRETEC Bug Resolution Log June 2026 do i=1,np do j=1+botedge,mp-topedge c23(i,j)=.5*(1./go(i,j+1)-1./go(i,j-1))*go(i,j)/dy enddo enddo but at physical bottom/top boundaries it is hard-set to zero: if(botedge.eq.1)then do i=1,np c23(i,1)=0. enddo endif if(topedge.eq.1)then do i=1,np c23(i,mp)=0. enddo endif This means that at physical side boundaries: c13(1,:) = 0 c13(np,:) = 0 c23(:,1) = 0 c23(:,mp) = 0 regardless of the actual one-sided topographic slope implied by zs. The related topo() routine also enforces zero-normal-gradient topography at physical boundaries: if(leftedge.eq.1) then do j=1-ih,mp+ih zs(1,j)=zs(2,j) !zero gradient do i=1,ih zs(1-i,j)=zs(1,j) enddo enddo endif if(rightedge.eq.1) then do j=1-ih,mp+ih zs(np,j)=zs(np-1,j) !zero gradient do i=1,ih zs(np+i,j)=zs(np,j) enddo enddo endif if(botedge.eq.1) then do i=1-ih,np+ih zs(i,1)=zs(i,2) do j=1,ih zs(i,1-j)=zs(i,1) enddo enddo endif 92 if(topedge.eq.1) then do i=1-ih,np+ih zs(i,mp)=zs(i,mp-1) do j=1,ih zs(i,mp+j)=zs(i,mp) enddo enddo endif So the zeroed metric is consistent with the current imposed zero-normal-slope terrain boundary condition. However, if the input topography has nonzero slope as it approaches a physical boundary, the code silently modifies the edge terrain and then forces the corresponding metric to zero. This can create a sharp metric kink near the physical boundary. c13 and c23 are not passive diagnostics. They directly enter several dynamical operators. In gradmoa(), they modify the pressure-gradient force: g13=c13(i,j)*gmul(k) g23=c23(i,j)*gmul(k) g33= gi(i,j,k) forceSI_xv(i,j,k,iuvel)=forceSI_xv(i,j,k,iuvel) & -(px(i,j,k)+g13*pz(i,j,k)) forceSI_xv(i,j,k,ivvel)=forceSI_xv(i,j,k,ivvel) & -(py(i,j,k)+g23*pz(i,j,k)) forceSI_xv(i,j,k,iwvel)=forceSI_xv(i,j,k,iwvel) & -(g33*pz(i,j,k)) In MOA, they affect the contravariant vertical velocity: o(i,j,:,1)=(xv(i,j,:,iwvel)*gi(i,j,:) & +c13(i,j)*gmul(:)*xv(i,j,:,iuvel) & +c23(i,j)*gmul(:)*xv(i,j,:,ivvel))/xv(i,j,:,irho)/gi(i,j,:) and later: o(i,j,k,1)=(xvtmp(i,j,k,iwvel)*gi(i,j,k) & +c13(i,j)*gmul(k)*xvtmp(i,j,k,iuvel) & +c23(i,j)*gmul(k)*xvtmp(i,j,k,ivvel))/xvtmp(i,j,k,irho) & /gi(i,j,k) They also enter bottom/subground boundary treatment in explicit_domain_updates(): g13 = c13(i,j)*gmul(1) g23 = c23(i,j)*gmul(1) g33 = g13**2+g23**2+gi(i,j,1)**2 and turbulence metric terms in turbFieldUpdate(): 93 J31 = c13(i,j)*gmul(k) J32 = c23(i,j)*gmul(k) sqrtG_KG33(i,j,k) = sqrtG_Kxy(i,j,k) * (J31**2+J32**2) & +sqrtG_Kz(i,j,k) * gi(i,j,k)**2 Therefore, a discontinuity in c13 or c23 is a discontinuity in the modeled coordinate transformation and in the horizontal/vertical coupling used by pressure, advection, bottom boundary conditions, and turbulence. For example, if the terrain approaches the right boundary with a nonzero x-slope, the interior c13(np-1,j) may be nonzero, but the boundary value is forced to: c13(np,j)=0. This creates an abrupt transition: c13(np-2,j) ~= terrain slope metric c13(np-1,j) ~= terrain slope metric c13(np,j) = 0 The analogous issue exists for: left boundary: c13(1,j) right boundary: c13(np,j) bottom boundary: c23(i,1) top boundary: c23(i,mp) This may be intentional if the model requires terrain to become exactly zero-normal-slope at physical side boundaries. But if the input topography is not already tapered to zero slope, the code creates an artificial metric transition at the boundary. This can produce boundary-aligned artifacts when one or more of the following are true: physical, non-cyclic side boundaries are used input topography has nonzero normal slope near a physical boundary terrain is steep near xmin/xmax/ymin/ymax pressure-gradient forcing is active over sloped terrain vertical velocity / contravariant velocity coupling is important subgrid turbulence or bottom boundary treatment reads c13/c23 near edges the affected feature originates near a physical boundary and propagates inward Most suspicious regions are: left physical boundary: i = 1 j = 1:mp c13(1,:) right physical boundary: i = np j = 1:mp c13(np,:) 94 bottom physical boundary: i = 1:np j = 1 c23(:,1) top physical boundary: i = 1:np j = mp c23(:,mp) The artifact would likely appear as a pressure-gradient or vertical-coupling feature aligned with a physical side boundary, especially near terrain that does not smoothly flatten before the edge. This is probably harmless for flat topography, cyclic boundaries, or topography that has already been smoothly tapered to zero normal slope before the physical domain edge. It is a real latent issue for sloped topography intersecting physical side boundaries. The safest fix depends on the intended physical meaning of side boundaries. Option 1: Keep legacy zero-normal-slope terrain behavior, but make it explicit and smooth If physical side boundaries are intended to enforce zero-normal terrain slope, then the existing c13=0 / c23=0 behavior is conceptually consistent with topo.F90. In that case, add diagnostics and documentation, and require or perform topo tapering before the boundary. For example, before topo() overwrites the physical edge values, compute the incoming boundary slope and warn if it is non-negligible: maxslope=maxval(abs(zs(2,1:mp)-zs(1,1:mp)))/dx if(maxslope.gt.slope_tol)then print*,’WARNING:␣nonzero␣input␣topo␣slope␣at␣left␣physical␣boundary:’, & maxslope endif endif Similarly: maxslope=maxval(abs(zs(np,1:mp)-zs(np-1,1:mp)))/dx ... endif if(botedge.eq.1)then maxslope=maxval(abs(zs(1:np,2)-zs(1:np,1)))/dy ... endif if(topedge.eq.1)then maxslope=maxval(abs(zs(1:np,mp)-zs(1:np,mp-1)))/dy ... 95 endif Then require topography to be padded or tapered so that: dzs/dx = 0 at left/right physical boundaries dzs/dy = 0 at bottom/top physical boundaries This preserves backward compatibility and avoids introducing nonzero terrain metrics through physical boundaries. Option 2: Allow sloped terrain at physical boundaries using one-sided metric derivatives If sloped topography is intended to intersect the physical side boundary, then metric.F90 should not hard-set the boundary metrics to zero. Instead, compute them with one-sided differences consistent with go. For example, define: q = 1.0_prec/go Then use centered differences in the interior: do j=1,mp do i=1+leftedge,np-rightedge c13(i,j)=0.5_prec*(q(i+1,j)-q(i-1,j))*go(i,j)/dx enddo enddo and one-sided second-order differences at physical x boundaries: do j=1,mp c13(1,j)=(-3.0_prec*q(1,j)+4.0_prec*q(2,j)-q(3,j)) & *go(1,j)/(2.0_prec*dx) enddo endif do j=1,mp c13(np,j)=(3.0_prec*q(np,j)-4.0_prec*q(np-1,j)+q(np-2,j)) & *go(np,j)/(2.0_prec*dx) enddo endif Similarly for c23: do i=1,np do j=1+botedge,mp-topedge c23(i,j)=0.5_prec*(q(i,j+1)-q(i,j-1))*go(i,j)/dy enddo enddo with one-sided physical y-boundary values: if(botedge.eq.1)then 96 FIRETEC Bug Resolution Log June 2026 do i=1,np c23(i,1)=(-3.0_prec*q(i,1)+4.0_prec*q(i,2)-q(i,3)) & *go(i,1)/(2.0_prec*dy) enddo endif if(topedge.eq.1)then do i=1,np c23(i,mp)=(3.0_prec*q(i,mp)-4.0_prec*q(i,mp-1)+q(i,mp-2)) & *go(i,mp)/(2.0_prec*dy) enddo endif This makes the boundary metric a continuation of the local topographic slope rather than a hard zero. However, this change is not sufficient by itself if topo.F90 still overwrites the physical edge terrain values. To truly allow nonzero boundary slope, topo.F90 should preserve the physical edge cells and only fill ghost cells consistently. For example, instead of: zs(1,j)=zs(2,j) use ghost-cell extrapolation such as: if(leftedge.eq.1) then do j=1-ih,mp+ih do i=1,ih zs(1-i,j)=zs(1,j)+real(i,prec)*(zs(1,j)-zs(2,j)) enddo enddo endif and similarly for the other physical sides. Option 3: Add an explicit gridlist option A robust compatibility-preserving fix would be to add a gridlist option such as: integer :: itopobc = 0 with behavior: itopobc = 0: legacy behavior force zero-normal-slope topo at physical edges force c13/c23 = 0 at physical edges itopobc = 1: preserve physical edge topo fill ghost topo by extrapolation compute c13/c23 at physical edges using one-sided differences itopobc = 2: legacy behavior, but warn or abort if input topo has nonzero boundary slope 97 This avoids changing existing results while making the boundary metric behavior intentional and testable. Diagnostic test Recommended tests: 1. Flat topography: c13 and c23 should remain zero everywhere. 2. Linear slope crossing a physical x boundary: legacy behavior should show c13 forced to zero at i=1 or i=np; one-sided metric behavior should produce a smooth c13 field. 3. Linear slope crossing a physical y boundary: legacy behavior should show c23 forced to zero at j=1 or j=mp; one-sided metric behavior should produce a smooth c23 field. 4. Real topography with physical side boundaries: compare pressure-gradient artifacts near xmin/xmax ,→ /ymin/ymax. 5. Same real topography tapered to zero slope near boundaries: artifacts should be reduced if the metric discontinuity is the source. Useful fields to output and inspect: zs go c13 c23 gi gmul*c13 gmul*c23 pressure-gradient forcing terms involving g13*pz and g23*pz contravariant vertical velocity o If artifacts disappear with flat topography or with smoothly tapered boundary topography, but appear with sloped terrain intersecting physical boundaries, this metric boundary treatment is a plausible cause. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 0792741 (2026-06-15, mirrored-boundary corner rewrite); 869ead7 (2026-06-25, boundary-error pass). The boundary-condition rewrite and later boundary-error pass changed how physical side halos and corners are filled. I did not find a small commit limited only to the metric coefficients, so this entry is best treated as resolved through the broader boundary cleanup. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/metric.F90 CODE-dev/topo.F90 ,→ CODE-dev/MOA.F90 index 27ee300..34553c3 100644 +++ b/CODE-dev/MOA.F90 @@ -23,7 +23,7 @@ subroutine MOA ! Local Variables 98 - integer :: its,i,j,k,kv,topbot,leftright + integer :: its,i,j,k,kv,iuv real(prec),allocatable :: u(:,:,:,:),v(:,:,:,:),o(:,:,:,:) ! centered contravariant coordinates/gi ! Executable Code @@ -78,19 +78,9 @@ subroutine MOA ! computation of advective tendencies (donorcell scheme) do kv=1,nv - if(kv.eq.1) then - topbot = 1 - leftright = 0 - elseif(kv.eq.2) then - topbot = 0 - leftright = 1 - else - topbot = 0 - leftright = 0 - endif - + call loop_update_flags(kv,iuv) call update(xvtmp(1-ih,1-ih,1,kv),xvtmp(1-ih,1-ih,1,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,topbot,leftright) + 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(xvtmp(1-ih,1-ih,1,kv),1-ih,np+ih,1-ih,mp+ih,l) enddo diff --git a/CODE-dev/metric.F90 b/CODE-dev/metric.F90 index f8914cc..4285f85 100644 --- a/CODE-dev/metric.F90 +++ b/CODE-dev/metric.F90 @@ -32,9 +32,9 @@ subroutine metric() enddo enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/metric.F90 CODE-dev/topo.F90 ,→ CODE-dev/MOA.F90 index 34553c3..9b97a6c 100644 +++ b/CODE-dev/MOA.F90 @@ -79,8 +79,7 @@ subroutine MOA ! computation of advective tendencies (donorcell scheme) do kv=1,nv - call update(xvtmp(1-ih,1-ih,1,kv),xvtmp(1-ih,1-ih,1,kv),np,mp,l, & - 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) + call update(xvtmp(:,:,:,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(xvtmp(1-ih,1-ih,1,kv),1-ih,np+ih,1-ih,mp+ih,l) enddo diff --git a/CODE-dev/metric.F90 b/CODE-dev/metric.F90 index 4285f85..3027840 100644 --- a/CODE-dev/metric.F90 +++ b/CODE-dev/metric.F90 @@ -32,9 +32,9 @@ subroutine metric() enddo 99 enddo - call update(gi,gi,np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) - call update(h,h,np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) - call update(go,go,np,mp,1,1-ih,np+ih,1-ih,mp+ih,1,0,0) + call update(gi,np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) + call update(h,np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) + call update(go,np,mp,1,1-ih,np+ih,1-ih,mp+ih,1,0,0) do j=1,mp do i=1+leftedge,np-rightedge @@ -68,8 +68,8 @@ subroutine metric() enddo endif - call update(c13,c13,np,mp,1,1-ih,np+ih,1-ih,mp+ih,1,0,0) - call update(c23,c23,np,mp,1,1-ih,np+ih,1-ih,mp+ih,1,0,0) + call update(c13,np,mp,1,1-ih,np+ih,1-ih,mp+ih,1,0,0) + call update(c23,np,mp,1,1-ih,np+ih,1-ih,mp+ih,1,0,0) deallocate (go) end subroutine metric ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 100 BUG-2026-06-013: gradmoa() pressure perturbation halos use scalar copy/Neumann behavior at all non-cyclic side boundaries • MOA.F90 – gradmoa • Related: – update.F90 – small_implicit_forcings in force.F90, through the call to gradmoa() Summary gradmoa() computes the pressure perturbation pr, updates its horizontal halos, and then differentiates it to form the pressure-gradient contribution to forceSI_xv. The relevant code is: call update(pr,pr,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0,0) Because both mirror-parity flags are passed as zero, topbot = 0 leftright = 0 pr is treated as a scalar/even quantity at symmetric boundaries. For all non-cyclic physical boundaries, including relaxation/open/environmental boundaries, update() effectively copies the nearest physical edge value into the ghost cells. For example, at the right boundary: a(nxp+i,j,k)=ae(nxp,jref,k) so for pressure perturbation: pr(np+1,j,k) = pr(np,j,k) pr(np+2,j,k) = pr(np,j,k) ... Then gradmoa() computes the pressure gradients with centered differences: px(i,j,k)=0.5*(pr(i+1,j,k)-pr(i-1,j,k))*dxi py(i,j,k)=0.5*(pr(i,j+1,k)-pr(i,j-1,k))*dyi At the right physical boundary this gives: px(np,j,k) = 0.5 * (pr(np,j,k) - pr(np-1,j,k)) / dx rather than a fully one-sided derivative, a zero wall-normal gradient, or a derivative based on an environmental/open-boundary pressure state. 101 For a purely scalar field at a reflective wall, copying the scalar into the ghost cell can be a reasonable Neumann-like condition. Therefore this is not automatically a confirmed bug. However, it is suspicious because gradmoa() applies the same pressure-halo treatment for all non-cyclic side boundary types. It does not distinguish between: symmetric/mirror side boundaries, relaxation/open/environmental side boundaries, inflow/outflow-like side boundaries, ordinary copied scalar boundaries. This means the pressure perturbation used by the pressure-gradient force may not be consistent with the velocity boundary condition or with the intended open/environmental pressure behavior. This is especially relevant when the velocity boundary is reflective or mirror-like. The velocity update may be trying to impose no-normal-flow behavior, while the pressure perturbation halo is simply copied. Near a side wall, that can produce a boundary-adjacent pressure-force stripe even if the velocity ghost-cell parity is otherwise correct. At xmax, the most relevant path is: call update(pr,pr,...,topbot=0,leftright=0) followed by: px(np,j,k)=0.5*(pr(np+1,j,k)-pr(np-1,j,k))*dxi with: pr(np+1,j,k) = pr(np,j,k) so the edge pressure gradient is determined by a half-width copy condition rather than by a boundary- condition-specific pressure treatment. This can produce or amplify boundary-aligned pressure-gradient artifacts near physical side boundaries. a pressure-force stripe near xmax or xmin, spurious acceleration adjacent to reflective or open side boundaries, red/blue velocity structures aligned with a side wall, pressure-gradient forcing inconsistent with the velocity wall condition, artifacts that appear in forceSI_xv before large-step advection, artifacts that are strongest in the boundary-adjacent cell or first few cells. The most suspicious regions are: right physical boundary: i = np-2 : np+ih left physical boundary: 102 FIRETEC Bug Resolution Log June 2026 i = 1-ih : 3 top physical boundary: j = mp-2 : mp+ih bottom physical boundary: j = 1-ih : 3 For the observed xmax issue, inspect: pr(np-2:np+ih,j,k) px(np-2:np,j,k) forceSI_xv(np-2:np,j,k,iuvel) If the visible artifact aligns with a pressure-gradient stripe in px or in the iuvel component of forceSI_xv, this issue is likely contributing. Suggested diagnostic Add temporary diagnostic output in or immediately after gradmoa() for the right boundary: write(*,*) ’gradmoa␣right␣boundary␣diagnostic’ write(*,*) ’pr:’, pr(np-2:np+ih,j,k) write(*,*) ’px:’, px(np-2:np,j,k) write(*,*) ’forceSI_xv␣u:’, forceSI_xv(np-2:np,j,k,iuvel) A more useful diagnostic is to output the pressure-gradient contribution before other small-step forcings are added. In gradmoa(), the relevant x-momentum pressure term is: -(px(i,j,k)+c13(i,j)*gmul(k)*pz(i,j,k)) So outputting a separate diagnostic array such as: pgfx(i,j,k)=-(px(i,j,k)+c13(i,j)*gmul(k)*pz(i,j,k)) would help separate pressure-gradient artifacts from gravity, Coriolis, relaxation, drag, heat-source, and fire-related forcings. Recommended fields to inspect: pr px py pz c13*gmul*pz c23*gmul*pz -(px+c13*gmul*pz) -(py+c23*gmul*pz) forceSI_xv(:,:,:,iuvel) forceSI_xv(:,:,:,ivvel) For the xmax artifact, specifically check whether the red structure is collocated with: px stripe near i = np 103 or -(px+c13*gmul*pz) stripe near i = np Suggested fix or test The correct fix depends on the intended pressure boundary condition. Option 1: Keep scalar copy behavior, but document it If the intended pressure perturbation boundary condition is zero-normal-gradient at all non-cyclic side boundaries, then the current behavior should be documented explicitly in gradmoa(). Add a comment such as: ! Pressure perturbation pr uses scalar zero-normal-gradient/copy halos ! at all non-cyclic horizontal boundaries before computing px and py. ! This is intentional for the current pressure-gradient formulation. call update(pr,pr,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0,0) This does not remove the artifact risk, but it makes the assumption explicit. Option 2: Use a boundary-condition-specific pressure halo routine A cleaner fix would be to avoid using one generic scalar-copy update for pressure perturbation and instead fill pressure halos according to the actual side boundary type. For example, introduce a pressure-specific halo update: call update_pressure_perturbation(pr,np,mp,l) Inside that routine, handle different side-boundary types explicitly: cyclic boundary: use MPI/periodic exchange symmetric/mirror wall: use appropriate scalar pressure condition, likely zero-normal-gradient relaxation/open/environmental boundary: either relax pressure perturbation toward zero, extrapolate pressure from the interior, or impose the environmental pressure perturbation expected by the formulation For open/environmental boundaries, since pr is a perturbation relative to pre, one possible test condition is: pr ghost = 0 or a tapered blend toward zero, rather than: pr ghost = pr edge However, this should be checked against the intended pressure formulation before being made permanent. 104 FIRETEC Bug Resolution Log June 2026 Option 3: Test a one-sided derivative at physical side boundaries As a diagnostic, replace the boundary-adjacent centered derivative with a one-sided derivative at physical side edges. For example, at the right edge: do k=1,l do j=1,mp px(np,j,k)=(pr(np,j,k)-pr(np-1,j,k))*dxi enddo enddo endif and at the left edge: do k=1,l do j=1,mp px(1,j,k)=(pr(2,j,k)-pr(1,j,k))*dxi enddo enddo endif Similarly for py at bottom/top boundaries. This is not necessarily the final correct discretization, but it is a useful A/B test. If the boundary stripe changes substantially, then the artifact is sensitive to the pressure-gradient boundary discretization. Option 4: Test forcing the pressure perturbation halo to zero for open/relaxation sides For relaxation/open/environmental side boundaries, test whether the artifact is reduced by forcing pressure perturbation ghost cells toward zero instead of copying the edge value. Conceptually: if(rightedge.eq.1.and.ibc_right.ge.1.and.ibc_right.lt.5)then pr(np+1:np+ih,:,:) = 0.0_prec endif and similarly for other physical sides. This should be treated as a diagnostic first, not an automatic final fix, because it changes the pressure boundary condition. Run the same case with diagnostics enabled and compare: original scalar-copy pressure halos, one-sided pressure-gradient edge derivative, pressure perturbation ghost cells forced toward zero for open/relaxation sides, flat terrain, tapered terrain near the boundary, reflective versus relaxation side BCs. 105 If the boundary artifact follows the pressure-gradient term, especially near xmax, then this issue should be promoted from “suspicious pressure BC treatment” to a confirmed pressure-gradient boundary-condition bug. This is less immediately certain than the reversed velocity mirror flags and the non-periodic MPI neighbor wrapping, but it is directly in the small-step pressure-gradient force path and could plausibly create a side-boundary velocity artifact. Git evidence: 07433ba (2026-05-29, LSPGF fix); 1084a83 (2026-06-09, Neumann spelling follow-up). The large-scale pressure-gradient helper received a targeted fix, followed by a small Neumann spelling/- cleanup commit in the same area. # 07433ba Lspgf Fix # Full command: git show --find-renames --unified=3 07433ba -- CODE-dev/HeatSource/heatsource_heat.F90 ,→ CODE-dev/tinit.F90 CODE-dev/largeScalePGF.F90 index e9f32d1..7196145 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -64,7 +64,6 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) use xvall, only : irho,itheta use fuel_variables, only : rnfuel,hf - use zcart_function, only : zcart use constants, only : tolerance @@ -78,8 +77,7 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) real(prec) :: source_function=0.0 real(prec) :: energy,fi,frho real(prec) :: volume - - + real(prec),external :: zcart ! Executable Code do itsource=1,nsource_hs index 04fb165..49e8003 100644 +++ b/CODE-dev/largeScalePGF.F90 @@ -7,7 +7,8 @@ subroutine rinitLargeScalePGF use gridlist_variables, only : n,m,l,zgroundref,zab,izlspgf, & zu,irst,prec use lspgf_variables, only : iwindx,nMassFlux,massFluxTemp, & - massFlux,targMassFlux,sintheta,sinthetaf,flspgf + massFlux,targMassFlux,sintheta,sinthetaf,flspgf,cosg,sing, & + intsintheta use msga_variables, only : mpi_rank,mpi_sum,ierror,mpi_comm_world #ifdef DBL_PREC @@ -18,16 +19,14 @@ subroutine rinitLargeScalePGF 106 FIRETEC Bug Resolution Log June 2026 - use zcart_function ... [diff excerpt truncated; run the command above for the full commit diff] # 1084a83 Neuman typo # Full command: git show --find-renames --unified=3 1084a83 -- CODE-dev/update.F90 index 0fbeaff..e1f2dee 100644 +++ b/CODE-dev/update.F90 @@ -453,7 +453,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) do k=1,nzp do j=1,ih do i=1,ih - a(nxp+i,nyp+j,k)=ae(nyp,nyp,k) ! Neumann + a(nxp+i,nyp+j,k)=ae(nxp,nyp,k) ! Neumann enddo enddo enddo @@ -473,7 +473,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) do k=1,nzp do j=1,ih do i=1,ih - a(nxp+i,1-j,k)=ae(nyp,1,k) ! Neumann + a(nxp+i,1-j,k)=ae(nxp,1,k) ! Neumann enddo enddo enddo Overview This list contains bugs related to radiation boundary conditions, Monte Carlo photon transport, and MPI domain configuration. 107 BUG-2026-06-014: Mirror Radiation Boundary Conditions Let Photons Leave the Domain Summary The mirror/symmetric radiation boundary-condition handling in shoot_photons does not actually keep photons in the computational domain after they cross a lateral boundary. The routine updates the photon cell index first, which can move i1 or j1 outside the valid range, and only later flips the direction vector for mirror boundary conditions. Because the main photon-transport loop requires i1 and j1 to be in range at the top of each iteration, the reflected photon exits the loop before it can continue propagating. This means mirror radiation boundary conditions can behave like absorbing/leaking boundaries for photons that cross left, right, top, or bottom boundaries. Affected file and routine • File: monteCarlo_rad.F90 • Routine: shoot_photons • Relevant boundary-condition values: – ibc_* == 0: cyclic boundary – ibc_* == 5: mirror/symmetric boundary Evidence from current implementation The photon-transport loop only continues while the current cell index is in range: do while(i1.ge.1.and.i1.le.n.and.j1.ge.1.and.j1.le.m.and. & k1.ge.1.and.k1.le.lmc.and.lopt.gt.0) When the next event is an intersection with an x or y cell face, the routine immediately increments the corresponding cell index: if(abs(t-tx).lt.tolerance)then i1=i1+int(sign(one,dir(1))) elseif(abs(t-ty).lt.tolerance)then j1=j1+int(sign(one,dir(2))) else k1=k1+int(sign(one,dir(3))) kt=int(sign(one,dir(3))) endif For cyclic boundaries, the code repairs the index and position before the next loop iteration: ! Cyclic boundary conditions implementation if(ibc_left.eq.0.and.i1.lt.1) then i1=i1+n xf=xf+n*dx endif if(ibc_right.eq.0.and.i1.gt.n) then i1=i1-n xf=xf-n*dx 108 endif if(ibc_bot.eq.0.and.j1.lt.1)then j1=j1+m yf=yf+m*dy endif if(ibc_top.eq.0.and.j1.gt.m) then j1=j1-m yf=yf-m*dy endif However, the mirror/symmetric boundary handling only flips the direction vector: ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.xf.le.tolerance) dir(1) = -dir(1) if(ibc_right.eq.5.and.xf.ge.(n*dx-tolerance)) dir(1) = -dir(1) if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) There is no corresponding restoration of i1 or j1 to a valid in-domain cell. Therefore, if a photon crosses the left boundary, i1 becomes 0; if it crosses the right boundary, i1 becomes n+1; if it crosses the low-y boundary, j1 becomes 0; and if it crosses the high-y boundary, j1 becomes m+1. The direction may be reflected, but the next evaluation of the do while condition terminates the loop because the cell index is out of range. Impact This bug can cause photon leakage through mirror boundaries. Consequences may include: • Under-counting photon residence/absorption near mirror boundaries. • Incorrect radiation energy deposition near domain edges. • Loss of the intended symmetry/no-flux behavior for radiation transport. • Boundary-condition-dependent bias in Monte Carlo radiation results. Mirror boundaries should be handled similarly to cyclic boundaries: after a crossing moves i1 or j1 out of range, the code should restore the index to the adjacent in-domain cell, reflect the position across the boundary plane, and flip the appropriate direction component. ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.i1.lt.1) then i1=1 xf=max(tolerance,-xf) dir(1)=-dir(1) endif if(ibc_right.eq.5.and.i1.gt.n) then i1=n xf=min(n*dx-tolerance,2.0_prec*n*dx-xf) dir(1)=-dir(1) endif if(ibc_bot.eq.5.and.j1.lt.1) then j1=1 yf=max(tolerance,-yf) dir(2)=-dir(2) 109 endif if(ibc_top.eq.5.and.j1.gt.m) then j1=m yf=min(m*dy-tolerance,2.0_prec*m*dy-yf) dir(2)=-dir(2) endif Git evidence: 070ccdf (2026-06-08, firebrand reflection boundaries); 7b1ccb0 (2026-06-04, Monte Carlo and solar mirror support); dc9c30c (2026-06-08, radiation/firebrand mirror-boundary enabling). Radiation and solar mirror handling was added/cleaned up, and the previous hard stops for combining mirror boundaries with radiation or firebrands were removed once the reflected-boundary paths existed. # 070ccdf Added reflection boundaries to firebrands and cleaned up monteCarlo reflections. # Full command: git show --find-renames --unified=3 070ccdf -- CODE-dev/Radiation/monteCarlo_rad.F90 index 15f9ea1..ad507f3 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -737,7 +737,7 @@ subroutine shoot_photons zf=zf+dir(3)*t ! Cyclic boundary conditions implementation - if(ibc_left.eq.0.and.ibc_right.eq.0)then !JSM Change this to ibc_left, etc. + if(ibc_left.eq.0.and.ibc_right.eq.0)then if(i1.lt.1)then i1=i1+n xf=xf+n*dx # 7b1ccb0 Cleaned montecarlo, added mirror/symmetric into solarHeat_veg, and changed comparisons to ,→ use tolerance constant. # Full command: git show --find-renames --unified=3 7b1ccb0 -- CODE-dev/Radiation/monteCarlo_rad.F90 index 68046f0..15f9ea1 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -756,6 +756,7 @@ subroutine shoot_photons endif endif endif ! lopt.gt.0 + ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.xf.le.tolerance) dir(1) = -dir(1) if(ibc_right.eq.5.and.xf.ge.(n*dx-tolerance)) dir(1) = -dir(1) if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) # dc9c30c Removed stops for rad and fbrands on with mirror boundaries and split cyclic conditions for ,→ each side. # Full command: git show --find-renames --unified=3 dc9c30c -- CODE-dev/Radiation/monteCarlo_rad.F90 index ad507f3..5d477be 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -737,23 +737,21 @@ subroutine shoot_photons zf=zf+dir(3)*t 110 FIRETEC Bug Resolution Log June 2026 ! Cyclic boundary conditions implementation - if(ibc_left.eq.0.and.ibc_right.eq.0)then - if(i1.lt.1)then - i1=i1+n - xf=xf+n*dx - elseif(i1.gt.n)then - i1=i1-n - xf=xf-n*dx - endif + if(ibc_left.eq.0.and.i1.lt.1) then + i1=i1+n + xf=xf+n*dx endif - if(ibc_top.eq.0.and.ibc_bot.eq.0)then - if(j1.lt.1)then - j1=j1+m - yf=yf+m*dy - elseif(j1.gt.m)then - j1=j1-m - yf=yf-m*dy - endif + if(ibc_right.eq.0.and.i1.gt.n) then + i1=i1-n + xf=xf-n*dx + endif + if(ibc_bot.eq.0.and.j1.lt.1)then + j1=j1+m + yf=yf+m*dy + endif + if(ibc_top.eq.0.and.j1.gt.m) then + j1=j1-m + yf=yf-m*dy endif endif ! lopt.gt.0 ! Mirror / symmetric boundary conditions 111 BUG-2026-06-015: Top/bottom symmetric-boundary checks are reversed in ray-tracing mirror logic Summary The ray-tracing mirror/symmetric boundary checks for the y-direction appear to use the wrong boundary-condition variables in both: • Monte-Carlo radiation photon tracing, in shoot_photons • Solar shade/heating ray tracing, in solarHeating The current logic checks: if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) This is reversed. In the rest of the codebase, the convention is: • Bottom y-boundary: yf <= 0 • Top y-boundary: yf >= m*dy Therefore the mirror checks should be: if(ibc_bot.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) if(ibc_top.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) The x-direction checks appear consistent. Affected code Both shoot_photons and solarHeating contain the same reversed y-direction mirror boundary conditions. Impact This bug is masked when both top and bottom boundaries are symmetric, but if the user configures asymmetric y-boundaries, for example: ibc_bot = 5 ibc_top = 1 then rays hitting the bottom boundary will not be reflected as intended, while top-boundary behavior may be incorrectly controlled by the bottom setting. This can affect: • Radiative absorption/distribution from Monte-Carlo photons • Solar shading/insolation calculations • Vegetation heating rates • Any cases using symmetric/mirror boundary conditions only on one y-boundary 112 - if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) - if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) + if(ibc_bot.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) + if(ibc_top.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) Git evidence: 4343edc (2026-06-10, top/bottom mirror-boundary fix). The ray-tracing mirror-boundary definitions were corrected so top and bottom boundary tests use the proper side. # 4343edc Fix for bug 2 from Colby list on June 9, top and bot were swapped in mirror boundary ,→ definitions. # Full command: git show --find-renames --unified=3 4343edc -- CODE-dev/Radiation/monteCarlo_rad.F90 ,→ CODE-dev/Vegetation/solarHeat_veg.F90 index cfae5f6..8333fb1 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -757,8 +757,8 @@ subroutine shoot_photons ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.xf.le.tolerance) dir(1) = -dir(1) if(ibc_right.eq.5.and.xf.ge.(n*dx-tolerance)) dir(1) = -dir(1) - if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) - if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) + if(ibc_bot.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) + if(ibc_top.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) enddo if(i1.ge.1.and.i1.le.n.and.j1.ge.1.and.j1.le.m.and. & k1.ge.1.and.k1.le.lmc) & index 52fb3c1..2b4744f 100644 +++ b/CODE-dev/Vegetation/solarHeat_veg.F90 @@ -203,8 +203,8 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & ! Mirror / symmetric boundary conditions if(ibc_left.eq.5.and.xf.le.tolerance) dir(1) = -dir(1) if(ibc_right.eq.5.and.xf.ge.(n*dx-tolerance)) dir(1) = -dir(1) - if(ibc_top.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) - if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) + if(ibc_bot.eq.5.and.yf.le.tolerance) dir(2) = -dir(2) + if(ibc_top.eq.5.and.yf.ge.(m*dy-tolerance)) dir(2) = -dir(2) enddo endif enddo 113 BUG-2026-06-016: shoot_photons bottom-surface quadratic branch tests acoeftop instead of acoefbot Summary In the Monte Carlo radiation photon-tracing routine shoot_photons, the bottom-surface intersection logic computes bottom-face quadratic coefficients: • acoefbot • bcoefbot • ccoefbot but then incorrectly tests acoeftop when deciding whether the bottom-surface equation is linear or quadratic. The bottom branch should test acoefbot, not acoeftop. Current buggy code if(kt.le.0)then if(abs(acoeftop).lt.tolerance)then !a.eq.0 if(ccoefbot*bcoefbot.lt.0.) tz=-ccoefbot/bcoefbot else delta=bcoefbot**2-4*acoefbot*ccoefbot if(delta.gt.0.)then tz1=-0.5*(bcoefbot-sqrt(delta))/acoefbot tz2=-0.5*(bcoefbot+sqrt(delta))/acoefbot if(tz1.gt.0.)then tz=tz1 if(tz2.gt.0.) tz=min(tz1,tz2) elseif(tz2.gt.0.)then tz=tz2 endif endif endif elseif(abs(acoeftop).gt.tolerance)then if(bcoefbot*acoefbot.lt.0) tz=-bcoefbot/acoefbot endif Why this is incorrect The top and bottom cell faces may have different bilinear surface shapes, especially in terrain-following grids, fuel-zone AZ layers, or non-planar cells. The a coefficient determines whether the ray/surface intersection should be solved as a linear equation or a quadratic equation. For the top face, the correct coefficient is acoeftop. For the bottom face, the correct coefficient is acoefbot. Using acoeftop in the bottom branch can cause the code to: • Treat a genuinely quadratic bottom surface as linear. 114 • Treat a nearly linear bottom surface as quadratic. • Divide by a near-zero acoefbot in the quadratic formula. • Skip valid bottom intersections. • Choose the wrong photon exit face. • Produce incorrect absorption locations and radiative energy deposition. - if(abs(acoeftop).lt.tolerance)then + if(abs(acoefbot).lt.tolerance)then ... - elseif(abs(acoeftop).gt.tolerance)then + elseif(abs(acoefbot).gt.tolerance)then Impact This bug affects photon transport in the Monte Carlo radiation model. Potential consequences include: • Incorrect photon crossing distance tz • Wrong face selected as the next photon exit face • Incorrect movement between AZ cells • Incorrect photon absorption counts • Incorrect radiative heating/cooling • Possible numerical instability The issue is likely hidden for flat or nearly planar cells. It is more likely to matter for non-flat topography, terrain-following distorted cells, and complex fuel-zone structures. Git evidence: 5e20226 (2026-06-15, radiation acoefbot typo fix); 869ead7 (2026-06-25, boundary-error pass). The bottom-surface photon branch in CODE-dev/Radiation/monteCarlo_rad.F90 was changed from acoeftop to acoefbot; the later boundary-error pass carried the corrected branch forward. # 5e20226 Fixed typo on radiation that changes acoeftop to acoefbot on line 716. # Full command: git show --find-renames --unified=3 5e20226 -- CODE-dev/Radiation/monteCarlo_rad.F90 index 8333fb1..4678fcc 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -713,7 +713,7 @@ subroutine shoot_photons endif endif endif - elseif(abs(acoeftop).gt.tolerance)then ! look for potential second intersection 115 + elseif(abs(acoefbot).gt.tolerance)then ! look for potential second intersection ! here we use the fact that ccoef should be equal to 0 in this case (suivvox(3)=-1) if(bcoefbot*acoefbot.lt.0) tz=-bcoefbot/acoefbot ! choose the second root when ,→ positive (first should be 0) endif # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/Radiation/monteCarlo_rad.F90 index 504972f..08fd36a 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -11,7 +11,7 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & use radiation_general_variables, only : fsiesrad,firad use radiation_montecarlo_variables, only : Etot,Emin - use constants, only : pref,sigma + use constants, only : pref ! Local Variables @@ -653,7 +653,7 @@ subroutine shoot_photons (xf/dx-(i1-1))*(yf/dy-(j1-1))) if(kt.le.0)then - if(abs(acoeftop).lt.tolerance)then !a.eq.0 + if(abs(acoefbot).lt.tolerance)then !a.eq.0 if(ccoefbot*bcoefbot.lt.0.0_wp) tz=-ccoefbot/bcoefbot ! correct intersection with tz ,→ >0 else delta=bcoefbot**2-4*acoefbot*ccoefbot 116 BUG-2026-06-017: Missing cyclic-pair validation allows inconsistent MPI/domain boundary state Summary Removing cyclic-pair validation allows one-sided periodic boundaries that conflict with MPI halo topology and domain physics. The previous validation required cyclic boundary conditions to be paired by direction. Those checks were removed. As a result, invalid asymmetric configurations such as: ibc_left = 0 ibc_right = 1 are now accepted. However, setup_MPI still constructs MPI neighbors using periodic wraparound in both horizontal directions. That means halo exchange remains toroidal even if only one side is declared cyclic. The resulting configuration is internally inconsistent: one global edge wraps periodically while the opposite edge is treated as a physical/non-cyclic boundary. Why this is a real bug setup_MPI always builds wraparound neighbors. For x-direction: peleft=mpi_rank-1 if (peleft<((mpos-1)*nprocx)) peleft=mpi_rank+(nprocx-1) peright=mpi_rank+1 if (peright>(mpos*nprocx-1)) peright=mpi_rank-(nprocx-1) So the MPI topology is always periodic/toroidal. But physical edge flags are set independently: if((ibc_right.gt.0).and.(mod((mpi_rank+1),nprocx)==0)) rightedge=1 if((ibc_left.gt.0).and.(mod((mpi_rank+1),nprocx)==1.or.nprocx==1)) & leftedge=1 This means ibc_left = 0, ibc_right = 1 creates behavior where the left global boundary is treated as cyclic, the right global boundary is treated as physical, and MPI halo exchange still wraps left/right processors. Impact This can cause silent numerical/physical errors, including: • Wrong halo values near one boundary • Inconsistent gradients near lateral edges • Non-conservative or asymmetric transport 117 • Incorrect advection near boundaries • Incorrect radiation ray wrapping • Incorrect firebrand wrapping/removal behavior • Inconsistent topography/metric ghost cells • Hard-to-debug boundary artifacts The issue is especially dangerous because the simulation can continue without crashing. Expected behavior The code should reject configurations where only one side of a horizontal pair is cyclic. Valid examples: ibc_left = 0 ibc_right = 0 ibc_left = 1 ibc_right = 5 Invalid examples: ibc_left = 0 ibc_right = 1 ibc_bot = 0 ibc_top = 3 The key rule is: For each horizontal direction, cyclicity must be paired. Either both sides are 0, or neither side is 0. Restore validation in setup_MPI after MPI initialization: if ((ibc_left.eq.0) .neqv. (ibc_right.eq.0)) then print*,’BOUNDARY␣CONDITION␣ERROR’ print*,’ibc_left␣and␣ibc_right␣must␣both␣be␣cyclic␣or␣both␣non-cyclic’ print*,’Cyclic␣boundary␣condition␣value␣is␣0’ print*,’ibc_left␣=’,ibc_left,’␣ibc_right␣=’,ibc_right endif call mpi_finalize(ierror) STOP endif if ((ibc_bot.eq.0) .neqv. (ibc_top.eq.0)) then print*,’BOUNDARY␣CONDITION␣ERROR’ print*,’ibc_bot␣and␣ibc_top␣must␣both␣be␣cyclic␣or␣both␣non-cyclic’ print*,’Cyclic␣boundary␣condition␣value␣is␣0’ print*,’ibc_bot␣=’,ibc_bot,’␣ibc_top␣=’,ibc_top endif call mpi_finalize(ierror) STOP endif 118 Git evidence: 6ca071a (2026-06-17, cyclic-pair validation); b2f594b (2026-06-17, cyclic-condition messages). Input validation was added to stop when cyclic conditions are configured without the required matching opposite side, and the diagnostic messages were tightened afterward. # 6ca071a Adding the stop if cyclic conditions are defined without matching opposite sides. # Full command: git show --find-renames --unified=3 6ca071a -- CODE-dev/input.F90 index 65c1626..eec6586 100644 +++ b/CODE-dev/input.F90 @@ -56,6 +56,30 @@ subroutine input if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + if(ibc_top.eq.0.and.ibc_bot.ne.0) then + print*,’CANNOT HAVE CYCLIC CONDITIONS ON TOP BUT NOT ON BOTTOM’ + print*,’Either both ibc_top and ibc_bot are 0 or both are > 0.’ + print*,’If both are > 0, they need not match.’ + STOP + elseif(ibc_bot.eq.0.and.ibc_top.ne.0) then + print*,’CANNOT HAVE CYCLIC CONDITIONS ON TOP BUT NOT ON BOTTOM’ + print*,’Either both ibc_top and ibc_bot are 0 or both are > 0.’ + print*,’If both are > 0, they need not match.’ + STOP + endif + + if(ibc_left.eq.0.and.ibc_right.ne.0) then + print*,’CANNOT HAVE CYCLIC CONDITIONS ON LEFT BUT NOT ON RIGHT’ + print*,’Either both ibc_left and ibc_right are 0 or both are > 0.’ + print*,’If both are > 0, they need not match.’ + STOP + elseif(ibc_right.eq.0.and.ibc_left.ne.0) then + print*,’CANNOT HAVE CYCLIC CONDITIONS ON LEFT BUT NOT ON RIGHT’ + print*,’Either both ibc_left and ibc_right are 0 or both are > 0.’ + print*,’If both are > 0, they need not match.’ + STOP + endif + ! Ambient Conditions call QueryGridlist_real (’tambient’,tambient,48) call QueryGridlist_real (’pressground’,pressground,48) # b2f594b fixed messages for cyclic conditions that stop the program. # Full command: git show --find-renames --unified=3 b2f594b -- CODE-dev/input.F90 index eec6586..26594df 100644 +++ b/CODE-dev/input.F90 @@ -62,7 +62,7 @@ subroutine input print*,’If both are > 0, they need not match.’ STOP elseif(ibc_bot.eq.0.and.ibc_top.ne.0) then - print*,’CANNOT HAVE CYCLIC CONDITIONS ON TOP BUT NOT ON BOTTOM’ + print*,’CANNOT HAVE CYCLIC CONDITIONS ON BOTTOM BUT NOT ON TOP’ 119 FIRETEC Bug Resolution Log June 2026 print*,’Either both ibc_top and ibc_bot are 0 or both are > 0.’ print*,’If both are > 0, they need not match.’ STOP @@ -74,7 +74,7 @@ subroutine input print*,’If both are > 0, they need not match.’ STOP elseif(ibc_right.eq.0.and.ibc_left.ne.0) then - print*,’CANNOT HAVE CYCLIC CONDITIONS ON LEFT BUT NOT ON RIGHT’ + print*,’CANNOT HAVE CYCLIC CONDITIONS ON RIGHT BUT NOT ON LEFT’ print*,’Either both ibc_left and ibc_right are 0 or both are > 0.’ print*,’If both are > 0, they need not match.’ STOP 120 BUG-2026-06-018: Initialize integer MPI status array with integer literal Summary update declares sndrcvStatus as an integer array, but initializes it with a real literal: integer, allocatable :: sndrcvStatus(:) ... sndrcvStatus = 0.0 This should be initialized with an integer literal instead: sndrcvStatus = 0 Impact This is not a functional bug in standard Fortran, since 0.0 is converted to integer 0 on assignment. However, it is: • type-inconsistent, • potentially warning-generating with stricter compiler flags, • less clear than using an integer literal for an integer MPI status array. - allocate(sndrcvStatus(mpi_status_size)); sndrcvStatus = 0.0 + allocate(sndrcvStatus(mpi_status_size)); sndrcvStatus = 0 Git evidence: 7c10434 (2026-06-11, integer MPI status initialization). The committed change initializes sndrcvStatus with integer zero in CODE-dev/update.F90. # 7c10434 Bug 6 on Colbys list from June 9, initialize sndrcvStatus with integer 0 instead of 0.0 in ,→ update # Full command: git show --find-renames --unified=3 7c10434 -- CODE-dev/update.F90 index e1f2dee..5ddbe79 100644 +++ b/CODE-dev/update.F90 @@ -79,7 +79,7 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) allocate(tmpyrcv(nybuf)); tmpyrcv = 0.0 allocate(tmpcorsnd(ncorbuf)); tmpcorsnd = 0.0 allocate(tmpcorrcv(ncorbuf)); tmpcorrcv = 0.0 - allocate(sndrcvStatus(mpi_status_size)); sndrcvStatus = 0.0 + allocate(sndrcvStatus(mpi_status_size)); sndrcvStatus = 0 ... [diff excerpt truncated; run the command above for the full commit diff] 121 BUG-2026-06-019: Symmetric BC support for radiation/solar is broken, and firebrands are not safe enough Summary Removing the input guards that disallowed radiation and firebrands with symmetric boundary conditions introduces a real regression. • Radiation / solarHeating: symmetric reflection is currently incorrect. • Firebrands: reflection is closer to correct, but exact-boundary handling can still produce invalid processor assignment. Actual behavior 1. Radiation / solar rays do not properly reflect Both shoot_photons and solarHeating only flip direction at symmetric boundaries but do not reset i1 / j1 or move xf / yf back inside the valid domain. Result: symmetric boundaries behave like leaky/absorbing boundaries rather than mirrors. 2. Top/bot checks are reversed in radiation/solar Current code: if(ibc_top.eq.5.and.yf.le.tolerance) ... if(ibc_bot.eq.5.and.yf.ge.(m*dy-tolerance)) ... But geometrically: • yf <= 0 is the bottom • yf >= m*dy is the top So those conditions are reversed. 3. Firebrand reflection still has unsafe exact-boundary cases evolveFB does perform a real reflection, but it still allows exact-boundary values to persist. If xvbrand ,→ (it,ix) == n*dx, then after reflection it is still n*dx. Later processor ownership computation can produce an invalid mpi_rank_fb. 4. Firebrand feature maturity concern The igniteFB() subroutine is empty/stubbed out, indicating the feature is not fully implemented. Immediate safe fix Restore the removed input guards for: • radiation with symmetric BCs 122 • firebrands with symmetric BCs This is the safest short-term fix and matches current implementation reality. Follow-up fix If symmetric support is intended to remain enabled: • fix ray reflection in shoot_photons • fix ray reflection in solarHeating • clamp reflected firebrands strictly inside the domain • clamp processor assignment inputs • add targeted tests before removing guards again Git evidence: 070ccdf (2026-06-08, firebrand reflection boundaries); 3a1258c (2026-06-08, firebrand mirror-boundary fixes); dc9c30c (2026-06-08, radiation/firebrand mirror-boundary enabling); 6102606 (2026-06-04, cyclic/symmetric boundary support). Symmetric/mirror behavior was added across radiation, solar heating, cyclic boundaries, and firebrands. The later firebrand commits split boundary checks and made the mirror paths safer before the old stops were removed. # 070ccdf Added reflection boundaries to firebrands and cleaned up monteCarlo reflections. # Full command: git show --find-renames --unified=3 070ccdf -- CODE-dev/Firebrands/evolve_fb.F90 CODE- ,→ dev/Radiation/monteCarlo_rad.F90 index d5342a3..c13aabb 100644 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -3,7 +3,8 @@ !----------------------------------------------------------------------- subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & il,iu,jl,ju,lls) - use gridlist_variables, only : prec,n,m,l,dx,dy,dz,ibcx,ibcy + use gridlist_variables, only : prec,n,m,l,dx,dy,dz,ibc_left,ibc_right, & + ibc_top,ibc_bot use firebrand_gridlist_variables, only : shapeFB,dsizeFB use firebrand_general_variables, only : Cd_dsk,Cd_cyl,Cd_sph, & numBrands,xvbrand,nvbrand,ix,iy,iz,iuvel,ivvel,iwvel,irad,ihght,irho @@ -120,29 +121,41 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & retain(it)=.false. numBrand=numBrand-1 else if(xvbrand(it,ix).le.0)then ! Outside x domain - if(ibcx.eq.0)then + if(ibc_left.eq.0.and.ibc_right.eq.0)then xvbrand(it,ix)=n*dx+xvbrand(it,ix) + elseif(ibc_left.eq.5) then + xvbrand(it,ix)= -xvbrand(it,ix) + xvbrand(it,iuvel)=-xvbrand(it,iuvel) else retain(it)=.false. numBrand=numBrand-1 endif 123 else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain - if(ibcx.eq.0)then + if(ibc_left.eq.0.and.ibc_right.eq.0)then xvbrand(it,ix)=xvbrand(it,ix)-n*dx + elseif(ibc_right.eq.5) then + xvbrand(it,ix)=n*dx-(xvbrand(it,ix)-(n*dx)) + xvbrand(it,iuvel)=-xvbrand(it,iuvel) else retain(it)=.false. numBrand=numBrand-1 endif else if(xvbrand(it,iy).le.0)then ! Outside y domain - if(ibcy.eq.0)then + if(ibc_top.eq.0.and.ibc_bot.eq.0)then ... [diff excerpt truncated; run the command above for the full commit diff] # 3a1258c Fixed Firebrands mirror boundaries. # Full command: git show --find-renames --unified=3 3a1258c -- CODE-dev/Firebrands/evolve_fb.F90 index c13aabb..4b8f499 100644 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -121,7 +121,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & retain(it)=.false. numBrand=numBrand-1 else if(xvbrand(it,ix).le.0)then ! Outside x domain - if(ibc_left.eq.0.and.ibc_right.eq.0)then + if(ibc_left.eq.0)then xvbrand(it,ix)=n*dx+xvbrand(it,ix) xvbrand(it,ix)= -xvbrand(it,ix) @@ -131,7 +131,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & numBrand=numBrand-1 endif else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain - if(ibc_left.eq.0.and.ibc_right.eq.0)then + if(ibc_right.eq.0)then xvbrand(it,ix)=xvbrand(it,ix)-n*dx xvbrand(it,ix)=n*dx-(xvbrand(it,ix)-(n*dx)) @@ -141,7 +141,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & numBrand=numBrand-1 endif else if(xvbrand(it,iy).le.0)then ! Outside y domain - if(ibc_top.eq.0.and.ibc_bot.eq.0)then + if(ibc_bot.eq.0)then xvbrand(it,iy)=m*dy+xvbrand(it,iy) elseif(ibc_bot.eq.5) then xvbrand(it,iy)=-xvbrand(it,iy) @@ -151,11 +151,11 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & numBrand=numBrand-1 endif else if(xvbrand(it,iy).ge.m*dy)then ! Outside y domain - if(ibc_top.eq.0.and.ibc_bot.eq.0)then + if(ibc_top.eq.0)then xvbrand(it,iy)=xvbrand(it,iy)-m*dy - xvbrand(it,ivvel)=-xvbrand(it,ivvel) - elseif(ibc_bot.eq.5) then + elseif(ibc_top.eq.5) then xvbrand(it,iy)=m*dy-(xvbrand(it,iy)-(m*dy)) 124 ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. Overview This list contains bugs related to boundary and corner cell handling in the MPI halo exchange routine, including mirror/reflective boundary condition implementation issues. 125 BUG-2026-06-020: Bottom-right corner uses topedge instead of botedge Summary The bottom-right corner logic in update.F90 checks topedge in two places where it should check botedge. Affected locations • update.F90:592 • update.F90:636 Current code if(topedge.eq.1.and.rightedge.eq.1) then ! Domain bot right corner and later in the same bottom-right block: else if(topedge.eq.1) then This block is explicitly handling the bottom-right corner. The comment says Domain bot right corner, the write indices are bottom ghost/corner cells: a(nxp+i,1-j,k) and the branch uses bottom-boundary logic: ibc_bot Therefore the edge test should use botedge, not topedge. Impact On processors that are on the physical bottom boundary but not the top boundary, the intended bottom-right corner boundary logic will not run. Conversely, processors on the top-right boundary may incorrectly enter bottom-corner handling. This can corrupt ghost/corner cells near a(nxp+i,1-j,k). if(botedge.eq.1.and.rightedge.eq.1) then ! Domain bot right corner and: else if(botedge.eq.1) then 126 Git evidence: 0792741 (2026-06-15, mirrored-boundary corner rewrite); 23370e2 (2026-06-18, multi-halo mirror reflection). The mirrored-boundary corner implementation in CODE-dev/update.F90 was rewritten, then extended so mirror reflection applies across multiple halo cells rather than only the edge cell. # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/update.F90 index 5ddbe79..e357b19 100644 +++ b/CODE-dev/update.F90 @@ -37,12 +37,13 @@ ! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) +subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove + rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & + MPI_Sendrecv #if DBL_PREC #else @@ -53,13 +54,12 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) ! Local Variables integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv - real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) - integer :: icnt,itag,iref,jref,ncount + integer :: itag,ncount real(prec),allocatable :: tmpxsnd(:),tmpxrcv(:),tmpysnd(:), & @@ -73,102 +73,125 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp - allocate(tmpxsnd(nxbuf)); tmpxsnd = 0.0 - allocate(tmpxrcv(nxbuf)); tmpxrcv = 0.0 - allocate(tmpysnd(nybuf)); tmpysnd = 0.0 ... [diff excerpt truncated; run the command above for the full commit diff] # 23370e2 Cleaned up update so that mirror reflects more than just the edge but interior to the domain ,→ for multiple halo cells. # Full command: git show --find-renames --unified=3 23370e2 -- CODE-dev/update.F90 127 index e357b19..e3295d7 100644 +++ b/CODE-dev/update.F90 @@ -42,9 +42,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & - MPI_Sendrecv -#if DBL_PREC + rightedge,peleftbelow,perightbelow,peleftabove,perightabove +#ifdef DBL_PREC #else use msga_variables, only : mpi_real @@ -57,7 +56,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) - integer :: i0,j0 + integer :: i0,j0,imirror,jmirror @@ -69,6 +68,10 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) j0=0 if(iperiod.eq.1) i0=1 if(iperiod.eq.2) j0=1 + imirror=1 + jmirror=1 + if(iuv.eq.1) imirror=-1 + if(iuv.eq.2) jmirror=-1 nxbuf=nxp*ih*nzp nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp @@ -77,7 +80,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) allocate(tmpcorsnd(ncorbuf),tmpcorrcv(ncorbuf)) - if(icorner.ne.2) then + if(icorner.ne.2)then ... [diff excerpt truncated; run the command above for the full commit diff] 128 BUG-2026-06-021: Upper-left corner send omits i0/j0 staggered-grid offsets Summary The upper-left corner send buffer in update.F90 omits the iperiod-dependent staggered-grid offsets i0 and j0. Affected location • update.F90:578 Current code tmpcorsnd(ncount)=a(i,nyp-ih+j,k) The other corner-send blocks apply the iperiod-dependent offsets i0 and/or j0 so that staggered variables send the correct interior strip. For example, the other corner sends use patterns like: a(nxp-i0-ih+i,nyp-j0-ih+j,k) a(nxp-i0-ih+i,j+j0,k) a(i+i0,j+j0,k) The upper-left send should be symmetric with those blocks and should include both offsets: a(i+i0,nyp-j0-ih+j,k) Impact For cell-centered variables this may be masked when i0 = 0 and j0 = 0. For staggered variables, especially those using iperiod = 1 or iperiod = 2, the wrong strip of interior cells can be sent to the diagonal neighbor. This affects corner ghost-cell values exchanged with perightbelow. tmpcorsnd(ncount)=a(i+i0,nyp-j0-ih+j,k) Git evidence: 0792741 (2026-06-15, mirrored-boundary corner rewrite); 23370e2 (2026-06-18, multi-halo mirror reflection). The upper-left and related corner sends were folded into the new corner-send logic that accounts for staggered-grid offsets and multi-halo reflection. 129 # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/update.F90 index 5ddbe79..e357b19 100644 +++ b/CODE-dev/update.F90 @@ -37,12 +37,13 @@ ! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) +subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove + rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & + MPI_Sendrecv #if DBL_PREC #else @@ -53,13 +54,12 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) ! Local Variables integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv - real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) - integer :: icnt,itag,iref,jref,ncount + integer :: itag,ncount real(prec),allocatable :: tmpxsnd(:),tmpxrcv(:),tmpysnd(:), & @@ -73,102 +73,125 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp - allocate(tmpxsnd(nxbuf)); tmpxsnd = 0.0 - allocate(tmpxrcv(nxbuf)); tmpxrcv = 0.0 - allocate(tmpysnd(nybuf)); tmpysnd = 0.0 ... [diff excerpt truncated; run the command above for the full commit diff] # 23370e2 Cleaned up update so that mirror reflects more than just the edge but interior to the domain ,→ for multiple halo cells. # Full command: git show --find-renames --unified=3 23370e2 -- CODE-dev/update.F90 index e357b19..e3295d7 100644 +++ b/CODE-dev/update.F90 @@ -42,9 +42,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & 130 - MPI_Sendrecv -#if DBL_PREC + rightedge,peleftbelow,perightbelow,peleftabove,perightabove +#ifdef DBL_PREC #else use msga_variables, only : mpi_real @@ -57,7 +56,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) - integer :: i0,j0 + integer :: i0,j0,imirror,jmirror @@ -69,6 +68,10 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) j0=0 if(iperiod.eq.1) i0=1 if(iperiod.eq.2) j0=1 + imirror=1 + jmirror=1 + if(iuv.eq.1) imirror=-1 + if(iuv.eq.2) jmirror=-1 nxbuf=nxp*ih*nzp nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp @@ -77,7 +80,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) allocate(tmpcorsnd(ncorbuf),tmpcorrcv(ncorbuf)) - if(icorner.ne.2) then + if(icorner.ne.2)then ... [diff excerpt truncated; run the command above for the full commit diff] 131 BUG-2026-06-022: Inconsistent DBL_PREC preprocessor guard Summary The DBL_PREC preprocessor guard at line 47 of update.F90 uses #if DBL_PREC while the rest of the file uses #ifdef DBL_PREC. Affected location • update.F90:47 Current code #if DBL_PREC Why this is worth fixing The rest of the file uses: #ifdef DBL_PREC If the build system always defines DBL_PREC with a numeric value, #if DBL_PREC is probably fine. However, #ifdef DBL_PREC is more consistent with the rest of this file and more robust if the macro is defined without an explicit value. Impact This is a low-risk robustness issue, not a confirmed boundary/corner correctness bug. #ifdef DBL_PREC Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, The precision configuration was consolidated around shared precision definitions and the unified MPI real datatype. Later follow-ups fixed missed precision sites and cleaned up boundary code affected by the precision conversion. # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/CMakeLists.txt CODE-dev/ ,→ Emissions/deposit_ems.F90 132 index 8214c12..15edeeb 100644 +++ b/CODE-dev/CMakeLists.txt @@ -20,6 +20,15 @@ endif() add_compile_options(-O2 -g) #add_compile_options(-Wall -Wextra -Werror -fbounds-check -pedantic -fcheck=all) +# Option for precision +option(DBL_PREC "Use double precision" OFF) #default is single precision unless: cmake .. -DDBL_PREC= ,→ ON +if(DBL_PREC) + add_compile_definitions(DBL_PREC) + message(STATUS "Building with DOUBLE PRECISION") +else() + message(STATUS "Building with SINGLE PRECISION") +endif() + # Find dependencies find_package(MPI REQUIRED COMPONENTS Fortran) include_directories(${MPI_Fortran_INCLUDE_PATH}) index c8ea749..1bd5ca1 100644 +++ b/CODE-dev/Emissions/deposit_ems.F90 @@ -21,7 +21,7 @@ subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & real(prec),intent(in) :: sizeScale(nfuel,il:iu,jl:ju,lls) - real(prec) :: zeta=0.95 ! Water aerosols (Stulov, Murashkevich, and Fuchs, Journal of Aerosol ,→ Science (1978)) + real(prec) :: zeta=0.95_prec ! Water aerosols (Stulov, Murashkevich, and Fuchs, Journal of Aerosol ,→ Science (1978)) real(prec) :: av real(prec) :: iM real(prec),external :: LagrangeInterp,zcart @@ -33,16 +33,16 @@ subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & do k=1,lls do it=1,nAero do r=1,nMAero - iM=LagrangeInterp(nMAero,r-1./2., & + iM=LagrangeInterp(nMAero,r-1.0_prec/2.0_prec, & xvAero(i,j,k,nMAero*(it-1)+1:nMAero*it)) - av=0. + av=0.0_prec ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/update.F90 index e3295d7..26618be 100644 +++ b/CODE-dev/update.F90 @@ -43,11 +43,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & -#ifdef DBL_PREC -#else 133 FIRETEC Bug Resolution Log June 2026 -#endif + use msga_variables, only : mpi_prec use gridsetup, only : timestep @@ -93,14 +89,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1000 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,pebelow, & - itag,tmpxrcv,ncount,mpi_double_precision,peabove,itag, & -#else - call MPI_Sendrecv(tmpxsnd,ncount,mpi_real,pebelow,itag,tmpxrcv, & - ncount,mpi_real,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) -#endif + call MPI_Sendrecv(tmpxsnd,ncount,mpi_prec,pebelow,itag,tmpxrcv, & + ncount,mpi_prec,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) ncount=0 do k=1,nzp @@ -143,14 +133,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1100 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,peabove, & - itag,tmpxrcv,ncount,mpi_double_precision,pebelow,itag, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 134 BUG-2026-06-023: ibc=5 mirror/reflective boundary uses constant extrapolation instead of true mirrored ghost cells Summary update.F90 currently treats ibc_* = 5 as a "Mirror Velocity" boundary condition, but the implementation only mirrors the sign of the normal velocity component. It does not mirror the spatial index of the interior field into the ghost cells. As a result, for halo width ih > 1, every ghost layer is filled from the same boundary-adjacent interior cell. This is equivalent to constant extrapolation, or zero-gradient fill, with a sign flip for the normal velocity component. It is not a true reflective/mirrored extension of the interior state. This can degrade or corrupt high-order stencils near reflective boundaries, because ghost cells beyond the first layer do not contain the expected reflected interior values. Current behavior At the left boundary, for normal velocity iuv == 1 and ibc_left == 5, the code currently does: a(1-i,j,k) = -a(1,j,k) For ih = 3, this gives: a(0,j,k) = -a(1,j,k) a(-1,j,k) = -a(1,j,k) a(-2,j,k) = -a(1,j,k) All ghost layers are copied from the same boundary cell. Similarly, for non-normal components or scalar fields, the current else branch does: a(1-i,j,k) = a(1,j,k) so all ghost layers are constant copies of the boundary cell. Expected behavior For a true mirror/reflective boundary, each ghost layer should map to the corresponding interior layer. For the left boundary: a(1-i,j,k) = +/- a(i,j,k) For ih = 3, this gives: a(0,j,k) = +/- a(1,j,k) a(-1,j,k) = +/- a(2,j,k) a(-2,j,k) = +/- a(3,j,k) The sign should be negative for the velocity component normal to the reflective wall, and positive for tangential velocity components and scalar fields. 135 FIRETEC Bug Resolution Log June 2026 Why this matters With a one-cell halo, the current implementation and a true mirror implementation are identical for the first ghost cell. The bug becomes important when ih > 1 or when high-order advection, diffusion, filtering, pressure-gradient, or interpolation stencils use multiple ghost layers. Example for a left reflective wall and interior values: i = 1 2 3 u = 10 7 4 Current implementation: i = -2 -1 0 1 2 3 u = -10 -10 -10 10 7 4 True odd reflection: i = -2 -1 0 1 2 3 u = -4 -7 -10 10 7 4 These are not equivalent for any stencil that uses more than one ghost cell. For scalars or tangential components, the same issue exists with even reflection. Current implementation: q = 10 10 10 10 7 4 True even reflection: q = 4 7 10 10 7 4 The current ibc=5 logic only checks whether the field is the normal velocity component. If so, it flips the sign. Otherwise, it falls through to the same Neumann/constant-extension logic used for all other boundary types. This means ibc=5 does not receive a distinct even-reflection path for non-normal components or scalar fields. Proposed fix For physical boundaries where ibc_* == 5: • use odd reflection for the velocity component normal to the boundary; • use even reflection for all other variables; • preserve the existing Neumann/constant-extension behavior for non-reflective boundary types. Suggested test A simple regression test would be to initialize a monotonic field near a reflective boundary with ih >= 3, call update, and verify that the ghost cells are reflected by layer rather than copied from the first interior 136 cell. For example, at the left boundary with ibc_left = 5 and iuv = 1: interior: a(1) = 10 a(2) = 7 a(3) = 4 expected ghost values: a(0) = -10 a(-1) = -7 a(-2) = -4 For a scalar or tangential component under the same boundary: expected ghost values: a(0) = 10 a(-1) = 7 a(-2) = 4 The current code would instead produce: a(0) = +/-10 a(-1) = +/-10 a(-2) = +/-10 which demonstrates the bug. Git evidence: 23370e2 (2026-06-18, multi-halo mirror reflection); 0792741 (2026-06-15, mirrored- boundary corner rewrite). The mirror-boundary implementation was changed from constant edge extrapolation to reflection over the halo depth, including the corner cases introduced by multiple halo cells. # 23370e2 Cleaned up update so that mirror reflects more than just the edge but interior to the domain ,→ for multiple halo cells. # Full command: git show --find-renames --unified=3 23370e2 -- CODE-dev/update.F90 index e357b19..e3295d7 100644 +++ b/CODE-dev/update.F90 @@ -42,9 +42,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & - MPI_Sendrecv -#if DBL_PREC + rightedge,peleftbelow,perightbelow,peleftabove,perightabove +#ifdef DBL_PREC #else use msga_variables, only : mpi_real 137 @@ -57,7 +56,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) - integer :: i0,j0 + integer :: i0,j0,imirror,jmirror @@ -69,6 +68,10 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) j0=0 if(iperiod.eq.1) i0=1 if(iperiod.eq.2) j0=1 + imirror=1 + jmirror=1 + if(iuv.eq.1) imirror=-1 + if(iuv.eq.2) jmirror=-1 nxbuf=nxp*ih*nzp nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp @@ -77,7 +80,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) allocate(tmpcorsnd(ncorbuf),tmpcorrcv(ncorbuf)) - if(icorner.ne.2) then + if(icorner.ne.2)then ... [diff excerpt truncated; run the command above for the full commit diff] # 0792741 Updating update to 1) fix corner implementation of the mirrored boundary layer, 2) eliminate ,→ ae as it wasn’t used, and 3) reduce the number of ’if’ calls. # Full command: git show --find-renames --unified=3 0792741 -- CODE-dev/update.F90 index 5ddbe79..e357b19 100644 +++ b/CODE-dev/update.F90 @@ -37,12 +37,13 @@ ! normal to the particular boundary. ! !----------------------------------------------------------------------- -subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) +subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use gridlist_variables, only : ih,nprocy,prec, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & - rightedge,peleftbelow,perightbelow,peleftabove,perightabove + rightedge,peleftbelow,perightbelow,peleftabove,perightabove, & + MPI_Sendrecv #if DBL_PREC #else @@ -53,13 +54,12 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) ! Local Variables integer,intent(in) :: nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv - real(prec),intent(in) :: ae(il:iu,jl:ju,nzp) 138 - integer :: icnt,itag,iref,jref,ncount + integer :: itag,ncount real(prec),allocatable :: tmpxsnd(:),tmpxrcv(:),tmpysnd(:), & @@ -73,102 +73,125 @@ subroutine update(a,ae,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) nybuf=nyp*ih*nzp ncorbuf=ih*ih*nzp - allocate(tmpxsnd(nxbuf)); tmpxsnd = 0.0 - allocate(tmpxrcv(nxbuf)); tmpxrcv = 0.0 - allocate(tmpysnd(nybuf)); tmpysnd = 0.0 ... [diff excerpt truncated; run the command above for the full commit diff] Overview This list documents a broad precision-portability cleanup across the solver, physics modules, and supporting utilities. The main issues were mixed use of configured-precision variables with default-real literals, hard-coded floating-point kinds, duplicated single-versus-double precision branches, and a handful of interface or MPI-related mismatches. The fixes standardize the implementation on real(prec), _prec literals, and real(...,kind=prec) conversions so the same source behaves consistently in both single- and double-precision builds. 139 BUG-2026-06-024: No proper build-time switch for precision mode Summary The source expected DBL_PREC-gated behavior, but the build system did not expose a clean CMake option to explicitly enable or disable double precision. • CMakeLists.txt Without an explicit build-time switch, the selected floating-point mode is implicit and harder to audit. That makes single- and double-precision builds less reproducible and increases the chance that developers compile with the wrong precision configuration. Impact This can leave precision selection inconsistent across builds and make precision-sensitive debugging harder. Add a dedicated CMake option for DBL_PREC, define the compile macro when enabled, and emit a clear status message indicating whether the build is using single or double precision. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/CMakeLists.txt index 8214c12..15edeeb 100644 +++ b/CODE-dev/CMakeLists.txt @@ -20,6 +20,15 @@ endif() add_compile_options(-O2 -g) #add_compile_options(-Wall -Wextra -Werror -fbounds-check -pedantic -fcheck=all) +# Option for precision +option(DBL_PREC "Use double precision" OFF) #default is single precision unless: cmake .. -DDBL_PREC= ,→ ON +if(DBL_PREC) 140 + add_compile_definitions(DBL_PREC) + message(STATUS "Building with DOUBLE PRECISION") +else() + message(STATUS "Building with SINGLE PRECISION") +endif() + # Find dependencies find_package(MPI REQUIRED COMPONENTS Fortran) include_directories(${MPI_Fortran_INCLUDE_PATH}) # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/CMakeLists.txt index 15edeeb..4f144d3 100644 +++ b/CODE-dev/CMakeLists.txt @@ -23,6 +23,7 @@ add_compile_options(-O2 -g) # Option for precision option(DBL_PREC "Use double precision" OFF) #default is single precision unless: cmake .. -DDBL_PREC= ,→ ON if(DBL_PREC) + set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "DBL_PREC") # COMMENT OUT IF SINGLE ,→ PRECISION add_compile_definitions(DBL_PREC) message(STATUS "Building with DOUBLE PRECISION") else() @@ -34,7 +35,7 @@ find_package(MPI REQUIRED COMPONENTS Fortran) include_directories(${MPI_Fortran_INCLUDE_PATH}) # Module dependecies -#set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "DBL_PREC") # COMMENT OUT IF SINGLE ,→ PRECISION + add_subdirectory(Emissions) add_subdirectory(Firebrands) add_subdirectory(HeatSource) # a849341 Fixed precision bugs, and a single boundary bug. Also made a couple changes to how precision ,→ was called. # Full command: git show --find-renames --unified=3 a849341 -- CODE-dev/CMakeLists.txt index 4f144d3..bc179eb 100644 +++ b/CODE-dev/CMakeLists.txt @@ -35,7 +35,6 @@ find_package(MPI REQUIRED COMPONENTS Fortran) include_directories(${MPI_Fortran_INCLUDE_PATH}) # Module dependecies - add_subdirectory(Emissions) add_subdirectory(Firebrands) add_subdirectory(HeatSource) # 80d0a79 missed prec=4 somewhere # Full command: git show --find-renames --unified=3 80d0a79 -- CODE-dev/Vegetation/rinit_veg.F90 index 739757a..1a8e8b9 100644 +++ b/CODE-dev/Vegetation/rinit_veg.F90 @@ -3,6 +3,7 @@ 141 FIRETEC Bug Resolution Log June 2026 ! FIRETEC for use throughout the simulation !----------------------------------------------------------------------- subroutine rinitVeg + use, intrinsic :: iso_fortran_env, only : real32 use gridlist_variables, only : n,m,nprocx,nprocy,tambient,wp use vegetation_gridlist_variables, only : nfuel,ivegread,cpwood, & ignfile,ifire @@ -143,7 +144,7 @@ contains #ifdef DBL_PREC integer :: i,j,k,iproc,iprocx,jprocy,ia,ja,nsize real(wp),allocatable :: tmparray(:,:,:,:),indata(:,:,:) - real(4),allocatable :: indata_sp(:,:,:) + real(real32),allocatable :: indata_sp(:,:,:) !real32 for data allocate(tmparray(np,mp,nzdim,numprocs)) tmparray = 0.0_wp 142 BUG-2026-06-025: Mixed-kind numeric literals caused precision loss and SP/DP inconsistencies Summary Many routines mixed real(prec) variables with default real literals such as 0., 1.!, 0.5, 1.e-6!, and 2./3.. This introduced implicit kind conversion into arithmetic that was intended to follow the configured precision kind. • Emissions/deposit_ems.F90 • Emissions/input_ems.F90 • MOA.F90 • advectionScheme.F90 • variables.F90 • many similar files in emissions, vegetation, radiation, and turbulence code Default real literals are not guaranteed to match the configured prec kind. When they are combined with real(prec) variables, compilers may insert implicit conversions or evaluate parts of the expression at a different precision than intended. Impact These mixed-kind expressions can reduce numerical consistency, trigger compiler diagnostics, and produce different behavior between single- and double-precision builds. Convert default real literals to kind-safe forms such as 0.0_prec, 1.0_prec, 0.5_prec, and 2.0_prec/3.0_prec throughout the affected formulas. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/Emissions/deposit_ems.F90 CODE ,→ -dev/Emissions/input_ems.F90 CODE-dev/MOA.F90 index c8ea749..1bd5ca1 100644 143 +++ b/CODE-dev/Emissions/deposit_ems.F90 @@ -21,7 +21,7 @@ subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & real(prec),intent(in) :: sizeScale(nfuel,il:iu,jl:ju,lls) - real(prec) :: zeta=0.95 ! Water aerosols (Stulov, Murashkevich, and Fuchs, Journal of Aerosol ,→ Science (1978)) + real(prec) :: zeta=0.95_prec ! Water aerosols (Stulov, Murashkevich, and Fuchs, Journal of Aerosol ,→ Science (1978)) real(prec) :: av real(prec) :: iM real(prec),external :: LagrangeInterp,zcart @@ -33,16 +33,16 @@ subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & do k=1,lls do it=1,nAero do r=1,nMAero - iM=LagrangeInterp(nMAero,r-1./2., & + iM=LagrangeInterp(nMAero,r-1.0_prec/2.0_prec, & xvAero(i,j,k,nMAero*(it-1)+1:nMAero*it)) - av=0. + av=0.0_prec do ift=1,nfuel - av=av+2.*(rhoFuel(ift,i,j,k)/rhoMicro)/ & + av=av+2.0_prec*(rhoFuel(ift,i,j,k)/rhoMicro)/ & sizeScale(ift,i,j,k) enddo forcingAero(i,j,k,nMAero*(it-1)+r)= & forcingAero(i,j,k,nMAero*(it-1)+r)- & - zeta*av/4.*sqrt(8.*kB*Temp(i,j,k)/pi)*iM + zeta*av/4.0_prec*sqrt(8.0_prec*kB*Temp(i,j,k)/pi)*iM enddo enddo enddo @@ -54,12 +54,12 @@ subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & do j=jl,ju do it=1,nAero do r=1,nMAero - iM=LagrangeInterp(nMAero,r-1./2., & + iM=LagrangeInterp(nMAero,r-1.0_prec/2.0_prec, & xvAero(i,j,1,nMAero*(it-1)+1:nMAero*it)) - av=1/(zcart(zedge(2),i,j)-zcart(zedge(1),i,j)) ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/variables.F90 index aa434cf..57cb3d1 100644 +++ b/CODE-dev/variables.F90 @@ -94,6 +94,12 @@ module msga_variables use mpi +#ifdef DBL_PREC + integer, parameter :: mpi_prec = mpi_double_precision +#else + integer, parameter :: mpi_prec = mpi_real +#endif + 144 integer :: mpi_rank,npos,mpos,numprocs integer :: blocktype,blocktype0 integer :: rightedge=0 # a849341 Fixed precision bugs, and a single boundary bug. Also made a couple changes to how precision ,→ was called. # Full command: git show --find-renames --unified=3 a849341 -- CODE-dev/Emissions/deposit_ems.F90 CODE ,→ -dev/Emissions/input_ems.F90 CODE-dev/MOA.F90 index 1bd5ca1..230cb17 100644 +++ b/CODE-dev/Emissions/deposit_ems.F90 @@ -5,7 +5,7 @@ !----------------------------------------------------------------------- subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & il,iu,jl,ju,lls,nfuel) - use gridlist_variables, only : prec + use gridlist_variables, only : wp @@ -13,18 +13,18 @@ subroutine deposit(forcingAero,xvAero,Temp,rhoFuel,sizeScale,rhoMicro, & ! Local Variables integer,intent(in) :: il,iu,jl,ju,lls,nfuel - real(prec),intent(inout) :: forcingAero(il:iu,jl:ju,lls,nAero*nMAero) - real(prec),intent(in) :: rhoMicro - real(prec),intent(in) :: xvAero(il:iu,jl:ju,lls,nAero*nMAero) - real(prec),intent(in) :: Temp(il:iu,jl:ju,lls) - real(prec),intent(in) :: rhoFuel(nfuel,il:iu,jl:ju,lls) - real(prec),intent(in) :: sizeScale(nfuel,il:iu,jl:ju,lls) + real(wp),intent(inout) :: forcingAero(il:iu,jl:ju,lls,nAero*nMAero) + real(wp),intent(in) :: rhoMicro + real(wp),intent(in) :: xvAero(il:iu,jl:ju,lls,nAero*nMAero) + real(wp),intent(in) :: Temp(il:iu,jl:ju,lls) + real(wp),intent(in) :: rhoFuel(nfuel,il:iu,jl:ju,lls) + real(wp),intent(in) :: sizeScale(nfuel,il:iu,jl:ju,lls) - real(prec) :: zeta=0.95_prec ! Water aerosols (Stulov, Murashkevich, and Fuchs, Journal of Aerosol ,→ Science (1978)) - real(prec) :: av - real(prec) :: iM - real(prec),external :: LagrangeInterp,zcart + real(wp) :: zeta=0.95_wp ! Water aerosols (Stulov, Murashkevich, and Fuchs, Journal of Aerosol ,→ Science (1978)) + real(wp) :: av + real(wp) :: iM + real(wp),external :: LagrangeInterp,zcart ! Executable Code ! Aerosol deposition on vegetation ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 145 BUG-2026-06-026: Missing prec imports caused compile failures after prec-suffix conversion Summary Several routines began using _prec-suffixed literals or real(...,kind=prec) conversions without importing the prec kind parameter. • Radiation/definearray_rad.F90 • Radiation/monteCarlo_rad.F90 • domainUpdates.F90 • force.F90 • rinit.F90 • several additional files using _prec literals If prec is not in scope, then literals such as 1.0_prec and conversions such as real(i,kind=prec) fail to compile because the kind parameter is undefined. Impact This causes direct compile failures and blocks otherwise-correct precision-safe fixes. Add use gridlist_variables, only : prec in every routine or module that uses prec-based declarations, literals, or conversions. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/Radiation/definearray_rad.F90 ,→ CODE-dev/Radiation/monteCarlo_rad.F90 CODE-dev/domainUpdates.F90 index a2be3bd..fef01b8 100644 +++ b/CODE-dev/Radiation/definearray_rad.F90 @@ -3,7 +3,7 @@ ! arrays used throughout the simulation 146 !----------------------------------------------------------------------- - use gridlist_variables, only : n,m,l + use gridlist_variables, only : n,m,l,prec use radiation_gridlist_variables, only : irad,iradeastflux @@ -15,24 +15,24 @@ subroutine defineRadArray - allocate(firad(np,mp,l)); firad=0. - allocate(fsiesrad(nfuel,np,mp,lfuel)); fsiesrad=0. + allocate(firad(np,mp,l)); firad=0.0_prec + allocate(fsiesrad(nfuel,np,mp,lfuel)); fsiesrad=0.0_prec - allocate(sourcesol(nfuel,np,mp,lfuel+nfuel)); sourcesol=0. - allocate(sourcegas(np,mp,l)); sourcegas=0. + allocate(sourcesol(nfuel,np,mp,lfuel+nfuel)); sourcesol=0.0_prec + allocate(sourcegas(np,mp,l)); sourcegas=0.0_prec allocate(kfindex(np,mp,nfuel)) - allocate(papvift(nfuel,np,mp,lfuel+nfuel)); papvift = 0.0 !projected area per unit volume of the ,→ solid - allocate(papvgas(np,mp,l+nfuel)); papvgas = 0.0 !projected area per unit volume of the gas - allocate(papvtotAZ(n,m,l+nfuel)); papvtotAZ = 0.0 !FPAZ - allocate(volumeAZ(np,mp,l+nfuel)); volumeAZ = 0.0 !FPAZ volume of cell + allocate(papvift(nfuel,np,mp,lfuel+nfuel)); papvift = 0.0_prec !projected area per unit volume of ,→ the solid + allocate(papvgas(np,mp,l+nfuel)); papvgas = 0.0_prec !projected area per unit volume of the gas + allocate(papvtotAZ(n,m,l+nfuel)); papvtotAZ = 0.0_prec !FPAZ + allocate(volumeAZ(np,mp,l+nfuel)); volumeAZ = 0.0_prec !FPAZ volume of cell allocate(zCartEdgeAZGlobal(4,n,m,0:l+nfuel)) allocate(nphotemisAZsplit(n,m,l+nfuel)) allocate(nphotonAZgather(n,m,l+nfuel)) allocate(nphotonAZ(n,m,l+nfuel)) if(iradeastflux.eq.1)then - allocate(nphotonEastFlux(n,m,l+nfuel)); nphotonEastFlux=0. ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/Radiation/monteCarlo_rad.F90 ,→ CODE-dev/rinit.F90 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -65,11 +65,7 @@ subroutine papv_defs -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use radiation_montecarlo_variables, only : papvift,papvgas,kfindex, & 147 @@ -168,14 +164,8 @@ subroutine papv_defs allocate(papvtotAZtmp(np,mp,l+nfuel,numprocs)) papvtotAZtmp = 0.0_prec -#ifdef DBL_PREC - call mpi_allgather(papvlocal,np*mp*(l+nfuel), & - mpi_double_precision,papvtotAZtmp,np*mp*(l+nfuel), & -#else - call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_real, & - papvtotAZtmp,np*mp*(l+nfuel),mpi_real,mpi_comm_world,ierror) -#endif + call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_prec, & + papvtotAZtmp,np*mp*(l+nfuel),mpi_prec,mpi_comm_world,ierror) do iprocx=1,nprocx do jprocy=1,nprocy iproc=iprocx+(jprocy-1)*nprocx @@ -197,16 +187,13 @@ end subroutine papv_defs ! lmc for photon generation and shooting !----------------------------------------------------------------------- + use mpi ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 148 BUG-2026-06-027: Hard-coded real(8) and default real declarations broke precision portability Summary Some code bypassed the configured precision abstraction by using explicit real(8) or default real declarations instead of real(prec). • higrad.F90 • rmaxmin.F90 These declarations hard-code a storage kind that may not match the selected build precision, under- mining portability and reintroducing silent conversion paths. Impact The code can drift away from the selected precision mode and create truncation or promotion mis- matches. Replace explicit floating-point kinds with real(prec) so declarations follow the configured precision mode consistently. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/higrad.F90 CODE-dev/rmaxmin. ,→ F90 index 8b4230c..755b212 100644 +++ b/CODE-dev/higrad.F90 @@ -23,7 +23,7 @@ subroutine donorcell(xf,il,iu,jl,ju,lls) real(prec),allocatable :: fd(:,:,:,:) ! Executable Code - allocate(fd(3,np+1,mp+1,l+1)); fd=0. + allocate(fd(3,np+1,mp+1,l+1)); fd=0.0_prec 149 do k=1,l do j=1,mp do i=1,np+1 @@ -77,7 +77,7 @@ subroutine gradmoa() ! Local Variables real(prec) :: g13,g23,g33 - real(8) :: pr_double,rg_over_prrcp_gas + real(prec) :: pr_local,rg_over_prrcp_gas real(prec),allocatable:: pr(:,:,:),px(:, :,:),py(:, :,:),pz(:, :,:) ! Executable Code @@ -91,13 +91,9 @@ subroutine gradmoa() do i=1,np rg_over_prrcp_gas=Rgas/mw_gas(i,j,k)* & Pref**(-Rgas/cp_gas(i,j,k)/mw_gas(i,j,k)) - pr_double=(xvtmp(i,j,k,itheta)* & - rg_over_prrcp_gas)**(cp_gas(i,j,k)/cv_gas(i,j,k))-pre(i,j,k) -#ifdef DBL_PREC - pr(i,j,k)=pr_double -#else - pr(i,j,k)=real(pr_double) -#endif + pr_local=(xvtmp(i,j,k,itheta)* & + rg_over_prrcp_gas)**(cp_gas(i,j,k)/cv_gas(i,j,k))-pre(i,j,k) + pr(i,j,k)=pr_local enddo enddo enddo @@ -106,8 +102,8 @@ subroutine gradmoa() do k=1,l do i=1,np ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/rmaxmin.F90 index ec8f639..7b29af3 100644 +++ b/CODE-dev/rmaxmin.F90 @@ -5,11 +5,7 @@ subroutine rmaxmin_1D(array,string,il,iu) use msga_variables, only : mpi_rank,mpi_comm_world,ierror,mpi_max, & mpi_min -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec ! Local Variables @@ -23,17 +19,10 @@ subroutine rmaxmin_1D(array,string,il,iu) ! Executable Code rmax=maxval(array) rmin=minval(array) -#ifdef DBL_PREC - call mpi_reduce(rmax,xmax,1,mpi_double_precision,mpi_max,0, & + call mpi_reduce(rmax,xmax,1,mpi_prec,mpi_max,0, & 150 - call mpi_reduce(rmin,xmin,1,mpi_double_precision,mpi_min,0, & + call mpi_reduce(rmin,xmin,1,mpi_prec,mpi_min,0, & -#else - call mpi_reduce(rmax,xmax,1,mpi_real,mpi_max,0, & - call mpi_reduce(rmin,xmin,1,mpi_real,mpi_min,0, & -#endif xmaxprint = xmax xminprint = xmin if(mpi_rank.eq.0) print*,’ RMAXMIN for ’,string, & @@ -48,11 +37,7 @@ subroutine rmaxmin_3D(array,string,il,iu,jl,ju,kl,ku) use msga_variables, only : mpi_rank,mpi_comm_world,ierror,mpi_max, & mpi_min -#ifdef DBL_PREC ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 151 BUG-2026-06-028: Inconsistent external function typing for zcart created interface mismatch risk Summary At least one routine declared the external function zcart as default real rather than real(prec). • xeVariation/xevariation.F90 An external interface with the wrong floating-point type can create mismatch risk at call sites and weaken numerical consistency. Impact This can produce confusing compiler diagnostics and potentially unsafe interface assumptions. Declare the external routine as real(prec),external :: zcart. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/xeVariation/xevariation.F90 index 0f4b99c..6fb49c4 100644 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -20,7 +20,7 @@ subroutine xevariation(ixevariation,ih,xe,il,iu,jl,ju,lls,nvp) integer,intent(in) :: il,iu,jl,ju,lls,nvp real(prec),intent(inout) :: xe(il:iu,jl:ju,lls,nvp) - real,external :: zcart + real(prec),external :: zcart integer :: kv real(prec) :: totw @@ -35,8 +35,8 @@ subroutine xevariation(ixevariation,ih,xe,il,iu,jl,ju,lls,nvp) do i=1,np xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & 152 (time*uramp/uramptime+u0)*xe(i,j,k,irho)) & - *max(0.,(1.-1.5*sum(xvfuel(:,i,j,k,irhof)))) & - *(min(100.,zcart(z(k),1,1))/zu)**(1./7.) + *max(0.0_prec,(1.0_prec-1.5_prec*sum(xvfuel(:,i,j,k,irhof)))) & + *(min(100.0_prec,zcart(z(k),1,1))/zu)**(1.0_prec/7.0_prec) enddo enddo enddo @@ -45,7 +45,7 @@ subroutine xevariation(ixevariation,ih,xe,il,iu,jl,ju,lls,nvp) do i=1,np xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & (time*uramp/uramptime+u0)*xe(i,j,k,irho)) & - *(min(100.,zcart(z(k),1,1))/zu)**(1./7.) + *(min(100.0_prec,zcart(z(k),1,1))/zu)**(1.0_prec/7.0_prec) enddo enddo enddo @@ -56,8 +56,8 @@ subroutine xevariation(ixevariation,ih,xe,il,iu,jl,ju,lls,nvp) do i=jl+ih,ju-ih xe(i,j,k,ivvel)=min(vramp*xe(i,j,k,irho), & (time*vramp/vramptime+v0)*xe(i,j,k,irho)) & - *max(0.,(1.-1.5*sum(xvfuel(:,i,j,k,irhof)))) & - *(min(100.,zcart(z(k),1,1))/zu)**(1./7.) + *max(0.0_prec,(1.0_prec-1.5_prec*sum(xvfuel(:,i,j,k,irhof)))) & + *(min(100.0_prec,zcart(z(k),1,1))/zu)**(1.0_prec/7.0_prec) enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/xeVariation/windfield.F90 CODE ,→ -dev/update.F90 index e3295d7..26618be 100644 +++ b/CODE-dev/update.F90 @@ -43,11 +43,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use gridsetup, only : timestep @@ -93,14 +89,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1000 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,pebelow, & - itag,tmpxrcv,ncount,mpi_double_precision,peabove,itag, & -#else - call MPI_Sendrecv(tmpxsnd,ncount,mpi_real,pebelow,itag,tmpxrcv, & - ncount,mpi_real,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) -#endif 153 FIRETEC Bug Resolution Log June 2026 + call MPI_Sendrecv(tmpxsnd,ncount,mpi_prec,pebelow,itag,tmpxrcv, & + ncount,mpi_prec,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) ncount=0 do k=1,nzp @@ -143,14 +133,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1100 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,peabove, & - itag,tmpxrcv,ncount,mpi_double_precision,pebelow,itag, & - mpi_comm_world,sndrcvStatus,ierror) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 154 BUG-2026-06-029: Precision-specific code paths were duplicated and inconsistent Summary The codebase maintained duplicate #ifdef DBL_PREC, #ifdef DBL, and related branches to spell the same formulas differently in single- and double-precision mode. • Radiation/monteCarlo_rad.F90 • advectionScheme.F90 • xeVariation/xevariation.F90 • variables.F90 • several additional files with split SP/DP branches Duplicated branches for the same formula are easy to let drift apart. They also complicate review because numerical changes must be validated in multiple places. Impact This increases maintenance burden and makes single- and double-precision behavior more likely to diverge. Collapse duplicate branches into a single implementation built on _prec literals and real(...,kind=prec) conversions. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/Radiation/monteCarlo_rad.F90 ,→ CODE-dev/advectionScheme.F90 CODE-dev/xeVariation/xevariation.F90 index b458963..99ae25a 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -39,7 +39,7 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & do j=jl,ju 155 do i=il,iu force(i,j,k)=force(i,j,k)+firad(i,j,k)/cp_gas(i,j,k)* & - (pref/pr(i,j,k))**(1.-cv_gas(i,j,k)/cp_gas(i,j,k)) + (pref/pr(i,j,k))**(1.0_prec-cv_gas(i,j,k)/cp_gas(i,j,k)) enddo enddo enddo @@ -80,8 +80,8 @@ subroutine papv_defs ! Local Variables integer :: i,j,k,kcell,ift integer :: ia,ja,iproc,iprocx,jprocy - real(prec) :: rmaxsootcon=0.2 ! Maximum soot concentration - real(prec) :: absemis=0.3 + real(prec) :: rmaxsootcon=0.2_prec ! Maximum soot concentration + real(prec) :: absemis=0.3_prec real(prec) :: aemit real(prec) :: fvsoot real(prec),allocatable :: papvlocal(:,:,:),papvtotAZtmp(:,:,:,:) @@ -92,10 +92,10 @@ subroutine papv_defs 1-ih,np+ih,1-ih,mp+ih,1,0,0) enddo call update(tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) - papvift = 0.0 - papvgas = 0.0 - papvtotAZ= 0.0 - allocate(papvlocal(np,mp,l+nfuel)); papvlocal = 0.0 + papvift = 0.0_prec + papvgas = 0.0_prec + papvtotAZ= 0.0_prec + allocate(papvlocal(np,mp,l+nfuel)); papvlocal = 0.0_prec if(isootmodel.eq.1)then ! HERE FP DEFINE A NEW MODEL FOR ABSORPTION COEFFICIENT: ! soot volume fraction is defined as correlated to mixture fraction, which is a linear fonction ,→ of tempg and O2 deficit @@ -107,16 +107,10 @@ subroutine papv_defs endif do j=1,mp ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/Radiation/monteCarlo_rad.F90 ,→ CODE-dev/variables.F90 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -65,11 +65,7 @@ subroutine papv_defs -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use radiation_montecarlo_variables, only : papvift,papvgas,kfindex, & @@ -168,14 +164,8 @@ subroutine papv_defs 156 allocate(papvtotAZtmp(np,mp,l+nfuel,numprocs)) papvtotAZtmp = 0.0_prec -#ifdef DBL_PREC - call mpi_allgather(papvlocal,np*mp*(l+nfuel), & - mpi_double_precision,papvtotAZtmp,np*mp*(l+nfuel), & -#else - call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_real, & - papvtotAZtmp,np*mp*(l+nfuel),mpi_real,mpi_comm_world,ierror) -#endif + call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_prec, & + papvtotAZtmp,np*mp*(l+nfuel),mpi_prec,mpi_comm_world,ierror) do iprocx=1,nprocx do jprocy=1,nprocy iproc=iprocx+(jprocy-1)*nprocx @@ -197,16 +187,13 @@ end subroutine papv_defs ! lmc for photon generation and shooting !----------------------------------------------------------------------- + use mpi ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 157 BUG-2026-06-030: MPI precision handling was fragile and sometimes precision-truncating Summary MPI reductions and gathers were already split by precision mode where needed, but some local scalars, temporary buffers, and diagnostics still used non-kind-safe reals or downcast results after communication. • rmaxmin.F90 • Radiation/monteCarlo_rad.F90 • Radiation/rinit_rad.F90 Even when the MPI datatype is correct, storing communicated values in default-real temporaries or printing a downcast copy can reintroduce precision loss. Impact This can truncate results, make diagnostics disagree with reduced values, and weaken cross-precision reproducibility. Retain precision-appropriate MPI datatypes, but standardize local storage and diagnostic intermediates on real(prec) and precision-safe literals. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/rmaxmin.F90 CODE-dev/Radiation ,→ /monteCarlo_rad.F90 CODE-dev/Radiation/rinit_rad.F90 index b458963..99ae25a 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -39,7 +39,7 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & do j=jl,ju do i=il,iu 158 force(i,j,k)=force(i,j,k)+firad(i,j,k)/cp_gas(i,j,k)* & - (pref/pr(i,j,k))**(1.-cv_gas(i,j,k)/cp_gas(i,j,k)) + (pref/pr(i,j,k))**(1.0_prec-cv_gas(i,j,k)/cp_gas(i,j,k)) enddo enddo enddo @@ -80,8 +80,8 @@ subroutine papv_defs ! Local Variables integer :: i,j,k,kcell,ift integer :: ia,ja,iproc,iprocx,jprocy - real(prec) :: rmaxsootcon=0.2 ! Maximum soot concentration - real(prec) :: absemis=0.3 + real(prec) :: rmaxsootcon=0.2_prec ! Maximum soot concentration + real(prec) :: absemis=0.3_prec real(prec) :: aemit real(prec) :: fvsoot real(prec),allocatable :: papvlocal(:,:,:),papvtotAZtmp(:,:,:,:) @@ -92,10 +92,10 @@ subroutine papv_defs 1-ih,np+ih,1-ih,mp+ih,1,0,0) enddo call update(tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) - papvift = 0.0 - papvgas = 0.0 - papvtotAZ= 0.0 - allocate(papvlocal(np,mp,l+nfuel)); papvlocal = 0.0 + papvift = 0.0_prec + papvgas = 0.0_prec + papvtotAZ= 0.0_prec + allocate(papvlocal(np,mp,l+nfuel)); papvlocal = 0.0_prec if(isootmodel.eq.1)then ! HERE FP DEFINE A NEW MODEL FOR ABSORPTION COEFFICIENT: ! soot volume fraction is defined as correlated to mixture fraction, which is a linear fonction ,→ of tempg and O2 deficit @@ -107,16 +107,10 @@ subroutine papv_defs endif do j=1,mp ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/rmaxmin.F90 CODE-dev/Radiation ,→ /monteCarlo_rad.F90 CODE-dev/Radiation/rinit_rad.F90 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -65,11 +65,7 @@ subroutine papv_defs -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use radiation_montecarlo_variables, only : papvift,papvgas,kfindex, & @@ -168,14 +164,8 @@ subroutine papv_defs 159 allocate(papvtotAZtmp(np,mp,l+nfuel,numprocs)) papvtotAZtmp = 0.0_prec -#ifdef DBL_PREC - call mpi_allgather(papvlocal,np*mp*(l+nfuel), & - mpi_double_precision,papvtotAZtmp,np*mp*(l+nfuel), & -#else - call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_real, & - papvtotAZtmp,np*mp*(l+nfuel),mpi_real,mpi_comm_world,ierror) -#endif + call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_prec, & + papvtotAZtmp,np*mp*(l+nfuel),mpi_prec,mpi_comm_world,ierror) do iprocx=1,nprocx do jprocy=1,nprocy iproc=iprocx+(jprocy-1)*nprocx @@ -197,16 +187,13 @@ end subroutine papv_defs ! lmc for photon generation and shooting !----------------------------------------------------------------------- + use mpi ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 160 BUG-2026-06-031: Integer-to-real conversion logic in initialization was not kind-safe Summary Several initialization and interpolation paths used separate dble(... ) versus real(... ) branches depending on whether double precision was enabled. • rinit.F90 • tinit.F90 • xeVariation/xevariation.F90 Branching between dble and default real duplicates conversion logic and still does not express the intended target kind directly. Impact The conversion behavior can diverge across precision modes and is harder to maintain than a single configured-kind conversion. Replace split conversions with real(value,kind=prec). Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/rinit.F90 CODE-dev/tinit.F90 ,→ CODE-dev/xeVariation/xevariation.F90 index 8f4aa8d..299b0f7 100644 +++ b/CODE-dev/rinit.F90 @@ -12,6 +12,7 @@ subroutine rinit use forcings, only : wt use metric_variables, only : x,y,z,zedge,zb use xvall, only : nv,xv,xe,iuvel,ivvel + use gridlist_variables, only : prec 161 FIRETEC Bug Resolution Log June 2026 ! Local Variables @@ -20,33 +21,28 @@ subroutine rinit ! Executable Code ! Time integration parameters - wt(1)=0.3/nts - wt(nts+1)=0.7/nts + wt(1)=0.3_prec/nts + wt(nts+1)=0.7_prec/nts ! Grid definition -#ifdef DBL_PREC - dt=dts*dble(nts) !dt is the large time step - dtp=dt/dble(ntp) !dt is the physics time step for FIRETEC -#else - dt=dts*real(nts) !dt is the large time step - dtp=dt/real(ntp) !dt is the physics time step for FIRETEC -#endif - dxi=1./dx - dyi=1./dy - dzi=1./dz - dti=1./dt + dt=dts*real(nts,kind=prec) !dt is the large time step + dtp=dt/real(ntp,kind=prec) !dt is the physics time step for FIRETEC + dxi=1.0_prec/dx + dyi=1.0_prec/dy + dzi=1.0_prec/dz + dti=1.0_prec/dt do i=1-ih,n+ih - x(i)=(i-1)*dx-((n+1)/2.-1)*dx + x(i)=(i-1)*dx-((n+1)/2.0_prec-1)*dx ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/rinit.F90 index 299b0f7..12c8016 100644 +++ b/CODE-dev/rinit.F90 @@ -226,11 +226,7 @@ subroutine setVelocityProfile() use fuel_variables, only : lfuel,min_rhoFuel,sizeScale,actualFuelDepth use msga_variables, only : npos,mpos,mpi_comm_world,ierror,mpi_sum, & mpi_rank,mpi_max -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use metric_variables, only : zedge,zs,z use xvall, only : xe,iuvel,ivvel,irho,xvfuel,irhof @@ -277,21 +273,12 @@ subroutine setVelocityProfile() enddo enddo enddo -#ifdef DBL_PREC - call mpi_allreduce(hmax,hmaxt,1,mpi_double_precision,mpi_max, & + call mpi_allreduce(hmax,hmaxt,1,mpi_prec,mpi_max, & 162 - call mpi_allreduce(LAIlow,LAIlowt,1,mpi_double_precision,mpi_sum, & + call mpi_allreduce(LAIlow,LAIlowt,1,mpi_prec,mpi_sum, & - call mpi_allreduce(LAIup,LAIupt,1,mpi_double_precision,mpi_sum, & + call mpi_allreduce(LAIup,LAIupt,1,mpi_prec,mpi_sum, & -#else - call mpi_allreduce(hmax,hmaxt,1,mpi_real,mpi_max, & - mpi_comm_world,ierror) - call mpi_allreduce(LAIlow,LAIlowt,1,mpi_real,mpi_sum, & - mpi_comm_world,ierror) - call mpi_allreduce(LAIup,LAIupt,1,mpi_real,mpi_sum, & - mpi_comm_world,ierror) -#endif LAIlowt=LAIlowt/real((iue-ius+1)*(jue-jus+1),kind=prec) LAIupt=LAIupt/real((iue-ius+1)*(jue-jus+1),kind=prec) # a849341 Fixed precision bugs, and a single boundary bug. Also made a couple changes to how precision ,→ was called. # Full command: git show --find-renames --unified=3 a849341 -- CODE-dev/rinit.F90 CODE-dev/tinit.F90 ,→ CODE-dev/xeVariation/xevariation.F90 index 12c8016..83f437a 100644 +++ b/CODE-dev/rinit.F90 @@ -12,7 +12,7 @@ subroutine rinit use forcings, only : wt use metric_variables, only : x,y,z,zedge,zb use xvall, only : nv,xv,xe,iuvel,ivvel - use gridlist_variables, only : prec + use gridlist_variables, only : wp ! Local Variables @@ -21,28 +21,28 @@ subroutine rinit ! Executable Code ! Time integration parameters - wt(1)=0.3_prec/nts ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 163 BUG-2026-06-032: Numerically sensitive physics constants were not precision-safe Summary Many empirical or physical constants in combustion, radiation, evaporation, solar, and thermodynamics code were written as default reals instead of _prec-suffixed constants. • Emissions/zBEST_ems.F90 • Vegetation/burn_veg.F90 • thermodynamics.F90 • Radiation/monteCarlo_rad.F90 • additional radiation, vegetation, and variables modules Physical constants are often used in numerically sensitive paths. If they are declared as default real, the expression tree can inherit an unintended kind. Impact This can alter sensitive calculations, reduce consistency between precision modes, and make results depend on implicit compiler conversions. Convert such constants to precision-safe declarations using _prec consistently. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/Emissions/zBEST_ems.F90 CODE- ,→ dev/Vegetation/burn_veg.F90 CODE-dev/thermodynamics.F90 diff --git a/CODE-dev/Emissions/zBEST_ems.F90 b/CODE-dev/Emissions/zBEST_ems.F90 index 0176178..c3e4d5c 100644 --- a/CODE-dev/Emissions/zBEST_ems.F90 +++ b/CODE-dev/Emissions/zBEST_ems.F90 @@ -26,20 +26,20 @@ subroutine ZBEST(forcing,xv,frhof,temps,rhof,ilh,iuh,jlh,juh,ku, & real(prec),intent(in) :: dt 164 integer :: ift,i,j,k - real(prec) :: TempI=600. ! Incipient Zone Temperature - real(prec) :: TempF=1200. ! Flame Zone Temperature - real(prec) :: TempR=1800. ! Reaction Zone Temperature - real(prec) :: SP=0.56 ! Fuel’s Sooting Potential - real(prec) :: Zst=0.135 ! Stoichiometric mixture fraction (C_33 H_48 O_19) - real(prec) :: AO2=7.98E-1 ! pre-exponential constant (kg K^0.5/Pa m2 s) - real(prec) :: EO2 = -1.77E8 ! activation energy (J/kmole) - real(prec) :: AOH = 1.89E-3 ! pre-exponentail constant (kg K^0.5/Pa m2 s) - real(prec) :: mC = 12.01 ! Molecular weight of carbon (kg) - real(prec) :: xtol = 0.111 ! 0.132 mass fraction # mole fraction of toluene surrogates in the ,→ tar - real(prec) :: xnaph= 0.342 ! 0.457 mass fraction # mole fraction of naphthalene surrogates in ,→ the tar - real(prec) :: rhoV = 0.45 ! Density of volatiles (kg/m3) - real(prec) :: eps = 2.2*0.001 ! Van der Waals enhancement factor*Collision Efficiency - real(prec) :: rhost= 1850.0 ! Particle density (kg/m3) + real(prec) :: TempI=600.0_prec ! Incipient Zone Temperature + real(prec) :: TempF=1200.0_prec ! Flame Zone Temperature + real(prec) :: TempR=1800.0_prec ! Reaction Zone Temperature + real(prec) :: SP=0.56_prec ! Fuel’s Sooting Potential + real(prec) :: Zst=0.135_prec ! Stoichiometric mixture fraction (C_33 H_48 O_19) + real(prec) :: AO2=7.98E-1_prec ! pre-exponential constant (kg K^0.5/Pa m2 s) + real(prec) :: EO2 = -1.77E8_prec ! activation energy (J/kmole) + real(prec) :: AOH = 1.89E-3_prec ! pre-exponentail constant (kg K^0.5/Pa m2 s) + real(prec) :: mC = 12.01_prec ! Molecular weight of carbon (kg) + real(prec) :: xtol = 0.111_prec ! 0.132 mass fraction # mole fraction of toluene surrogates in ,→ the tar + real(prec) :: xnaph= 0.342_prec ! 0.457 mass fraction # mole fraction of naphthalene ,→ surrogates in the tar + real(prec) :: rhoV = 0.45_prec ! Density of volatiles (kg/m3) + real(prec) :: eps = 2.2_prec*0.001_prec ! Van der Waals enhancement factor*Collision Efficiency + real(prec) :: rhost= 1850.0_prec ! Particle density (kg/m3) real(prec) :: Diff,Deq,Q,dstar,nu,VolC,ff real(prec) :: yH2,yCH4,yCO2,yCO,SP_mtar,SP_xtar,Ntar real(prec) :: PO2r,POHr,Oxidation @@ -52,22 +52,22 @@ subroutine ZBEST(forcing,xv,frhof,temps,rhof,ilh,iuh,jlh,juh,ku, & ! Executable Code ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/Radiation/monteCarlo_rad.F90 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -65,11 +65,7 @@ subroutine papv_defs -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use radiation_montecarlo_variables, only : papvift,papvgas,kfindex, & 165 @@ -168,14 +164,8 @@ subroutine papv_defs allocate(papvtotAZtmp(np,mp,l+nfuel,numprocs)) papvtotAZtmp = 0.0_prec -#ifdef DBL_PREC - call mpi_allgather(papvlocal,np*mp*(l+nfuel), & - mpi_double_precision,papvtotAZtmp,np*mp*(l+nfuel), & -#else - call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_real, & - papvtotAZtmp,np*mp*(l+nfuel),mpi_real,mpi_comm_world,ierror) -#endif + call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_prec, & + papvtotAZtmp,np*mp*(l+nfuel),mpi_prec,mpi_comm_world,ierror) do iprocx=1,nprocx do jprocy=1,nprocy iproc=iprocx+(jprocy-1)*nprocx @@ -197,16 +187,13 @@ end subroutine papv_defs ! lmc for photon generation and shooting !----------------------------------------------------------------------- + use mpi ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 166 BUG-2026-06-033: Default-real initialization of arrays and scalars polluted precision consistency Summary A number of allocation and reset paths initialized real(prec) arrays or scalars with default real values such as 0.0, 1.0, or 0.. • definearray.F90 • Radiation/definearray_rad.F90 • HeatSource/rinit_heat.F90 • Vegetation/rinit_veg.F90 • subGridTurb/defineArray_turb.F90 Even simple initialization values can introduce avoidable kind conversions if they do not match the target array’s configured precision. Impact This weakens precision consistency during setup, reset, and allocation paths across the solver. Initialize real(prec) storage with 0.0_prec, 1.0_prec, and similar kind-safe literals. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/definearray.F90 CODE-dev/ ,→ Radiation/definearray_rad.F90 CODE-dev/HeatSource/rinit_heat.F90 diff --git a/CODE-dev/HeatSource/rinit_heat.F90 b/CODE-dev/HeatSource/rinit_heat.F90 index a53e1c0..b3e78f5 100644 --- a/CODE-dev/HeatSource/rinit_heat.F90 +++ b/CODE-dev/HeatSource/rinit_heat.F90 @@ -24,9 +24,9 @@ subroutine rinitHeatSource() allocate(HRR(nsource_hs,2)) allocate(MLRHRR_eof_hs(nsource_hs)) 167 - TME = 0.0 - MLR = 0.0 - HRR = 0.0 + TME = 0.0_prec + MLR = 0.0_prec + HRR = 0.0_prec MLRHRR_eof_hs = .false. do itsource = 1,nsource_hs index a2be3bd..fef01b8 100644 +++ b/CODE-dev/Radiation/definearray_rad.F90 @@ -3,7 +3,7 @@ ! arrays used throughout the simulation !----------------------------------------------------------------------- - use gridlist_variables, only : n,m,l + use gridlist_variables, only : n,m,l,prec use radiation_gridlist_variables, only : irad,iradeastflux @@ -15,24 +15,24 @@ subroutine defineRadArray - allocate(firad(np,mp,l)); firad=0. - allocate(fsiesrad(nfuel,np,mp,lfuel)); fsiesrad=0. + allocate(firad(np,mp,l)); firad=0.0_prec + allocate(fsiesrad(nfuel,np,mp,lfuel)); fsiesrad=0.0_prec - allocate(sourcesol(nfuel,np,mp,lfuel+nfuel)); sourcesol=0. - allocate(sourcegas(np,mp,l)); sourcegas=0. + allocate(sourcesol(nfuel,np,mp,lfuel+nfuel)); sourcesol=0.0_prec ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/Vegetation/rinit_veg.F90 index a1da2da..62f9890 100644 +++ b/CODE-dev/Vegetation/rinit_veg.F90 @@ -3,11 +3,12 @@ ! FIRETEC for use throughout the simulation !----------------------------------------------------------------------- subroutine rinitVeg - use gridlist_variables, only : n,m,tambient,prec + use gridlist_variables, only : n,m,nprocx,nprocy,tambient,prec use vegetation_gridlist_variables, only : nfuel,ivegread,cpwood, & ignfile,ifire - use msga_variables, only : mpi_rank + use msga_variables, only : mpi_comm_world,mpi_rank,numprocs,ierror + use msga_variables, only : mpi_prec use xvall, only : xvfuel,irhof,irhow,isies,ipsiw use fuel_variables, only : lfuel,sizeScale,actualFuelDepth,temps, & rhoFuelInitial,min_rhoFuel @@ -21,7 +22,8 @@ subroutine rinitVeg ! Local Variables 168 - integer :: fsize + integer :: fsize,file_real_bytes,record_overhead,payload_bytes + integer :: plane_bytes,expected_size real(prec) :: cpsolid real(prec),allocatable :: rmoist(:,:,:,:),fuelDepth(:,:,:,:) real(prec),external :: zcart @@ -29,12 +31,34 @@ subroutine rinitVeg ! Executable Code if(ivegread.eq.1)then - inquire(file=’treesrhof.dat’,size=fsize) - ! Divide by 4 bytes - lfuel=(fsize-8)/(4*n*m*nfuel) -#ifdef DBL_PREC - lfuel = int(lfuel/2) +#ifdef VEG_FILE_DBL_PREC + file_real_bytes = 8 +#else + file_real_bytes = 4 ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 169 BUG-2026-06-034: Mixed-kind intrinsic calls were unsafe Summary Several intrinsic calls such as max, min, sqrt, sign, acos, log, and exp mixed real(prec) operands with default real literals. • advectionScheme.F90 • Vegetation/solarHeat_veg.F90 • variables.F90 • Firebrands/evolve_fb.F90 • additional metric, radiation, initialization, and solver files If intrinsic arguments are not kind-consistent, compilers may choose a different overload or evaluate parts of the expression at an unintended precision. Impact This can change evaluation kind, produce warnings, and reduce consistency in numerically sensitive logic. Make intrinsic arguments kind-consistent by replacing default literals with _prec-suffixed values. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/advectionScheme.F90 CODE-dev/ ,→ Vegetation/solarHeat_veg.F90 CODE-dev/variables.F90 index 2b4744f..5117fb2 100644 +++ b/CODE-dev/Vegetation/solarHeat_veg.F90 @@ -36,7 +36,7 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & integer :: i1,j1,k1,kcell integer :: iproc,iprocx,jprocy integer :: nsize - real(prec) :: DeepShadeLAI=10. 170 + real(prec) :: DeepShadeLAI=10.0_prec real(prec) :: dir(3) real(prec) :: z1top,z2top,z3top,z4top,zlayer real(prec) :: xf,yf,zf @@ -59,13 +59,13 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & do j=1,mp do i=1,np zlayer=(sum(zCartEdgeAZGlobal(:,i,j,k)- & - zCartEdgeAZGlobal(:,i,j,k-1)))/4. + zCartEdgeAZGlobal(:,i,j,k-1)))/4.0_prec LAIlocal(i,j,k)=sum(rhoFuel(kfindex(i,j,k:nfuel),i,j,1)/ & sizeScale(kfindex(i,j,k:nfuel),i,j,1)*zlayer/rhoMicro) enddo enddo enddo - LAIlocal(:,:,nfuel+1)=0. + LAIlocal(:,:,nfuel+1)=0.0_prec do k=nfuel+2,lfuel+nfuel do j=1,mp do i=1,np @@ -106,7 +106,7 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & dir(1)=sin(sun_azimuth)*cos(sun_elevation) dir(2)=sin(sun_azimuth)*sin(sun_elevation) dir(3)=cos(sun_azimuth) - sumShade(:,:,:)=0. + sumShade(:,:,:)=0.0_prec do k=1,lfuel+nfuel if(k.lt.nfuel+1)then kcell=1 @@ -119,10 +119,10 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & i1=i j1=j k1=k ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/Vegetation/solarHeat_veg.F90 ,→ CODE-dev/variables.F90 CODE-dev/Firebrands/evolve_fb.F90 index 8ce3d93..c3846f1 100644 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -203,11 +203,7 @@ subroutine updateFB ix,iy use msga_variables, only : numprocs,mpi_integer,mpi_max, & mpi_comm_world,ierror -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use mpi @@ -249,14 +245,8 @@ subroutine updateFB nsize=mxbrand*nvbrand do iproc=1,numprocs -#ifdef DBL_PREC 171 - call mpi_scatter(xvsndBrands,nsize,mpi_double_precision, & - xvrcvBrands(:,:,iproc),nsize,mpi_double_precision,iproc-1, & - mpi_comm_world,ierror) -#else - call mpi_scatter(xvsndBrands,nsize,mpi_real,xvrcvBrands(:,:,iproc),& - nsize,mpi_real,iproc-1,mpi_comm_world,ierror) -#endif + call mpi_scatter(xvsndBrands,nsize,mpi_prec,xvrcvBrands(:,:,iproc), & + nsize,mpi_prec,iproc-1,mpi_comm_world,ierror) enddo deallocate(xvsndBrands) index 5117fb2..386ac81 100644 +++ b/CODE-dev/Vegetation/solarHeat_veg.F90 @@ -17,11 +17,7 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & leaf_albedo,leaf_emis use thermo_variables, only : pr,tempg use xvall, only : iH2O ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 172 BUG-2026-06-035: Core constants module depended on duplicated SP/DP branches Summary The central constants module defined key values such as pi, g, Rgas, pref, and other scientific constants using duplicated single- and double-precision branches. • variables.F90 Core constants should not require separate SP/DP branches when the configured kind already provides a uniform abstraction. Duplicate definitions are easy to let drift apart. Impact This increases maintenance burden and raises the risk that fundamental constants diverge across precision modes. Define constants once using real(prec) declarations and _prec literals. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/variables.F90 index 34f29cd..7e0d8c8 100644 +++ b/CODE-dev/variables.F90 @@ -15,15 +15,15 @@ module gridlist_variables integer :: irst = 0 ! Restart flag integer :: nt = 10000 ! Total number of large timesteps integer :: nts = 10 ! Number of small timesteps (higrad) in a large timestep - real(prec) :: dts = 0.001 ! Temporal size of a small timestep (higrad) + real(prec) :: dts = 0.001_prec ! Temporal size of a small timestep (higrad) integer :: ntp = 10 ! Number of small timesteps (firetec) in a large timestep integer :: n = 200 ! Number of cells in the x dimension integer :: m = 200 ! Number of cells in the y dimension 173 integer :: l = 40 ! Number of cells in the z dimension - real(prec) :: dx = 2. ! Size of cell in x dimension - real(prec) :: dy = 2. ! Size of cell in y dimension - real(prec) :: dz = 15. ! Size of cell in z dimension before stretching - real(prec) :: aa1 = 0.1 ! Stretching parameter for z direction + real(prec) :: dx = 2.0_prec ! Size of cell in x dimension + real(prec) :: dy = 2.0_prec ! Size of cell in y dimension + real(prec) :: dz = 15.0_prec ! Size of cell in z dimension before stretching + real(prec) :: aa1 = 0.1_prec ! Stretching parameter for z direction integer :: nprocx = 8 ! Number of processors in the x dimension integer :: nprocy = 8 ! Number of processors in the y dimension integer :: ih = 1 ! Number of halo cells @@ -36,37 +36,37 @@ module gridlist_variables integer :: ibc_right = 7825 ! Lateral Right boundary conditions (0=cyclic,1<=4 different ,→ relaxation options,5=symmetric) integer :: ibctopopen = 0 ! Open outlet, feeslip option at top integer :: iab = 1 ! Options for top absorption initialization - real(prec) :: zab = 400. ! Bottom of top damper (m) - real(prec) :: tow = 10. ! Magnitude parameter for top relaxation - real(prec) :: zStabBot = 400. ! Height of bottom stability layer (m) (common values are ,→ 400. and 800.) - real(prec) :: zStabMid = 450. ! Height of middle stability layer (m) (common values are ,→ 450. and 1000.) - real(prec) :: thetaStabMid = 0. ! Theta increase in the middle stability layer (K/m) (common ,→ values are 8./50. and 8.0/200.0) - real(prec) :: thetaStabTop = 0. ! Theta increase in the top stability layer (K/m) (common ,→ values are 6./1000. and 3.0/1000.0) + real(prec) :: zab = 400.0_prec ! Bottom of top damper (m) + real(prec) :: tow = 10.0_prec ! Magnitude parameter for top relaxation + real(prec) :: zStabBot = 400.0_prec ! Height of bottom stability layer (m) (common values ,→ are 400. and 800.) + real(prec) :: zStabMid = 450.0_prec ! Height of middle stability layer (m) (common values ,→ are 450. and 1000.) + real(prec) :: thetaStabMid = 0.0_prec ! Theta increase in the middle stability layer (K/m) ( ,→ common values are 8./50. and 8.0/200.0) + real(prec) :: thetaStabTop = 0.0_prec ! Theta increase in the top stability layer (K/m) ( ,→ common values are 6./1000. and 3.0/1000.0) integer :: iturb = 2 ! Turbulence resolution options ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/variables.F90 index aa434cf..57cb3d1 100644 +++ b/CODE-dev/variables.F90 @@ -94,6 +94,12 @@ module msga_variables use mpi +#ifdef DBL_PREC + integer, parameter :: mpi_prec = mpi_double_precision +#else + integer, parameter :: mpi_prec = mpi_real +#endif + integer :: mpi_rank,npos,mpos,numprocs integer :: blocktype,blocktype0 integer :: rightedge=0 174 # a849341 Fixed precision bugs, and a single boundary bug. Also made a couple changes to how precision ,→ was called. # Full command: git show --find-renames --unified=3 a849341 -- CODE-dev/variables.F90 index 57cb3d1..bfe55b3 100644 +++ b/CODE-dev/variables.F90 @@ -3,27 +3,28 @@ ! gridlist itself !----------------------------------------------------------------------- module gridlist_variables + use, intrinsic :: iso_fortran_env, only : real32,real64 #ifdef DBL_PREC - integer,parameter :: prec = 8 + integer,parameter :: wp = real64 #else - integer,parameter :: prec = 4 + integer,parameter :: wp = real32 #endif integer :: irst = 0 ! Restart flag integer :: nt = 10000 ! Total number of large timesteps integer :: nts = 10 ! Number of small timesteps (higrad) in a large timestep - real(prec) :: dts = 0.001_prec ! Temporal size of a small timestep (higrad) + real(wp) :: dts = 0.001_wp ! Temporal size of a small timestep (higrad) integer :: ntp = 10 ! Number of small timesteps (firetec) in a large timestep integer :: n = 200 ! Number of cells in the x dimension integer :: m = 200 ! Number of cells in the y dimension integer :: l = 40 ! Number of cells in the z dimension - real(prec) :: dx = 2.0_prec ! Size of cell in x dimension - real(prec) :: dy = 2.0_prec ! Size of cell in y dimension - real(prec) :: dz = 15.0_prec ! Size of cell in z dimension before stretching - real(prec) :: aa1 = 0.1_prec ! Stretching parameter for z direction + real(wp) :: dx = 2.0_wp ! Size of cell in x dimension + real(wp) :: dy = 2.0_wp ! Size of cell in y dimension + real(wp) :: dz = 15.0_wp ! Size of cell in z dimension before stretching + real(wp) :: aa1 = 0.1_wp ! Stretching parameter for z direction integer :: nprocx = 8 ! Number of processors in the x dimension integer :: nprocy = 8 ! Number of processors in the y dimension integer :: ih = 1 ! Number of halo cells @@ -36,37 +37,37 @@ module gridlist_variables integer :: ibc_right = 7825 ! Lateral Right boundary conditions (0=cyclic,1<=4 different ,→ relaxation options,5=symmetric) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 175 BUG-2026-06-036: Pressure-gradient helper code used fixed double-precision staging variables Summary higrad.F90 staged pressure calculations through real(8) temporaries and then conditionally cast the result depending on build precision. • higrad.F90 This hard-codes a double-precision staging path even when the configured build precision is not double precision. Impact It creates avoidable casts, complicates maintenance, and weakens portability across precision modes. Use a single real(prec) temporary and assign the result directly. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/higrad.F90 index 8b4230c..755b212 100644 +++ b/CODE-dev/higrad.F90 @@ -23,7 +23,7 @@ subroutine donorcell(xf,il,iu,jl,ju,lls) real(prec),allocatable :: fd(:,:,:,:) ! Executable Code - allocate(fd(3,np+1,mp+1,l+1)); fd=0. + allocate(fd(3,np+1,mp+1,l+1)); fd=0.0_prec do k=1,l do j=1,mp do i=1,np+1 @@ -77,7 +77,7 @@ subroutine gradmoa() ! Local Variables 176 real(prec) :: g13,g23,g33 - real(8) :: pr_double,rg_over_prrcp_gas + real(prec) :: pr_local,rg_over_prrcp_gas real(prec),allocatable:: pr(:,:,:),px(:, :,:),py(:, :,:),pz(:, :,:) ! Executable Code @@ -91,13 +91,9 @@ subroutine gradmoa() do i=1,np rg_over_prrcp_gas=Rgas/mw_gas(i,j,k)* & Pref**(-Rgas/cp_gas(i,j,k)/mw_gas(i,j,k)) - pr_double=(xvtmp(i,j,k,itheta)* & - rg_over_prrcp_gas)**(cp_gas(i,j,k)/cv_gas(i,j,k))-pre(i,j,k) -#ifdef DBL_PREC - pr(i,j,k)=pr_double -#else - pr(i,j,k)=real(pr_double) -#endif + pr_local=(xvtmp(i,j,k,itheta)* & + rg_over_prrcp_gas)**(cp_gas(i,j,k)/cv_gas(i,j,k))-pre(i,j,k) + pr(i,j,k)=pr_local enddo enddo enddo @@ -106,8 +102,8 @@ subroutine gradmoa() do k=1,l do i=1,np ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/update.F90 CODE-dev/variables. ,→ F90 index e3295d7..26618be 100644 +++ b/CODE-dev/update.F90 @@ -43,11 +43,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use gridsetup, only : timestep @@ -93,14 +89,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1000 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,pebelow, & - itag,tmpxrcv,ncount,mpi_double_precision,peabove,itag, & - mpi_comm_world,sndrcvStatus,ierror) -#else - call MPI_Sendrecv(tmpxsnd,ncount,mpi_real,pebelow,itag,tmpxrcv, & - ncount,mpi_real,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) 177 FIRETEC Bug Resolution Log June 2026 -#endif + call MPI_Sendrecv(tmpxsnd,ncount,mpi_prec,pebelow,itag,tmpxrcv, & + ncount,mpi_prec,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) ncount=0 do k=1,nzp @@ -143,14 +133,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1100 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,peabove, & - itag,tmpxrcv,ncount,mpi_double_precision,pebelow,itag, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 178 BUG-2026-06-037: Diagnostics truncated precision before printing and reporting Summary Some reduced values were stored in default-real print variables before output, even when the upstream calculation and communication used the configured precision kind. • rmaxmin.F90 Downcasting values for reporting can make diagnostics less accurate than the actual computed quantities and can hide precision issues. Impact Printed diagnostics may not reflect the solver’s real precision state. Promote diagnostic intermediates to real(prec) and remove unnecessary casts before reporting. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/rmaxmin.F90 index ce7dd11..ec8f639 100644 +++ b/CODE-dev/rmaxmin.F90 @@ -18,7 +18,7 @@ subroutine rmaxmin_1D(array,string,il,iu) character(*) :: string real(prec) :: rmax,rmin,xmax,xmin - real :: xmaxprint,xminprint + real(prec) :: xmaxprint,xminprint ! Executable Code rmax=maxval(array) @@ -28,16 +28,14 @@ subroutine rmaxmin_1D(array,string,il,iu) 179 call mpi_reduce(rmin,xmin,1,mpi_double_precision,mpi_min,0, & - xmaxprint = real(xmax) - xminprint = real(xmin) #else call mpi_reduce(rmax,xmax,1,mpi_real,mpi_max,0, & call mpi_reduce(rmin,xmin,1,mpi_real,mpi_min,0, & +#endif xmaxprint = xmax xminprint = xmin -#endif if(mpi_rank.eq.0) print*,’ RMAXMIN for ’,string, & ’ : max = ’,xmaxprint,’ ,min = ’,xminprint @@ -63,7 +61,7 @@ subroutine rmaxmin_3D(array,string,il,iu,jl,ju,kl,ku) character(*) :: string real(prec) :: rmax,rmin,xmax,xmin - real :: xmaxprint,xminprint + real(prec) :: xmaxprint,xminprint ! Executable Code rmax=maxval(array(:,:,:)) @@ -73,16 +71,14 @@ subroutine rmaxmin_3D(array,string,il,iu,jl,ju,kl,ku) ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/rmaxmin.F90 index ec8f639..7b29af3 100644 +++ b/CODE-dev/rmaxmin.F90 @@ -5,11 +5,7 @@ subroutine rmaxmin_1D(array,string,il,iu) use msga_variables, only : mpi_rank,mpi_comm_world,ierror,mpi_max, & mpi_min -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec ! Local Variables @@ -23,17 +19,10 @@ subroutine rmaxmin_1D(array,string,il,iu) ! Executable Code rmax=maxval(array) rmin=minval(array) -#ifdef DBL_PREC - call mpi_reduce(rmax,xmax,1,mpi_double_precision,mpi_max,0, & + call mpi_reduce(rmax,xmax,1,mpi_prec,mpi_max,0, & - call mpi_reduce(rmin,xmin,1,mpi_double_precision,mpi_min,0, & + call mpi_reduce(rmin,xmin,1,mpi_prec,mpi_min,0, & -#else 180 - call mpi_reduce(rmax,xmax,1,mpi_real,mpi_max,0, & - call mpi_reduce(rmin,xmin,1,mpi_real,mpi_min,0, & -#endif xmaxprint = xmax xminprint = xmin if(mpi_rank.eq.0) print*,’ RMAXMIN for ’,string, & @@ -48,11 +37,7 @@ subroutine rmaxmin_3D(array,string,il,iu,jl,ju,kl,ku) use msga_variables, only : mpi_rank,mpi_comm_world,ierror,mpi_max, & mpi_min -#ifdef DBL_PREC ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 181 BUG-2026-06-038: Precision bugs existed in numerically critical advection and turbulence kernels Summary Low-level transport and turbulence kernels used unsuffixed literals and thresholds in flux limiting, diffusion, Reynolds-stress, and related gradient calculations. • advectionScheme.F90 • subGridTurb/diffuse_turb.F90 • subGridTurb/rijgradu_turb.F90 • subGridTurb/stressrij_turb.F90 • several other files under subGridTurb/* These kernels sit on numerically sensitive hot paths. Even small kind mismatches in coefficients, epsilons, or intrinsic arguments can affect stability and reproducibility. Impact Kind inconsistencies in these routines can change cross-precision agreement in some of the most solver-critical paths. Convert coefficients, epsilons, initialization values, and intrinsic arguments in advection and turbulence kernels to precision-safe _prec forms. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/advectionScheme.F90 CODE-dev/ ,→ subGridTurb/diffuse_turb.F90 CODE-dev/subGridTurb/rijgradu_turb.F90 index 382217e..c0b168c 100644 +++ b/CODE-dev/advectionScheme.F90 @@ -13,15 +13,16 @@ module advection_functions 182 real(prec),intent(in) :: y - pp = max(0.0,y) + pp = max(0.0_prec,y) !************************************* real(prec) function pn(y) + use gridlist_variables, only : prec real(prec),intent(in) :: y - pn = -min(0.0,y) + pn = -min(0.0_prec,y) !************************************* @@ -34,10 +35,11 @@ module advection_functions end function donor !************************************* real(prec) function vdiv1(a1,a2,a3,r) + use gridlist_variables, only : prec real(prec),intent(in) :: a1,a2,a3,r - vdiv1 = 0.25*a2*(a3-a1)/r + vdiv1 = 0.25_prec*a2*(a3-a1)/r end function vdiv1 !************************************* @@ -45,15 +47,16 @@ module advection_functions real(prec),intent(in) :: aa,b1,b2,b3,b4,r - vdiv2 = 0.25*aa*(b1+b2-b3-b4)/r + vdiv2 = 0.25_prec*aa*(b1+b2-b3-b4)/r ... [diff excerpt truncated; run the command above for the full commit diff] # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/update.F90 index e3295d7..26618be 100644 +++ b/CODE-dev/update.F90 @@ -43,11 +43,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use gridsetup, only : timestep @@ -93,14 +89,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo 183 itag=(timestep*10000)+1000 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,pebelow, & - itag,tmpxrcv,ncount,mpi_double_precision,peabove,itag, & -#else - call MPI_Sendrecv(tmpxsnd,ncount,mpi_real,pebelow,itag,tmpxrcv, & - ncount,mpi_real,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) -#endif + call MPI_Sendrecv(tmpxsnd,ncount,mpi_prec,pebelow,itag,tmpxrcv, & + ncount,mpi_prec,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) ncount=0 do k=1,nzp @@ -143,14 +133,8 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo itag=(timestep*10000)+1100 -#ifdef DBL_PREC - call MPI_Sendrecv(tmpxsnd,ncount,mpi_double_precision,peabove, & - itag,tmpxrcv,ncount,mpi_double_precision,pebelow,itag, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. Overview This list documents a radiation-physics consistency bug in which the Stefan–Boltzmann constant was both inaccurate in the shared constants module and duplicated with a different hardcoded value in the Monte Carlo radiation module. 184 BUG-2026-06-039: Incorrect and inconsistent Stefan–Boltzmann constant values Summary The Stefan–Boltzmann constant was defined with an incorrect value in variables.F90 and was also hardcoded with a different value in Radiation/monteCarlo_rad.F90. This created both a numerical accuracy issue and an inconsistency between radiation modules. • CODE-dev/variables.F90 • CODE-dev/Radiation/monteCarlo_rad.F90 The codebase used two different values for the Stefan–Boltzmann constant: ! variables.F90 sigma = 5.678e-8_prec ! Radiation/monteCarlo_rad.F90 5.67051e-8_prec The value in variables.F90 was less accurate than the CODATA 2018 recommended value: sigma = 5.670374419e-8_prec Additionally, the Monte Carlo radiation module hardcoded its own value in multiple source-term calculations instead of using the shared sigma constant from the constants module. This made the radiation behavior inconsistent across modules and increased the risk of future divergence if the constant were updated in only one location. Impact This bug affected radiation source calculations that depend on the Stefan–Boltzmann constant. The numerical difference is small but systematic, and it could lead to inconsistent radiative heat transfer results between simple radiation and Monte Carlo radiation paths. The issue also reduced maintainability because the same physical constant was defined in one module but duplicated as hardcoded literals elsewhere. Changes made Updated sigma in variables.F90 The Stefan–Boltzmann constant in the constants module was updated from: real(prec) :: sigma = 5.678e-8_prec ! Stefan-Boltzmann constant (W/(m^2K^4)) to: 185 FIRETEC Bug Resolution Log June 2026 real(prec) :: sigma = 5.670374419e-8_prec ! Stefan-Boltzmann constant (W/(m^2K^4)) This updates the shared constant to the CODATA 2018 recommended value. Imported sigma into Radiation/monteCarlo_rad.F90 The main Monte Carlo radiation subroutine import was changed from: use constants, only : pref to: use constants, only : pref,sigma The nested source_defs() subroutine was also updated to import sigma: use constants, only : sigma Removed hardcoded Stefan–Boltzmann values from Monte Carlo radiation source terms The hardcoded value 5.67051e-8_prec was replaced with the shared sigma constant in all affected source calculations. Examples: sourcesol(ift,i,j,k)=4.0_prec*papvift(ift,i,j,k) & *(t4bar-tambient**2)*(t4bar+tambient**2)*sigma sourcesol(ift,i,j,k+nfuel)=4.0_prec*papvift(ift,i,j,k+nfuel) & *(t4bar-tambient**2)*(t4bar+tambient**2)*sigma sourcegas(i,j,k)=4.0_prec*papvgas(i,j,k+nfuel)* & (t4bar-tambient**2)*(t4bar+tambient**2)*sigma Files changed CODE-dev/variables.F90 Updated the shared Stefan–Boltzmann constant: - real(prec) :: sigma = 5.678e-8_prec ! Stefan-Boltzmann constant (W/(m^2K^4)) + real(prec) :: sigma = 5.670374419e-8_prec ! Stefan-Boltzmann constant (W/(m^2K^4)) CODE-dev/Radiation/monteCarlo_rad.F90 Imported sigma from the constants module: 186 - use constants, only : pref + use constants, only : pref,sigma Added sigma import to source_defs(): + use constants, only : sigma Replaced hardcoded Stefan–Boltzmann constant values: - *(t4bar-tambient**2)*(t4bar+tambient**2)*5.67051e-8_prec + *(t4bar-tambient**2)*(t4bar+tambient**2)*sigma - *(t4bar-tambient**2)*(t4bar+tambient**2)*5.67051e-8_prec + *(t4bar-tambient**2)*(t4bar+tambient**2)*sigma - (t4bar-tambient**2)*(t4bar+tambient**2)*5.67051e-8_prec + (t4bar-tambient**2)*(t4bar+tambient**2)*sigma Result The code now uses a single shared Stefan–Boltzmann constant throughout the affected radiation calculations. This improves numerical consistency, accuracy, and maintainability by avoiding duplicated hardcoded physical constants. Git evidence: 14164a2 (2026-06-22, Stefan-Boltzmann constant fix). The Stefan-Boltzmann constant was made consistent in the shared variables/radiation code instead of carrying mismatched values across modules. # 14164a2 Fix Stefan-Boltzmann constant in radiation modules # Full command: git show --find-renames --unified=3 14164a2 -- CODE-dev/variables.F90 CODE-dev/ ,→ Radiation/monteCarlo_rad.F90 index 99ae25a..ed1ca67 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -11,7 +11,7 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & use radiation_general_variables, only : fsiesrad,firad use radiation_montecarlo_variables, only : Etot,Emin - use constants, only : pref + use constants, only : pref,sigma ! Local Variables @@ -211,6 +211,7 @@ subroutine source_defs() use radiation_montecarlo_variables, only : sourcesol,sourcegas, & papvift,Etot,EAZ,volumeAZ,Emin,papvtotAZ,nphotbatch,lmc,papvgas 187 + use constants, only : sigma ! Local Variables @@ -252,7 +253,7 @@ subroutine source_defs() t4bar=sqrt((temps(ift,i,j,1)**2+facp*wdth**2) & *(temps(ift,i,j,1)**2+facm*wdth**2)) sourcesol(ift,i,j,k)=4.0_prec*papvift(ift,i,j,k) & - *(t4bar-tambient**2)*(t4bar+tambient**2)*5.67051e-8_prec + *(t4bar-tambient**2)*(t4bar+tambient**2)*sigma endif !if(temps.gt.tambient) enddo ! loop on ift enddo ! do i @@ -282,7 +283,7 @@ subroutine source_defs() t4bar=sqrt((temps(ift,i,j,k)**2+facp*wdth**2) & *(temps(ift,i,j,k)**2+facm*wdth**2)) sourcesol(ift,i,j,k+nfuel)=4.0_prec*papvift(ift,i,j,k+nfuel) & - *(t4bar-tambient**2)*(t4bar+tambient**2)*5.67051e-8_prec + *(t4bar-tambient**2)*(t4bar+tambient**2)*sigma endif !if(temps.gt.tambient) enddo ! loop on ift enddo ! do i @@ -313,7 +314,7 @@ subroutine source_defs() t4bar=sqrt((tempg(i,j,k)**2+facp*wdth**2) & *(tempg(i,j,k)**2+facm*wdth**2)) ... [diff excerpt truncated; run the command above for the full commit diff] Overview This list documents nine completed bug reports added in June 2026. They cover boundary-condition handling, MPI halo-exchange robustness, radiation-source indexing, firebrand boundary logic, and precision portability issues. 188 BUG-2026-06-040: MPDATA y-face halo update appears to use botedge instead of topedge when updating f2o Summary In advectionScheme.F90, near the end of mpdata(), the MPDATA/FCT path updates the y-face flux-correction array f2o with an update() call whose y-extent is selected using botedge: if(botedge.eq.0) then call update(f2o(:,:,:,kv), & np,mp,l,1-ih,np+ih,1-ih,mp+ih+1,3,0,2) else call update(f2o(:,:,:,kv), & np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,3,0,2) endif This appears inconsistent with the array geometry and with nearby MPDATA code. f2o is a y-face array with an extra face on the high-y side, so the decision to include mp+1 should depend on topedge, not botedge. The analogous x-face update uses rightedge to decide whether f1o should be updated through np or np+1. The analogous y-face update should therefore use topedge to decide whether f2o should be updated through mp or mp+1. • CODE-dev/advectionScheme.F90 • CODE-dev/update.F90 • CODE-dev/msga.F90 • CODE-dev/variables.F90 • CODE-dev/force.F90 The suspect code is: if(rightedge.eq.0) then call update(f1o(:,:,:,kv), & np,mp,l,1-ih,np+ih+1,1-ih,mp+ih,2,0,1) else call update(f1o(:,:,:,kv), & np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,2,0,1) endif if(botedge.eq.0) then call update(f2o(:,:,:,kv), & np,mp,l,1-ih,np+ih,1-ih,mp+ih+1,3,0,2) else call update(f2o(:,:,:,kv), & np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,3,0,2) endif The first block is structurally correct for f1o: f1o is an x-face array, so including the high-side x face np+1 depends on whether this rank is on the right/high-x boundary. The second block appears 189 inconsistent: f2o is a y-face array, so including the high-side y face mp+1 should depend on whether this rank is on the top/high-y boundary. Evidence from array allocation supports this interpretation: allocate (v1mp(il:iu+1,jl:ju ,lls ,nvp)); v1mp=0.0_prec allocate (v2mp(il:iu ,jl:ju+1,lls ,nvp)); v2mp=0.0_prec allocate (v3mp(il:iu ,jl:ju ,lls+1,nvp)); v3mp=0.0_prec allocate (f1(il:iu+1,jl:ju ,lls ,nvp) ); f1= 0.0_prec allocate (f2(il:iu ,jl:ju+1,lls ,nvp) ); f2= 0.0_prec allocate (f3(il:iu ,jl:ju ,lls+1,nvp) ); f3= 0.0_prec allocate (f1o(il:iu+1,jl:ju ,lls ,nvp) ); f1o= 0.0_prec allocate (f2o(il:iu ,jl:ju+1,lls ,nvp) ); f2o= 0.0_prec allocate (f3o(il:iu ,jl:ju ,lls+1,nvp) ); f3o= 0.0_prec That means f1o has the extra face in the x direction, il:iu+1, while f2o has the extra face in the y direction, jl:ju+1. Therefore the special +1 extent for f1o is associated with the high-x/right side, while the special +1 extent for f2o is associated with the high-y/top side. Earlier in the same mpdata() routine, the code already uses topedge when deciding whether y-face arrays should be updated through mp or mp+1. For v2mp: if (topedge.eq.0) then call update(v2mp(:,:,:,kv),np,mp,l, & 1-ih,np+ih,1-ih,mp+ih+1,3,0,2) else call update(v2mp(:,:,:,kv),np,mp+1, & l,1-ih,np+ih,1-ih,mp+ih+1,3,0,2) endif For f2: if (topedge.eq.0) then call update(f2(:,:,:,kv),np,mp,l, & 1-ih,np+ih,1-ih,mp+ih+1,3,0,2) else call update(f2(:,:,:,kv),np,mp+1,l, & 1-ih,np+ih,1-ih,mp+ih+1,3,0,2) endif These are direct precedents for how y-face arrays with jl:ju+1 should be handled. The later f2o block differs from this pattern by using botedge. msga.F90 also confirms the meanings of the edge flags: ! set up edge information (0=>not an edge, 1=>edge) if((ibc_right.gt.0).and.(mod((mpi_rank+1),nprocx)==0)) rightedge=1 if((ibc_left.gt.0).and.(mod((mpi_rank+1),nprocx)==1.or.nprocx==1)) & leftedge=1 if ((ibc_bot.gt.0).and.((mpi_rank+1).le.nprocx)) botedge=1 if ((ibc_top.gt.0).and.(((numprocs)-(mpi_rank+1)) y u <-> v np <-> mp dx <-> dy left/right boundaries <-> bottom/top boundaries The current code breaks this structural symmetry in the f2o update path: • x-face f1o uses the high-side x boundary flag, rightedge, to decide whether to include np+1; • y-face f2o should analogously use the high-side y boundary flag, topedge, to decide whether to include mp+1; • instead, it uses the low-side y boundary flag, botedge. This likely affects MPDATA/FCT runs where this later correction path is active, especially runs with nfct > 1 and a y-direction MPI decomposition where botedge and topedge are not identical. It may be masked or less visible when nfct = 1, when there is no y-direction MPI decomposition, or when a single y rank is both bottom and top edge. Express the fix as a minimal diff: @@ - if(botedge.eq.0) then + if(topedge.eq.0) then call update(f2o(:,:,:,kv), & np,mp,l,1-ih,np+ih,1-ih,mp+ih+1,3,0,2) else The fix is small and localized, but existing nfct > 1 results may change near y boundaries. That result change would be expected if the current code is incorrectly updating the wrong y-face extent. A targeted regression test should compare rotated x- and y-oriented cases and verify that mp+1 is selected exactly when topedge = 1, not when botedge = 1. Git evidence: ee83e79 (2026-06-09, zeta bug-list pass); 0325b25 (2026-07-14, MPDATA cleanup); a849341 (2026-06-24, precision and boundary follow-up fixes). The MPDATA y-face update calls were folded into the new staggered-boundary update interface and later MPDATA cleanup. The current code uses side-specific update flags rather than the earlier hand-written edge test pattern. # ee83e79 Gone through Colby’s zeta list of bugs. Still a couple issues to go through. # Full command: git show --find-renames --unified=3 ee83e79 -- CODE-dev/advectionScheme.F90 CODE-dev/ ,→ update.F90 CODE-dev/variables.F90 191 +++ b/CODE-dev/advectionScheme.F90 @@ -132,7 +132,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1,0) + call update(u,u,np,mp,l,1-ih,np+ih,1-ih,mp+ih,2,0,1) do k=1,l do j=1,mp do i=1,np+1 @@ -159,7 +159,7 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) enddo endif - call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,0,1) + call update(v,v,np,mp,l,1-ih,np+ih,1-ih,mp+ih,3,0,2) do k=1,l do j=1,mp+1 do i=1,np @@ -186,8 +186,8 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta,order) ! the following updated are required for antidiffusive vel in ! mpdata - call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1,0) - call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,0,1) + call update(u1,u1,np+1,mp,l,1-ih,np+ih+1,1-ih,mp+ih,1,1,1) + call update(u2,u2,np,mp+1,l,1-ih,np+ih,1-ih,mp+ih+1,1,2,2) endif @@ -210,13 +210,10 @@ subroutine mpdata(x,h,xe,il,iu,jl,ju,lls,nvp) - !real(prec),external :: donor,vcorr,vdiv1,vdiv2,vdyf,pn,pp - + integer :: n3,kv,i,j,k,ip,im,jp,jm,kp,km,itrfct,iuv ... [diff excerpt truncated; run the command above for the full commit diff] # 0325b25 Clean up of mpdata. # Full command: git show --find-renames --unified=3 0325b25 -- CODE-dev/advectionScheme.F90 CODE-dev/ ,→ update.F90 +++ b/CODE-dev/advectionScheme.F90 @@ -1,9 +1,7 @@ !**********************************************************************! ! this routine computes the advection on the large time steps and ! the nv variables. It can use either donorcell or fct -! !**********************************************************************! - 192 @@ -13,7 +11,7 @@ module advection_functions - pp = max(0.0_wp,y) + pp = max(0._wp,y) !************************************* @@ -22,7 +20,7 @@ module advection_functions - pn = -min(0.0_wp,y) + pn = -min(0._wp,y) !************************************* @@ -56,7 +54,7 @@ module advection_functions - rat2 = (z2-z1)*0.5_wp + rat2 = 0.5_wp*(z2-z1) !************************************* @@ -117,10 +115,6 @@ subroutine setAdvectiveVelocities(u,v,o,il,iu,jl,ju,lls,dta) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 193 BUG-2026-06-041: MPI broadcast type mismatch in source_defs Summary The source_defs routine currently computes a global radiation energy total, Etot, using mpi_reduce followed by mpi_Bcast. The code chooses the MPI datatype with #ifdef DBL_PREC, using either mpi_double_precision or mpi_real depending on the configured precision. The existing comment says: ! Workaround for a weird type mismatch bug in gfortran That comment is misleading. The underlying issue is not specifically a gfortran broadcast bug. The real issue is that the MPI datatype must match the Fortran kind of real(prec). If prec and DBL_PREC ever get out of sync, the code can compile successfully but pass the wrong datatype to MPI at runtime. • monteCarlo_rad.F90 The current pattern is effectively: #ifdef DBL_PREC call mpi_reduce(Etotlocal,Etot,1,mpi_double_precision,mpi_sum,0, & #else call mpi_reduce(Etotlocal,Etot,1,mpi_real,0,mpi_comm_world, & ierror) #endif ! Workaround for a weird type mismatch bug in gfortran #ifdef DBL_PREC call mpi_Bcast(Etot,1,mpi_double_precision,0,mpi_comm_world,ierror) papvthresh=2.0_prec*min_rhoFuel/(maxval(sizeScale)*rhoMicro) #else call mpi_Bcast(Etot,1,mpi_real,0,mpi_comm_world,ierror) papvthresh=2.0_prec*min_rhoFuel/(maxval(sizeScale)*rhoMicro) #endif Etotlocal and Etot are treated as real(prec), but MPI does not understand real(prec) directly. It only sees a memory buffer and an MPI datatype, such as mpi_real or mpi_double_precision. Therefore this mapping must always be correct: real(prec) <--> matching MPI datatype real(4) / single precision <--> mpi_real real(8) / double precision <--> mpi_double_precision If Etot is an 8-byte real but the code passes mpi_real, MPI will reduce or broadcast it as if it were a 4-byte real. That can corrupt the value, produce incorrect totals, or cause compiler/MPI-dependent behavior. 194 The broadcast exists because mpi_reduce only makes the reduced value valid on the root rank, rank 0, while Etot is later used on all ranks in logic such as if(Etot.LT.Emin)then and in photon allocation calculations involving EAZ(i,j,k)/Etot. Impact This communication pattern is valid but more verbose than necessary. It duplicates precision-specific code, carries a misleading compiler-specific workaround comment, and increases the risk of MPI datatype mismatches at runtime if precision selection and datatype selection ever diverge. Replace the mpi_reduce plus mpi_Bcast pair with a single mpi_allreduce. This removes duplicated communication, removes the misleading comment, and makes the intent clearer. The assignment to papvthresh should also be moved outside the precision-dependent branch because it is identical in both branches. A representative diff is: diff --git a/monteCarlo_rad.F90 b/monteCarlo_rad.F90 @@ - call mpi_reduce(Etotlocal,Etot,1,mpi_double_precision,mpi_sum,0, & + call mpi_allreduce(Etotlocal,Etot,1,mpi_double_precision,mpi_sum, & @@ - call mpi_reduce(Etotlocal,Etot,1,mpi_real,0,mpi_comm_world, & + call mpi_allreduce(Etotlocal,Etot,1,mpi_real,mpi_sum,mpi_comm_world, & ierror) @@ - ! Workaround for a weird type mismatch bug in gfortran -#ifdef DBL_PREC - call mpi_Bcast(Etot,1,mpi_double_precision,0,mpi_comm_world,ierror) - papvthresh=2.0_prec*min_rhoFuel/(maxval(sizeScale)*rhoMicro) -#else - call mpi_Bcast(Etot,1,mpi_real,0,mpi_comm_world,ierror) - papvthresh=2.0_prec*min_rhoFuel/(maxval(sizeScale)*rhoMicro) -#endif + papvthresh=2.0_prec*min_rhoFuel/(maxval(sizeScale)*rhoMicro) Longer term, the project should define one project-wide MPI datatype alias for real(prec), for example mpi_prec, so MPI communication does not have to repeat #ifdef DBL_PREC at each call site. Git evidence: 6e086cf (2026-06-22, unified MPI precision datatype); a849341 (2026-06-24, precision and boundary follow-up fixes). The radiation source broadcast path now uses the shared MPI datatype tied to real(wp), avoiding the old single/double precision mismatch. # 6e086cf Use unified MPI precision datatype across precision-dependent routines # Full command: git show --find-renames --unified=3 6e086cf -- CODE-dev/Radiation/monteCarlo_rad.F90 195 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -65,11 +65,7 @@ subroutine papv_defs -#ifdef DBL_PREC -#else -#endif + use msga_variables, only : mpi_prec use radiation_montecarlo_variables, only : papvift,papvgas,kfindex, & @@ -168,14 +164,8 @@ subroutine papv_defs allocate(papvtotAZtmp(np,mp,l+nfuel,numprocs)) papvtotAZtmp = 0.0_prec -#ifdef DBL_PREC - call mpi_allgather(papvlocal,np*mp*(l+nfuel), & - mpi_double_precision,papvtotAZtmp,np*mp*(l+nfuel), & -#else - call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_real, & - papvtotAZtmp,np*mp*(l+nfuel),mpi_real,mpi_comm_world,ierror) -#endif + call mpi_allgather(papvlocal,np*mp*(l+nfuel),mpi_prec, & + papvtotAZtmp,np*mp*(l+nfuel),mpi_prec,mpi_comm_world,ierror) do iprocx=1,nprocx do jprocy=1,nprocy iproc=iprocx+(jprocy-1)*nprocx @@ -197,16 +187,13 @@ end subroutine papv_defs ! lmc for photon generation and shooting !----------------------------------------------------------------------- + use mpi ... [diff excerpt truncated; run the command above for the full commit diff] # a849341 Fixed precision bugs, and a single boundary bug. Also made a couple changes to how precision ,→ was called. # Full command: git show --find-renames --unified=3 a849341 -- CODE-dev/Radiation/monteCarlo_rad.F90 index 9291e6f..504972f 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -4,7 +4,7 @@ !----------------------------------------------------------------------- subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & il,iu,jl,ju,lls,nfuel) - use gridlist_variables, only : prec + use gridlist_variables, only : wp use radiation_gridlist_variables, only : icallrad use gridsetup, only : ittot @@ -16,9 +16,9 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & 196 ! Local Variables - real(prec),intent(in) :: xvsolid(nfuel,il:iu,jl:ju,lls) - real(prec),intent(inout) :: force(ilh:iuh,jlh:juh,lls) - real(prec),intent(inout) :: force_fuel(nfuel,il:iu,jl:ju,lls) + real(wp),intent(in) :: xvsolid(nfuel,il:iu,jl:ju,lls) + real(wp),intent(inout) :: force(ilh:iuh,jlh:juh,lls) + real(wp),intent(inout) :: force_fuel(nfuel,il:iu,jl:ju,lls) character(len=10) :: iftname @@ -39,7 +39,7 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & do j=jl,ju do i=il,iu force(i,j,k)=force(i,j,k)+firad(i,j,k)/cp_gas(i,j,k)* & - (pref/pr(i,j,k))**(1.0_prec-cv_gas(i,j,k)/cp_gas(i,j,k)) + (pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) enddo enddo enddo @@ -60,12 +60,12 @@ end subroutine firerad_MC ! generation and shooting !----------------------------------------------------------------------- subroutine papv_defs - use gridlist_variables, only : l,ih,tambient,nprocx,nprocy,prec + use gridlist_variables, only : l,ih,tambient,nprocx,nprocy,wp use radiation_gridlist_variables, only : isootmodel,crad ... [diff excerpt truncated; run the command above for the full commit diff] 197 BUG-2026-06-042: Non-portable precision definition in gridlist_variables.f90 Summary The prec parameter in gridlist_variables.f90 uses hardcoded kind values, 4 and 8, which are compiler-dependent and non-portable. These should be replaced with selected_real_kind() for Fortran 90+ compatibility. • gridlist_variables.f90 The current module definition is: #ifdef DBL_PREC integer,parameter :: prec = 8 #else integer,parameter :: prec = 4 #endif Kind numbers such as 4 and 8 are not standardized in Fortran and may vary by compiler. As a result: • some compilers may use different kind values for single and double precision; • there is no guarantee that kind 4 represents a 32-bit real or that kind 8 represents a 64-bit real on all systems; • the implementation violates Fortran portability best practices. The impact is that the code may fail to compile on certain compilers, may select incorrect precision if a compiler uses different numbering, and loses portability across HPC systems and compiler families, including GNU, Intel, and Cray. Impact This issue directly affects portability and numerical configuration. The current implementation may work on the compilers already tested, but it is not guaranteed to remain correct across all supported systems or future compiler environments. Use selected_real_kind() in diff form: diff --git a/gridlist_variables.f90 b/gridlist_variables.f90 @@ #ifdef DBL_PREC - integer,parameter :: prec = 8 + ! Double precision: ~15 decimal digits, exponent range ~10^307 + integer,parameter :: prec = selected_real_kind(15, 307) #else - integer,parameter :: prec = 4 198 + ! Single precision: ~6 decimal digits, exponent range ~10^37 + integer,parameter :: prec = selected_real_kind(6, 37) #endif After applying the fix, verify the selected precision with diagnostics such as: if (mpi_rank == 0) then print*, ’Precision␣kind␣value:’, prec print*, ’Storage␣size␣(bits):’, storage_size(1.0_prec) print*, ’Decimal␣precision:’, precision(1.0_prec) print*, ’Exponent␣range:’, range(1.0_prec) endif Expected results are approximately 32 bits / 6 digits / exponent range 37 for single precision and 64 bits / 15 digits / exponent range 307 for double precision. Testing should include builds with -DDBL_PREC=ON and -DDBL_PREC=OFF, ideally on GNU, Intel, and Cray compilers, with regression checks and restart compatibility review. Git evidence: 5a8fd2e (2026-06-19, precision mismatch fixes); a849341 (2026-06-24, precision and boundary follow-up fixes); 80d0a79 (2026-06-24, missed precision setting). Precision definitions in gridlist and related modules were moved to the common precision scheme, with a follow-up for a missed prec=4 location. # 5a8fd2e fixed precision mismatches # Full command: git show --find-renames --unified=3 5a8fd2e -- CODE-dev/io.F90 CODE-dev/CMakeLists.txt ,→ CODE-dev/variables.F90 index 8214c12..15edeeb 100644 +++ b/CODE-dev/CMakeLists.txt @@ -20,6 +20,15 @@ endif() add_compile_options(-O2 -g) #add_compile_options(-Wall -Wextra -Werror -fbounds-check -pedantic -fcheck=all) +# Option for precision +option(DBL_PREC "Use double precision" OFF) #default is single precision unless: cmake .. -DDBL_PREC= ,→ ON +if(DBL_PREC) + add_compile_definitions(DBL_PREC) + message(STATUS "Building with DOUBLE PRECISION") +else() + message(STATUS "Building with SINGLE PRECISION") +endif() + # Find dependencies find_package(MPI REQUIRED COMPONENTS Fortran) include_directories(${MPI_Fortran_INCLUDE_PATH}) index f1bd9f0..e074f8f 100644 +++ b/CODE-dev/io.F90 @@ -150,8 +150,8 @@ subroutine readio(array,iunit,nzdim) 199 ! Executable Code allocate(indata(n,m,nzdim),tmparray(np,mp,nzdim,numprocs)) - indata = 0.0 - tmparray = 0.0 + indata = 0.0_prec + tmparray = 0.0_prec read(iunit) indata do iprocx=1,nprocx do jprocy=1,nprocy index 34f29cd..7e0d8c8 100644 +++ b/CODE-dev/variables.F90 @@ -15,15 +15,15 @@ module gridlist_variables integer :: irst = 0 ! Restart flag integer :: nt = 10000 ! Total number of large timesteps ... [diff excerpt truncated; run the command above for the full commit diff] # a849341 Fixed precision bugs, and a single boundary bug. Also made a couple changes to how precision ,→ was called. # Full command: git show --find-renames --unified=3 a849341 -- CODE-dev/update.F90 CODE-dev/io.F90 ,→ CODE-dev/readgridlist.F90 index 308705c..e9f8095 100644 +++ b/CODE-dev/io.F90 @@ -79,23 +79,23 @@ end subroutine irstreadio ! writeio writes a single array to a specified output file !----------------------------------------------------------------------- subroutine writeio(indata,iunit,nzdim) - use gridlist_variables, only : n,m,nprocx,nprocy,prec + use gridlist_variables, only : n,m,nprocx,nprocy,wp use msga_variables, only : numprocs,mpi_comm_world,mpi_rank,ierror - use msga_variables, only : mpi_prec + use msga_variables, only : mpi_wp ! Local Variables integer,intent(in) :: nzdim,iunit - real(prec),intent(in) :: indata(np,mp,nzdim) + real(wp),intent(in) :: indata(np,mp,nzdim) integer :: i,j,k,iproc,iprocx,jprocy,ia,ja,nsize - real(prec),allocatable :: tmparray(:,:,:,:),outdata(:,:,:) + real(wp),allocatable :: tmparray(:,:,:,:),outdata(:,:,:) ! Executable Code allocate(tmparray(np,mp,nzdim,numprocs),outdata(n,m,nzdim)) nsize=np*mp*nzdim - call mpi_gather(indata,nsize,mpi_prec,tmparray,nsize,mpi_prec, & + call mpi_gather(indata,nsize,mpi_wp,tmparray,nsize,mpi_wp, & 0,mpi_comm_world,ierror) if (mpi_rank.eq.0) then do iprocx=1,nprocx @@ -121,24 +121,24 @@ end subroutine writeio ! readio reads a single array from a specified output file !----------------------------------------------------------------------- subroutine readio(array,iunit,nzdim) 200 - use gridlist_variables, only : n,m,nprocx,nprocy,prec + use gridlist_variables, only : n,m,nprocx,nprocy,wp use msga_variables, only : mpi_comm_world,mpi_rank,numprocs,ierror - use msga_variables, only : mpi_prec ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 201 BUG-2026-06-043: Firebrand exact top-boundary handling writes the x coordinate instead of y Summary The exact top-boundary equality case in Firebrands/evolve_fb.F90 checks iy, but modifies ix. A firebrand exactly on the top domain boundary therefore has its x coordinate overwritten with a y coordinate, while the y coordinate remains unchanged. • Firebrands/evolve_fb.F90 The relevant code is: else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain on right if(xvbrand(it,ix).eq.(n*dx)) xvbrand(it,ix)=xvbrand(it,ix)-tolerance ... else if(xvbrand(it,iy).ge.m*dy)then ! Outside y domain on top if(xvbrand(it,iy).eq.(m*dy)) xvbrand(it,ix)=xvbrand(it,iy)-tolerance if(ibc_top.eq.0)then xvbrand(it,iy)=xvbrand(it,iy)-m*dy The top-boundary equality case checks iy, but modifies ix. A firebrand exactly on the top domain boundary has its x coordinate overwritten with a y coordinate. The y coordinate remains exactly m*dy, so mirror handling and later processor assignment can still see it as outside. In updateFB, the destination rank is derived from floor(xvbrand(it,iy)/dy/mp), so exact iy = m*dy can map one row past the valid processor range. Impact This can corrupt firebrand coordinates, leave a top-boundary brand still outside in y, and send it to an invalid or unintended processor row during later processor assignment and boundary handling. Correct the typo in diff form: diff --git a/Firebrands/evolve_fb.F90 b/Firebrands/evolve_fb.F90 @@ - if(xvbrand(it,iy).eq.(m*dy)) xvbrand(it,ix)=xvbrand(it,iy)-tolerance + if(xvbrand(it,iy).eq.(m*dy)) xvbrand(it,iy)=xvbrand(it,iy)-tolerance A more robust follow-up would use a tolerance comparison instead of exact floating-point equality, but the minimal fix is the index correction. Git evidence: 0497645 (2026-06-15, split firebrand boundary checks); c8296c6 (2026-06-15, firebrand edge tolerance); 869ead7 (2026-06-25, boundary-error pass). 202 Firebrand boundary handling was split by side, edge tolerances were added for exact-edge landings, and the later boundary pass removed the erroneous coordinate reuse in removal/landing logic. # 0497645 Split firebrand if statement to check left and right and then top and bottom but not all in ,→ the same if/else loop. # Full command: git show --find-renames --unified=3 0497645 -- CODE-dev/Firebrands/evolve_fb.F90 index b9ed4bc..57032f0 100644 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -120,7 +120,9 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then ! Landed on ground or lofted beyond ,→ vertical domain retain(it)=.false. numBrand=numBrand-1 - else if(xvbrand(it,ix).le.0)then ! Outside x domain + endif + ! Check left and right boundaries + if(xvbrand(it,ix).le.0)then ! Outside x domain xvbrand(it,ix)=n*dx+xvbrand(it,ix) @@ -140,7 +142,10 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & retain(it)=.false. numBrand=numBrand-1 endif - else if(xvbrand(it,iy).le.0)then ! Outside y domain + endif + + ! Check top and bottom boundaries + if(xvbrand(it,iy).le.0)then ! Outside y domain if(ibc_bot.eq.0)then xvbrand(it,iy)=m*dy+xvbrand(it,iy) elseif(ibc_bot.eq.5) then # c8296c6 Added check for when brand lands exactly on the edge of the domain, add or subtract ,→ tolerance to location. # Full command: git show --find-renames --unified=3 c8296c6 -- CODE-dev/Firebrands/evolve_fb.F90 index 57032f0..8eb4fbd 100644 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -121,8 +121,10 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & retain(it)=.false. numBrand=numBrand-1 endif + ! Check left and right boundaries - if(xvbrand(it,ix).le.0)then ! Outside x domain + if(xvbrand(it,ix).le.0)then ! Outside x domain on left + if(xvbrand(it,ix).eq.0) xvbrand(it,ix)=xvbrand(it,ix)+tolerance xvbrand(it,ix)=n*dx+xvbrand(it,ix) @@ -132,7 +134,8 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & retain(it)=.false. numBrand=numBrand-1 endif 203 - else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain + else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain on right + if(xvbrand(it,ix).eq.(n*dx)) xvbrand(it,ix)=xvbrand(it,ix)-tolerance xvbrand(it,ix)=xvbrand(it,ix)-n*dx @@ -145,7 +148,8 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & endif ! Check top and bottom boundaries - if(xvbrand(it,iy).le.0)then ! Outside y domain + if(xvbrand(it,iy).le.0)then ! Outside y domain on bottom + if(xvbrand(it,iy).eq.0) xvbrand(it,iy)=xvbrand(it,iy)+tolerance if(ibc_bot.eq.0)then xvbrand(it,iy)=m*dy+xvbrand(it,iy) elseif(ibc_bot.eq.5) then @@ -155,7 +159,8 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & retain(it)=.false. numBrand=numBrand-1 endif - else if(xvbrand(it,iy).ge.m*dy)then ! Outside y domain + else if(xvbrand(it,iy).ge.m*dy)then ! Outside y domain on top ... [diff excerpt truncated; run the command above for the full commit diff] # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/Firebrands/evolve_fb.F90 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -11,7 +11,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & + use constants, only : pi,g @@ -120,11 +120,11 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then ! Landed on ground or lofted beyond ,→ vertical domain retain(it)=.false. numBrand=numBrand-1 + cycle endif ! Check left and right boundaries - if(xvbrand(it,ix).le.0)then ! Outside x domain on left - if(xvbrand(it,ix).eq.0) xvbrand(it,ix)=xvbrand(it,ix)+tolerance + if(xvbrand(it,ix).lt.0)then ! Outside x domain on left xvbrand(it,ix)=n*dx+xvbrand(it,ix) @@ -133,9 +133,9 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. numBrand=numBrand-1 + cycle ... [diff excerpt truncated; run the command above for the full commit diff] 204 BUG-2026-06-044: Radiation bottom-face intersection uses the top-face coefficient Summary In Radiation/monteCarlo_rad.F90, the code computes the bottom-face quadratic coefficients, but then decides whether the bottom-face equation is linear by checking acoeftop instead of acoefbot. • Radiation/monteCarlo_rad.F90 The evidence is: ! Downward photon acoefbot=(z1bot+z4bot-z2bot-z3bot)*dir(1)*dir(2)/(dx*dy) bcoefbot=(-dir(3)+dir(2)/dy*(z3bot-z1bot)+dir(1)/dx* & (z2bot-z1bot)+(z1bot+z4bot-z2bot-z3bot)*(dir(2)/dy* & (xf/dx-(i1-1))+dir(1)/dx*(yf/dy-(j1-1)))) ccoefbot=(z1bot-zf+(z3bot-z1bot)*(yf/dy-(j1-1))+ & (z2bot-z1bot)*(xf/dx-(i1-1))+(z1bot+z4bot-z2bot-z3bot)* & (xf/dx-(i1-1))*(yf/dy-(j1-1))) if(kt.le.0)then if(abs(acoeftop).lt.tolerance)then !a.eq.0 if(ccoefbot*bcoefbot.lt.0.0_prec) tz=-ccoefbot/bcoefbot On terrain-following or deformed cells, top and bottom faces can have different bilinear coefficients. If the top face is effectively linear and the bottom face is not, the code incorrectly uses the linear formula for the bottom face. If the top face is not linear and the bottom face is, the quadratic branch can divide by a near-zero acoefbot. Impact This can produce incorrect bottom-face intersection behavior in the downward-photon branch of the Monte Carlo radiation solver, especially on terrain/deformed cells where top and bottom geometry differs. Use acoefbot in diff form: diff --git a/Radiation/monteCarlo_rad.F90 b/Radiation/monteCarlo_rad.F90 @@ - if(abs(acoeftop).lt.tolerance)then !a.eq.0 + if(abs(acoefbot).lt.tolerance)then !a.eq.0 if(ccoefbot*bcoefbot.lt.0.0_prec) tz=-ccoefbot/bcoefbot 205 Git evidence: 5e20226 (2026-06-15, radiation acoefbot typo fix); 869ead7 (2026-06-25, boundary-error pass). The bottom radiation intersection branch now uses acoefbot rather than the top-face coefficient. # 5e20226 Fixed typo on radiation that changes acoeftop to acoefbot on line 716. # Full command: git show --find-renames --unified=3 5e20226 -- CODE-dev/Radiation/monteCarlo_rad.F90 index 8333fb1..4678fcc 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -713,7 +713,7 @@ subroutine shoot_photons endif endif endif - elseif(abs(acoeftop).gt.tolerance)then ! look for potential second intersection + elseif(abs(acoefbot).gt.tolerance)then ! look for potential second intersection ! here we use the fact that ccoef should be equal to 0 in this case (suivvox(3)=-1) if(bcoefbot*acoefbot.lt.0) tz=-bcoefbot/acoefbot ! choose the second root when ,→ positive (first should be 0) endif # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/Radiation/monteCarlo_rad.F90 index 504972f..08fd36a 100644 +++ b/CODE-dev/Radiation/monteCarlo_rad.F90 @@ -11,7 +11,7 @@ subroutine firerad_MC(force,force_fuel,xvsolid,ilh,iuh,jlh,juh, & use radiation_general_variables, only : fsiesrad,firad use radiation_montecarlo_variables, only : Etot,Emin - use constants, only : pref,sigma + use constants, only : pref ! Local Variables @@ -653,7 +653,7 @@ subroutine shoot_photons (xf/dx-(i1-1))*(yf/dy-(j1-1))) if(kt.le.0)then - if(abs(acoeftop).lt.tolerance)then !a.eq.0 + if(abs(acoefbot).lt.tolerance)then !a.eq.0 if(ccoefbot*bcoefbot.lt.0.0_wp) tz=-ccoefbot/bcoefbot ! correct intersection with tz ,→ >0 else delta=bcoefbot**2-4*acoefbot*ccoefbot 206 BUG-2026-06-045: V-ramp environmental boundary target uses transposed loop bounds and skips boundary cells Summary xevariation receives xe(1:np,1:mp,:,:) and bounds il=1, iu=np, jl=1, ju=mp. The u-ramp correctly updates all local interior cells. The v-ramp loops, however, use x bounds for j and y bounds for i, and also shrink the loop by ih on both sides. • xeVariation/xevariation.F90 • domainUpdates.F90 • boundary.F90 The relevant evidence is: if(uswitch==1)then do k=1,lfuel do j=1,mp do i=1,np xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & ... if(vswitch==1)then do k=1,lfuel do j=il+ih,iu-ih do i=jl+ih,ju-ih xe(i,j,k,ivvel)=min(vramp*xe(i,j,k,irho), & ... do k=lfuel+1,lls do j=il+ih,iu-ih do i=jl+ih,ju-ih xe(i,j,k,ivvel)=min(vramp*xe(i,j,k,irho), & Caller context shows: domainUpdates.F90 169 if(ixevariation.ge.1) call xevariation(ixevariation,ih, & 170 xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) boundary.F90 25 force(i,j,k,kv)=force(i,j,k,kv)+relaxxv(i,j,k,min(kv,4))* & 26 (xe(i,j,k,kv)-xv(i,j,k,kv))/dt Because the caller passes only the interior slice, shrinking by ih is wrong. If np ̸= mp, the transposed bounds can address outside the local xe dimensions. Even when np = mp, the code skips the first and last local row/column. Those skipped cells include physical boundary cells whose xe values drive relaxation forcing in boundary.F90. 207 Impact This can address outside the local xe dimensions when local x and y extents differ, or can silently skip physical boundary cells even when the local domain is square. That weakens or misapplies the boundary relaxation forcing. Use the declared i and j bounds in the correct orientation and do not shrink the loops by ih. In diff form: diff --git a/xeVariation/xevariation.F90 b/xeVariation/xevariation.F90 @@ - do j=il+ih,iu-ih - do i=jl+ih,ju-ih + do j=jl,ju + do i=il,iu xe(i,j,k,ivvel)=min(vramp*xe(i,j,k,irho), & @@ - do j=il+ih,iu-ih - do i=jl+ih,ju-ih + do j=jl,ju + do i=il,iu xe(i,j,k,ivvel)=min(vramp*xe(i,j,k,irho), & Git evidence: 869ead7 (2026-06-25, boundary-error pass); 8122925 (2026-08-05, xeVariation fixes). The v-ramp/environmental boundary loops were corrected in the boundary-error pass, then the xeVariation pass fixed related local/global coordinate handling and dense-sensor advancement. # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/xeVariation/xevariation.F90 ,→ CODE-dev/domainUpdates.F90 index 56bc028..5cd8479 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -89,7 +89,7 @@ subroutine explicit_domain_updates use gridlist_variables, only : l,ilspgf,frqlspgf,ixevariation,ih, & iheatsource,iturb use vegetation_gridlist_variables, only : nfuel,ifire - use gridsetup, only : np,mp,ittot,time + use gridsetup, only : np,mp,ittot use forcings, only : forceLE_xv,forceSE_xv,forceLE_xvfuel, & forceSE_xvfuel @@ -166,7 +166,7 @@ subroutine explicit_domain_updates enddo endif if(iturb.eq.2) call turbFieldUpdate() - if(ixevariation.ge.1) call xevariation(ixevariation,ih, & + if(ixevariation.ge.1) call xevariation(ixevariation, & xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) 208 if(iheatsource.gt.0) & index 7846782..a3b853d 100644 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -1,7 +1,7 @@ !----------------------------------------------------------------------- ! ixevariation takes into account any evolution of xe !----------------------------------------------------------------------- -subroutine xevariation(ixevariation,ih,xe,il,iu,jl,ju,lls,nvp) +subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) use gridlist_variables, only : n,m,u0,uswitch,v0,vswitch,zu,dx,dy,wp use uvRamp_variables, only : uramp,uramptime,vramp,vramptime use windfieldio, only : windspeedupfactor,itinterp,ibcells,jbcells, & @@ -16,7 +16,7 @@ subroutine xevariation(ixevariation,ih,xe,il,iu,jl,ju,lls,nvp) ! Local Variables - integer,intent(in) :: ixevariation,ih + integer,intent(in) :: ixevariation integer,intent(in) :: il,iu,jl,ju,lls,nvp ... [diff excerpt truncated; run the command above for the full commit diff] # 8122925 Addressing problems in xeVariation. # Full command: git show --find-renames --unified=3 8122925 -- CODE-dev/xeVariation/xevariation.F90 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -75,14 +75,14 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) itabsnew=itabsold+itinterp if (mpi_rank.eq.0) write(6,*) ’reading file ’,fxvdataname + call windfld_read(fxvdataname,xvdatanew) endif ! here we update xe do k=1,lls do j=jl,ju + ja=(mpos-1)*mp+j do i=il,iu ia=(npos-1)*np+i - ja=(mpos-1)*mp+j if(ia.le.ibcells.or.ia.gt.n-ibcells & do kv=1,nvwind @@ -107,11 +107,13 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) case (3) do k=1,lfuel do j=jl,ju + ja=(mpos-1)*mp+j do i=il,iu + ia=(npos-1)*np+i totw=0._wp do kv=1,nSensors senw(kv)=1._wp/(tolerance+sqrt((time-SensorTimes(kv))**2 & - +((i-1)*dx-SensorX(kv))**2+((j-1)*dy-SensorY(kv))**2)) + +((ia-1)*dx-SensorX(kv))**2+((ja-1)*dy-SensorY(kv))**2)) totw=totw+senw(kv) 209 FIRETEC Bug Resolution Log June 2026 enddo xe(i,j,k,iuvel)=0._wp @@ -136,7 +138,7 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) ja=(mpos-1)*mp+j do i=il,iu ia=(npos-1)*np+i - totw=0.0_wp + totw=0._wp ... [diff excerpt truncated; run the command above for the full commit diff] 210 BUG-2026-06-046: radiationSink receives a fuel-depth gas-force slice but loops over the full atmosphere depth Summary CODE-dev/force.F90 calls the simple radiation sink with a gas force slice whose third dimension is restricted to 1:lfuel: call radiationSink(forceSE_xv(:,:,1:lfuel,itheta), & forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & xvfuel(:,:,:,:,irhow),tempg,temps, & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,lfuel,nfuel) However, the same call passes lls=l, and radiationSink declares and loops over the gas force argument as if its third dimension has length lls: real(prec),intent(inout) :: force(ilh:iuh,jlh:juh,lls) ... do k=1,lls ... force(i,j,k)=force(i,j,k)+... enddo If lfuel < l, the actual argument has a third-dimension section of length lfuel, while the dummy argument is declared with length l. That is a likely argument-shape mismatch and can lead to out-of-bounds access or non-portable behavior. • CODE-dev/force.F90 • CODE-dev/Radiation/sink_rad.F90 The current call site in CODE-dev/force.F90 is: elseif(irad.eq.3)then ! Radiation Sink call radiationSink(forceSE_xv(:,:,1:lfuel,itheta), & forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & xvfuel(:,:,:,:,irhow),tempg,temps, & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,lfuel,nfuel) endif The relevant dummy argument and loop in CODE-dev/Radiation/sink_rad.F90 are: real(prec),intent(inout) :: force(ilh:iuh,jlh:juh,lls) ... do k=1,lls do j=jl,ju do i=il,iu ... force(i,j,k)=force(i,j,k)+firad_gas/cp_gas(i,j,k)* & (pref/pr(i,j,k))**(1.0_prec-cv_gas(i,j,k)/cp_gas(i,j,k)) 211 enddo enddo enddo The call passes inconsistent information about the vertical extent of the gas force array: actual gas force section: forceSE_xv(:,:,1:lfuel,itheta) dummy gas force shape: force(ilh:iuh,jlh:juh,lls) passed lls value: l The code therefore tells radiationSink that force has l vertical levels even though the actual section has only lfuel levels. This is especially suspicious because the other gas arrays passed to radiationSink, such as tempg, pre, pr, cp_gas, cv_gas, and xe, are full gas-domain fields indexed over k=1,lls. The gas-radiation loop is written to operate over the full lls gas column, while the actual force argument is sliced to fuel depth only. Impact This mismatch is a code correctness issue independent of the radiation physics. Depending on compiler, optimization level, bounds checking, and memory layout, it may fail with bounds or shape checking enabled, silently write beyond the dummy argument’s actual section, rely on non-portable contiguous- memory behavior, or accidentally update the intended full forceSE_xv field only because the underlying storage happens to be laid out favorably. If the simple gas radiation sink is intended to apply over the same full gas depth as the Monte Carlo radiation call, pass the full gas potential-temperature force field: @@ - call radiationSink(forceSE_xv(:,:,1:lfuel,itheta), & + call radiationSink(forceSE_xv(:,:,:,itheta), & forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & xvfuel(:,:,:,:,irhow),tempg,temps, & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,lfuel,nfuel) If it is intentionally supposed to apply only to the fuel-depth gas levels, then the lls argument should be changed to lfuel instead: @@ - 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,lfuel,nfuel) + 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,lfuel,lfuel,nfuel) The preferred fix is likely the first one, because the existing subroutine already loops over k=1,lls for the gas sink and the caller already passes lls=l. Validation should include a build with bounds checking, such as -fcheck=bounds, and a run with irad.eq.3 and lfuel < l. 212 The radiation source/sink implementation was reworked in the radiation bug-list pass. The fuel radiation arrays now use fuel-depth dimensions, and low-energy source states return cleanly rather than leaving stale radiation forcing active. # 9ce10f9 Significant fixes to Radiation bugs. This commit needs to be vetted thoroughly. # Full command: git show --find-renames --unified=3 9ce10f9 -- CODE-dev/force.F90 index b765a72..7b542f4 100644 +++ b/CODE-dev/force.F90 @@ -133,7 +133,8 @@ end subroutine small_explicit_forcings use heatsource_gridlist_variables, only : starttime_hs + use vegetation_gridlist_variables, only : nfuel,ifire + use radiation_gridlist_variables, only : isolar use forcings, only : forceSE_xv,forceLE_xv,forceSE_xvfuel, & @@ -170,13 +171,13 @@ subroutine large_explicit_forcings !!!!! Solar heating and evaporation Forcings !!!!! - if(imoist.eq.1)then + !call evapBulk(forceLE_xv,forceLE_xvfuel,xv,xvrho,xvfuel, & + ! 1-ih,np+ih,1-ih,mp+ih,0,l,1,np,1,mp,lfuel,nv,nvfuel,nfuel) + if(isolar.eq.1)then call solarHeating(forceLE_xvfuel(:,:,:,:,isies), & xvfuel(:,:,:,:,irhof),xvfuel(:,:,:,:,irhow), & xv(:,:,:,iH2O),1-ih,np+ih,1-ih,mp+ih,l, & - call evapBulk(forceLE_xv,forceLE_xvfuel,xv,xvrho,xvfuel, & - 1-ih,np+ih,1-ih,mp+ih,0,l,1,np,1,mp,lfuel,nv,nvfuel,nfuel) endif endif 213 BUG-2026-06-047: Halo exchange MPI tags can exceed MPI_TAG_UB after only a few timesteps Summary The update routine builds every MPI tag from the global timestep. MPI does not allow arbitrary integer tags; every communicator has a finite MPI_TAG_UB, and portable MPI code can only rely on a minimum upper bound of 32767. • update.F90 The code uses: 95 itag=(timestep*10000)+1000 145 itag=(timestep*10000)+1100 197 itag=(timestep*10000)+1200 247 itag=(timestep*10000)+1300 300 itag=(timestep*10000)+1400 395 itag=(timestep*10000)+1500 490 itag=(timestep*10000)+1600 585 itag=(timestep*10000)+1700 Each tag is then used in MPI_Sendrecv calls for side and corner halo exchanges. On an implementation that only guarantees the portable lower bound, the routine starts producing invalid tags at timestep = 4: timestep = 3 -> max update tag = 31700 timestep = 4 -> min update tag = 41000 That can make normal halo exchange fail with MPI_ERR_TAG or abort on MPI implementations with a smaller tag range. On implementations with larger tag ranges, the same pattern can still fail in long runs or restarted runs when default integer arithmetic overflows. With 32-bit default integers, timestep * 10000 + 1700 overflows at about timestep = 214749. The timestep component is not needed for correctness here. The routine uses blocking MPI_Sendrecv, and the eight exchange phases already have distinct fixed offsets, 1000 through 1700. Reusing the same small phase tags on later calls is safe once the previous blocking exchange has completed. Impact This can cause ordinary halo exchanges to fail after only a few timesteps on some MPI implementations, and can produce restart- or run-length-dependent failures on others. Use fixed, small phase tags for the eight exchange directions, or query MPI_TAG_UB and explicitly validate any encoded tag scheme. The simplest fix is to remove timestep from the tag calculation and remove the now-unused use gridsetup, only : timestep. In diff form: 214 diff --git a/update.F90 b/update.F90 @@ - use gridsetup, only : timestep @@ - itag=(timestep*10000)+1000 + itag=1000 @@ - itag=(timestep*10000)+1100 + itag=1100 @@ - itag=(timestep*10000)+1200 + itag=1200 @@ - itag=(timestep*10000)+1300 + itag=1300 @@ - itag=(timestep*10000)+1400 + itag=1400 @@ - itag=(timestep*10000)+1500 + itag=1500 @@ - itag=(timestep*10000)+1600 + itag=1600 @@ - itag=(timestep*10000)+1700 + itag=1700 Longer-term cleanup would define named tag parameters, for example tag_y_top = 1000 and tag_y_bot = 1100, to make the communication phases easier to audit and to prevent future reintroduction of unbounded runtime-derived tags. Git evidence: 869ead7 (2026-06-25, boundary-error pass). The halo-exchange MPI tags in CODE-dev/update.F90 were changed from timestep-dependent tags to fixed per-message tags, preventing tag growth past MPI_TAG_UB. # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/update.F90 index e51fc69..fc37ec7 100644 +++ b/CODE-dev/update.F90 @@ -38,13 +38,12 @@ ! !----------------------------------------------------------------------- subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) - use gridlist_variables, only : ih,nprocy,wp, & + use gridlist_variables, only : ih,wp, & use msga_variables, only : ierror,mpi_status_size,pebelow,peabove, & peleft,peright,mpi_comm_world,botedge,topedge,leftedge, & 215 - use gridsetup, only : timestep ! Local Variables @@ -88,7 +87,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo enddo - itag=(timestep*10000)+1000 + itag=1000 call MPI_Sendrecv(tmpxsnd,ncount,mpi_wp,pebelow,itag,tmpxrcv, & ncount,mpi_wp,peabove,itag,mpi_comm_world,sndrcvStatus,ierror) @@ -132,7 +131,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo enddo - itag=(timestep*10000)+1100 + itag=1100 call MPI_Sendrecv(tmpxsnd,ncount,mpi_wp,peabove,itag,tmpxrcv, & ncount,mpi_wp,pebelow,itag,mpi_comm_world,sndrcvStatus,ierror) if(botedge.ne.1)then @@ -178,7 +177,7 @@ subroutine update(a,nxp,nyp,nzp,il,iu,jl,ju,icorner,iperiod,iuv) enddo enddo enddo - itag=(timestep*10000)+1200 ... [diff excerpt truncated; run the command above for the full commit diff] 216 BUG-2026-06-048: Firebrands can be removed multiple times in one boundary pass Summary The firebrand boundary-removal logic in Firebrands/evolve_fb.F90 is inconsistent about exiting the loop immediately after a brand is marked for removal. Burnout removal exits immediately with cycle, but vertical-domain removal does not. • Firebrands/evolve_fb.F90 The evidence is: 114 ! Identify irrelevant brands 115 if(xvbrand(it,ihght).lt.0.000001_prec.or.xvbrand(it,irad).lt.0.000001_prec & 116 .or.xvbrand(it,irho).lt.0.0001_prec)then ! Burnout 117 retain(it)=.false. 118 numBrand=numBrand-1 119 cycle 120 else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then ! Landed on ground or lofted beyond ,→ vertical domain 121 retain(it)=.false. 122 numBrand=numBrand-1 123 endif ... 133 else 134 retain(it)=.false. 135 numBrand=numBrand-1 136 endif ... 158 else 159 retain(it)=.false. 160 numBrand=numBrand-1 161 endif A vertically removed brand can continue into the lateral x and y boundary checks and be counted as removed again. Similarly, a brand removed by an absorbing x boundary can still be removed again by an absorbing y boundary. numBrand is later used to allocate xvtmpbrand at lines 177–188, so double-decrementing can make the allocation smaller than the number of retained records. Impact Double-decrementing numBrand can make the later allocation smaller than the true number of retained records. That creates a correctness risk in firebrand compaction and later firebrand bookkeeping. Exit the do it=1,numBrands loop as soon as a brand is marked not retained. The minimal patch in diff form is: 217 diff --git a/Firebrands/evolve_fb.F90 b/Firebrands/evolve_fb.F90 @@ else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then retain(it)=.false. numBrand=numBrand-1 + cycle endif @@ else retain(it)=.false. numBrand=numBrand-1 + cycle endif @@ else retain(it)=.false. numBrand=numBrand-1 + cycle endif A larger cleanup would use a single removal flag or helper routine so decrementing happens exactly once for each firebrand. Git evidence: 869ead7 (2026-06-25, boundary-error pass). Firebrand removal now cycles immediately after a brand is removed, so the same particle cannot be removed repeatedly in one boundary pass. # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/Firebrands/evolve_fb.F90 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -11,7 +11,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & + use constants, only : pi,g @@ -120,11 +120,11 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then ! Landed on ground or lofted beyond ,→ vertical domain retain(it)=.false. numBrand=numBrand-1 + cycle endif ! Check left and right boundaries - if(xvbrand(it,ix).le.0)then ! Outside x domain on left - if(xvbrand(it,ix).eq.0) xvbrand(it,ix)=xvbrand(it,ix)+tolerance 218 FIRETEC Bug Resolution Log June 2026 + if(xvbrand(it,ix).lt.0)then ! Outside x domain on left xvbrand(it,ix)=n*dx+xvbrand(it,ix) @@ -133,9 +133,9 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. numBrand=numBrand-1 + cycle endif - else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain on right - if(xvbrand(it,ix).eq.(n*dx)) xvbrand(it,ix)=xvbrand(it,ix)-tolerance + else if(xvbrand(it,ix).gt.(n*dx))then ! Outside x domain on right xvbrand(it,ix)=xvbrand(it,ix)-n*dx @@ -144,12 +144,12 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. ... [diff excerpt truncated; run the command above for the full commit diff] 219 July 2026 Overview This list documents 57 completed reports compiled for the July 2026 update. In addition to the earlier driver, forcing, and MPI items, the completed entries now cover emissions, firebrands, heat sources, input validation, radiation, subgrid turbulence, initialization, variable handling, vegetation, xe-variation, and boundary-condition validation. Source-report dispositions such as Changed and Decided no are retained where they appear in the original completed-bug filenames. 220 BUG-2026-07-001: Firebrand Output Is Called With Time Instead Of The Timestep Source report: compressF90/COMPRESS-001.md Files • compress.F90 • Firebrands/io_fb.F90 • Firebrands/variables_fb.F90 • rinit.F90 • force.F90 ! compress.F90 78 if(mod(it,frqoutput).eq.0)then 79 call binary_writeio(ittot) 80 if(ifbrand.ge.1) call writeio_fb(time) 81 endif ! Firebrands/io_fb.F90 4 subroutine writeio_fb(ittot) ... 14 integer,intent(in) :: ittot ... 43 call namefile(ittot,outname_fb,fname) ! rinit.F90 / force.F90 93 if(ifbrand.eq.1) call rinitFirebrands(irst) ... 154 if(ifbrand.eq.1) call firebrand(...) Problem writeio_fb expects an integer timestep and uses it to build the firebrand output filename. compress.F90 passes time, a real-valued simulation time. Because writeio_fb is an external subroutine with no explicit interface at the call site, this mismatch can compile but the callee reads the real argument’s bytes as an integer. The resulting firebrand filenames can be garbage or inconsistent with restart expectations. The guard is also inconsistent: initialization and evolution only support ifbrand.eq.1, but output uses ifbrand.ge.1. If a nonzero unsupported value is ever supplied, compress.F90 can call writeio_fb without the firebrand arrays being initialized. Pass ittot, not time, and use the same ifbrand.eq.1 guard used by initialization and physics. 221 @@ if(mod(it,frqoutput).eq.0)then + if(ifbrand.eq.1) call writeio_fb(ittot) endif Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup). The firebrand output call in CODE-dev/compress.F90 was changed to pass the absolute timestep counter ittot rather than simulation time. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/compress.F90 CODE-dev/rinit. ,→ F90 +++ b/CODE-dev/compress.F90 @@ -24,10 +24,6 @@ program compress ! Initialize MPI - - ! Create output directory - @@ -63,8 +59,7 @@ program compress print*,’NaNs or Infinity in XV array’ + exit endif call small_explicit_forcings ! Calculates explicit large timestep forcings @@ -81,12 +76,12 @@ program compress !!! IO - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then + if(mod(ittot,frqoutput).eq.0)then 222 + if(ifbrand.ge.1) call writeio_fb(ittot) endif it=it+1 enddo ... [diff excerpt truncated; run the command above for the full commit diff] 223 BUG-2026-07-002: Restart At Or Beyond nt Runs One Extra Step Source report: compressF90/COMPRESS-002 (decided no).md Files • compress.F90 • rinit.F90 • io.F90 • variables.F90 ! compress.F90 31 call rinit 33 it=1 34 do while(ittot.lt.nt) 35 ittot=it+itrestart ! io.F90 58 idot=index(restartfile,’out.’)+4 59 iend=len_trim(restartfile) 60 read(restartfile(idot:iend),*) itrestart ! rinit.F90 75 if(irst.eq.1) call irstreadio ... 79 time=itrestart*dts*nts ! variables.F90 247 integer :: itrestart=0 ! Iteration of restart 248 integer :: ittot=0 Problem On restart, irstreadio updates itrestart, and rinit updates time, but ittot remains at its module default of 0 until the first iteration of the loop. The loop condition therefore uses stale state: do while(ittot.lt.nt) If the restart file is already at the requested final timestep, for example restartfile = comp.out.10000 and nt = 10000, the condition is still true because ittot is 0. The driver enters the loop, sets ittot = 10001, and advances one unwanted extra timestep past nt. After rinit, synchronize ittot with itrestart before testing the loop condition. 224 @@ + ittot=itrestart it=1 do while(ittot.lt.nt) ittot=it+itrestart Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); fc462a7 (2026-07-13, restart safety check). Restart-loop handling was tightened in the July cleanup, and a later restart safety check was added to guard accidental or inconsistent irst=1 use. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/compress.F90 CODE-dev/rinit. ,→ F90 +++ b/CODE-dev/compress.F90 @@ -24,10 +24,6 @@ program compress ! Initialize MPI - - ! Create output directory - @@ -63,8 +59,7 @@ program compress print*,’NaNs or Infinity in XV array’ + exit endif call small_explicit_forcings ! Calculates explicit large timestep forcings @@ -81,12 +76,12 @@ program compress !!! IO - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then 225 + if(mod(ittot,frqoutput).eq.0)then + if(ifbrand.ge.1) call writeio_fb(ittot) endif it=it+1 enddo ... [diff excerpt truncated; run the command above for the full commit diff] # fc462a7 restart check # Full command: git show --find-renames --unified=3 fc462a7 -- CODE-dev/input.F90 index 7d674e4..46d0c48 100644 +++ b/CODE-dev/input.F90 @@ -41,6 +41,7 @@ subroutine input call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) + call validate_restart_config call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) if(icfmeflag.ne.0)then print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ @@ -288,6 +289,38 @@ subroutine input end subroutine input +subroutine validate_restart_config + use gridlist_variables, only : irst,restartfile + use msga_variables, only : mpi_rank + implicit none + + logical :: restart_exists + + if(irst.ne.0.and.irst.ne.1)then + print*,’ERROR: invalid irst value: ’,irst + print*,’Allowed values are 0 fresh run or 1 restart.’ + STOP + endif + + if(irst.eq.1)then + if(len_trim(restartfile).eq.0)then + print*,’ERROR: irst=1 requests a restart, but restartfile is blank.’ + print*,’Set irst=0 for a fresh run, or set restartfile to an existing output/restart file.’ + STOP + endif + + inquire(file=trim(restartfile),exist=restart_exists) + if(.not.restart_exists)then + if(mpi_rank.eq.0)then + print*,’ERROR: irst=1 requests a restart, but restartfile does not exist:’ + print*,’restartfile = ’,trim(restartfile) + print*,’Set irst=0 for a fresh run, or correct restartfile.’ ... [diff excerpt truncated; run the command above for the full commit diff] 226 BUG-2026-07-003: Restart Output Cadence Uses The Local Loop Counter Source report: compressF90/COMPRESS-003.md Files • compress.F90 • io.F90 • Sensors/sensors.F90 • xeVariation/windfield.F90 • Radiation/monteCarlo_rad.F90 ! compress.F90 33 it=1 34 do while(ittot.lt.nt) 35 ittot=it+itrestart ... 74 if(windfieldout.eq.1) call windField(ittot) 75 if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then 76 call sensors_write 77 endif 78 if(mod(it,frqoutput).eq.0)then 79 call binary_writeio(ittot) 80 if(ifbrand.ge.1) call writeio_fb(time) 81 endif Related routines use absolute timesteps: ! io.F90 21 write(fend,"(i0)") ittot ! Sensors/sensors.F90 38 if(ncycle.lt.ittot) then 40 write(unitnum,’(I8,A1)’,advance=’no’)ittot,’,’ ! xeVariation/windfield.F90 14 if(ittot.ge.itwindfield.and.mod(ittot,itinterp).eq.0)then ! Radiation/monteCarlo_rad.F90 27 if(mod(ittot,icallrad).eq.0)then Problem it is the count of steps taken during this process invocation. ittot is the absolute simulation timestep, including itrestart. File names and sensor rows are written with ittot, and other timestep-driven 227 features use ittot, but compress.F90 decides standard output and sensor cadence with mod(it, ...). After restart, this shifts output cadence whenever itrestart is not aligned to the frequency. For example, with itrestart = 75 and frqoutput = 50, the next absolute output should be timestep 100, but the current driver writes when it = 50, producing comp.out.125. Use ittot for cadence checks so restarts preserve the same absolute output schedule as fresh runs. This also keeps standard output, sensor output, wind field output, and radiation update conventions consistent. @@ - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then + if(mod(ittot,frqoutput).eq.0)then + if(ifbrand.eq.1) call writeio_fb(ittot) endif This diff includes the firebrand call correction from COMPRESS-001 because the same block should not keep passing time once it is edited. Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup). Output cadence checks in CODE-dev/compress.F90 were changed to use the absolute timestep counter ittot rather than the restart-local loop counter. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/compress.F90 +++ b/CODE-dev/compress.F90 @@ -24,10 +24,6 @@ program compress ! Initialize MPI - - ! Create output directory - 228 @@ -63,8 +59,7 @@ program compress print*,’NaNs or Infinity in XV array’ + exit endif call small_explicit_forcings ! Calculates explicit large timestep forcings @@ -81,12 +76,12 @@ program compress !!! IO - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then + if(mod(ittot,frqoutput).eq.0)then - if(ifbrand.ge.1) call writeio_fb(time) + if(ifbrand.ge.1) call writeio_fb(ittot) endif it=it+1 enddo 229 BUG-2026-07-004: NaN Guard Checks Only One Local Cell And Can Strand MPI Ranks Source report: compressF90/COMPRESS-004 (decided no).md Files • compress.F90 • rmaxmin.F90 • variables.F90 ! compress.F90 41 call explicit_domain_updates ! Updates environmental variables (pressure, etc.) 42 do kv=1,nv-1 43 call rmaxmin_3D(xvrho(:,:,1:l,kv),xv_list(kv), & 44 1-ih,np+ih,1-ih,mp+ih,1,l) 45 enddo 46 call rmaxmin_3D(xv(:,:,1:l,nv),xv_list(nv), & 47 1-ih,np+ih,1-ih,mp+ih,1,l) ... 55 if(isnan(xvrho(1,1,1,1)).or.abs(xvrho(1,1,1,1)).gt.1e15) then 56 print*,’NaNs␣or␣Infinity␣in␣XV␣array’ 57 call mpi_finalize(ierror) 58 STOP 59 endif ! rmaxmin.F90 52 rmax=maxval(array(:,:,:)) 53 rmin=minval(array(:,:,:)) 54 call mpi_reduce(rmax,xmax,1,mpi_wp,mpi_max,0, & 55 mpi_comm_world,ierror) 56 call mpi_reduce(rmin,xmin,1,mpi_wp,mpi_min,0, & 57 mpi_comm_world,ierror) Problem The driver prints min/max values for many fields, but the actual stop condition checks only xvrho ,→ (1,1,1,1) on each MPI rank. A NaN, Inf, or runaway value in any other cell, variable, halo, or fuel field can continue into the next physics step. The stop is also not collective. If one rank’s local (1,1,1,1) is bad and another rank’s is not, the bad rank calls mpi_finalize and stops while the other ranks continue toward later collectives. That can lead to a hang or an MPI abort rather than a clean diagnostic. Finally, isnan is compiler-specific in this form. The codebase targets GNU, Intel, and Cray compilers, so the standard ieee_arithmetic intrinsic is safer. 230 Check the full local interior state with ieee_is_nan, reduce a bad-state flag across MPI ranks, and finalize collectively when any rank reports a problem. @@ program compress + use, intrinsic :: ieee_arithmetic, only : ieee_is_nan ! Global variables use gridlist_variables, only : nt,ih,l,windfieldout,frqoutput, & - isensor,ifbrand,outname + isensor,ifbrand,outname,wp @@ - use msga_variables, only : mpi_rank,ierror + use msga_variables, only : mpi_rank,ierror,mpi_comm_world,mpi_integer, & + mpi_max @@ - integer :: kv,it,ift + integer :: kv,it,ift + integer :: bad_local,bad_global @@ - if(isnan(xvrho(1,1,1,1)).or.abs(xvrho(1,1,1,1)).gt.1e15) then - print*,’NaNs or Infinity in XV array’ + bad_local=0 + if(any(ieee_is_nan(xv(1:np,1:mp,1:l,:))).or. & + any(abs(xv(1:np,1:mp,1:l,:)).gt.1.0e15_wp).or. & + any(ieee_is_nan(xvrho(1:np,1:mp,1:l,:))).or. & + any(abs(xvrho(1:np,1:mp,1:l,:)).gt.1.0e15_wp).or. & + any(ieee_is_nan(xvfuel(:,1:np,1:mp,1:lfuel,:))).or. & + any(abs(xvfuel(:,1:np,1:mp,1:lfuel,:)).gt.1.0e15_wp)) then + bad_local=1 + endif + call mpi_allreduce(bad_local,bad_global,1,mpi_integer,mpi_max, & + mpi_comm_world,ierror) + if(bad_global.ne.0) then + if(mpi_rank.eq.0) print*,’NaNs or Infinity in XV array’ call mpi_finalize(ierror) STOP endif Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup). The NaN guard no longer finalizes/stops from a single local-cell check; the cleanup changes the local response to exit the output loop path rather than strand other ranks behind an unconditional stop. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/compress.F90 231 +++ b/CODE-dev/compress.F90 @@ -24,10 +24,6 @@ program compress ! Initialize MPI - - ! Create output directory - @@ -63,8 +59,7 @@ program compress print*,’NaNs or Infinity in XV array’ + exit endif call small_explicit_forcings ! Calculates explicit large timestep forcings @@ -81,12 +76,12 @@ program compress !!! IO - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then + if(mod(ittot,frqoutput).eq.0)then - if(ifbrand.ge.1) call writeio_fb(time) + if(ifbrand.ge.1) call writeio_fb(ittot) endif it=it+1 enddo 232 BUG-2026-07-005: Optional Output Directories Are Not Created Before Use Source report: compressF90/COMPRESS-005.md Files • compress.F90 • input.F90 • Sensors/rinit_sense.F90 • Sensors/variables_sense.F90 • Firebrands/io_fb.F90 • Firebrands/variables_fb.F90 ! compress.F90 27 ! Create output directory 28 call ensure_directory_exists(outname) 30 call definearray 31 call rinit ! input.F90 166 subroutine ensure_directory_exists(filepath) ... 176 ! Find last slash to extract directory path 177 last_slash = index(filepath, ’/’, back=.true.) ... 191 mkdir_cmd = ’mkdir␣-p␣"’ // trim(dirpath) // ’"’ 192 call execute_command_line(trim(mkdir_cmd), wait=.true., exitstat=ierr) ! Sensors/variables_sense.F90 15 character(len=260) :: sensorfile = ’sensor’ ! Name of the sensor output files ! Sensors/rinit_sense.F90 38 call namefile(i,sensorfile,sensorFileName) 39 inquire(file=trim(sensorFileName)//’.csv’, exist = exists) ... 48 open(unit=unitnum,file=trim(sensorFileName)//’.csv’, & 49 form=’formatted’,status=’unknown’) ! Firebrands/variables_fb.F90 15 character(len=257) :: outname_fb = ’brand.out’ ! Name of firebrand output files ! Firebrands/io_fb.F90 43 call namefile(ittot,outname_fb,fname) ... 233 46 open(48,file=fname,form=’unformatted’,status=’unknown’) Problem compress.F90 creates only the directory implied by the main outname. Sensor and firebrand outputs use independent filename prefixes (sensorfile and outname_fb) that can include their own directories, but those directories are not created before the files are opened. This is especially visible for sensors because rinit calls rinitSense, and rinitSense opens the sensor CSV files during initialization. A gridlist such as sensorfile = ’./sensors/sensor’ can fail immediately unless ./sensors already exists, even though the driver already has a helper designed to create output directories. Create directories for each enabled output stream before rinit opens or writes those files. xvdataname is already handled inside input_xevariation, so the missing pieces here are sensors and firebrands. @@ use gridsetup, only : itrestart,np,mp,ittot,time use msga_variables, only : mpi_rank,ierror use xvall, only : xv,xvrho,nv,xv_list,xvfuel,xvfuel_list,nvfuel - use sensor_gridlist_variables, only : se_frq_write + use sensor_gridlist_variables, only : se_frq_write,sensorfile + use firebrand_gridlist_variables, only : outname_fb @@ ! Create output directory + if(isensor.eq.1) call ensure_directory_exists(sensorfile) + if(ifbrand.eq.1) call ensure_directory_exists(outname_fb) Git evidence: c04e05e (2026-06-08, output directory creation message); c21d0ea (2026-07-08, broad bug-list cleanup). Directory handling was adjusted around optional outputs. The June commit reports when an output directory is created, and the July cleanup removed an early directory-creation call from the compression path. # c04e05e print if output directory created # Full command: git show --find-renames --unified=3 c04e05e -- CODE-dev/compress.F90 CODE-dev/input. ,→ F90 234 index f59888e..98d8af4 100644 +++ b/CODE-dev/compress.F90 @@ -5,7 +5,7 @@ program compress ! Global variables use gridlist_variables, only : nt,ih,l,windfieldout,frqoutput, & - isensor,ifbrand + isensor,ifbrand,outname use gridsetup, only : itrestart,np,mp,ittot,time use msga_variables, only : mpi_rank,ierror @@ -21,8 +21,12 @@ program compress ! Read user inputs call input - ! Initialize Simulation + ! Initialize MPI + + ! Create output directory + call ensure_directory_exists(outname) + index 8149a57..c1e441f 100644 +++ b/CODE-dev/input.F90 @@ -36,9 +36,6 @@ subroutine input call QueryGridlist_string (’restartfile’,restartfile,48) call QueryGridlist_integer(’icfmeflag’,icfmeflag,48) call QueryGridlist_integer(’ihdf’,ihdf,48) - - ! Create output directory if it doesn’t exist - call ensure_directory_exists(outname) ! Relaxation call QueryGridlist_integer(’ih’,ih,48) @@ -185,20 +182,61 @@ end subroutine input ... [diff excerpt truncated; run the command above for the full commit diff] # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/compress.F90 CODE-dev/input. ,→ F90 +++ b/CODE-dev/compress.F90 @@ -24,10 +24,6 @@ program compress ! Initialize MPI - - ! Create output directory - 235 @@ -63,8 +59,7 @@ program compress print*,’NaNs or Infinity in XV array’ - call mpi_finalize(ierror) - STOP + exit endif call small_explicit_forcings ! Calculates explicit large timestep forcings @@ -81,12 +76,12 @@ program compress !!! IO - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then + if(mod(ittot,frqoutput).eq.0)then + if(ifbrand.ge.1) call writeio_fb(ittot) endif it=it+1 enddo ... [diff excerpt truncated; run the command above for the full commit diff] 236 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-006: ZBEST Aerosol Moment Pointers Stay Pointed At u Source report: definearrayF90/DEFINEARRAY-001 (decided no).md Files • definearray.F90 • variables.F90 • force.F90 • Emissions/zBEST_ems.F90 ! variables.F90 161 integer :: iuvel=1,ivvel=1,iwvel=1 162 integer :: itheta=1,ika=1,ikb=1,iO2=1,iH2O=1,irho=1 163 integer :: iM0=1,iM1=1 ! definearray.F90 97 if(iemissions.gt.0)then 98 iEmitStart = nv+1 ... 107 if(nAero.gt.0)then 108 iEmitStop = nv+nAero*nMAero 109 nv = nv + nAero*nMAero 110 endif 111 endif ! force.F90 257 select case (iemissions) ... 265 case (3) 266 call ZBEST(forceSI_xv,xvtmp,-forceSI_xvfuel(:,:,:,:,irhof), & 267 temps(:,1:np,1:mp,:),xvfueltmp(:,:,:,:,irhof), & 268 1-ih,np+ih,1-ih,mp+ih,l,1,np,1,mp,lfuel,nv,nfuel,dts) ! Emissions/zBEST_ems.F90 11 use xvall, only : iM0,iM1,iuvel,ivvel,iwvel,iO2,irho,iH2O ... 129 if(EF.gt.0.0_wp)then 130 forcing(i,j,k,iM1)=forcing(i,j,k,iM1)+EF*frhof(ift,i,j,k) 131 forcing(i,j,k,iM0)=forcing(i,j,k,iM0)+ & 132 EF*frhof(ift,i,j,k)*N/M 133 endif 237 Problem xvpointers adds aerosol moment slots to xv when nAero > 0, but it never updates the global aerosol moment pointers iM0 and iM1. Those pointers keep their module defaults of 1, which is also iuvel. When iemissions == 3, ZBEST writes soot moment source terms through iM0 and iM1. With the current pointers, those source terms are added to the u momentum component instead of the aerosol moment fields. The aerosol fields remain unchanged, while the wind field receives non-momentum forcing. The code also does not fail fast if ZBEST is enabled without at least one aerosol species and at least two aerosol moments. Set iM0 and iM1 when the aerosol block is appended, and validate the minimum aerosol configuration needed by ZBEST. @@ if(iemissions.gt.0)then iEmitStart = nv+1 @@ endif if(nAero.gt.0)then + if(nMAero.lt.2)then + print*,’nMAero must be at least 2 when aerosol emissions are enabled’ + STOP + endif + iM0 = nv+1 + iM1 = nv+2 iEmitStop = nv+nAero*nMAero nv = nv + nAero*nMAero endif + if(iemissions.eq.3.and.nAero.lt.1)then + print*,’ZBEST emissions require at least one aerosol species’ + STOP + endif endif Git evidence: 91c2a57 (2026-07-22, aerosol merge fixes); f349df9 (2026-08-18, speedups part 1). The aerosol merge moved ZBEST and aerosol moment handling into the active emissions path, and the speedup pass later reordered ZBEST loops without leaving stale pointers at the base gas state. # 91c2a57 Aerosols Merge # Full command: git show --find-renames --unified=3 91c2a57 -- CODE-dev/definearray.F90 CODE-dev/force ,→ .F90 index 197601e..816c91d 100644 238 +++ b/CODE-dev/definearray.F90 @@ -2,8 +2,7 @@ ! Allocate global arrays !----------------------------------------------------------------------- - use gridlist_variables, only : nts,ih,iturb,ilspgf,l,n,m,wp, & - uswitch,vswitch + use gridlist_variables, only : nts,ih,iturb,ilspgf,l,n,m,wp use forcings, only : force,forceSE_xv,forceSI_xv,forceLE_xv,xvLim, & use xvall, only : xv,xe,xvtmp,relaxxv,nv,xvrho,xvrhotmp @@ -16,7 +15,7 @@ subroutine definearray ! Executable Code - allocate(xe(np,mp,l,nv)) + allocate(xe(np,mp,l,nv)); xe=0._wp allocate(xv(1-ih:np+ih,1-ih:mp+ih,l,nv)) allocate(xvLim(2,nv)); xvLim(1,:)=-1.e20_wp; xvLim(2,:)=1.e20_wp allocate(xvrho(1-ih:np+ih,1-ih:mp+ih,0:l,nv-1)) +++ b/CODE-dev/force.F90 @@ -7,7 +7,7 @@ subroutine forcing + use xvall, only : xv,xvrho,nv,xvfuel,nvfuel use metric_variables, only : h @@ -133,7 +133,7 @@ subroutine large_explicit_forcings use xvall, only : xv,xvrho,xvfuel,nv,iuvel,ivvel,iwvel,irho, & - nvfuel,irhof,isies,iH2O,irhow,irhof,xv_list + nvfuel,irhof,isies,iH2O,irhow,irhof ... [diff excerpt truncated; run the command above for the full commit diff] # f349df9 Speedups Part 1. # Full command: git show --find-renames --unified=3 f349df9 -- CODE-dev/force.F90 CODE-dev/Emissions/ ,→ zBEST_ems.F90 diff --git a/CODE-dev/Emissions/zBEST_ems.F90 b/CODE-dev/Emissions/zBEST_ems.F90 index c2c8bb6..9ffeff7 100644 --- a/CODE-dev/Emissions/zBEST_ems.F90 +++ b/CODE-dev/Emissions/zBEST_ems.F90 @@ -64,10 +64,10 @@ subroutine ZBEST(forcing,xv,frhof,temps,rhof,ilh,iuh,jlh,juh,ku, & SP_xtar = SP/SP_mtar/ & (SP/SP_mtar+yH2/2._wp+yCH4/16._wp+yCO2/44._wp+yCO/28._wp) ! Mole fraction of precursors - do ift=1,nfuel - do i=il,iu - do j=jl,ju - do k=1,lls + do k=1,lls + do j=jl,ju + do i=il,iu + do ift=1,nfuel 239 ! Do we bother with this? if(frhof(ift,i,j,k).le.0._wp) cycle index e37eb46..207e3ca 100644 +++ b/CODE-dev/force.F90 @@ -26,9 +26,9 @@ subroutine forcing call update(forceLE_xv(:,:,:,kv),np,mp,l, & 1-ih,np+ih,1-ih,mp+ih,0,0,iuv) call donorcell(forceLE_xv(:,:,:,kv),1-ih,np+ih,1-ih,mp+ih,l) - do i=1,np + do k=1,l do j=1,mp - do k=1,l + do i=1,np xv(i,j,k,kv)=xv(i,j,k,kv)+forceLE_xv(i,j,k,kv)*dt enddo enddo @@ -62,9 +62,9 @@ subroutine forcingLimits(xv,xvLimits,il,iu,jl,ju,lls,nvp) ! Executable Code do kv=1,nvp - do i=il,iu + do k=1,lls do j=jl,ju ... [diff excerpt truncated; run the command above for the full commit diff] 240 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-007: No-Emission Runs Still Pass Emission Arrays To Thermodynamics Source report: definearrayF90/DEFINEARRAY-002 (decided no).md Files • definearray.F90 • variables.F90 • input.F90 • domainUpdates.F90 • thermodynamics.F90 • Emissions/variables_ems.F90 ! variables.F90 165 integer :: iEmitStart=1,iEmitStop=1 ! definearray.F90 97 if(iemissions.gt.0)then 98 iEmitStart = nv+1 ... 111 endif ! input.F90 148 ! Emissions 149 call QueryGridlist_integer(’iemissions’,iemissions,48) 150 if(ifire.eq.1.and.iemissions.eq.0) iemissions=2 151 if(iemissions.gt.0) call input_emissions(iemissions,ifire) ! Emissions/variables_ems.F90 10 integer :: nEmit = 0 ! Number of resolved emitted gas species ... 25 character(len=6),allocatable :: spEmit(:) 26 real(wp),allocatable :: cpEmit(:) 27 real(wp),allocatable :: mwEmit(:) ! domainUpdates.F90 51 call updateGasThermProps( & 52 xvtmp(i,j,k,iEmitStart:iEmitStop)/xvtmp(i,j,k,irho), & 53 cpEmit,mwEmit,nEmit,xvtmp(i,j,k,itheta)/xvtmp(i,j,k,irho), & ... 121 call updateGasThermProps( & 122 xv(i,j,k,iEmitStart:iEmitStop)/xv(i,j,k,irho), & 123 cpEmit,mwEmit,nEmit,xv(i,j,k,itheta)/xv(i,j,k,irho), & ! thermodynamics.F90 241 12 integer,intent(in) :: nEmit 14 real(wp),intent(in) :: yEmit(nEmit),cpEmit(nEmit),mwEmit(nEmit) 22 cp_gas=sum(cpEmit*yEmit)+cp_N2*(1.0_wp-sum(yEmit)) Problem xvpointers leaves iEmitStart and iEmitStop at their module defaults when iemissions == 0. If fire is disabled, input.F90 does not force emissions on and input_emissions is not called, so cpEmit and mwEmit can remain unallocated. Both implicit_domain_updates and explicit_domain_updates always call updateGasThermProps with cpEmit, mwEmit, and the iEmitStart:iEmitStop slice. In a no-emission run, that means an unallocated gas-property table can be passed to a routine expecting arrays of size nEmit, while the default emission slice points at transported variable 1 (u) rather than an empty gas-species list. At best this relies on compiler- and interface-dependent behavior for zero-length explicit-shape dummies. At worst it crashes under runtime checks or corrupts thermodynamic properties for wind-only/no-fire configurations. Make the no-emission state explicit and avoid passing unallocated emission arrays to updateGasThermProps. Keep domainUpdates on a real zero-length array path when nEmit == 0. @@ ! Transported array pointers iuvel = 1 ivvel = 2 iwvel = 3 itheta = 4 nv = 4 + iEmitStart = 1 + iEmitStop = 0 @@ if(iemissions.gt.0)then iEmitStart = nv+1 @@ ! Local Variables integer :: i,j,k,kv,iuv,ift + real(wp) :: noEmit(0) @@ - call updateGasThermProps( & - xvtmp(i,j,k,iEmitStart:iEmitStop)/xvtmp(i,j,k,irho), & - cpEmit,mwEmit,nEmit,xvtmp(i,j,k,itheta)/xvtmp(i,j,k,irho), & - xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k), & - pr(i,j,k),tempg(i,j,k)) + if(nEmit.gt.0)then + call updateGasThermProps( & + xvtmp(i,j,k,iEmitStart:iEmitStop)/xvtmp(i,j,k,irho), & 242 + cpEmit,mwEmit,nEmit,xvtmp(i,j,k,itheta)/xvtmp(i,j,k,irho), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k), & + pr(i,j,k),tempg(i,j,k)) + else + call updateGasThermProps(noEmit,noEmit,noEmit,0, & + xvtmp(i,j,k,itheta)/xvtmp(i,j,k,irho),xvtmp(i,j,k,irho), & + cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) + endif @@ ! Local Variables real(wp):: g13, g23, g33 ! metric tensor real(wp)::uground,vground,wground ! cartesian at ground level + real(wp) :: noEmit(0) @@ - call updateGasThermProps( & - xv(i,j,k,iEmitStart:iEmitStop)/xv(i,j,k,irho), & - cpEmit,mwEmit,nEmit,xv(i,j,k,itheta)/xv(i,j,k,irho), & - xv(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k), & - pr(i,j,k),tempg(i,j,k)) + if(nEmit.gt.0)then + call updateGasThermProps( & + xv(i,j,k,iEmitStart:iEmitStop)/xv(i,j,k,irho), & + cpEmit,mwEmit,nEmit,xv(i,j,k,itheta)/xv(i,j,k,irho), & + xv(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k), & + pr(i,j,k),tempg(i,j,k)) + else + call updateGasThermProps(noEmit,noEmit,noEmit,0, & + xv(i,j,k,itheta)/xv(i,j,k,irho),xv(i,j,k,irho), & + cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) + endif Git evidence: 561333f (2026-08-01, heat-source, no-emission, and O2 fixes); 3189a4b (2026-08-11, empty-emission thermodynamics cleanup). No-emission thermodynamics was made explicit by passing empty emission arrays through a dedicated branch, avoiding calls that expected allocated emission state when nEmit=0. # 561333f finally fixed my splashing issue # Full command: git show --find-renames --unified=3 561333f -- CODE-dev/definearray.F90 CODE-dev/ ,→ domainUpdates.F90 CODE-dev/thermodynamics.F90 +++ b/CODE-dev/definearray.F90 @@ -78,6 +78,7 @@ subroutine xvpointers ! Executable Code + iO2 = 0 ! Transported array pointers iuvel = 1 ivvel = 2 243 +++ b/CODE-dev/domainUpdates.F90 @@ -40,6 +40,7 @@ subroutine implicit_domain_updates ! Local Variables + real(wp) :: empty_emit(1:0) ! Executable Code forceSI_xv=0._wp @@ -51,10 +52,17 @@ subroutine implicit_domain_updates do i=1,np do j=1,mp do k=1,l - call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & - xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + if(nEmit.eq.0)then + call updateGasThermProps(empty_emit,empty_emit,empty_emit,0, & + xvrhotmp(i,j,k,itheta),xvtmp(i,j,k,irho), & + cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & + tempg(i,j,k)) + else + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) ... [diff excerpt truncated; run the command above for the full commit diff] # 3189a4b General cleanup, moving handlebars down below so I can still actually read the code, getting ,→ rid of unused variables, and redoing the thermodynamics call for the empty emissions arrays. # Full command: git show --find-renames --unified=3 3189a4b -- CODE-dev/definearray.F90 CODE-dev/ ,→ variables.F90 CODE-dev/input.F90 index ba65dbb..816c91d 100644 +++ b/CODE-dev/definearray.F90 @@ -78,7 +78,6 @@ subroutine xvpointers ! Executable Code - iO2 = 0 ! Transported array pointers iuvel = 1 ivvel = 2 index 9618375..cb75b11 100644 +++ b/CODE-dev/input.F90 @@ -3,20 +3,18 @@ !---------------------------------------------------------------- - use heatsource_gridlist_variables, only : starttime_hs use vegetation_gridlist_variables, only : ifire,imoist use QueryGridlist_mod, only: QueryGridlist_variable 244 FIRETEC Bug Resolution Log July 2026 ! Local Variables - logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax character(len=256) :: gridlist_file ! Executable Code gridlist_file="gridlist" - if (command_argument_count().ge.1) call get_command_argument(1,gridlist_file) - if (len_trim(gridlist_file).eq.0) gridlist_file="gridlist" + if (command_argument_count().ge.1) & + call get_command_argument(1,gridlist_file) open(unit=48,file=trim(gridlist_file),action="read") ! Temporal and spatial domain @@ -37,19 +35,11 @@ subroutine input ! General I/O ... [diff excerpt truncated; run the command above for the full commit diff] 245 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-008: Aerosol xv_list Labels Can Be Wrong Or Crash On Long Species Names Source report: definearrayF90/DEFINEARRAY-003 (decided no).md Files • definearray.F90 • variables.F90 • Emissions/variables_ems.F90 • compress.F90 • Sensors/rinit_sense.F90 • xeVariation/windfield.F90 ! variables.F90 156 character(len=12),allocatable :: xv_list(:) ! Emissions/variables_ems.F90 29 character(len=12),allocatable :: spAero(:) ! definearray.F90 122 if(nAero.gt.0)then 123 do i=1,nAero 124 do j=1,nMAero 125 indx=index(spAero(i),’␣’) 126 write(xv_list(iEmitStart+nEmit+nMAero*(i-1)+j-1),"(A,I0)") & 127 spAero(i)(1:indx),j 128 enddo 129 enddo 130 endif ! compress.F90 43 call rmaxmin_3D(xvrho(:,:,1:l,kv),xv_list(kv), & ! Sensors/rinit_sense.F90 51 do ni=1,size(xv_list) 52 write(unitnum,’(A8)’,advance=’no’) xv_list(ni) ! xeVariation/windfield.F90 137 write(48) xv_list 246 Problem The aerosol label builder searches for the first blank in spAero(i) and then writes spAero(i)(1:indx) plus the moment number into a 12-character xv_list element. This has two failure modes: • If an aerosol species uses all 12 characters, index(spAero(i),’ ’) returns 0, so the species substring is empty and labels collapse to just the moment number. • If the first blank is at the end of the 12-character field, or the species plus moment number is longer than 12 characters, the internal write target can be too short. That can raise an internal-file write error before the simulation starts. Those labels are used in min/max diagnostics, sensor headers, and windfield output, so this can either crash initialization or produce ambiguous output names for aerosol fields. Build the label in a temporary string that is longer than xv_list, use trim(spAero(i)) instead of searching for a blank manually, and then assign into xv_list. The assignment may truncate to the current 12- character label width, but it avoids internal-write overflow and does not drop full-width names to an empty substring. @@ ! Local Variables integer :: i,j - integer :: indx + integer :: idx + character(len=32) :: aerosolLabel @@ if(nAero.gt.0)then do i=1,nAero do j=1,nMAero - indx=index(spAero(i),’ ’) - write(xv_list(iEmitStart+nEmit+nMAero*(i-1)+j-1),"(A,I0)") & - spAero(i)(1:indx),j + idx=iEmitStart+nEmit+nMAero*(i-1)+j-1 + write(aerosolLabel,"(A,’_’,I0)") trim(spAero(i)),j + xv_list(idx)=aerosolLabel enddo enddo endif Git evidence: 91c2a57 (2026-07-22, aerosol merge fixes); a15c17e (2026-07-23, longer path variables). Aerosol labels and path/name buffers were made safer through the aerosol merge and later lengthened path variables, reducing the risk of truncation or label mismatch for longer species names. 247 # 91c2a57 Aerosols Merge # Full command: git show --find-renames --unified=3 91c2a57 -- CODE-dev/definearray.F90 CODE-dev/ ,→ Emissions/variables_ems.F90 CODE-dev/compress.F90 index a930960..86ce04b 100644 +++ b/CODE-dev/Emissions/variables_ems.F90 @@ -31,7 +31,9 @@ module emission_general_variables contains + !--------------------------------------------------------------------- ! Lagrangian Interpolation function + !--------------------------------------------------------------------- real(wp) function LagrangeInterp(n,p,array) integer,intent(in) :: n @@ -41,15 +43,17 @@ module emission_general_variables integer :: i,j - LagrangeInterp=0.0_wp + LagrangeInterp=0._wp + if(any(array.le.0.0_wp)) return + do i=1,n iw=1 do j=1,n if(i.ne.j) iw=iw*(p-j)/(i-j) enddo - LagrangeInterp=log10(array(i))*iw + LagrangeInterp=LagrangeInterp+log10(array(i))*iw enddo - LagrangeInterp=10**LagrangeInterp + LagrangeInterp=10._wp**LagrangeInterp end function LagrangeInterp end module emission_general_variables index 2a451db..9d4fca0 100644 +++ b/CODE-dev/compress.F90 @@ -5,7 +5,7 @@ program compress ! Global variables ... [diff excerpt truncated; run the command above for the full commit diff] # a15c17e lengthened file path variables # Full command: git show --find-renames --unified=3 a15c17e -- CODE-dev/Sensors/rinit_sense.F90 index ced92c1..1136aa5 100644 +++ b/CODE-dev/Sensors/rinit_sense.F90 @@ -17,7 +17,7 @@ subroutine rinitSense() ! Local Variables integer :: i,j,k,ia,ja,ni integer :: unitnum - character(len=200) :: sensorFileName + character(len=512) :: sensorFileName 248 FIRETEC Bug Resolution Log July 2026 real(wp) :: fuzz=0.0001_wp 249 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-009: Fire And Fuel Heat Paths Use kb Even When It Was Never Added To xv Source report: definearrayF90/DEFINEARRAY-004 (changed).md Files • definearray.F90 • force.F90 • Vegetation/convection_veg.F90 • Vegetation/evaporation_veg.F90 • Vegetation/burn_veg.F90 • variables.F90 ! variables.F90 162 integer :: itheta=1,ika=1,ikb=1,iO2=1,iH2O=1,irho=1 ! definearray.F90 89 if(iturb.gt.0)then 90 nv = nv+1 91 ika = nv 92 if(iturb.gt.1)then 93 nv = nv+1 94 ikb = nv 95 endif 96 endif ... 149 if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then 150 isies = nvfuel+1 151 nvfuel = nvfuel+1 152 endif ! force.F90 236 if(isies.ne.1)then 237 call convection(forceSI_xv(:,:,:,itheta), & ... 240 if(imoist.eq.1)then ... 245 call evapBulk(forceSI_xv,forceSI_xvfuel,xvtmp,xvrho,xvfueltmp, & ... 248 if(ifire.eq.1)then ... 251 call burnFuel(forceSI_xv,forceSI_xvfuel,xvtmp,xvfueltmp, & ! Vegetation/convection_veg.F90 9 use xvall, only : irhof,irhow,ika,ikb,iuvel,ivvel,iwvel ... 46 rktemp=xvrho(i,j,k,ika)+1.2_wp*xvrho(i,j,k,ikb) 250 47 sp=sqrt(rktemp)+ & ! Vegetation/burn_veg.F90 8 use xvall, only : ikb,iO2,irho,irhof,irhow,isies,itheta ... 47 rkctemp=0.2_wp*xv(i,j,k,ikb)/xv(i,j,k,irho) 50 sigmac=sc*0.5_wp*sqrt(rkctemp) Problem xvpointers only creates the kb transported variable when iturb > 1. If a run uses fire, moisture, or radiation-related solid energy (isies.ne.1) with iturb == 0, both ika and ikb remain at their module default of 1, which is the u momentum field. If iturb == 1, ika is created but ikb still remains 1. The vegetation routines then compute turbulent mixing from xvrho(...,ika) and xvrho(...,ikb). In those configurations, they use wind momentum/velocity as turbulence energy. That can silently distort convective heat transfer and burning rates, or produce sqrt of a negative value when u is negative. Either implement non-kb formulas for these physics paths or reject the unsupported combination early. With the current code, fail-fast is safer because the fire/moisture/solid-energy routines are written around the two-equation turbulence indices. @@ ! Executable Code + if((ifire.eq.1.or.imoist.eq.1.or.irad.gt.0).and.iturb.lt.2)then + print*,’ifire/imoist/irad fuel-energy paths require iturb=2 because they use ka and kb’ + STOP + endif + ! Transported array pointers iuvel = 1 ivvel = 2 Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup). Input validation now rejects physics combinations that require ka/kb unless the supported turbulence mode initializes those fields. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/Vegetation/input_veg.F90 CODE- ,→ dev/largeScalePGF.F90 index ce90d8b..7c0602c 100644 251 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -21,6 +21,11 @@ subroutine input_vegetation() call QueryGridlist_variable(’imoist’,imoist,48) call QueryGridlist_variable(’inonlocal’,inonlocal,48) call QueryGridlist_variable(’idiffsies’,idiffsies,48) + if((idiffsies.eq.1).and.ifire.lt.0)then + print*,"You’re an idiot!!! idiffsies.eq.1 but ifire.eq.0, you& + & can’t have creeping fire without fire." + STOP + endif call QueryGridlist_variable(’ifuel’,ifuel,48) call QueryGridlist_variable(’ignfile’,ignfile,48) +++ b/CODE-dev/largeScalePGF.F90 @@ -9,13 +9,13 @@ subroutine rinitLargeScalePGF use lspgf_variables, only : iwindx,nMassFlux,massFluxTemp, & massFlux,targMassFlux,sintheta,sinthetaf,flspgf,cosg,sing, & + use msga_variables, only : mpi_wp,ierror,mpi_rank + use mpi ! Local Variables @@ -47,7 +47,7 @@ subroutine rinitLargeScalePGF allocate(massFluxTemp(nMassFlux)); massFluxTemp=0.0_wp allocate(massFlux(nMassFlux)); massFlux=0.0_wp - intsinthetal = 0.0_wp ! integrated value of sintheta over the vertical + intsinthetal = 0._wp ! integrated value of sintheta over the vertical ... [diff excerpt truncated; run the command above for the full commit diff] 252 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-010: iturb=1 Reaches Turbulence Initialization With Unallocated Arrays Source report: definearrayF90/DEFINEARRAY-005 (changed).md Files • definearray.F90 • rinit.F90 • subGridTurb/defineArray_turb.F90 • subGridTurb/rinit_turb.F90 • subGridTurb/force_turb.F90 ! definearray.F90 45 if(iturb.gt.0) call defineTurbArray ! subGridTurb/defineArray_turb.F90 12 if(iturb.eq.2)then 13 allocate(sa(1-ih:np+ih,1-ih:mp+ih,l)) 14 allocate(saxy(1-ih:np+ih,1-ih:mp+ih,l)) 15 allocate(saz(1-ih:np+ih,1-ih:mp+ih,l)) 16 allocate(sb(1-ih:np+ih,1-ih:mp+ih,l)) ... 24 endif ! rinit.F90 67 if(iturb.ge.1) call rinitSubTurb ! subGridTurb/rinit_turb.F90 10 use linn_turb_variables, only : saxy,saz,sa,sb ... 24 if(isa.eq.1)then ! saxy=saz=cst 25 saxy(i,j,k)=2.0_wp 26 saz(i,j,k)=saxy(i,j,k) ... 46 sa(i,j,k)=(saxy(i,j,k)**2.0_wp*saz(i,j,k))**(1.0_wp/3.0_wp) 47 sb(i,j,k)=0.25_wp ! subGridTurb/force_turb.F90 24 if(iturb.eq.1)then ! Diffusive Radiation Scheme 25 if(mpi_rank.eq.0) print*,’Smagorinski␣Not␣implemented’ 26 call mpi_finalize(ierror) 27 STOP 253 Problem definearray calls defineTurbArray for any iturb > 0, but defineTurbArray only allocates the Linn turbulence arrays when iturb == 2. Later, rinit calls rinitSubTurb for iturb >= 1, and rinitSubTurb unconditionally writes saxy, saz, sa, and sb. For iturb == 1, those arrays were never allocated, so the run can crash during initialization before it reaches the explicit Smagorinski Not implemented stop in calcForceTurb. Reject iturb == 1 before allocation/initialization, or fully implement and allocate the arrays required by that mode. Since calcForceTurb already says this mode is not implemented, the smallest safe fix is an early stop. @@ allocate(xvrho(1-ih:np+ih,1-ih:mp+ih,0:l,nv)) allocate(xvtmp(1-ih:np+ih,1-ih:mp+ih,l,nv)) + if(iturb.eq.1)then + print*,’iturb=1 is not implemented’ + STOP + endif if(iturb.gt.0) call defineTurbArray Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). Unsupported turbulence mode handling was tightened so iturb=1 no longer proceeds into fire/moist/ra- diation paths that require unallocated turbulence arrays. Later subgrid commits cleaned up the remaining kernels. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/rinit.F90 index bfffefd..7c85306 100644 +++ b/CODE-dev/rinit.F90 @@ -207,7 +207,7 @@ subroutine setRhoThetaP !Theta stab is the lapse rate enddo xvLim(1,itheta)=200._wp xvLim(2,itheta)=5000._wp - xvLim(1,irho)=0._wp + xvLim(1,irho)=1.e-6_wp xvLim(2,irho)=10._wp call update(xe(:,:,:,itheta),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) call update(xe(:,:,:,irho),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,0) # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. 254 # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/rinit.F90 CODE-dev/subGridTurb ,→ /force_turb.F90 +++ b/CODE-dev/rinit.F90 @@ -102,12 +102,14 @@ end subroutine rinit !----------------------------------------------------------------------- subroutine setRhoThetaP !Theta stab is the lapse rate use gridlist_variables, only : zStabBot,zStabMid,thetaStabMid, & - thetaStabTop,relativeHumidity,dx,dy,l,pressground,tambient, & + thetaStabTop,dx,dy,l,pressground,tambient,zgroundref,slopeangle, & + slopeazimuth,wp + use emission_general_variables, only : specificHumidity + use emission_gridlist_variables, only : relativeHumidity + use thermo_variables, only : pre,tempg @@ -116,7 +118,6 @@ subroutine setRhoThetaP !Theta stab is the lapse rate ! Local Variables @@ -126,17 +127,11 @@ subroutine setRhoThetaP !Theta stab is the lapse rate ! Executable Code - ! Set specific humidity - ! water pressure saturation in PA (from Humidity Conversion Formulas, Vaisala) - ! OK at 0.083% within the range 50-100°C - pw=relativeHumidity*611.64_wp* & - exp(17.62_wp*(Tambient-273.15_wp)/(tambient-30.13_wp)) ! water vapor pressure (Pa) - specificHumidity=0.62199_wp*pw/(pressground-0.378*pw) yH2O=specificHumidity yO2 =0.233_wp/(specificHumidity+1._wp) ... [diff excerpt truncated; run the command above for the full commit diff] 255 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-011: Implicit Domain Updates Leave Ground-Layer xvrho Stale Source report: domainUpdatesF90/DOMAINUPDATES-001 (decided no).md Files • domainUpdates.F90 • MOA.F90 • force.F90 • Firebrands/firebrand_fb.F90 • Firebrands/functions_fb.F90 ! domainUpdates.F90 27 subroutine implicit_domain_updates ... 56 do kv=1,nv 57 xvrho(i,j,k,kv)=xvtmp(i,j,k,kv)/xvtmp(i,j,k,irho) 58 enddo ... 62 do kv=1,nv 63 call loop_update_flags(kv,iuv) 64 call update(xvrho(:,:,1:l,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,iuv) 65 enddo ! domainUpdates.F90 137 k=1 !bottombc 138 do j=1-ih+1,mp+ih-1 139 do i=1-ih+1,np+ih-1 ... 144 xvrho(i,j,0,kv)=getSubGroundValue(xvrho(i,j,k,kv), & ... 151 xvrho(i,j,0,iwvel) = 2*wground-xvrho(i,j,1,iwvel) ! MOA.F90 86 call implicit_domain_updates 87 call small_implicit_forcings ... 113 wavg(i,j,k)=wavg(i,j,k)+wt(its+1)*xvtmp(i,j,k,iwvel)/ & 114 xvtmp(i,j,k,irho)/gi(i,j,k) ! force.F90 154 if(ifbrand.eq.1) call firebrand(xvrho(:,:,:,iuvel), & 155 xvrho(:,:,:,ivvel),xvrho(:,:,:,iwvel),1-ih,np+ih,1-ih,mp+ih,0,l, & ! Firebrands/functions_fb.F90 62 else 256 63 kp=k 64 km=k-1 ... 77 u00=u_c(im,jm,km)*(1-xd)+u_c(ip,jm,km) Problem implicit_domain_updates recomputes xvrho(:,:,1:l,:) from xvtmp, but it never recomputes the k=0 ground ghost layer. explicit_domain_updates has custom bottom-boundary code for xvrho(:,:,0,:), so the model clearly expects that layer to track the current normalized state. During MOA, the small-step solution advances in xvtmp; each call to implicit_domain_updates refreshes the interior normalized fields but leaves the ground plane from the previous large-step explicit update. After MOA, large_explicit_forcings can call firebrand with xvrho(:,:,:,iuvel:iwvel) over 0:l. GetWind uses km=k-1, so particles in the first cell can interpolate against stale ground velocities. This can make near-ground firebrand transport inconsistent with the final implicit small-step state, especially when pressure, drag, buoyancy, or relaxation changed the first-layer winds during MOA. Move the bottom-boundary construction into a shared helper and call it from both implicit_domain_updates ,→ and explicit_domain_updates immediately after the xvrho(:,:,1:l,:) halo updates. @@ end module SubGround_function + +module XvRhoGroundUpdate + use gridlist_variables, only : wp + contains + subroutine updateXvRhoGround(xvrho,np,mp,l,ih,nv,iuvel,ivvel,iwvel) + use metric_variables, only : gmul,c13,c23,gi + use SubGround_function + implicit none + integer,intent(in) :: np,mp,l,ih,nv,iuvel,ivvel,iwvel + real(wp),intent(inout) :: xvrho(1-ih:np+ih,1-ih:mp+ih,0:l,nv) + integer :: i,j,kv,iuv + real(wp) :: g13,g23,g33,uground,vground,wground + + do j=1,mp + do i=1,np + g13 = c13(i,j)*gmul(1) + g23 = c23(i,j)*gmul(1) + g33 = g13**2+g23**2+gi(i,j,1)**2 + do kv=1,nv + xvrho(i,j,0,kv)=getSubGroundValue(xvrho(i,j,1,kv), & + xvrho(i-1,j,1,kv),xvrho(i+1,j,1,kv),xvrho(i,j-1,1,kv), & + xvrho(i,j+1,1,kv),g13,g23,g33) + enddo + uground=0.5_wp*(xvrho(i,j,1,iuvel)+xvrho(i,j,0,iuvel)) + vground=0.5_wp*(xvrho(i,j,1,ivvel)+xvrho(i,j,0,ivvel)) + wground = - (g13 * uground + g23 * vground)/gi(i,j,1) 257 + xvrho(i,j,0,iwvel) = 2*wground-xvrho(i,j,1,iwvel) + enddo + enddo + + do kv=1,nv + call loop_update_flags(kv,iuv) + call update(xvrho(:,:,0:0,kv),np,mp,1,1-ih,np+ih, & + 1-ih,mp+ih,1,0,iuv) + enddo + end subroutine updateXvRhoGround +end module XvRhoGroundUpdate @@ subroutine implicit_domain_updates @@ - use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & + use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & + iuvel,ivvel,iwvel, & + use XvRhoGroundUpdate, only : updateXvRhoGround @@ do kv=1,nv call update(xvrho(:,:,1:l,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,iuv) enddo + call updateXvRhoGround(xvrho,np,mp,l,ih,nv,iuvel,ivvel,iwvel) call update(tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0) Git evidence: a1686b2 (2026-07-14, local xvrho and timestep arrays); 561333f (2026-08-01, heat-source, no-emission, and O2 fixes); 3189a4b (2026-08-11, empty-emission thermodynamics cleanup). The July/August state-update cleanup made xvrho handling local to the owning state and added explicit empty-emission thermodynamic paths, reducing stale ground/halo state use in these coupled updates. # a1686b2 Changes to xvrho so that we don’t have update it (all the information is local) and we have ,→ a large time step/small time step array so we don’t have to re-calculate again and again. # Full command: git show --find-renames --unified=3 a1686b2 -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ force.F90 +++ b/CODE-dev/domainUpdates.F90 @@ -29,7 +29,7 @@ subroutine implicit_domain_updates - use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & + use xvall, only : xvtmp,xvfueltmp,xvrhotmp,nv,irho,itheta, & use thermo_variables, only : pr,tempg,cv_gas,cp_gas,mw_gas @@ -42,26 +42,22 @@ subroutine implicit_domain_updates integer :: i,j,k,kv,iuv,ift ! Executable Code 258 - forceSI_xv=0.0_wp - forceSI_xvfuel=0.0_wp + forceSI_xv=0._wp + forceSI_xvfuel=0._wp + do kv=1,nv-1 + xvrhotmp(:,:,1:l,kv)=xvtmp(:,:,:,kv)/xvtmp(:,:,:,irho) + enddo do i=1,np do j=1,mp do k=1,l - do kv=1,nv - xvrho(i,j,k,kv)=xvtmp(i,j,k,kv)/xvtmp(i,j,k,irho) - call updateGasThermProps(xvrho(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrho(i,j,k,itheta),xvtmp(i,j,k,irho), & - cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & - tempg(i,j,k)) + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) enddo enddo enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 561333f finally fixed my splashing issue # Full command: git show --find-renames --unified=3 561333f -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ force.F90 +++ b/CODE-dev/domainUpdates.F90 @@ -40,6 +40,7 @@ subroutine implicit_domain_updates ! Local Variables + real(wp) :: empty_emit(1:0) ! Executable Code forceSI_xv=0._wp @@ -51,10 +52,17 @@ subroutine implicit_domain_updates do i=1,np do j=1,mp do k=1,l - call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & - xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + if(nEmit.eq.0)then + call updateGasThermProps(empty_emit,empty_emit,empty_emit,0, & + xvrhotmp(i,j,k,itheta),xvtmp(i,j,k,irho), & + cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & + tempg(i,j,k)) + else + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) 259 + endif enddo enddo enddo @@ -101,6 +109,7 @@ subroutine explicit_domain_updates ! Local Variables + real(wp) :: empty_emit(1:0) real(wp):: g13, g23, g33 ! metric tensor real(wp)::uground,vground,wground ! cartesian at ground level ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 260 BUG-2026-07-012: Explicit Ground xvrho Boundary Leaves Lateral Halos Stale Source report: domainUpdatesF90/DOMAINUPDATES-002 (decided no).md Files • domainUpdates.F90 • subGridTurb/stressrij_turb.F90 • subGridTurb/diffuse_turb.F90 • subGridTurb/force_turb.F90 ! domainUpdates.F90 132 do kv=1,nv 133 call loop_update_flags(kv,iuv) 134 call update(xvrho(:,:,1:l,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,iuv) 135 enddo ... 137 k=1 !bottombc 138 do j=1-ih+1,mp+ih-1 139 do i=1-ih+1,np+ih-1 ... 144 xvrho(i,j,0,kv)=getSubGroundValue(xvrho(i,j,k,kv), & ... 151 xvrho(i,j,0,iwvel) = 2*wground-xvrho(i,j,1,iwvel) With the default ih=1, the bottom-boundary loop writes only i=1:np, j=1:mp. It does not update xvrho(0,:,0,:), xvrho(np+1,:,0,:), xvrho(:,0,0,:), xvrho(:,mp+1,0,:), or the bottom corners. ! subGridTurb/stressrij_turb.F90 44 ! Here we assume that: 45 ! u,v,w are defined on [0,np+1]*[0,mp+1]*[0,l], meaning that they have been updated 46 ! and that bottom bc is implemented (top bc is hard coded here) 47 ! for u, v, w : NB corners are required! ... 133 uz = 0.5_wp*(xvrho(i,j,kp1,iuvel)-xvrho(i,j,k-1,iuvel)+ & 134 xvrho(i-1,j,kp1,iuvel)-xvrho(i-1,j,k-1,iuvel))*hdzi ! subGridTurb/diffuse_turb.F90 2 ! Diffuse a variable phi that should be defined on [0,np+1]*[0,mp+1]*[0,l], 3 ! This requires that the variable have been updated with corners and bottom bc ... 79 pz = 0.5_wp*(phi(i,j,kp1)-phi(i,j,k-1)+phi(i-1,j,kp1)-phi(i-1,j,k-1))*hdzi Problem explicit_domain_updates updates lateral halos and corners for xvrho(:,:,1:l,:), then computes only the interior k=0 bottom plane. The turbulence routines document that the velocity/scalar fields must be 261 valid on [0,np+1]*[0,mp+1]*[0,l], and their k=1 stencils read bottom-layer halos such as xvrho(0,j,0,*), xvrho(np+1,j,0,*), xvrho(i,0,0,*), and corners. Those values are either left from an older time, left at allocation-time contents, or missing MPI- neighbor/corner updates. That contaminates bottom-face gradients in stressrij and diffuse, directly affecting near-ground turbulent momentum and scalar fluxes. After computing the interior k=0 bottom boundary, run the normal halo exchange on the single bottom plane with icorner=1. This fills lateral halos and corners consistently with the freshly computed interior values. The same helper proposed in DOMAINUPDATES-001 can do this for both explicit and implicit updates. @@ @@ use SubGround_function + use XvRhoGroundUpdate, only : updateXvRhoGround @@ - real(wp):: g13, g23, g33 ! metric tensor - real(wp)::uground,vground,wground ! cartesian at ground level @@ do kv=1,nv call update(xvrho(:,:,1:l,kv),np,mp,l,1-ih,np+ih,1-ih,mp+ih,1,0,iuv) enddo call update(tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0) - k=1 !bottombc - do j=1-ih+1,mp+ih-1 - do i=1-ih+1,np+ih-1 - g13 = c13(i,j)*gmul(1) - g23 = c23(i,j)*gmul(1) - g33 = g13**2+g23**2+gi(i,j,1)**2 - do kv=1,nv - xvrho(i,j,0,kv)=getSubGroundValue(xvrho(i,j,k,kv), & - xvrho(i-1,j,k,kv),xvrho(i+1,j,k,kv),xvrho(i,j-1,k,kv), & - xvrho(i,j+1,k,kv),g13,g23,g33) - uground=0.5_wp*(xvrho(i,j,1,iuvel)+xvrho(i,j,0,iuvel)) - vground=0.5_wp*(xvrho(i,j,1,ivvel)+xvrho(i,j,0,ivvel)) - wground = - (g13 * uground + g23 * vground)/gi(i,j,1) - xvrho(i,j,0,iwvel) = 2*wground-xvrho(i,j,1,iwvel) - enddo + call updateXvRhoGround(xvrho,np,mp,l,ih,nv,iuvel,ivvel,iwvel) Git evidence: a1686b2 (2026-07-14, local xvrho and timestep arrays); 561333f (2026-08-01, heat-source, no-emission, and O2 fixes); 3189a4b (2026-08-11, empty-emission thermodynamics cleanup). 262 The July/August state-update cleanup made xvrho handling local to the owning state and added explicit empty-emission thermodynamic paths, reducing stale ground/halo state use in these coupled updates. # a1686b2 Changes to xvrho so that we don’t have update it (all the information is local) and we have ,→ a large time step/small time step array so we don’t have to re-calculate again and again. # Full command: git show --find-renames --unified=3 a1686b2 -- CODE-dev/domainUpdates.F90 +++ b/CODE-dev/domainUpdates.F90 @@ -29,7 +29,7 @@ subroutine implicit_domain_updates - use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & + use xvall, only : xvtmp,xvfueltmp,xvrhotmp,nv,irho,itheta, & use thermo_variables, only : pr,tempg,cv_gas,cp_gas,mw_gas @@ -42,26 +42,22 @@ subroutine implicit_domain_updates integer :: i,j,k,kv,iuv,ift ! Executable Code - forceSI_xv=0.0_wp - forceSI_xvfuel=0.0_wp + forceSI_xv=0._wp + forceSI_xvfuel=0._wp + do kv=1,nv-1 + xvrhotmp(:,:,1:l,kv)=xvtmp(:,:,:,kv)/xvtmp(:,:,:,irho) + enddo do i=1,np do j=1,mp do k=1,l - do kv=1,nv - xvrho(i,j,k,kv)=xvtmp(i,j,k,kv)/xvtmp(i,j,k,irho) - call updateGasThermProps(xvrho(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrho(i,j,k,itheta),xvtmp(i,j,k,irho), & - cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & - tempg(i,j,k)) + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) enddo enddo enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 561333f finally fixed my splashing issue # Full command: git show --find-renames --unified=3 561333f -- CODE-dev/domainUpdates.F90 +++ b/CODE-dev/domainUpdates.F90 @@ -40,6 +40,7 @@ subroutine implicit_domain_updates 263 ! Local Variables + real(wp) :: empty_emit(1:0) ! Executable Code forceSI_xv=0._wp @@ -51,10 +52,17 @@ subroutine implicit_domain_updates do i=1,np do j=1,mp do k=1,l - call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & - xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + if(nEmit.eq.0)then + call updateGasThermProps(empty_emit,empty_emit,empty_emit,0, & + xvrhotmp(i,j,k,itheta),xvtmp(i,j,k,irho), & + cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & + tempg(i,j,k)) + else + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) + endif enddo enddo enddo @@ -101,6 +109,7 @@ subroutine explicit_domain_updates ! Local Variables + real(wp) :: empty_emit(1:0) real(wp):: g13, g23, g33 ! metric tensor real(wp)::uground,vground,wground ! cartesian at ground level ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 264 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-013: Solid Temperatures Are Not Updated For Non-Fire isies Physics Source report: domainUpdatesF90/DOMAINUPDATES-003 (changed).md Files • domainUpdates.F90 • definearray.F90 • force.F90 • Vegetation/solarHeat_veg.F90 • Radiation/sink_rad.F90 • Radiation/monteCarlo_rad.F90 ! definearray.F90 146 irhof = 1 147 irhow = 2 148 nvfuel = 2 149 if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then 150 isies = nvfuel+1 151 nvfuel = nvfuel+1 152 endif ! Vegetation/definearray_veg.F90 26 if(isies.ne.1)then 27 allocate(temps(nfuel,1-ih:np+ih,1-ih:mp+ih,lfuel)) 28 endif ! domainUpdates.F90 68 if(ifire.eq.1)then 69 do i=1,np ... 73 call updateSolidThermProps(xvfueltmp(ift,i,j,k,irhof), & 74 xvfueltmp(ift,i,j,k,irhow),xvfueltmp(ift,i,j,k,isies), & 75 temps(ift,i,j,k)) ... 155 if(ifire.eq.1)then 156 do i=1,np ... 160 call updateSolidThermProps(xvfuel(ift,i,j,k,irhof), & 161 xvfuel(ift,i,j,k,irhow),xvfuel(ift,i,j,k,isies), & 162 temps(ift,i,j,k)) ! force.F90 103 elseif(irad.eq.2)then ! Monte-Carlo Radiation Scheme 104 call firerad_MC(forceSE_xv(:,:,:,itheta), & 105 forceSE_xvfuel(:,:,:,:,isies), & ... 265 108 elseif(irad.eq.3)then ! Radiation Sink 109 call radiationSink(forceSE_xv(:,:,:,itheta), & 110 forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & 111 xvfuel(:,:,:,:,irhow),tempg,temps, & ... 240 if(imoist.eq.1)then 241 call solarHeating(forceSI_xvfuel(:,:,:,:,isies), & ! Vegetation/solarHeat_veg.F90 221 QlwOUT=leaf_emis*sigma*temps(it,i,j,k)**4 ! Radiation/sink_rad.F90 46 firad_solid=-0.95_wp*sigma*av*(temps(it,i,j,k)**4-tenv**4) Problem temps and the solid internal-energy field isies are created whenever imoist.eq.1, ifire.eq.1, or irad.gt.0. But both implicit_domain_updates and explicit_domain_updates recompute temps only when ifire.eq.1. That means non-fire moisture or radiation configurations can evolve xvfuel(:,:,:,:,isies) while temps remains at its old value. Several physics routines use temps directly: solar heating computes outgoing longwave radiation from temps**4, radiation sink uses temps**4, Monte Carlo radiation updates/uses temps, and evaporation uses temps for saturation/boiling logic. This is a state-consistency bug: xvfuel(:,:,:,:,isies) is the transported/evolved quantity, but the derived temps field is stale whenever solid energy exists without active burning. Gate the solid temperature refresh on the existence of isies, not on ifire. The code already uses isies.ne.1 as the allocation/physics guard elsewhere. @@ - if(ifire.eq.1)then + if(isies.ne.1)then do i=1,np do j=1,mp do k=1,lfuel @@ - if(ifire.eq.1)then + if(isies.ne.1)then do i=1,np do j=1,mp do k=1,lfuel Git evidence: a1686b2 (2026-07-14, local xvrho and timestep arrays); 561333f (2026-08-01, heat-source, no-emission, and O2 fixes); 3189a4b (2026-08-11, empty-emission thermodynamics cleanup). 266 The July/August state-update cleanup made xvrho handling local to the owning state and added explicit empty-emission thermodynamic paths, reducing stale ground/halo state use in these coupled updates. # a1686b2 Changes to xvrho so that we don’t have update it (all the information is local) and we have ,→ a large time step/small time step array so we don’t have to re-calculate again and again. # Full command: git show --find-renames --unified=3 a1686b2 -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ definearray.F90 CODE-dev/force.F90 index 3bdea4f..197601e 100644 +++ b/CODE-dev/definearray.F90 @@ -6,7 +6,7 @@ subroutine definearray uswitch,vswitch use forcings, only : force,forceSE_xv,forceSI_xv,forceLE_xv,xvLim, & - use xvall, only : xv,xe,xvtmp,relaxxv,nv,xvrho,uprofile + use xvall, only : xv,xe,xvtmp,relaxxv,nv,xvrho,xvrhotmp use thermo_variables, only : tempg,pr,pre,cp_gas,cv_gas,mw_gas use lspgf_variables, only : sintheta,sinthetaf,flspgf @@ -17,8 +17,11 @@ subroutine definearray allocate(xe(np,mp,l,nv)) - allocate(xv(1-ih:np+ih,1-ih:mp+ih,l,nv)); xv=0.0_wp + allocate(xv(1-ih:np+ih,1-ih:mp+ih,l,nv)) allocate(xvLim(2,nv)); xvLim(1,:)=-1.e20_wp; xvLim(2,:)=1.e20_wp + allocate(xvrho(1-ih:np+ih,1-ih:mp+ih,0:l,nv-1)) + allocate(xvtmp(1-ih:np+ih,1-ih:mp+ih,l,nv)) + allocate(xvrhotmp(1-ih:np+ih,1-ih:mp+ih,0:l,nv-1)) allocate(wt(nts+1)); wt=1./nts allocate(wtf(nts)); wtf=1./nts allocate(uavg(1-ih:np+ih,1-ih:mp+ih,l)) @@ -40,11 +43,7 @@ subroutine definearray allocate(z(l)) allocate(zedge(l+1)) allocate(relaxxv(np,mp,l,4)); relaxxv=0.0_wp - allocate(xvrho(1-ih:np+ih,1-ih:mp+ih,0:l,nv)) - allocate(xvtmp(1-ih:np+ih,1-ih:mp+ih,l,nv)) if(iturb.gt.0) call defineTurbArray - if (uswitch.eq.2.or.vswitch.eq.2) & - allocate(uprofile(1-ih:np+ih,1-ih:mp+ih,l)) !FP allocate(pr(np,mp,l)) allocate(mw_gas(np,mp,l)) allocate(cp_gas(np,mp,l)) +++ b/CODE-dev/domainUpdates.F90 ... [diff excerpt truncated; run the command above for the full commit diff] # 561333f finally fixed my splashing issue # Full command: git show --find-renames --unified=3 561333f -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ definearray.F90 CODE-dev/force.F90 +++ b/CODE-dev/definearray.F90 267 @@ -78,6 +78,7 @@ subroutine xvpointers ! Executable Code + iO2 = 0 ! Transported array pointers iuvel = 1 ivvel = 2 +++ b/CODE-dev/domainUpdates.F90 @@ -40,6 +40,7 @@ subroutine implicit_domain_updates ! Local Variables + real(wp) :: empty_emit(1:0) ! Executable Code forceSI_xv=0._wp @@ -51,10 +52,17 @@ subroutine implicit_domain_updates do i=1,np do j=1,mp do k=1,l - call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & - xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + if(nEmit.eq.0)then + call updateGasThermProps(empty_emit,empty_emit,empty_emit,0, & + xvrhotmp(i,j,k,itheta),xvtmp(i,j,k,irho), & + cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & + tempg(i,j,k)) + else + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 268 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-014: Heat Source Fuel Burn Leaves Solid Temperatures Stale Source report: domainUpdatesF90/DOMAINUPDATES-004 (decided no).md Files • domainUpdates.F90 • HeatSource/heatsource_heat.F90 • thermodynamics.F90 • compress.F90 • force.F90 • Vegetation/diffusesies_veg.F90 • Firebrands/generation_fb.F90 ! domainUpdates.F90 155 if(ifire.eq.1)then 156 do i=1,np 157 do j=1,mp 158 do k=1,lfuel 159 do ift=1,nfuel 160 call updateSolidThermProps(xvfuel(ift,i,j,k,irhof), & 161 xvfuel(ift,i,j,k,irhow),xvfuel(ift,i,j,k,isies), & 162 temps(ift,i,j,k)) ... 168 if(iturb.eq.2) call turbFieldUpdate() 169 if(ixevariation.ge.1) call xevariation(ixevariation, & 170 xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) 171 if(ilspgf.ge.1.and.mod(ittot,frqlspgf).eq.0) call largeScalePGF 172 if(iheatsource.gt.0) & 173 call updateHeatSourcePosition(iheatsource, & 174 xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) ! HeatSource/heatsource_heat.F90 23 ! here we update value of rhof in the heat source ... 38 if(overlap_area.gt.0.0_wp) & 39 rhof(:,i,j,1) = 0.01_wp ! burn fuel (drag is very small) ... 57 if(overlap_area.gt.0.0_wp) & 58 rhof(:,i,j,1)=0.01_wp ! burn fuel (drag is very small) ! thermodynamics.F90 35 subroutine updateSolidThermProps(rhoFuel,rhoWater,sies,temps) ... 47 cpsolid=(rhoFuel*cpwood+rhoWater*cpwater)/(rhoFuel+rhoWater) 48 temps=sies/cpsolid 269 ! compress.F90 41 call explicit_domain_updates ! Updates environmental variables (pressure, etc.) ... 61 call small_explicit_forcings ! Calculates explicit large timestep forcings ... 69 call large_explicit_forcings ! force.F90 108 elseif(irad.eq.3)then ! Radiation Sink 109 call radiationSink(forceSE_xv(:,:,:,itheta), & 110 forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & 111 xvfuel(:,:,:,:,irhow),tempg,temps, & ... 115 if(idiffsies.eq.1) call diffusesies(xvfuel(:,:,:,:,irhof), & 116 xvfuel(:,:,:,:,irhow),forceSE_xvfuel(:,:,:,:,irhof), & 117 forceSE_xvfuel(:,:,:,:,isies),1,np,1,mp,lfuel,nfuel,ih) ... 153 !!!!! Firebrand Forcings !!!!! 154 if(ifbrand.eq.1) call firebrand(xvrho(:,:,:,iuvel), & 155 xvrho(:,:,:,ivvel),xvrho(:,:,:,iwvel),1-ih,np+ih,1-ih,mp+ih,0,l, & 156 xv(:,:,:,irho),tempg(:,:,:),xvfuel(:,:,:,:,irhof), & 157 temps(:,:,:,:),1,np,1,mp,lfuel,nfuel) Problem explicit_domain_updates refreshes the derived solid temperature field before calling updateHeatSourcePosition ,→ . Despite its name, updateHeatSourcePosition does not only update geometry: it directly burns fuel by assigning xvfuel(:,:,:,:,irhof) to 0.01_wp in active heat-source cells. temps is derived from rhoFuel, rhoWater, and sies in updateSolidThermProps. If the heat source changes rhoFuel after temps has been recomputed, then temps no longer matches the fuel state for the rest of that large timestep. That stale value is consumed immediately. The timestep driver calls small_explicit_forcings after explicit_domain_updates, where radiation and diffusesies use temps. It then calls large_explicit_forcings, where firebrand generation also uses temps alongside the newly changed xvfuel(:,:,:,:,irhof). This can produce inconsistent heat loss, spread, ignition, or firebrand-launch behavior in heat-source cells. Apply the heat-source fuel-density update before recomputing solid thermal properties, so temps is derived from the final xvfuel(:,:,:,:,irhof) for the timestep. If DOMAINUPDATES-003 is applied, keep the solid-temperature guard as isies.ne.1. If this report is applied by itself, the minimal fix is just to move the existing if(iheatsource.gt.0) block above the existing temperature-refresh block. @@ - if(ifire.eq.1)then + if(iheatsource.gt.0) & 270 + call updateHeatSourcePosition(iheatsource, & + xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) + + if(isies.ne.1)then do i=1,np do j=1,mp do k=1,lfuel @@ if(ixevariation.ge.1) call xevariation(ixevariation, & xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) - if(iheatsource.gt.0) & - call updateHeatSourcePosition(iheatsource, & - xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) end subroutine explicit_domain_updates Git evidence: a1686b2 (2026-07-14, local xvrho and timestep arrays); 561333f (2026-08-01, heat-source, no-emission, and O2 fixes); 3189a4b (2026-08-11, empty-emission thermodynamics cleanup). The July/August state-update cleanup made xvrho handling local to the owning state and added explicit empty-emission thermodynamic paths, reducing stale ground/halo state use in these coupled updates. # a1686b2 Changes to xvrho so that we don’t have update it (all the information is local) and we have ,→ a large time step/small time step array so we don’t have to re-calculate again and again. # Full command: git show --find-renames --unified=3 a1686b2 -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ force.F90 +++ b/CODE-dev/domainUpdates.F90 @@ -29,7 +29,7 @@ subroutine implicit_domain_updates - use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & + use xvall, only : xvtmp,xvfueltmp,xvrhotmp,nv,irho,itheta, & use thermo_variables, only : pr,tempg,cv_gas,cp_gas,mw_gas @@ -42,26 +42,22 @@ subroutine implicit_domain_updates integer :: i,j,k,kv,iuv,ift ! Executable Code - forceSI_xv=0.0_wp - forceSI_xvfuel=0.0_wp + forceSI_xv=0._wp + forceSI_xvfuel=0._wp + do kv=1,nv-1 + xvrhotmp(:,:,1:l,kv)=xvtmp(:,:,:,kv)/xvtmp(:,:,:,irho) + enddo do i=1,np do j=1,mp 271 do k=1,l - do kv=1,nv - xvrho(i,j,k,kv)=xvtmp(i,j,k,kv)/xvtmp(i,j,k,irho) - call updateGasThermProps(xvrho(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrho(i,j,k,itheta),xvtmp(i,j,k,irho), & - cp_gas(i,j,k),cv_gas(i,j,k),mw_gas(i,j,k),pr(i,j,k), & - tempg(i,j,k)) + call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & + cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & + xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & + mw_gas(i,j,k),pr(i,j,k),tempg(i,j,k)) enddo enddo enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 561333f finally fixed my splashing issue # Full command: git show --find-renames --unified=3 561333f -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ HeatSource/heatsource_heat.F90 CODE-dev/thermodynamics.F90 index f5c71f3..8f47282 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -67,7 +67,7 @@ end subroutine updateHeatSourcePosition !----------------------------------------------------------------------- - use gridlist_variables, only : dx,dy,wp + use gridlist_variables, only : dx,dy,wp,ih @@ -83,7 +83,7 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) ! Local Variables integer,intent(in) :: il,iu,jl,ju,lls,nv - real(wp),intent(inout) :: force(il:iu,jl:ju,lls,nv) + real(wp),intent(inout) :: force(1-ih:np+ih,1-ih:mp+ih,lls,nv) integer :: i,j,k,itsource,iostat integer :: ia,ja +++ b/CODE-dev/domainUpdates.F90 @@ -40,6 +40,7 @@ subroutine implicit_domain_updates ! Local Variables + real(wp) :: empty_emit(1:0) ! Executable Code forceSI_xv=0._wp @@ -51,10 +52,17 @@ subroutine implicit_domain_updates do i=1,np do j=1,mp do k=1,l - call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & - cpEmit,mwEmit,nEmit,xvrhotmp(i,j,k,itheta), & 272 - xvtmp(i,j,k,irho),cp_gas(i,j,k),cv_gas(i,j,k), & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 273 BUG-2026-07-015: Sensor Wind Variation Uses The Vertical Index As A Terrain Index Source report: domainUpdatesF90/DOMAINUPDATES-005 (changed).md Files • domainUpdates.F90 • xeVariation/xevariation.F90 • metric.F90 • boundary.F90 ! domainUpdates.F90 168 if(iturb.eq.2) call turbFieldUpdate() 169 if(ixevariation.ge.1) call xevariation(ixevariation, & 170 xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) ! xeVariation/xevariation.F90 126 xe(i,j,k,iuvel)=xe(i,j,k,iuvel)+SensorUvel(kv)* & 127 max(0.0_wp,1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))* & 128 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & ... 130 xe(i,j,k,ivvel)=xe(i,j,k,ivvel)+SensorVvel(kv)* & 131 max(0.0_wp,1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))* & 132 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & ... 152 xe(i,j,k,iuvel)=xe(i,j,k,iuvel)+SensorUvel(kv)* & 153 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)*senw(kv)/totw 154 xe(i,j,k,ivvel)=xe(i,j,k,ivvel)+SensorVvel(kv)* & 155 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)*senw(kv)/totw ! xeVariation/xevariation.F90 186 xe(i,j,k,iuvel)=xe(i,j,k,iuvel)+senDataNew(kv,2)* & 187 max(0.0_wp,1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))* & 188 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & ... 194 xe(i,j,k,iuvel)=xe(i,j,k,iuvel)+senDataOld(kv,2)* & 195 max(0.0_wp,1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))* & 196 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & ... 222 xe(i,j,k,iuvel)=xe(i,j,k,iuvel)+senDataNew(kv,2)* & 223 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & ... 228 xe(i,j,k,iuvel)=xe(i,j,k,iuvel)+senDataOld(kv,2)* & 229 (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & ! metric.F90 79 function zcart(sigmax,i,j) result(z) ... 274 85 integer,intent(in) :: i,j ... 93 z=gdeform*(zb-zs(i,j))/zb+zs(i,j) ! boundary.F90 25 force(i,j,k,kv)=force(i,j,k,kv)+relaxxv(i,j,k,min(kv,4))* & 26 (xe(i,j,k,kv)-xv(i,j,k,kv))/dt Problem domainUpdates.F90 calls xevariation every large timestep when ixevariation.ge.1, passing the local interior xe(1:np,1:mp,:,:) with i and j bounds. In the sensor-driven branches, xevariation computes a height factor with zcart(z(k),j,k). But zcart expects horizontal indices (i,j) and indexes terrain as zs(i,j). The current call passes the loop’s y-index as the terrain x-index and the vertical level k as the terrain y-index. When the vertical level range extends beyond the allocated y-index halo of zs, this can address outside the second dimension inside zcart. When it stays in bounds, it still samples terrain from the wrong horizontal cell, so the sensor wind target uses the wrong vertical coordinate. The bad xe then feeds boundary relaxation through boundary.F90, and can force the domain toward a sensor wind profile based on unrelated terrain. This affects ixevariation == 3 and ixevariation == 4; the existing completed v-ramp loop-bound bug covers a different branch. Pass the current horizontal cell indices to zcart in the sensor branches. diff --git a/xeVariation/xevariation.F90 b/xeVariation/xevariation.F90 @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)*senw(kv)/totw + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)*senw(kv)/totw @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)*senw(kv)/totw + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)*senw(kv)/totw @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & 275 @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & @@ - (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp)* & + (zcart(z(k),i,j)/SensorZ(kv))**(1.0_wp/7.0_wp)* & Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 811932f (2026-07-23, cross-wind and corner fix set). The sensor wind-variation calculation was corrected so terrain height is evaluated with the cell coordinates rather than using the vertical index as a horizontal terrain index. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ xeVariation/xevariation.F90 index 648f9d6..e8fb65c 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -27,7 +27,7 @@ end module SubGround_function subroutine implicit_domain_updates use forcings, only : forceSI_xv,forceSI_xvfuel - use vegetation_gridlist_variables, only : nfuel,ifire + use vegetation_gridlist_variables, only : nfuel use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & @@ -87,7 +87,7 @@ end subroutine implicit_domain_updates use gridlist_variables, only : l,ilspgf,frqlspgf,ixevariation,ih, & iheatsource,iturb - use vegetation_gridlist_variables, only : nfuel,ifire + use vegetation_gridlist_variables, only : nfuel use gridsetup, only : np,mp,ittot use forcings, only : forceLE_xv,forceSE_xv,forceLE_xvfuel, & @@ -167,8 +167,8 @@ subroutine explicit_domain_updates if(ixevariation.ge.1) call xevariation(ixevariation, & xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) - if(iheatsource.gt.0) & - call updateHeatSourcePosition(iheatsource, & - xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) 276 + !if(iheatsource.gt.0) & + ! call updateHeatSourcePosition(iheatsource, & + ! xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) end subroutine explicit_domain_updates index a3b853d..6d64a23 100644 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -35,8 +35,8 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do i=il,iu xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & (time*uramp/uramptime+u0)*xe(i,j,k,irho)) & ... [diff excerpt truncated; run the command above for the full commit diff] # 811932f Small changes trying to fix a problem with a cross-wind where corners seem to create a wake. # Full command: git show --find-renames --unified=3 811932f -- CODE-dev/domainUpdates.F90 CODE-dev/ ,→ xeVariation/xevariation.F90 index 656211a..52c374e 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -45,7 +45,10 @@ subroutine implicit_domain_updates forceSI_xv=0._wp forceSI_xvfuel=0._wp - do i=1,np + do kv=1,nv-1 + xvrhotmp(:,:,1:l,kv)=xvtmp(:,:,:,kv)/xvtmp(:,:,:,irho) + enddo + do i=1,np do j=1,mp do k=1,l call updateGasThermProps(xvrhotmp(i,j,k,iEmitStart:iEmitStop), & @@ -97,7 +100,7 @@ subroutine explicit_domain_updates ! Local Variables - integer :: i,j,k,ift,kv + integer :: i,j,k,iuv,ift,kv real(wp):: g13, g23, g33 ! metric tensor real(wp)::uground,vground,wground ! cartesian at ground level @@ -122,12 +125,12 @@ subroutine explicit_domain_updates enddo call update(tempg,np,mp,l,1-ih,np+ih,1-ih,mp+ih,0,0,0) k=1 !bottombc - do j=1-ih+1,mp+ih-1 - do i=1-ih+1,np+ih-1 + do j=1,mp + do i=1,np g13 = c13(i,j)*gmul(1) g23 = c23(i,j)*gmul(1) g33 = g13**2+g23**2+gi(i,j,1)**2 - do kv=1,nv + do kv=1,nv-1 xvrho(i,j,0,kv)=getSubGroundValue(xvrho(i,j,k,kv), & xvrho(i-1,j,k,kv),xvrho(i+1,j,k,kv),xvrho(i,j-1,k,kv), & xvrho(i,j+1,k,kv),g13,g23,g33) @@ -138,6 +141,11 @@ subroutine explicit_domain_updates 277 ... [diff excerpt truncated; run the command above for the full commit diff] 278 BUG-2026-07-016: FORCE-002: Density can be clipped to exactly zero, then divided by on the next update Source report: forceF90/FORCE-002 (changed).md • force.F90 • MOA.F90 • rinit.F90 • domainUpdates.F90 ! rinit.F90 210 xvLim(1,irho)=0._wp 211 xvLim(2,irho)=10._wp ! force.F90 60 xv(i,j,k,kv)=max(xvLimits(1,kv),min(xvLimits(2,kv), & 61 xv(i,j,k,kv))) ! MOA.F90 93 call forcingLimits(xvtmp,xvLim,1-ih,np+ih,1-ih,mp+ih,l,nv) ! domainUpdates.F90 52 xvtmp(i,j,k,iEmitStart:iEmitStop)/xvtmp(i,j,k,irho), & 53 cpEmit,mwEmit,nEmit,xvtmp(i,j,k,itheta)/xvtmp(i,j,k,irho), & ... 57 xvrho(i,j,k,kv)=xvtmp(i,j,k,kv)/xvtmp(i,j,k,irho) Problem The limiter permits irho to become exactly 0.0_wp. That can happen after either the MOA small-step limiter or the final large-step forcing limiter. The very next domain update divides by density to compute species fractions, actual potential temperature, and every xvrho component. A density value clipped to zero therefore becomes a divide- by-zero/NaN source. The limiter prevents negative density but does not preserve the stronger invariant the rest of the code requires: xv(:,:,:,irho) > 0 Use a positive density floor, not zero. The floor should be chosen as a model parameter if there is already a preferred low-density cutoff; otherwise a small constant is safer than exact zero. 279 +++ b/CODE-dev/rinit.F90 @@ - xvLim(1,irho)=0._wp + xvLim(1,irho)=1.0e-6_wp xvLim(2,irho)=10._wp A more explicit variant is to define a named rho_floor constant in constants or gridlist_variables and use that value in both the limiter and any diagnostics that check for invalid density. Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 6e02566 (2026-07-09, validation crutches to reduce bad runs). The July validation pass added guardrails around invalid states and input combinations that could otherwise drive density or derived physics into bad values. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/rinit.F90 CODE-dev/ ,→ domainUpdates.F90 index 648f9d6..e8fb65c 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -27,7 +27,7 @@ end module SubGround_function subroutine implicit_domain_updates use forcings, only : forceSI_xv,forceSI_xvfuel - use vegetation_gridlist_variables, only : nfuel,ifire + use vegetation_gridlist_variables, only : nfuel use xvall, only : xvtmp,xvfueltmp,xvrho,nv,irho,itheta, & @@ -87,7 +87,7 @@ end subroutine implicit_domain_updates use gridlist_variables, only : l,ilspgf,frqlspgf,ixevariation,ih, & iheatsource,iturb - use vegetation_gridlist_variables, only : nfuel,ifire + use vegetation_gridlist_variables, only : nfuel use gridsetup, only : np,mp,ittot use forcings, only : forceLE_xv,forceSE_xv,forceLE_xvfuel, & @@ -167,8 +167,8 @@ subroutine explicit_domain_updates if(ixevariation.ge.1) call xevariation(ixevariation, & xe(1:np,1:mp,:,:),1,np,1,mp,l,nv) - if(iheatsource.gt.0) & - call updateHeatSourcePosition(iheatsource, & - xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) + !if(iheatsource.gt.0) & + ! call updateHeatSourcePosition(iheatsource, & + ! xvfuel(:,:,:,:,irhof),nfuel,1,np,1,mp,lfuel) 280 end subroutine explicit_domain_updates index bfffefd..7c85306 100644 +++ b/CODE-dev/rinit.F90 @@ -207,7 +207,7 @@ subroutine setRhoThetaP !Theta stab is the lapse rate enddo xvLim(1,itheta)=200._wp xvLim(2,itheta)=5000._wp ... [diff excerpt truncated; run the command above for the full commit diff] # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/domainUpdates.F90 index e8fb65c..4c0d91f 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -86,7 +86,7 @@ end subroutine implicit_domain_updates !----------------------------------------------------------------------- use gridlist_variables, only : l,ilspgf,frqlspgf,ixevariation,ih, & - iheatsource,iturb + iturb use gridsetup, only : np,mp,ittot 281 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-017: FORCE-003: iturb=1 bypasses the existing unsupported-mode stop and leaves fire physics using the wrong field as kb Source report: forceF90/FORCE-003 (changed).md • force.F90 • subGridTurb/force_turb.F90 • definearray.F90 • Vegetation/convection_veg.F90 • Vegetation/evaporation_veg.F90 • Vegetation/burn_veg.F90 ! force.F90 94 if(iturb.eq.2) call calcForceTurb(xv,forceSE_xv, & 95 1-ih,np+ih,1-ih,mp+ih,l,nv) ! subGridTurb/force_turb.F90 24 if(iturb.eq.1)then ! Diffusive Radiation Scheme 25 if(mpi_rank.eq.0) print*,’Smagorinski␣Not␣implemented’ 26 call mpi_finalize(ierror) 27 STOP 28 elseif (iturb.eq.2) then ! Linn Subgrid Turbulence Model ! definearray.F90 89 if(iturb.gt.0)then 90 nv = nv+1 91 ika = nv 92 if(iturb.gt.1)then 93 nv = nv+1 94 ikb = nv 95 endif 96 endif ! Vegetation/convection_veg.F90 46 rktemp=xvrho(i,j,k,ika)+1.2_wp*xvrho(i,j,k,ikb) ! Vegetation/burn_veg.F90 47 rkctemp=0.2_wp*xv(i,j,k,ikb)/xv(i,j,k,irho) 282 Problem calcForceTurb already has an explicit stop for iturb=1, but force.F90 never calls it for that mode because the call is guarded by iturb.eq.2. That means an iturb=1 run can continue past the intended "not implemented" stop. In this mode definearray.F90 assigns ika, but does not assign a real ikb; ikb remains its default value of 1, which is the u momentum field. Fire and moisture routines then use xvrho(...,ikb) or xv(...,ikb) as if it were turbulent kinetic energy. This can create bad heat-transfer rates, bad burn rates, or sqrt() of nonsensical values. Let calcForceTurb handle every nonzero turbulence mode so the existing iturb=1 stop is actually reached. If iturb=0 with fire/moisture is intended to be supported, the vegetation routines also need a no-TKE branch; if not, input should reject that configuration explicitly. +++ b/CODE-dev/force.F90 @@ - if(iturb.eq.2) call calcForceTurb(xv,forceSE_xv, & + if(iturb.gt.0) call calcForceTurb(xv,forceSE_xv, & 1-ih,np+ih,1-ih,mp+ih,l,nv) Optional follow-up validation: @@ call QueryGridlist_integer(’iturb’,iturb,48) + if(ifire.eq.1.and.iturb.ne.2) then + print*,’ERROR: fire physics currently requires iturb=2 because kb is used’ + STOP + endif if(iturb.gt.0) call input_subGridTurb(iturb) That second guard is deliberately conservative. A better long-term fix is to make convection, evapBulk, and burnFuel handle iturb=0/1 without reading a missing kb field. Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). The unsupported iturb=1 path was blocked for coupled fire physics and later turbulence code was cleaned up so kernels use their explicit arguments. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/input.F90 index 172cf03..0e6c441 100644 283 +++ b/CODE-dev/input.F90 @@ -3,7 +3,7 @@ !---------------------------------------------------------------- - use vegetation_gridlist_variables, only : ifire + use vegetation_gridlist_variables, only : ifire,imoist use QueryGridlist_mod, only: QueryGridlist_variable @@ -119,6 +119,10 @@ subroutine input ! Subgrid Turbulence call QueryGridlist_variable(’iturb’,iturb,48) + if(iturb.eq.1)then + print*,’iturb=1, Smagorinski not smagging yet’ + STOP + endif if(iturb.gt.0) call input_subGridTurb(iturb) ! Radiation @@ -154,6 +158,13 @@ subroutine input #ifdef LANL_MOD call input_LANL_MOD() #endif LANL_MOD + + if((ifire.eq.1.or.imoist.eq.1.or.irad.gt.0).and.iturb.lt.2)then + print*,’Ya did wrong!!! ifire/imoist/irad fuel-energy paths & + &require iturb=2 because they use ka and kb’ + STOP + endif + close(48) # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/subGridTurb/force_turb.F90 ,→ CODE-dev/Vegetation/burn_veg.F90 CODE-dev/input.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo index 1ea3acf..ecb8386 100644 +++ b/CODE-dev/input.F90 @@ -126,9 +126,7 @@ subroutine input 284 FIRETEC Bug Resolution Log July 2026 ! Emissions call QueryGridlist_variable(’iemissions’,iemissions,48) - if((ifire.eq.1).and.(iemissions.eq.0)) iemissions=2 call input_emissions(iemissions,ifire) - call QueryGridlist_variable(’relativehumidity’,relativeHumidity,48) #ifdef LANL_MOD call input_LANL_MOD() diff --git a/CODE-dev/subGridTurb/force_turb.F90 b/CODE-dev/subGridTurb/force_turb.F90 index 405c9a8..5398b1a 100644 --- a/CODE-dev/subGridTurb/force_turb.F90 +++ b/CODE-dev/subGridTurb/force_turb.F90 @@ -4,12 +4,10 @@ ! once on the large time step !----------------------------------------------------------------------- subroutine calcForceTurb(xv,force_xv,il,iu,jl,ju,lls,nv) - use gridlist_variables, only : iturb,ih,l,wp + use gridlist_variables, only : iturb,wp use turb_gridlist_variables, only : rturbprandtl ... [diff excerpt truncated; run the command above for the full commit diff] 285 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-018: FORCE-004: Fuel-layer loops can read past the gas-column top Source report: forceF90/FORCE-004.md • force.F90 • Vegetation/drag_veg.F90 • Vegetation/convection_veg.F90 • Vegetation/evaporation_veg.F90 • Vegetation/burn_veg.F90 • Vegetation/rinit_veg.F90 ! force.F90 91 call dragm(forceSE_xv,xv,1-ih,np+ih,1-ih,mp+ih,l,nv) ! force.F90 237 call convection(forceSI_xv(:,:,:,itheta), & 238 forceSI_xvfuel(:,:,:,:,isies),xvrho,xvfueltmp, & 239 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,0,l,lfuel,nv,nvfuel,nfuel) ... 245 call evapBulk(forceSI_xv,forceSI_xvfuel,xvtmp,xvrho,xvfueltmp, & 246 1-ih,np+ih,1-ih,mp+ih,0,l,1,np,1,mp,lfuel,nv,nvfuel,nfuel) ... 251 call burnFuel(forceSI_xv,forceSI_xvfuel,xvtmp,xvfueltmp, & 252 1-ih,np+ih,1-ih,mp+ih,l,1,np,1,mp,lfuel,nv,nvfuel,nfuel) ! Vegetation/rinit_veg.F90 35 lfuel=(fsize-8)/(4*n*m*nfuel) ! Vegetation/drag_veg.F90 30 do k=1,lfuel ... 74 sp=sqrt(xvrho(i,j,k,iuvel)**2.0_wp+xvrho(i,j,k,ivvel)**2.0_wp+ & 75 xvrho(i,j,k,iwvel)**2.0_wp) ! Vegetation/convection_veg.F90 34 do k=1,lfuel ... 37 ucol=xvrho(i,j,k:k+2,iuvel) 38 vcol=xvrho(i,j,k:k+2,ivvel) 39 wcol=xvrho(i,j,k:k+2,iwvel) ! Vegetation/evaporation_veg.F90 121 do k=1,lls 286 ... 127 xvrho(i,j,k:k+2,iuvel),xvrho(i,j,k:k+2,ivvel), & 128 xvrho(i,j,k:k+2,iwvel),u_corr,v_corr,w_corr,k) Problem The atmospheric arrays passed from force.F90 have vertical extent 1:l for xv/force_xv, and 0:l for xvrho. The fuel arrays have extent 1:lfuel, and lfuel is inferred from the vegetation file size. There is no guard that requires lfuel to fit inside the gas column. Several fuel physics routines assume it does: • dragm loops k=1:lfuel and reads/writes gas fields at gas level k, so it needs lfuel <= l. • convection and evapBulk read xvrho(i,j,k:k+2,...), so they need lfuel <= l-2. • burnFuel, evapPDF, and ZBEST also write gas forcing at fuel index k, so they need at least lfuel <= l. The shipped sample cases use l=20 and usually lfuel=1, so the bug stays hidden. A deeper vegetation file or a shallower gas grid can turn this into an out-of-bounds read/write. Validate the fuel/gas vertical compatibility before entering these force paths. Failing fast is safer than silently clamping lfuel, because skipping upper fuel layers would change physics without telling the user. +++ b/CODE-dev/force.F90 @@ ! Executable Code !!!!! Transported Forcings !!!!!! + if(lfuel.gt.l) then + print*,’ERROR: lfuel must be <= l for dragm gas-column coupling’ + STOP + endif ! compute macro drag contribution call dragm(forceSE_xv,xv,1-ih,np+ih,1-ih,mp+ih,l,nv) @@ ! Executable Code @@ !!!!! Vegetation Forcings !!!!!! + if(lfuel+2.gt.l) then + print*,’ERROR: lfuel must be <= l-2 for convection/evapBulk xvrho stencils’ + STOP + endif call convection(forceSI_xv(:,:,:,itheta), & forceSI_xvfuel(:,:,:,:,isies),xvrho,xvfueltmp, & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,0,l,lfuel,nv,nvfuel,nfuel) A more polished version should validate this once after rinitVeg determines lfuel, and should include mpi_rank/mpi_finalize to match the codebase’s MPI error handling style. 287 Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). Fuel-depth loops in coupled forcing paths were tightened during the July cleanup and subsequent subgrid/thermodynamics pass so fuel-depth arrays are not treated as full-atmosphere fields. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/Vegetation/input_veg.F90 CODE- ,→ dev/rinit.F90 CODE-dev/largeScalePGF.F90 index ce90d8b..7c0602c 100644 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -21,6 +21,11 @@ subroutine input_vegetation() call QueryGridlist_variable(’imoist’,imoist,48) call QueryGridlist_variable(’inonlocal’,inonlocal,48) call QueryGridlist_variable(’idiffsies’,idiffsies,48) + if((idiffsies.eq.1).and.ifire.lt.0)then + print*,"You’re an idiot!!! idiffsies.eq.1 but ifire.eq.0, you& + & can’t have creeping fire without fire." + STOP + endif call QueryGridlist_variable(’ifuel’,ifuel,48) call QueryGridlist_variable(’ignfile’,ignfile,48) +++ b/CODE-dev/largeScalePGF.F90 @@ -9,13 +9,13 @@ subroutine rinitLargeScalePGF use lspgf_variables, only : iwindx,nMassFlux,massFluxTemp, & massFlux,targMassFlux,sintheta,sinthetaf,flspgf,cosg,sing, & + use msga_variables, only : mpi_wp,ierror,mpi_rank + use mpi ! Local Variables @@ -47,7 +47,7 @@ subroutine rinitLargeScalePGF allocate(massFluxTemp(nMassFlux)); massFluxTemp=0.0_wp allocate(massFlux(nMassFlux)); massFlux=0.0_wp - intsinthetal = 0.0_wp ! integrated value of sintheta over the vertical + intsinthetal = 0._wp ! integrated value of sintheta over the vertical ... [diff excerpt truncated; run the command above for the full commit diff] # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 288 FIRETEC Bug Resolution Log July 2026 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo 289 BUG-2026-07-019: FORCE-005: icorio > 2 can index outside the vertical column Source report: forceF90/FORCE-005.md • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/force.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/input.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/variables. ,→ F90 In force.F90, the Coriolis branch accepts any positive icorio: !Coriolis Forces if(icorio.ge.1)then do k=1,l do j=1,mp do i=1,np kref = k+(l-k)*(icorio-1) ! k or l depending icorio=1 or 2 uc=xe(i,j,kref,1) vc=xe(i,j,kref,2) forceSI_xv(i,j,k,iuvel)=forceSI_xv(i,j,k,iuvel)+xv(i,j,k,irho)*fcorio*vc forceSI_xv(i,j,k,ivvel)=forceSI_xv(i,j,k,ivvel)-xv(i,j,k,irho)*fcorio*uc enddo enddo enddo endif !icorio.ge.1 input.F90 reads icorio directly: call QueryGridlist_integer(’icorio’,icorio,1) variables.F90 documents it only as a generic option: integer :: icorio = 0 ! Option fors coriolis effect Problem The inline comment says the expression is only intended for icorio=1 or icorio=2. However, the guard is icorio.ge.1, and there does not appear to be validation that rejects larger values. For icorio=3, the computed index is: kref = k + (l-k)*2 = 2*l - k That exceeds the valid 1:l range for most vertical levels. Larger icorio values move even farther outside the column. This can read invalid memory from xe(i,j,kref,...), producing crashes or silently corrupt Coriolis forcing. 290 Make the accepted modes explicit in force.F90, keep the mode branch outside the inner loops, and fail fast for unsupported positive values. +++ b/CODE-dev/force.F90 @@ - if(icorio.ge.1)then + if(icorio.eq.1)then do k=1,l do j=1,mp do i=1,np - kref = k+(l-k)*(icorio-1) ! k or l depending icorio=1 or 2 - uc=xe(i,j,kref,1) - vc=xe(i,j,kref,2) + uc=xe(i,j,k,1) + vc=xe(i,j,k,2) forceSI_xv(i,j,k,iuvel)=forceSI_xv(i,j,k,iuvel)+xv(i,j,k,irho)*fcorio*vc forceSI_xv(i,j,k,ivvel)=forceSI_xv(i,j,k,ivvel)-xv(i,j,k,irho)*fcorio*uc enddo enddo enddo + elseif(icorio.eq.2)then + do k=1,l + do j=1,mp + do i=1,np + uc=xe(i,j,l,1) + vc=xe(i,j,l,2) + forceSI_xv(i,j,k,iuvel)=forceSI_xv(i,j,k,iuvel)+xv(i,j,k,irho)*fcorio*vc + forceSI_xv(i,j,k,ivvel)=forceSI_xv(i,j,k,ivvel)-xv(i,j,k,irho)*fcorio*uc + enddo + enddo + enddo - endif !icorio.ge.1 + elseif(icorio.ne.0)then + print*,’ERROR: icorio must be 0, 1, or 2’ + STOP + endif !icorio A broader cleanup would also validate icorio immediately after it is read in input.F90, so the run fails during configuration parsing instead of inside the forcing step. Git evidence: 38a57e9 (2026-08-14, readgridlist, rmaxmin, and wind initialization fixes). The wind-initialization pass reworked the affected coriolis/wind-profile branches and corrected out-of- range vertical indexing behavior in the initialized profiles. # 38a57e9 readgridlist and rmaxmin small reworks. Also rinit if uswitch/vswitch= 0 or 1 working ,→ correctly again. # Full command: git show --find-renames --unified=3 38a57e9 -- CODE-dev/compress.F90 CODE-dev/ ,→ readgridlist.F90 CODE-dev/rmaxmin.F90 index cc4b9eb..6fe11bc 100644 291 +++ b/CODE-dev/compress.F90 @@ -14,7 +14,7 @@ program compress use xvall, only : xv,xvrho,nv,xv_list,xvfuel,xvfuel_list,nvfuel, & isies use sensor_gridlist_variables, only : se_frq_write + use rmaxmin_mod, only : rmaxmin ! Local variables @@ -42,18 +42,18 @@ program compress ! Write to the standard out state variables do kv=1,nv-1 - call rmaxmin_3D(xvrho(:,:,1:l,kv),xv_list(kv)) + call rmaxmin(xvrho(:,:,1:l,kv),xv_list(kv)) enddo - call rmaxmin_3D(xv(:,:,1:l,nv),xv_list(nv)) - call rmaxmin_3D(tempg,’Tempg’) - call rmaxmin_3D(pr,’pr’) + call rmaxmin(xv(:,:,1:l,nv),xv_list(nv)) + call rmaxmin(tempg,’Tempg’) + call rmaxmin(pr,’pr’) do ift=1,nfuel if(mpi_rank.eq.0) print*,’Fuel Type’,ift do kv=1,nvfuel - call rmaxmin_3D(xvfuel(ift,:,:,:,kv),xvfuel_list(kv)) + call rmaxmin(xvfuel(ift,:,:,:,kv),xvfuel_list(kv)) enddo if(isies.ne.1) then - call rmaxmin_3D(temps(ift,:,:,:),’Temps’) + call rmaxmin(temps(ift,:,:,:),’Temps’) endif enddo index 185c275..9dc112e 100644 +++ b/CODE-dev/readgridlist.F90 ... [diff excerpt truncated; run the command above for the full commit diff] 292 BUG-2026-07-020: FORCE-006: Emission-factor aerosol sources are read but not applied Source report: forceF90/FORCE-006 (decided no).md • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/force.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/Emissions/ ,→ input_ems.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/Emissions/ ,→ efSource_ems.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/definearray. ,→ F90 force.F90 applies emission-factor forcing only over the gas emission slice: case (2) call efSource(forceSI_xv(:,:,:,iEmitStart:iEmitStop), & -forceSI_xvfuel(:,:,:,:,irhof),1-ih,np+ih,1-ih,mp+ih,l, & 1,np,1,mp,lfuel,nfuel,nEmit) efSource_ems.F90 only has a gas-species forcing argument of length nEmit: subroutine efSource(forcing,fuelConsumed,ilh,iuh,jlh,juh,ku, & il1,iu1,jl1,ju1,kl1,nfuel,nEmit) use emission_factor_variables, only : efEmit implicit none integer,intent(in) :: ilh,iuh,jlh,juh,ku,il1,iu1,jl1,ju1,kl1,nfuel,nEmit real(wp),intent(inout) :: forcing(ilh:iuh,jlh:juh,ku,nEmit) real(wp),intent(in) :: fuelConsumed(nfuel,ilh:iuh,jlh:juh,kl1) ... do isp=1,nEmit forcing(i,j,k,isp)=forcing(i,j,k,isp)+fuelConsumed(ift,i,j,k)*efEmit(isp) enddo But input_ems.F90 reads aerosol emission factors for iemissions=2: allocate(efAero(nAero)); efAero(:)=1.e-2_wp call QueryGridlist_real_array(’efAero’,efAero,nAero,48) endif And definearray.F90 appends aerosol moment variables after the gas emission variables: do ii=1,nAero*nMAero nm1 = addScalar(nm1,spAero((ii-1)/nMAero+1)//’_’//cMAero(mod(ii-1,nMAero)+1),[...]) 293 enddo Problem When iemissions=2, the model reads efAero, but the force path never applies it. The only call is to efSource, which loops over nEmit gas species. Aerosol moment fields in iEmitStart+nEmit:iEmitStop receive no emission-factor source. That makes aerosol emission-factor inputs silently ineffective: users can configure aerosol factors and get no particulate forcing from this path. Because the gas species are still emitted, the run can look superficially successful while aerosol outputs are biased low or identically missing. The best fix is to add an aerosol-aware emission-factor routine and call it after the gas source. The exact mapping from efAero into aerosol moments is a model decision, so the placeholder below shows the force-side wiring and makes that decision explicit. +++ b/CODE-dev/force.F90 @@ case (2) call efSource(forceSI_xv(:,:,:,iEmitStart:iEmitStop), & -forceSI_xvfuel(:,:,:,:,irhof),1-ih,np+ih,1-ih,mp+ih,l, & 1,np,1,mp,lfuel,nfuel,nEmit) + if(nAero.gt.0)then + call efAeroSource(forceSI_xv(:,:,:,iEmitStart+nEmit:iEmitStop), & + -forceSI_xvfuel(:,:,:,:,irhof),1-ih,np+ih,1-ih,mp+ih,l, & + 1,np,1,mp,lfuel,nfuel,nAero,nMAero) + endif diff --git a/CODE-dev/Emissions/efSource_ems.F90 b/CODE-dev/Emissions/efSource_ems.F90 --- a/CODE-dev/Emissions/efSource_ems.F90 +++ b/CODE-dev/Emissions/efSource_ems.F90 @@ end subroutine efSource + +subroutine efAeroSource(forcing,fuelConsumed,ilh,iuh,jlh,juh,ku, & + il1,iu1,jl1,ju1,kl1,nfuel,nAero,nMAero) + use kinds + use emission_factor_variables, only : efAero + implicit none + + integer,intent(in) :: ilh,iuh,jlh,juh,ku,il1,iu1,jl1,ju1,kl1,nfuel,nAero,nMAero + real(wp),intent(inout) :: forcing(ilh:iuh,jlh:juh,ku,nAero*nMAero) + real(wp),intent(in) :: fuelConsumed(nfuel,ilh:iuh,jlh:juh,kl1) + integer :: i,j,k,ia,ift + + ! TODO: confirm which aerosol moment(s) should receive efAero mass. + do ift=1,nfuel + do k=1,kl1 + do j=jl1,ju1 + do i=il1,iu1 + do ia=1,nAero 294 + forcing(i,j,k,(ia-1)*nMAero+1)=forcing(i,j,k,(ia-1)*nMAero+1) & + +fuelConsumed(ift,i,j,k)*efAero(ia) + enddo + enddo + enddo + enddo + enddo +end subroutine efAeroSource If the aerosol moment mapping is not ready to implement, a safer interim fix is to stop when iemissions=2 and nAero>0 instead of silently ignoring efAero. Git evidence: 91c2a57 (2026-07-22, aerosol merge fixes). The aerosol merge wired emission-factor sources into CODE-dev/force.F90; the forcing routine now actually calls the aerosol settling/deposition/source routines. # 91c2a57 Aerosols Merge # Full command: git show --find-renames --unified=3 91c2a57 -- CODE-dev/force.F90 CODE-dev/Emissions/ ,→ input_ems.F90 CODE-dev/definearray.F90 +++ b/CODE-dev/Emissions/input_ems.F90 @@ -13,6 +13,7 @@ subroutine input_emissions(iemissions,ifire) ! Local Variables + integer :: isp character(len=6),allocatable :: spEmit_tmp(:) @@ -31,6 +32,9 @@ subroutine input_emissions(iemissions,ifire) ! Fixed Emissions Source Factor allocate(efEmit(nEmit)); efEmit(:)=1.6_wp ! kg/kg (Initializing all values as CO2) + do isp=1,nEmit + if(spEmit(isp).eq."O2") efEmit(isp)=0.0_wp + enddo call QueryGridlist_array(’efEmit’,efEmit,nEmit,48) endif @@ -53,7 +57,9 @@ subroutine input_emissions(iemissions,ifire) efEmit_tmp=efEmit deallocate(efEmit); allocate(efEmit(nEmit)) - efEmit(1)=0.0_wp + efEmit(1)=0._wp + efEmit(2:nEmit)=efEmit_tmp(:) + deallocate(efEmit_tmp) endif endif index 197601e..816c91d 100644 295 +++ b/CODE-dev/definearray.F90 @@ -2,8 +2,7 @@ ! Allocate global arrays !----------------------------------------------------------------------- - use gridlist_variables, only : nts,ih,iturb,ilspgf,l,n,m,wp, & ... [diff excerpt truncated; run the command above for the full commit diff] 296 BUG-2026-07-021: FORCE-007: idiffsies=1 can call diffusesies without a solid-energy field Source report: forceF90/FORCE-007 (changed).md • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/force.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/definearray. ,→ F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/Vegetation/ ,→ definearray_veg.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/Vegetation/ ,→ diffusesies_veg.F90 force.F90 calls diffusesies whenever idiffsies=1: if(idiffsies.eq.1) call diffusesies(xvfuel(:,:,:,:,irhof),xvfuel(:,:,:,:,irhow), & forceSE_xvfuel(:,:,:,:,irhof),forceSE_xvfuel(:,:,:,:,isies), & 1,np,1,mp,lfuel,nfuel,ih) definearray.F90 only creates the solid internal energy scalar when moisture, fire, or radiation is enabled: if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then isies = nvfuel+1 nvfuel = nvfuel+1 endif definearray_veg.F90 allocates temps using the same isies signal: allocate(temps(nfuel,1-ih:np+ih,1-ih:mp+ih,lfuel)) temps=tmpfuel endif diffusesies_veg.F90 then unconditionally uses temps: call update(temps(ift,:,:,:),1,nxp,1,nyp,nzp,ih) ... frhof(ift,i,j,k) = frhof(ift,i,j,k) - (fkpp*...)*dtinvinv fsies(ift,i,j,k) = fsies(ift,i,j,k) + fkpp*...*dtinvinv Problem idiffsies is not guarded by the conditions that actually create the solid internal energy field. If a configuration sets idiffsies=1 while ifire=0, imoist=0, and irad=0, then: 297 • isies remains at its default value, which aliases the first fuel variable. • temps is not allocated. • force.F90 passes forceSE_xvfuel(:,:,:,:,isies) anyway. • diffusesies reads temps and writes the aliased forcing array. This can crash on an unallocated array reference. Worse, if bounds/runtime checks are not catching it, isies=1 makes the density forcing and solid-energy forcing actual arguments refer to the same memory, so the routine mixes density and energy tendencies through overlapping dummy arguments. Fail fast before calling diffusesies unless the solid internal energy field exists. +++ b/CODE-dev/force.F90 @@ - if(idiffsies.eq.1) call diffusesies(xvfuel(:,:,:,:,irhof),xvfuel(:,:,:,:,irhow), & - forceSE_xvfuel(:,:,:,:,irhof),forceSE_xvfuel(:,:,:,:,isies), & - 1,np,1,mp,lfuel,nfuel,ih) + if(idiffsies.eq.1)then + if(isies.eq.1)then + if(mpi_rank.eq.0) print*,’ERROR: idiffsies requires solid internal energy; enable fire, ,→ moisture, or radiation’ + call mpi_finalize(ierror) + STOP + endif + call diffusesies(xvfuel(:,:,:,:,irhof),xvfuel(:,:,:,:,irhow), & + forceSE_xvfuel(:,:,:,:,irhof),forceSE_xvfuel(:,:,:,:,isies), & + 1,np,1,mp,lfuel,nfuel,ih) + endif A cleaner long-term fix is to validate this configuration at input time, next to the vegetation options, so invalid combinations are rejected before arrays are allocated. Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). Input validation and later subgrid cleanup prevent solid-energy diffusion from running without the required solid-energy state. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/Vegetation/input_veg.F90 CODE- ,→ dev/largeScalePGF.F90 index ce90d8b..7c0602c 100644 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -21,6 +21,11 @@ subroutine input_vegetation() call QueryGridlist_variable(’imoist’,imoist,48) call QueryGridlist_variable(’inonlocal’,inonlocal,48) call QueryGridlist_variable(’idiffsies’,idiffsies,48) 298 + if((idiffsies.eq.1).and.ifire.lt.0)then + print*,"You’re an idiot!!! idiffsies.eq.1 but ifire.eq.0, you& + & can’t have creeping fire without fire." + STOP + endif call QueryGridlist_variable(’ifuel’,ifuel,48) call QueryGridlist_variable(’ignfile’,ignfile,48) +++ b/CODE-dev/largeScalePGF.F90 @@ -9,13 +9,13 @@ subroutine rinitLargeScalePGF use lspgf_variables, only : iwindx,nMassFlux,massFluxTemp, & massFlux,targMassFlux,sintheta,sinthetaf,flspgf,cosg,sing, & + use msga_variables, only : mpi_wp,ierror,mpi_rank + use mpi ! Local Variables @@ -47,7 +47,7 @@ subroutine rinitLargeScalePGF allocate(massFluxTemp(nMassFlux)); massFluxTemp=0.0_wp allocate(massFlux(nMassFlux)); massFlux=0.0_wp - intsinthetal = 0.0_wp ! integrated value of sintheta over the vertical + intsinthetal = 0._wp ! integrated value of sintheta over the vertical ... [diff excerpt truncated; run the command above for the full commit diff] # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/subGridTurb/diffuse_turb.F90 CODE-dev/subGridTurb/force_turb.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -43,7 +43,7 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) 299 hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 + integer :: i,j,k,kp1 real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a,sqrtG_KG31a & ,sqrtG_KG32a,sqrtG_KG33a ! edge values of sqrtG_KGij @@ -104,31 +104,25 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) enddo enddo - ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (kk=l when k=l+1) - do k=1,lls+1 - km1=max(1,k-1) - kk=min(k,lls) + ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (k=l when k=l+1) + do k=1,lls do j=1,mp do i=1,np !at k-1/2 ... [diff excerpt truncated; run the command above for the full commit diff] 300 BUG-2026-07-022: FORCE-008: Point-source emissions can write outside the forcing array for invalid height or species Source report: forceF90/FORCE-008 (decided no).md • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/force.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/Emissions/ ,→ pointSource_ems.F90 • /Users/colbyfronk/Downloads/FIRETEC_versions/version_151_June26/higrad-firetec/CODE-dev/Emissions/ ,→ rinit_ems.F90 force.F90 calls pointSource for iemissions=1: case (1) call pointSource(forceSI_xv(:,:,:,iEmitStart:iEmitStop),1-ih,np+ih,1-ih,mp+ih,l,nEmit,nAero, ,→ nMAero) In pointSource_ems.F90, the gas source path searches for a grid cell and a species, then immediately uses the loop indices: do k=1,lls if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) exit enddo do isp=1,nEmit enddo emitForcing(i,j,k,isp) = emitForcing(i,j,k,isp) + & emitPointSource(iemit)/(dx*dy*(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j))) The aerosol source path repeats the same pattern: do k=1,lls if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) exit enddo do ia=1,nAero if(emitPointSpecies(iemit).eq.spAero(ia)) exit enddo emitForcing(i,j,k,nEmit+(ia-1)*nMAero+1) = emitForcing(i,j,k,nEmit+(ia-1)*nMAero+1) + & emitPointSource(iemit)/(dx*dy*(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j))) rinit_ems.F90 reads these point locations and species names from the emission point file: read(38,*) (emitPointSpecies(iemit),ii=1,3),emitPointSource(iemit) read(38,*) (emitPointLocation(iemit,ii),ii=1,3) 301 Problem The point-source routine assumes both searches always succeed, but neither result is checked. If an emission point height is above the local model top, the do k=1,lls loop finishes without hitting exit. Fortran leaves k as lls+1, so the following update writes emitForcing(...,k,...) out of bounds and evaluates zedge(k+1). If the configured species name does not match any gas species, isp becomes nEmit+1. If it does not match any aerosol species, ia becomes nAero+1. Those values are then used as array indices, which can write outside the emission block or deposit the source into the wrong variable. The bad inputs come from a runtime file, so this can be triggered by a typo in the emissions configuration rather than a code change. Add explicit found checks for both the vertical cell lookup and the species lookup before updating emitForcing. +++ b/CODE-dev/Emissions/pointSource_ems.F90 @@ - if(index(emitPointSpecies(iemit),’aero’).eq.0) then + if(index(emitPointSpecies(iemit),’aero’).eq.0) then + foundHeight = .false. do k=1,lls - if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) exit + if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) then + foundHeight = .true. + exit + endif enddo + if(.not.foundHeight)then + print*,’ERROR: emission point is above the model top: ’,emitPointSpecies(iemit) + STOP + endif + foundSpecies = .false. do isp=1,nEmit - if(emitPointSpecies(iemit).eq.spEmit(isp)) exit + if(emitPointSpecies(iemit).eq.spEmit(isp)) then + foundSpecies = .true. + exit + endif enddo + if(.not.foundSpecies)then + print*,’ERROR: unknown gas emission species: ’,emitPointSpecies(iemit) + STOP + endif emitForcing(i,j,k,isp) = emitForcing(i,j,k,isp) + & emitPointSource(iemit)/(dx*dy*(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j))) else + foundHeight = .false. do k=1,lls - if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) exit 302 + if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) then + foundHeight = .true. + exit + endif enddo + if(.not.foundHeight)then + print*,’ERROR: emission point is above the model top: ’,emitPointSpecies(iemit) + STOP + endif + foundSpecies = .false. do ia=1,nAero - if(emitPointSpecies(iemit).eq.spAero(ia)) exit + if(emitPointSpecies(iemit).eq.spAero(ia)) then + foundSpecies = .true. + exit + endif enddo + if(.not.foundSpecies)then + print*,’ERROR: unknown aerosol emission species: ’,emitPointSpecies(iemit) + STOP + endif emitForcing(i,j,k,nEmit+(ia-1)*nMAero+1) = emitForcing(i,j,k,nEmit+(ia-1)*nMAero+1) + & emitPointSource(iemit)/(dx*dy*(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j))) The actual patch also needs declarations near the top of pointSource: logical :: foundHeight, foundSpecies Git evidence: 91c2a57 (2026-07-22, aerosol merge fixes). Point-source emissions were corrected to choose the vertical cell using the upper cell edge and to use the active forcing dimensions rather than writing outside the target emission array. # 91c2a57 Aerosols Merge # Full command: git show --find-renames --unified=3 91c2a57 -- CODE-dev/force.F90 CODE-dev/Emissions/ ,→ pointSource_ems.F90 index 35c3390..024456d 100644 +++ b/CODE-dev/Emissions/pointSource_ems.F90 @@ -11,7 +11,7 @@ subroutine pointSource(emitForcing,il,iu,jl,ju,lls, & emitPointSpecies,aeroPointSpecies use gridlist_variables, only : dx,dy - use msga_variables, only : npos,mpos,mpi_rank + use msga_variables, only : npos,mpos @@ -33,7 +33,7 @@ subroutine pointSource(emitForcing,il,iu,jl,ju,lls, & i=mod(floor(emitPointLocation(iemit,1)/dx),np)+1 j=mod(floor(emitPointLocation(iemit,2)/dy),mp)+1 303 do k=1,lls - if(zcart(zedge(k),i,j).gt.emitPointLocation(iemit,3)) exit + if(zcart(zedge(k+1),i,j).gt.emitPointLocation(iemit,3)) exit enddo do isp=1,nEmit @@ -52,7 +52,7 @@ subroutine pointSource(emitForcing,il,iu,jl,ju,lls, & i=mod(floor(aeroPointLocation(iemit,1)/dx),np)+1 j=mod(floor(aeroPointLocation(iemit,2)/dy),mp)+1 do k=1,lls - if(zcart(zedge(k),i,j).gt.aeroPointLocation(iemit,3)) exit + if(zcart(zedge(k+1),i,j).gt.aeroPointLocation(iemit,3)) exit enddo do isp=1,nAero if(aeroPointSpecies(iemit).eq.spAero(isp)) exit +++ b/CODE-dev/force.F90 @@ -7,7 +7,7 @@ subroutine forcing + use xvall, only : xv,xvrho,nv,xvfuel,nvfuel ... [diff excerpt truncated; run the command above for the full commit diff] 304 BUG-2026-07-023: Large-scale PGF mass-flux reduction uses repeated scalar MPI_Allreduces Source report: MPI_5.md What it does now The large-scale pressure-gradient forcing path computes a local massFluxTemp and then performs one MPI_Allreduce per element: do i=1,nMassFlux call mpi_allreduce(massFluxTemp(i),massFlux(i),1,...) enddo Why this is inefficient This creates nMassFlux separate collective calls, each with its own latency and synchronization cost. When nMassFlux is more than a handful, the collective startup overhead can dominate. A single vector MPI_Allreduce would do the same work with one collective. Code evidence From largeScalePGF.F90: • repeated scalar allreduces: lines 279–288 Priority: Medium Collapse the loop into one vector collective. --- a/higrad-firetec/CODE-dev/largeScalePGF.F90 +++ b/higrad-firetec/CODE-dev/largeScalePGF.F90 @@ - do i=1,nMassFlux -#ifdef DBL_PREC - call mpi_allreduce(massFluxTemp(i),massFlux(i),1, & - mpi_double_precision,mpi_sum,mpi_comm_world,ierror) -#else - call mpi_allreduce(massFluxTemp(i),massFlux(i),1,mpi_real, & - mpi_sum,mpi_comm_world,ierror) -#endif - enddo +#ifdef DBL_PREC + call mpi_allreduce(massFluxTemp,massFlux,nMassFlux, & + mpi_double_precision,mpi_sum,mpi_comm_world,ierror) +#else + call mpi_allreduce(massFluxTemp,massFlux,nMassFlux,mpi_real, & + mpi_sum,mpi_comm_world,ierror) +#endif 305 Expected speedup • Medium • especially helpful when largeScalePGF is called often and nMassFlux is not tiny Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); ae1a78e (2026-08-18, speedups part 2). The LSPGF mass-flux calculation was changed from repeated scalar reductions to array-based collective communication, and the later speedup pass kept that path in the optimized loop order. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/largeScalePGF.F90 +++ b/CODE-dev/largeScalePGF.F90 @@ -9,13 +9,13 @@ subroutine rinitLargeScalePGF use lspgf_variables, only : iwindx,nMassFlux,massFluxTemp, & massFlux,targMassFlux,sintheta,sinthetaf,flspgf,cosg,sing, & + use msga_variables, only : mpi_wp,ierror,mpi_rank + use mpi ! Local Variables @@ -47,7 +47,7 @@ subroutine rinitLargeScalePGF allocate(massFluxTemp(nMassFlux)); massFluxTemp=0.0_wp allocate(massFlux(nMassFlux)); massFlux=0.0_wp - intsinthetal = 0.0_wp ! integrated value of sintheta over the vertical + intsinthetal = 0._wp ! integrated value of sintheta over the vertical ! definition of sintheta (vertical profile of the lspgf extrapolated from ekmann spiral) do k=1,l do j=1,mp @@ -58,10 +58,11 @@ subroutine rinitLargeScalePGF ! when gravity is rotated, zla vary with slopeangle and slope azimuth: gam = pi/zab*zla sintheta(i,j,k)=0.5_wp*exp(-gam)*sin(gam)/ & - sqrt(1.0_wp+exp(-2.0_wp*gam)-2.0_wp*exp(-gam)*cos(gam)) + sqrt(1._wp+exp(-2._wp*gam)-2._wp*exp(-gam)*cos(gam)) dzcell=zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j) - if(izlspgf.eq.0) intsinthetal=intsinthetal+ & - sintheta(i,j,k)*dzcell/(n*m) + + ! Calculated here if izlspgf.eq.0, else overwritten later + intsinthetal=intsinthetal+sintheta(i,j,k)*dzcell/(n*m) enddo ... [diff excerpt truncated; run the command above for the full commit diff] 306 # ae1a78e Speedups Part 2. # Full command: git show --find-renames --unified=3 ae1a78e -- CODE-dev/largeScalePGF.F90 index adb71a2..7a8d4f7 100644 +++ b/CODE-dev/largeScalePGF.F90 @@ -67,8 +67,8 @@ subroutine rinitLargeScalePGF enddo enddo if(izlspgf.eq.0)then ! mean of integral over z of sintheta*dz - call mpi_allreduce(intsinthetal,intsintheta,1,mpi_wp, & - mpi_sum,mpi_comm_world,ierror) + call mpi_allreduce(intsinthetal,intsintheta,1,mpi_wp,mpi_sum, & + mpi_comm_world,ierror) else !izlspgf.eq.1 : intsintheta=sintheta(zu) gam=pi/zab*(zu-zgroundref) intsintheta=0.5_wp*exp(-gam)*sin(gam)/ & 307 BUG-2026-07-024: EMISSIONS-023: ZBEST can be selected without fire-enabled fuel state Source report: aa-Jul8_completed/EMISSIONS-023.md Files • input.F90 • force.F90 • definearray.F90 • Vegetation/definearray_veg.F90 • Emissions/zBEST_ems.F90 The input path accepts any positive iemissions value independently of ifire: call QueryGridlist_integer(’iemissions’,iemissions,48) if(ifire.eq.1.and.iemissions.eq.0) iemissions=2 The solid internal-energy pointer and fuel temperature array are only created when the fuel heat/fire paths are enabled: if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then isies = nvfuel+1 nvfuel = nvfuel+1 endif allocate(temps(nfuel,1-ih:np+ih,1-ih:mp+ih,lfuel)) endif But small_implicit_forcings calls ZBEST for iemissions=3 regardless of ifire or whether temps exists: case (3) call ZBEST(forceSI_xv,xvtmp,-forceSI_xvfuel(:,:,:,:,irhof), & temps(:,1:np,1:mp,:),xvfueltmp(:,:,:,:,irhof), & 1-ih,np+ih,1-ih,mp+ih,l,1,np,1,mp,lfuel,nv,nfuel,dts) Problem A gridlist can set iemissions=3 while ifire=0. In that configuration, the fire burn path is skipped, temps may never be allocated, and forceSI_xvfuel(:,:,:,:,irhof) remains zero because burnFuel is not called. 308 The ZBEST call still passes temps(:,...) and fuel-consumption forcing. Depending on compiler/runtime checks, this can fail immediately on an unallocated array section or silently run a ZBEST mode that has no physical fuel-consumption source. ZBEST is a fire-dependent emissions model; it should be rejected unless the fire/fuel state it needs is enabled. Validate the option combination while reading the gridlist, before array layout and allocation depend on it. +++ b/CODE-dev/input.F90 @@ ! Emissions call QueryGridlist_integer(’iemissions’,iemissions,48) if(ifire.eq.1.and.iemissions.eq.0) iemissions=2 + if(iemissions.eq.3.and.ifire.ne.1)then + print*,’ERROR: iemissions=3 (ZBEST) requires ifire=1’ + stop + endif call QueryGridlist_real(’relativehumidity’,relativeHumidity,48) If ZBEST is later extended to work from an externally supplied burn-rate field, that mode should pass an allocated temperature field and a validated fuel-consumption source explicitly instead of reusing the fire-only arrays. Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 91c2a57 (2026-07-22, aerosol merge fixes). ZBEST/emissions activation was tied to the fire-enabled fuel state through the July validation work and the aerosol merge, so the mode no longer relies on absent fire arrays. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/input.F90 index 172cf03..0e6c441 100644 +++ b/CODE-dev/input.F90 @@ -3,7 +3,7 @@ !---------------------------------------------------------------- - use vegetation_gridlist_variables, only : ifire + use vegetation_gridlist_variables, only : ifire,imoist use QueryGridlist_mod, only: QueryGridlist_variable @@ -119,6 +119,10 @@ subroutine input 309 ! Subgrid Turbulence call QueryGridlist_variable(’iturb’,iturb,48) + if(iturb.eq.1)then + print*,’iturb=1, Smagorinski not smagging yet’ + STOP + endif if(iturb.gt.0) call input_subGridTurb(iturb) ! Radiation @@ -154,6 +158,13 @@ subroutine input #ifdef LANL_MOD call input_LANL_MOD() #endif LANL_MOD + + if((ifire.eq.1.or.imoist.eq.1.or.irad.gt.0).and.iturb.lt.2)then + print*,’Ya did wrong!!! ifire/imoist/irad fuel-energy paths & + &require iturb=2 because they use ka and kb’ + STOP + endif + close(48) # 91c2a57 Aerosols Merge # Full command: git show --find-renames --unified=3 91c2a57 -- CODE-dev/force.F90 CODE-dev/definearray ,→ .F90 index 197601e..816c91d 100644 +++ b/CODE-dev/definearray.F90 @@ -2,8 +2,7 @@ ! Allocate global arrays !----------------------------------------------------------------------- - use gridlist_variables, only : nts,ih,iturb,ilspgf,l,n,m,wp, & - uswitch,vswitch + use gridlist_variables, only : nts,ih,iturb,ilspgf,l,n,m,wp use forcings, only : force,forceSE_xv,forceSI_xv,forceLE_xv,xvLim, & use xvall, only : xv,xe,xvtmp,relaxxv,nv,xvrho,xvrhotmp @@ -16,7 +15,7 @@ subroutine definearray ! Executable Code - allocate(xe(np,mp,l,nv)) + allocate(xe(np,mp,l,nv)); xe=0._wp allocate(xv(1-ih:np+ih,1-ih:mp+ih,l,nv)) allocate(xvLim(2,nv)); xvLim(1,:)=-1.e20_wp; xvLim(2,:)=1.e20_wp allocate(xvrho(1-ih:np+ih,1-ih:mp+ih,0:l,nv-1)) +++ b/CODE-dev/force.F90 @@ -7,7 +7,7 @@ subroutine forcing + use xvall, only : xv,xvrho,nv,xvfuel,nvfuel 310 use metric_variables, only : h @@ -133,7 +133,7 @@ subroutine large_explicit_forcings use xvall, only : xv,xvrho,xvfuel,nv,iuvel,ivvel,iwvel,irho, & - nvfuel,irhof,isies,iH2O,irhow,irhof,xv_list + nvfuel,irhof,isies,iH2O,irhow,irhof ... [diff excerpt truncated; run the command above for the full commit diff] 311 BUG-2026-07-025: EMISSIONS-026: Unsupported iemissions values silently skip all emission forcing Source report: aa-Jul8_completed/EMISSIONS-026.md Files • input.F90 • force.F90 • Emissions/input_ems.F90 The input path accepts any positive iemissions value and initializes the emissions module: call QueryGridlist_integer(’iemissions’,iemissions,48) if(ifire.eq.1.and.iemissions.eq.0) iemissions=2 The force path implements only modes 1, 2, and 3: select case (iemissions) case (1) call pointSource(forceSI_xv(:,:,:,iEmitStart:iEmitStop), & 1-ih,np+ih,1-ih,mp+ih,l,nEmit,nAero,nMAero) case (2) call efSource(forceSI_xv(:,:,:,iEmitStart:iEmitStop), & -forceSI_xvfuel(:,:,:,:,irhof),1-ih,np+ih,1-ih,mp+ih,l, & 1,np,1,mp,lfuel,nfuel,nEmit) case (3) call ZBEST(forceSI_xv,xvtmp,-forceSI_xvfuel(:,:,:,:,irhof), & temps(:,1:np,1:mp,:),xvfueltmp(:,:,:,:,irhof), & 1-ih,np+ih,1-ih,mp+ih,l,1,np,1,mp,lfuel,nv,nfuel,dts) Problem Values such as iemissions = 4 are treated as active emissions during input and array definition, because they are positive. input_emissions can read species and aerosol configuration, xvpointers can add emission variables to xv, and rinitEmission can apply emission limits. During time stepping, however, small_implicit_forcings has no matching case, so no emission source routine runs. The model can therefore carry apparently configured emission fields that never receive a source term. Negative unsupported values have the opposite silent failure: they skip initialization and forcing without any diagnostic. This is especially easy to miss because the valid modes are encoded only by convention in separate files. A typo in the gridlist changes the transported variable layout or disables emissions instead of stopping with a clear error. 312 Validate the mode immediately after reading it, and add a defensive case default in the force path so unsupported modes cannot silently pass through if the value is changed later. +++ b/CODE-dev/input.F90 @@ ! Emissions call QueryGridlist_integer(’iemissions’,iemissions,48) + if(iemissions.lt.0.or.iemissions.gt.3)then + print*,’ERROR: invalid iemissions value ’,iemissions, & + ’. Valid values are 0, 1, 2, or 3.’ + stop + endif if(ifire.eq.1.and.iemissions.eq.0) iemissions=2 +++ b/CODE-dev/force.F90 @@ case (3) call ZBEST(forceSI_xv,xvtmp,-forceSI_xvfuel(:,:,:,:,irhof), & temps(:,1:np,1:mp,:),xvfueltmp(:,:,:,:,irhof), & 1-ih,np+ih,1-ih,mp+ih,l,1,np,1,mp,lfuel,nv,nfuel,dts) + case default + if(iemissions.ne.0)then + print*,’ERROR: unsupported iemissions value in forcing ’,iemissions + stop + endif Combine this with the iemissions=3/ifire compatibility check so every implemented mode also has the state it requires. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 91c2a57 (2026-07-22, aerosol merge fixes). The input-validation crutch pass added stops/warnings for unsupported mode values, and the aerosol merge made the supported emission modes explicit in the forcing path. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/input.F90 +++ b/CODE-dev/input.F90 @@ -9,6 +9,7 @@ subroutine input 313 ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input ! General I/O call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP + endif call QueryGridlist_variable(’ihdf’,ihdf,48) ! Relaxation @@ -52,6 +61,44 @@ subroutine input if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + call validate_lateral_ibc(’ibc_top’,ibc_top) + call validate_lateral_ibc(’ibc_bot’,ibc_bot) + call validate_lateral_ibc(’ibc_left’,ibc_left) + call validate_lateral_ibc(’ibc_right’,ibc_right) + ... [diff excerpt truncated; run the command above for the full commit diff] # 91c2a57 Aerosols Merge # Full command: git show --find-renames --unified=3 91c2a57 -- CODE-dev/force.F90 CODE-dev/Emissions/ ,→ input_ems.F90 +++ b/CODE-dev/Emissions/input_ems.F90 @@ -13,6 +13,7 @@ subroutine input_emissions(iemissions,ifire) ! Local Variables + integer :: isp character(len=6),allocatable :: spEmit_tmp(:) @@ -31,6 +32,9 @@ subroutine input_emissions(iemissions,ifire) ! Fixed Emissions Source Factor allocate(efEmit(nEmit)); efEmit(:)=1.6_wp ! kg/kg (Initializing all values as CO2) + do isp=1,nEmit + if(spEmit(isp).eq."O2") efEmit(isp)=0.0_wp + enddo 314 call QueryGridlist_array(’efEmit’,efEmit,nEmit,48) endif @@ -53,7 +57,9 @@ subroutine input_emissions(iemissions,ifire) efEmit_tmp=efEmit deallocate(efEmit); allocate(efEmit(nEmit)) - efEmit(1)=0.0_wp + efEmit(1)=0._wp + efEmit(2:nEmit)=efEmit_tmp(:) + deallocate(efEmit_tmp) endif endif +++ b/CODE-dev/force.F90 @@ -7,7 +7,7 @@ subroutine forcing ... [diff excerpt truncated; run the command above for the full commit diff] 315 BUG-2026-07-026: FIREBRANDS-009: Default firebrand restart file points at an incompatible main-output file Source report: aa-Jul8_completed/FIREBRANDS-009.md Files • Firebrands/variables_fb.F90 • Firebrands/io_fb.F90 The default firebrand restart path is the main model output name: character(len=257) :: restartfile_fb = ’comp.out.h5’ ! Name of restart file The firebrand restart reader opens that file as a Fortran unformatted firebrand file: open(48,file=restartfile_fb,form=’unformatted’,status=’old’) Firebrand output is written in a different custom binary stream: call namefile(ittot,outname_fb,fname) open(48,file=fname,form=’unformatted’,status=’unknown’) write(48) sum(totNumBrands) write(48) xvtotBrands Problem If irst=1 and the user does not override restartfile_fb, the firebrand restart routine tries to parse comp.out.h5 as the two-record firebrand binary format. That can fail immediately, read garbage into numBrands, or attempt an enormous allocation. The default should not point at an incompatible file type. It should either be blank and explicitly required for firebrand restart, or point to a firebrand output file generated by writeio_fb. Make the default empty and stop with a clear error when a firebrand restart is requested without a firebrand restart file. diff --git a/CODE-dev/Firebrands/variables_fb.F90 b/CODE-dev/Firebrands/variables_fb.F90 --- a/CODE-dev/Firebrands/variables_fb.F90 +++ b/CODE-dev/Firebrands/variables_fb.F90 316 @@ - character(len=257) :: restartfile_fb = ’comp.out.h5’ ! Name of restart file + character(len=257) :: restartfile_fb = ’’ ! Name of firebrand restart file +++ b/CODE-dev/Firebrands/io_fb.F90 @@ ! Executable Code ! Read-in restart file + if(trim(restartfile_fb).eq.’’)then + if(mpi_rank.eq.0) print*,’ERROR: restartfile_fb must name a firebrand output file when restarting ,→ firebrands.’ + STOP + endif open(48,file=restartfile_fb,form=’unformatted’,status=’old’) Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 869ead7 (2026-06-25, boundary-error pass); af8cb71 (2026-07-23, firebrand restart close). Firebrand input and boundary handling received validation and cleanup. The landed code split side checks, adds tolerance for exact edge cases, prevents repeated removal, and closes the restart file after reading. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Firebrands/variables_fb.F90 ,→ CODE-dev/Firebrands/io_fb.F90 index dcb9a66..6b9457f 100644 +++ b/CODE-dev/Firebrands/io_fb.F90 @@ -74,6 +74,10 @@ subroutine irstreadio_fb ! Executable Code ! Read-in restart file + if(trim(restartfile_fb).eq.’’)then + if(mpi_rank.eq.0) print*,’ERROR: restartfile_fb must name a firebrand output file when restarting ,→ firebrands.’ + STOP + endif open(48,file=restartfile_fb,form=’unformatted’,status=’old’) diff --git a/CODE-dev/Firebrands/variables_fb.F90 b/CODE-dev/Firebrands/variables_fb.F90 index b031fcd..8318b1c 100644 --- a/CODE-dev/Firebrands/variables_fb.F90 +++ b/CODE-dev/Firebrands/variables_fb.F90 @@ -13,7 +13,7 @@ module firebrand_gridlist_variables real(wp) :: rhoFB = 100.0_wp ! initial density of firebrands (kg/m3) real(wp) :: TempHot= 500.0_wp ! temperature threshold for launching firebrands (K) character(len=257) :: outname_fb = ’brand.out’ ! Name of firebrand output files - character(len=257) :: restartfile_fb = ’comp.out.h5’ ! Name of restart file 317 + character(len=257) :: restartfile_fb = ’’ ! Name of restart file end module firebrand_gridlist_variables # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/Firebrands/evolve_fb.F90 CODE- ,→ dev/update.F90 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -11,7 +11,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & + use constants, only : pi,g @@ -120,11 +120,11 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then ! Landed on ground or lofted beyond ,→ vertical domain retain(it)=.false. numBrand=numBrand-1 + cycle endif ! Check left and right boundaries - if(xvbrand(it,ix).le.0)then ! Outside x domain on left - if(xvbrand(it,ix).eq.0) xvbrand(it,ix)=xvbrand(it,ix)+tolerance + if(xvbrand(it,ix).lt.0)then ! Outside x domain on left xvbrand(it,ix)=n*dx+xvbrand(it,ix) @@ -133,9 +133,9 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. numBrand=numBrand-1 + cycle endif - else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain on right - if(xvbrand(it,ix).eq.(n*dx)) xvbrand(it,ix)=xvbrand(it,ix)-tolerance + else if(xvbrand(it,ix).gt.(n*dx))then ! Outside x domain on right xvbrand(it,ix)=xvbrand(it,ix)-n*dx @@ -144,12 +144,12 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. ... [diff excerpt truncated; run the command above for the full commit diff] # af8cb71 close file # Full command: git show --find-renames --unified=3 af8cb71 -- CODE-dev/Firebrands/io_fb.F90 index 6b9457f..06d3283 100644 +++ b/CODE-dev/Firebrands/io_fb.F90 @@ -82,6 +82,7 @@ subroutine irstreadio_fb 318 + close(48) ! Identify the brands to be removed from processor allocate(retain(numBrands)); retain = .true. 319 BUG-2026-07-027: FIREBRANDS-012: ifbrand > 1 writes uninitialized firebrand arrays Source report: aa-Jul8_completed/FIREBRANDS-012.md Files • compress.F90 • rinit.F90 • force.F90 • Firebrands/io_fb.F90 Initialization and forcing only run for exactly ifbrand == 1: if(ifbrand.eq.1) call rinitFirebrands(irst) if(ifbrand.eq.1) call firebrand(...) But output runs for any positive value: if(ifbrand.ge.1) call writeio_fb(time) writeio_fb assumes the firebrand array exists: call mpi_gatherv(xvbrand(:,it),numBrands,mpi_wp, & xvtotBrands(:,it),totNumBrands,displs,mpi_wp,0, & Problem If a gridlist sets ifbrand=2 or any other positive unsupported value, Firebrands are never initialized or evolved, but compress still calls writeio_fb. numBrands remains zero, yet xvbrand is unallocated, so taking xvbrand(:,it) is illegal even with a zero MPI send count. This turns an unsupported option value into a crash in the output path. The output condition should match the initialization/forcing condition, and invalid options should be rejected during input. Validate the option when it is read: 320 +++ b/CODE-dev/input.F90 @@ ! Firebrands call QueryGridlist_integer(’ifbrand’,ifbrand,48) + if(ifbrand.lt.0.or.ifbrand.gt.1) & + STOP ’ERROR: ifbrand must be 0 or 1.’ if(ifbrand.eq.1) call input_firebrands The writeio_fb(ittot) part also fixes the real/integer argument mismatch described in FIREBRANDS-006. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 869ead7 (2026-06-25, boundary-error pass); af8cb71 (2026-07-23, firebrand restart close). Firebrand input and boundary handling received validation and cleanup. The landed code split side checks, adds tolerance for exact edge cases, prevents repeated removal, and closes the restart file after reading. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Firebrands/io_fb.F90 CODE-dev/ ,→ input.F90 index dcb9a66..6b9457f 100644 +++ b/CODE-dev/Firebrands/io_fb.F90 @@ -74,6 +74,10 @@ subroutine irstreadio_fb ! Executable Code ! Read-in restart file + if(trim(restartfile_fb).eq.’’)then + if(mpi_rank.eq.0) print*,’ERROR: restartfile_fb must name a firebrand output file when restarting ,→ firebrands.’ + STOP + endif open(48,file=restartfile_fb,form=’unformatted’,status=’old’) +++ b/CODE-dev/input.F90 @@ -9,6 +9,7 @@ subroutine input ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input ! General I/O call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ 321 + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ ... [diff excerpt truncated; run the command above for the full commit diff] # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/rinit.F90 CODE-dev/force.F90 index 6e68d38..e4ae187 100644 +++ b/CODE-dev/force.F90 @@ -106,7 +106,7 @@ subroutine small_explicit_forcings xvfuel(:,:,:,:,irhof)+xvfuel(:,:,:,:,irhow), & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,nfuel) elseif(irad.eq.3)then ! Radiation Sink - call radiationSink(forceSE_xv(:,:,1:lfuel,itheta), & + call radiationSink(forceSE_xv(:,:,:,itheta), & forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & xvfuel(:,:,:,:,irhow),tempg,temps, & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,lfuel,nfuel) index 83f437a..d2cabcc 100644 +++ b/CODE-dev/rinit.F90 @@ -27,15 +27,15 @@ subroutine rinit ! Grid definition dt=dts*real(nts,kind=wp) !dt is the large time step dtp=dt/real(ntp,kind=wp) !dt is the physics time step for FIRETEC - dxi=1.0_wp/dx - dyi=1.0_wp/dy - dzi=1.0_wp/dz - dti=1.0_wp/dt + dxi=1._wp/dx + dyi=1._wp/dy + dzi=1._wp/dz + dti=1._wp/dt do i=1-ih,n+ih - x(i)=(i-1)*dx-((n+1)/2.0_wp-1)*dx + x(i)=(i-1)*dx-((n+1)/2._wp-1)*dx enddo do j=1-ih,m+ih - y(j)=(j-1)*dy-((m+1)/2.0_wp-1)*dy + y(j)=(j-1)*dy-((m+1)/2._wp-1)*dy enddo do k=1,l+1 zedge(k)=(k-1)*dz @@ -86,8 +86,8 @@ subroutine rinit enddo ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 322 BUG-2026-07-028: FIREBRANDS-019: Nonpositive firebrand geometry inputs can produce divide-by-zero and NaNs Source report: aa-Jul8_completed/FIREBRANDS-019.md Files • Firebrands/input_fb.F90 • Firebrands/evolve_fb.F90 • Firebrands/generation_fb.F90 User-provided geometry and density values are read without validation: call QueryGridlist_real(’radiusFB’,radius,48) call QueryGridlist_real(’heightFB’,height,48) call QueryGridlist_real(’rhoFB’,rhoFB,48) The evolution code divides by these dimensions and density: sqrt(w_abs*nu/xvbrand(it,ihght)) rhog(i,j,k)/xvbrand(it,irho)* & sqrt(w_abs*nu/(xvbrand(it,irad)*pi)) The launch code also uses the values in volumes and forces: force_grav=g*rhoFB*(pi*radius**2*height) Problem If radiusFB, heightFB, or rhoFB is zero or negative, Firebrands can divide by zero, take square roots of negative values, assign negative mass/weight, or produce NaNs during the first launch/evolution step. The default values are positive, but a bad gridlist value currently reaches the physics unchecked. Reject nonphysical values immediately after reading the Firebrands gridlist inputs. diff --git a/CODE-dev/Firebrands/input_fb.F90 b/CODE-dev/Firebrands/input_fb.F90 --- a/CODE-dev/Firebrands/input_fb.F90 +++ b/CODE-dev/Firebrands/input_fb.F90 @@ 323 call QueryGridlist_string (’outname_fb’,outname_fb,48) call QueryGridlist_string (’restartfile_fb’,restartfile_fb,48) + + if(radius.le.0.0_wp) STOP ’ERROR: radiusFB must be positive.’ + if(height.le.0.0_wp) STOP ’ERROR: heightFB must be positive.’ + if(rhoFB.le.0.0_wp) STOP ’ERROR: rhoFB must be positive.’ end subroutine input_firebrands Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 869ead7 (2026-06-25, boundary-error pass); af8cb71 (2026-07-23, firebrand restart close). Firebrand input and boundary handling received validation and cleanup. The landed code split side checks, adds tolerance for exact edge cases, prevents repeated removal, and closes the restart file after reading. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Firebrands/input_fb.F90 diff --git a/CODE-dev/Firebrands/input_fb.F90 b/CODE-dev/Firebrands/input_fb.F90 index 8125ba9..4bd729e 100644 --- a/CODE-dev/Firebrands/input_fb.F90 +++ b/CODE-dev/Firebrands/input_fb.F90 @@ -19,4 +19,8 @@ subroutine input_firebrands call ensure_directory_exists(outname_fb) call QueryGridlist_variable (’restartfile_fb’,restartfile_fb,48) + if(radius.le.0.0_wp) STOP ’ERROR: radiusFB must be positive.’ + if(height.le.0.0_wp) STOP ’ERROR: heightFB must be positive.’ + if(rhoFB.le.0.0_wp) STOP ’ERROR: rhoFB must be positive.’ + end subroutine input_firebrands # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/Firebrands/evolve_fb.F90 +++ b/CODE-dev/Firebrands/evolve_fb.F90 @@ -11,7 +11,7 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & + use constants, only : pi,g @@ -120,11 +120,11 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else if(xvbrand(it,iz).le.0.or.xvbrand(it,iz).ge.l*dz)then ! Landed on ground or lofted beyond ,→ vertical domain retain(it)=.false. numBrand=numBrand-1 + cycle endif 324 ! Check left and right boundaries - if(xvbrand(it,ix).le.0)then ! Outside x domain on left - if(xvbrand(it,ix).eq.0) xvbrand(it,ix)=xvbrand(it,ix)+tolerance + if(xvbrand(it,ix).lt.0)then ! Outside x domain on left xvbrand(it,ix)=n*dx+xvbrand(it,ix) @@ -133,9 +133,9 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. numBrand=numBrand-1 + cycle endif - else if(xvbrand(it,ix).ge.(n*dx))then ! Outside x domain on right - if(xvbrand(it,ix).eq.(n*dx)) xvbrand(it,ix)=xvbrand(it,ix)-tolerance + else if(xvbrand(it,ix).gt.(n*dx))then ! Outside x domain on right xvbrand(it,ix)=xvbrand(it,ix)-n*dx @@ -144,12 +144,12 @@ subroutine evolveFB(u,v,w,rhog,tempg,ilh,iuh,jlh,juh,klh, & else retain(it)=.false. ... [diff excerpt truncated; run the command above for the full commit diff] # af8cb71 close file # Full command: git show --find-renames --unified=3 af8cb71 -- CODE-dev/Firebrands/io_fb.F90 index 6b9457f..06d3283 100644 +++ b/CODE-dev/Firebrands/io_fb.F90 @@ -82,6 +82,7 @@ subroutine irstreadio_fb + close(48) ! Identify the brands to be removed from processor allocate(retain(numBrands)); retain = .true. 325 BUG-2026-07-029: FIREBRANDS-021: Firebrands can run without the fuel temperature field they require Source report: aa-Jul8_completed/FIREBRANDS-021.md Files • input.F90 • definearray.F90 • Vegetation/definearray_veg.F90 • force.F90 • Firebrands/generation_fb.F90 input enables Firebrands independently from the main fire model: ! Firebrands call QueryGridlist_integer(’ifbrand’,ifbrand,48) if(ifbrand.eq.1) call input_firebrands(ifbrand) The solid internal-energy/temperature field is created only for moisture, fire, or radiation: if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then isies = nvfuel+1 nvfuel = nvfuel+1 endif allocate(temps(nfuel,1-ih:np+ih,1-ih:mp+ih,lfuel)) endif But Firebrands always passes and uses temps: if(ifbrand.eq.1) call firebrand(xvrho(:,:,:,iuvel), & xvrho(:,:,:,ivvel),xvrho(:,:,:,iwvel),1-ih,np+ih,1-ih,mp+ih,0,l, & xv(:,:,:,irho),tempg(:,:,:),xvfuel(:,:,:,:,irhof), & temps(:,:,:,:),1,np,1,mp,lfuel,nfuel) if(any(temps(:,i,j,k).gt.tempHot) & .and.any(rhof(:,i,j,k).gt.0.00001_wp) & .and.(w(i,j,k).gt.0)) then 326 Problem A gridlist can set ifbrand=1 while leaving ifire=0, imoist=0, and irad=0. In that configuration, isies keeps its default value, temps is not allocated, and large_explicit_forcings still passes temps(:,:,:,:) into the Firebrands driver. That can crash on an unallocated allocatable array reference. If checks do not catch it, launchFB reads undefined fuel temperatures to decide whether to create new firebrands. Firebrand launch currently depends on the fire/fuel temperature machinery, so the input layer should reject unsupported Firebrand-only configurations instead of letting the run fail later. Require active fire physics before accepting ifbrand=1. This diff also uses the no-argument input_firebrands call expected by the Firebrands input routine. +++ b/CODE-dev/input.F90 @@ ! Firebrands call QueryGridlist_integer(’ifbrand’,ifbrand,48) - if(ifbrand.eq.1) call input_firebrands(ifbrand) + if(ifbrand.eq.1)then + if(ifire.ne.1)then + print*,’ERROR: ifbrand=1 requires ifire=1 because Firebrands use fuel temperatures.’ + STOP + endif + call input_firebrands + endif ! Emissions call QueryGridlist_integer(’iemissions’,iemissions,48) If Firebrands should support non-fire external heating in the future, then ifbrand also needs to participate in the isies/temps allocation and temperature-refresh guards. With the current launch model, failing early is the safer minimal fix. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 869ead7 (2026-06-25, boundary-error pass); af8cb71 (2026-07-23, firebrand restart close). Firebrand input and boundary handling received validation and cleanup. The landed code split side checks, adds tolerance for exact edge cases, prevents repeated removal, and closes the restart file after reading. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/input.F90 +++ b/CODE-dev/input.F90 327 @@ -9,6 +9,7 @@ subroutine input ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input ! General I/O call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP + endif call QueryGridlist_variable(’ihdf’,ihdf,48) ! Relaxation @@ -52,6 +61,44 @@ subroutine input if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + call validate_lateral_ibc(’ibc_top’,ibc_top) + call validate_lateral_ibc(’ibc_bot’,ibc_bot) + call validate_lateral_ibc(’ibc_left’,ibc_left) + call validate_lateral_ibc(’ibc_right’,ibc_right) + ... [diff excerpt truncated; run the command above for the full commit diff] # 869ead7 Went through a list of ’boundary errors’. # Full command: git show --find-renames --unified=3 869ead7 -- CODE-dev/force.F90 index 6e68d38..e4ae187 100644 +++ b/CODE-dev/force.F90 @@ -106,7 +106,7 @@ subroutine small_explicit_forcings xvfuel(:,:,:,:,irhof)+xvfuel(:,:,:,:,irhow), & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,nfuel) elseif(irad.eq.3)then ! Radiation Sink - call radiationSink(forceSE_xv(:,:,1:lfuel,itheta), & + call radiationSink(forceSE_xv(:,:,:,itheta), & forceSE_xvfuel(:,:,:,:,isies),xvfuel(:,:,:,:,irhof), & xvfuel(:,:,:,:,irhow),tempg,temps, & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,lfuel,nfuel) # af8cb71 close file # Full command: git show --find-renames --unified=3 af8cb71 -- CODE-dev/Firebrands/io_fb.F90 index 6b9457f..06d3283 100644 328 FIRETEC Bug Resolution Log July 2026 +++ b/CODE-dev/Firebrands/io_fb.F90 @@ -82,6 +82,7 @@ subroutine irstreadio_fb + close(48) ! Identify the brands to be removed from processor allocate(retain(numBrands)); retain = .true. 329 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-030: HEATSOURCE-001: Unsupported per-source option values silently change or disable heat-source forcing Source report: aa-Jul8_completed/HEATSOURCE-001.md Files • HeatSource/input_heat.F90 • HeatSource/heatsource_heat.F90 • HeatSource/rinit_heat.F90 input_heat.F90 reads several option arrays but does not validate their values: call QueryGridlist_real_array(’isource_function_hs’,tmp,nsource_hs,48) isource_function_hs = nint(tmp) ... call QueryGridlist_real_array(’imass_source_hs’,tmp,nsource_hs,48) imass_source_hs = nint(tmp) call QueryGridlist_real_array(’MLRHRRinputs_hs’,tmp,nsource_hs,48) MLRHRRinputs_hs = nint(tmp) The forcing path only implements isource_function_hs cases 0 through 3: source_function=0.0_wp select case(isource_function_hs(itsource)) case(0) source_function=1.0_wp case(1) if(sin(2.0_wp*pi*freq_hs(itsource)*time).ge.0.0_wp)then source_function = 1.0_wp endif case(2) source_function = 0.5_wp* & (1.0_wp+sin(2.0_wp*pi*freq_hs(itsource)*time)) case(3) if((freq_hs(itsource).gt.0.0_wp).and. & (freq_hs(itsource)*time.le.1.0_wp))then source_function = 1.0_wp endif Mass source options other than 1 and 2 fall through with no mass forcing: if(imass_source_hs(itsource).eq.1)then frho=coverfrac*energy/(hf/rnfuel) force(i,j,k,irho)=force(i,j,k,irho)+frho elseif(imass_source_hs(itsource).eq.2)then ... 330 endif !(imass_source_hs option) MLR/HRR files are enabled only when the flag equals exactly 1: if(any(MLRHRRinputs_hs.eq.1)) then ... if(MLRHRRinputs_hs(itsource).ne.1) cycle Problem Invalid per-source options are accepted during input and then interpreted as quiet no-ops or as a different mode: • isource_function_hs = 4 leaves source_function at zero, so the source is active by time window but injects no heat. • imass_source_hs = 3 applies heat but no gas-phase mass source. • MLRHRRinputs_hs = 2 does not read the MLR/HRR file path and falls back to the flux-based heat path instead. These are configuration errors, but the simulation can continue without a diagnostic. Because the arrays are per-source, a single typo can disable only one heat source in a multi-source setup, making the result especially hard to spot. Validate the option arrays immediately after converting them to integers, and add defensive defaults in the runtime select case. +++ b/CODE-dev/HeatSource/input_heat.F90 @@ call QueryGridlist_real_array(’isource_function_hs’,tmp,nsource_hs,48) isource_function_hs = nint(tmp) + if(any(isource_function_hs.lt.0).or.any(isource_function_hs.gt.3))then + print*,’ERROR: isource_function_hs entries must be 0, 1, 2, or 3’ + STOP + endif @@ call QueryGridlist_real_array(’imass_source_hs’,tmp,nsource_hs,48) imass_source_hs = nint(tmp) + if(any(imass_source_hs.lt.0).or.any(imass_source_hs.gt.2))then + print*,’ERROR: imass_source_hs entries must be 0, 1, or 2’ + STOP + endif call QueryGridlist_real_array(’MLRHRRinputs_hs’,tmp,nsource_hs,48) MLRHRRinputs_hs = nint(tmp) + if(any(MLRHRRinputs_hs.lt.0).or.any(MLRHRRinputs_hs.gt.1))then + print*,’ERROR: MLRHRRinputs_hs entries must be 0 or 1’ + STOP + endif 331 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ case(3) if((freq_hs(itsource).gt.0.0_wp).and. & (freq_hs(itsource)*time.le.1.0_wp))then source_function = 1.0_wp endif + case default + print*,’ERROR: unsupported isource_function_hs for heat source ’, & + itsource,isource_function_hs(itsource) + STOP Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 93d691b (2026-08-12, heat-source/windfield warning downgrade); 0774ad4 (2026-08-10, dormant heat-source allocation guard). Heat-source option/timing validation was tightened. Later commits downgrade the windfield- development conflict from a kill to a warning and avoid touching starttime_hs before it is allocated. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/HeatSource/input_heat.F90 CODE ,→ -dev/HeatSource/heatsource_heat.F90 index 120bde8..09c29df 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -162,6 +162,11 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) (freq_hs(itsource)*time.le.1.0_wp))then source_function = 1.0_wp endif + case default + if(mpi_rank.eq.0) print*, & + ’ERROR: unsupported isource_function_hs for heat source ’, & + itsource,isource_function_hs(itsource) + STOP index ea888e7..1b3c50b 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -14,6 +14,10 @@ subroutine input_heatsource(iheatsource) ! Executable Code call QueryGridlist_variable(’nsource_hs’,nsource_hs,48) + if(nsource_hs.le.0)then + print*,’ERROR: nsource_hs must be greater than zero when heat sources are enabled’ + STOP + endif 332 allocate(tmp(nsource_hs)) @@ -29,9 +33,17 @@ subroutine input_heatsource(iheatsource) call QueryGridlist_array(’isource_function_hs’,tmp,nsource_hs,48) isource_function_hs = nint(tmp) + if(any(isource_function_hs.lt.0).or.any(isource_function_hs.gt.3))then + print*,’ERROR: isource_function_hs entries must be 0, 1, 2, or 3’ + STOP + endif call QueryGridlist_array(’starttime_hs’,starttime_hs,nsource_hs,48) call QueryGridlist_array(’endtime_hs’,endtime_hs,nsource_hs,48) ... [diff excerpt truncated; run the command above for the full commit diff] # 93d691b Changed a kill statement to a warning regarding the heat source being turned on while the ,→ windfield is developing. # Full command: git show --find-renames --unified=3 93d691b -- CODE-dev/HeatSource/input_heat.F90 index 3b06cf1..3c2917b 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -144,10 +144,9 @@ subroutine input_heatsource(iheatsource) STOP endif if(any(starttime_hs.le.real(nt,wp)*dt))then - print*,’ERROR: heat source activates during windfield production.’ - print*,’Delay starttime_hs beyond the wind run or set & - &iheatsource=0.’ + print*,’WARNING: heat source activates during windfield production.’ + print*,’This may affect how the windfield develops.’ + endif if(any(endtime_hs.le.starttime_hs))then print*,’ERROR: each endtime_hs must be greater than starttime_hs’ @@ -158,10 +157,7 @@ subroutine input_heatsource(iheatsource) print*,’ERROR: av_hs and flux_hs must be nonnegative’ STOP endif - if(any(av_hs.lt.0._wp).or.any(flux_hs.lt.0._wp))then - print*,’ERROR: av_hs and flux_hs must be nonnegative’ - endif + if(any(depth_hs.le.0._wp))then print*,’ERROR: depth_hs entries must be greater than zero’ STOP # 0774ad4 Split if statement to avoid seg faulting if starttime_hs is not allocated. # Full command: git show --find-renames --unified=3 0774ad4 -- CODE-dev/force.F90 index 87aa64b..e2f469d 100644 +++ b/CODE-dev/force.F90 @@ -151,9 +151,11 @@ subroutine large_explicit_forcings ! Ignite new cells if(ifire.eq.1) call ignite(forceLE_xvfuel(:,:,:,:,isies),xvfuel, & - if(iheatsource.ge.1.and.any(time.ge.starttime_hs))then 333 - call heatSource(iheatsource, & - forceLE_xv,1,np,1,mp,l,nv) + if(iheatsource.ge.1) then + if(any(time.ge.starttime_hs))then + call heatSource(iheatsource, & + forceLE_xv,1,np,1,mp,l,nv) + endif endif !!!!! Firebrand Forcings !!!!! 334 BUG-2026-07-031: HEATSOURCE-009: Heat-source geometry and time inputs are not validated Source report: aa-Jul8_completed/HEATSOURCE-009.md Files • HeatSource/input_heat.F90 • HeatSource/heatsource_heat.F90 input_heat.F90 reads timing, heat, depth, and geometry arrays without sanity checks: call QueryGridlist_real_array(’starttime_hs’,starttime_hs,nsource_hs,48) call QueryGridlist_real_array(’endtime_hs’,endtime_hs,nsource_hs,48) allocate(freq_hs(nsource_hs),av_hs(nsource_hs),flux_hs(nsource_hs), & depth_hs(nsource_hs)) call QueryGridlist_real_array(’av_hs’,av_hs,nsource_hs,48) call QueryGridlist_real_array(’flux_hs’,flux_hs,nsource_hs,48) call QueryGridlist_real_array(’freq_hs’,freq_hs,nsource_hs,48) call QueryGridlist_real_array(’depth_hs’,depth_hs,nsource_hs,48) Circle geometry is read directly: allocate(xcen_hs(nsource_hs),ycen_hs(nsource_hs), & radius_hs(nsource_hs)) call QueryGridlist_real_array(’radius_hs’,radius_hs,nsource_hs,48) call QueryGridlist_real_array(’xcen_hs’,xcen_hs,nsource_hs,48) call QueryGridlist_real_array(’ycen_hs’,ycen_hs,nsource_hs,48) Rectangle geometry is also read directly: allocate(xl_hs(nsource_hs),xu_hs(nsource_hs), & yl_hs(nsource_hs),yu_hs(nsource_hs)) call QueryGridlist_real_array(’xl_hs’,xl_hs,nsource_hs,48) call QueryGridlist_real_array(’xu_hs’,xu_hs,nsource_hs,48) call QueryGridlist_real_array(’yl_hs’,yl_hs,nsource_hs,48) call QueryGridlist_real_array(’yu_hs’,yu_hs,nsource_hs,48) Downstream code quietly treats invalid values as no overlap or no active source. For example, nonpositive circle radius returns zero area: hs_circle_rect_area = 0.0_wp if(r.le.0.0_wp) return Inverted time windows are simply inactive: 335 heatsource_active = time.ge.starttime_hs(itsource) .and. & time.lt.endtime_hs(itsource) Problem Several invalid or physically suspicious heat-source inputs are accepted and then become silent no-ops or unintended sinks: • radius_hs <= 0 makes circular sources produce no area and no heat. • xl_hs >= xu_hs or yl_hs >= yu_hs makes rectangular sources produce no area and no heat. • depth_hs <= 0 makes the heat volume zero. • endtime_hs <= starttime_hs makes the source inactive for the whole run. • negative av_hs or flux_hs turns a heat source into a heat sink. • freq_hs <= 0 is incompatible with the single-pulse source function. These are almost always gridlist mistakes. Continuing without a diagnostic wastes full simulations and makes the output look like the heat source simply failed to ignite. Validate source parameters after the relevant arrays are read. Keep the checks close to input_heat.F90 so bad configurations fail before the run starts. +++ b/CODE-dev/HeatSource/input_heat.F90 @@ call QueryGridlist_real_array(’starttime_hs’,starttime_hs,nsource_hs,48) call QueryGridlist_real_array(’endtime_hs’,endtime_hs,nsource_hs,48) + if(any(endtime_hs.le.starttime_hs))then + print*,’ERROR: each endtime_hs must be greater than starttime_hs’ + STOP + endif @@ call QueryGridlist_real_array(’av_hs’,av_hs,nsource_hs,48) call QueryGridlist_real_array(’flux_hs’,flux_hs,nsource_hs,48) call QueryGridlist_real_array(’freq_hs’,freq_hs,nsource_hs,48) call QueryGridlist_real_array(’depth_hs’,depth_hs,nsource_hs,48) + if(any(av_hs.lt.0.0_wp).or.any(flux_hs.lt.0.0_wp))then + print*,’ERROR: av_hs and flux_hs must be nonnegative’ + STOP + endif + if(any(depth_hs.le.0.0_wp))then + print*,’ERROR: depth_hs entries must be greater than zero’ + STOP + endif + if(any((isource_function_hs.eq.3).and.(freq_hs.le.0.0_wp)))then + print*,’ERROR: pulse heat sources require freq_hs > 0’ + STOP + endif @@ call QueryGridlist_real_array(’radius_hs’,radius_hs,nsource_hs,48) 336 call QueryGridlist_real_array(’xcen_hs’,xcen_hs,nsource_hs,48) call QueryGridlist_real_array(’ycen_hs’,ycen_hs,nsource_hs,48) + if(any(radius_hs.le.0.0_wp))then + print*,’ERROR: radius_hs entries must be greater than zero’ + STOP + endif elseif(iheatsource.eq.2)then @@ call QueryGridlist_real_array(’xl_hs’,xl_hs,nsource_hs,48) call QueryGridlist_real_array(’xu_hs’,xu_hs,nsource_hs,48) call QueryGridlist_real_array(’yl_hs’,yl_hs,nsource_hs,48) call QueryGridlist_real_array(’yu_hs’,yu_hs,nsource_hs,48) + if(any(xu_hs.le.xl_hs).or.any(yu_hs.le.yl_hs))then + print*,’ERROR: rectangular heat sources require xl_hs < xu_hs and yl_hs < yu_hs’ + STOP + endif endif If cooling sources are intentionally supported through negative flux_hs, rename the option or add an explicit allow_heat_sink_hs flag so accidental sign mistakes still fail fast. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 93d691b (2026-08-12, heat-source/windfield warning downgrade); 0774ad4 (2026-08-10, dormant heat-source allocation guard). Heat-source option/timing validation was tightened. Later commits downgrade the windfield- development conflict from a kill to a warning and avoid touching starttime_hs before it is allocated. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/HeatSource/input_heat.F90 CODE ,→ -dev/HeatSource/heatsource_heat.F90 index 120bde8..09c29df 100644 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -162,6 +162,11 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) (freq_hs(itsource)*time.le.1.0_wp))then source_function = 1.0_wp endif + case default + if(mpi_rank.eq.0) print*, & + ’ERROR: unsupported isource_function_hs for heat source ’, & + itsource,isource_function_hs(itsource) + STOP index ea888e7..1b3c50b 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -14,6 +14,10 @@ subroutine input_heatsource(iheatsource) ! Executable Code call QueryGridlist_variable(’nsource_hs’,nsource_hs,48) + if(nsource_hs.le.0)then 337 + print*,’ERROR: nsource_hs must be greater than zero when heat sources are enabled’ + STOP + endif allocate(tmp(nsource_hs)) @@ -29,9 +33,17 @@ subroutine input_heatsource(iheatsource) call QueryGridlist_array(’isource_function_hs’,tmp,nsource_hs,48) isource_function_hs = nint(tmp) + if(any(isource_function_hs.lt.0).or.any(isource_function_hs.gt.3))then + print*,’ERROR: isource_function_hs entries must be 0, 1, 2, or 3’ + STOP + endif call QueryGridlist_array(’starttime_hs’,starttime_hs,nsource_hs,48) call QueryGridlist_array(’endtime_hs’,endtime_hs,nsource_hs,48) ... [diff excerpt truncated; run the command above for the full commit diff] # 93d691b Changed a kill statement to a warning regarding the heat source being turned on while the ,→ windfield is developing. # Full command: git show --find-renames --unified=3 93d691b -- CODE-dev/HeatSource/input_heat.F90 index 3b06cf1..3c2917b 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -144,10 +144,9 @@ subroutine input_heatsource(iheatsource) STOP endif if(any(starttime_hs.le.real(nt,wp)*dt))then - print*,’ERROR: heat source activates during windfield production.’ - print*,’Delay starttime_hs beyond the wind run or set & - &iheatsource=0.’ + print*,’WARNING: heat source activates during windfield production.’ + print*,’This may affect how the windfield develops.’ + endif if(any(endtime_hs.le.starttime_hs))then print*,’ERROR: each endtime_hs must be greater than starttime_hs’ @@ -158,10 +157,7 @@ subroutine input_heatsource(iheatsource) print*,’ERROR: av_hs and flux_hs must be nonnegative’ STOP endif - if(any(av_hs.lt.0._wp).or.any(flux_hs.lt.0._wp))then - print*,’ERROR: av_hs and flux_hs must be nonnegative’ - endif + if(any(depth_hs.le.0._wp))then print*,’ERROR: depth_hs entries must be greater than zero’ STOP # 0774ad4 Split if statement to avoid seg faulting if starttime_hs is not allocated. # Full command: git show --find-renames --unified=3 0774ad4 -- CODE-dev/force.F90 index 87aa64b..e2f469d 100644 +++ b/CODE-dev/force.F90 @@ -151,9 +151,11 @@ subroutine large_explicit_forcings 338 FIRETEC Bug Resolution Log July 2026 ! Ignite new cells if(ifire.eq.1) call ignite(forceLE_xvfuel(:,:,:,:,isies),xvfuel, & - if(iheatsource.ge.1.and.any(time.ge.starttime_hs))then - call heatSource(iheatsource, & - forceLE_xv,1,np,1,mp,l,nv) + if(iheatsource.ge.1) then + if(any(time.ge.starttime_hs))then + call heatSource(iheatsource, & + forceLE_xv,1,np,1,mp,l,nv) + endif endif !!!!! Firebrand Forcings !!!!! 339 BUG-2026-07-032: INPUT-002: uswitch=1/vswitch=1 wind ramps can be disabled by later ixevariation parsing Source report: aa-Jul8_completed/INPUT-002.md Files • input.F90 • rinit.F90 • xeVariation/input_xeVar.F90 • xeVariation/xevariation.F90 input.F90 tries to activate xe-variation mode 1 when either ambient wind switch requests a ramp: call QueryGridlist_real (’u0’,u0,48) call QueryGridlist_integer(’uswitch’,uswitch,48) call QueryGridlist_real (’v0’,v0,48) call QueryGridlist_integer(’vswitch’,vswitch,48) if(uswitch.eq.1.or.vswitch.eq.1) ixevariation=1 Later in the same subroutine, that value is read from the gridlist again: call QueryGridlist_integer(’ixevariation’,ixevariation,48) call QueryGridlist_integer(’windfieldin’,windfieldin,48) if(windfieldin.eq.1) ixevariation=2 call QueryGridlist_integer(’windfieldout’,windfieldout,48) if(ixevariation.gt.0.or.windfieldout.eq.1) & The ramp behavior is implemented only under xe-variation case 1: select case(ixevariation) case (1) if(uswitch==1)then ... endif if(vswitch==1)then ... endif rinit.F90 confirms that switch value 1 is delegated to xevariation.F90: ! NB uswitch.eq.1 is defined in xevariation.f 340 FIRETEC Bug Resolution Log July 2026 Problem If a gridlist sets uswitch=1 or vswitch=1, input.F90 sets ixevariation=1, but then the later QueryGridlist_integer ,→ (’ixevariation’,...) can overwrite it. A gridlist that explicitly says ixevariation = 0 disables the ramp. With the current missing-key behavior from INPUT-001, omitting ixevariation can also leave the value undefined. When this happens, input_xevariation does not read uramp, uramptime, vramp, or vramptime, rinitXeVariation is skipped, and domainUpdates.F90 never calls xevariation because it checks ixevariation.ge.1. Read the explicit xe-variation switches first, then derive the ramp mode after parsing. Keep windfield input as an exclusive mode because xevariation uses a single select case. +++ b/CODE-dev/input.F90 @@ call QueryGridlist_real (’u0’,u0,48) call QueryGridlist_integer(’uswitch’,uswitch,48) call QueryGridlist_real (’v0’,v0,48) call QueryGridlist_integer(’vswitch’,vswitch,48) - if(uswitch.eq.1.or.vswitch.eq.1) ixevariation=1 @@ ! XeVariation call QueryGridlist_integer(’ixevariation’,ixevariation,48) call QueryGridlist_integer(’windfieldin’,windfieldin,48) - if(windfieldin.eq.1) ixevariation=2 call QueryGridlist_integer(’windfieldout’,windfieldout,48) + if(windfieldin.eq.1)then + if(uswitch.eq.1.or.vswitch.eq.1)then + print*,’ERROR: windfieldin=1 cannot be combined with uswitch/vswitch=1 ramps’ + STOP + endif + ixevariation=2 + elseif(uswitch.eq.1.or.vswitch.eq.1)then + if(ixevariation.gt.0.and.ixevariation.ne.1)then + print*,’ERROR: uswitch/vswitch=1 requires ixevariation=0 or 1’ + STOP + endif + ixevariation=1 + endif if(ixevariation.gt.0.or.windfieldout.eq.1) & This preserves the automatic ramp activation while making incompatible xe-variation modes fail at input time instead of silently selecting the wrong behavior. Git evidence: 38a57e9 (2026-08-14, readgridlist, rmaxmin, and wind initialization fixes); 798df8b (2026-08-18, vegetation bug-list pass). The wind-switch parsing/initialization path was changed so uswitch=1 and vswitch=1 survive xeVariation parsing and initialize the ambient state correctly. 341 # 38a57e9 readgridlist and rmaxmin small reworks. Also rinit if uswitch/vswitch= 0 or 1 working ,→ correctly again. # Full command: git show --find-renames --unified=3 38a57e9 -- CODE-dev/rinit.F90 +++ b/CODE-dev/rinit.F90 @@ -66,11 +66,11 @@ subroutine rinit xv(1:np,1:mp,:,:)=xe + if(irst.eq.1) call irstreadio + ! Set up a large scale pressure gradient - ! Initialize environmental temporal variations time=itrestart*dts*nts @@ -127,14 +127,14 @@ subroutine setRhoThetaP !Theta stab is the lapse rate ! Executable Code ! Set specific humidity - ! water pressure saturation in hPA (from Humidity Conversion Formulas, Vaisala) + ! water pressure saturation in PA (from Humidity Conversion Formulas, Vaisala) ! OK at 0.083% within the range 50-100°C - pw=relativeHumidity*6.1164_wp*10._wp** & - (7.5914_wp*(Tambient-273.16_wp)/(tambient-32.44_wp)) ! water vapor pressure (hPa) - specificHumidity=0.62199_wp*pw/(pressground-pw) + pw=relativeHumidity*611.64_wp* & + exp(17.62_wp*(Tambient-273.15_wp)/(tambient-30.13_wp)) ! water vapor pressure (Pa) + specificHumidity=0.62199_wp*pw/(pressground-0.378*pw) yH2O=specificHumidity - yO2 =0.233_wp/(specificHumidity+1.0_wp) - yN2 =1.0_wp-yH2O-yO2 + yO2 =0.233_wp/(specificHumidity+1._wp) + yN2 =1._wp-yH2O-yO2 cpGas=yH2O*1996.0_wp+yO2*918.0_wp+yN2*1040.0_wp mwGas=yH2O*18.015_wp+yO2*31.998_wp+yN2*28.014_wp @@ -332,62 +332,62 @@ subroutine setVelocityProfile() enddo enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/rinit.F90 +++ b/CODE-dev/rinit.F90 @@ -232,6 +232,7 @@ subroutine setVelocityProfile() ! Executable Code + allocate(uprofile(np,mp,l)) 342 if(uswitch.eq.2.or.vswitch.eq.2)then ! Empirical profile of Kaimal and Finnigan 1994 and Raupach ,→ 1993 ! COMPUTATION OF LAIs and hmax hmax=0.0_wp !fuel max height (including actualfueldepth) @@ -304,7 +305,6 @@ subroutine setVelocityProfile() uprofilezu=exp(-c4*(1-zu/hmaxt)) endif ! COMPUTATION OF PROFILE (NORMALIZED AT CANOPY HEIGHT AT THIS STAGE) do k=1,l do j=1,mp do i=1,np @@ -382,7 +382,7 @@ subroutine setVelocityProfile() enddo endif !icorio.ne.2 + deallocate(uprofile) do k=1,l if(mpi_rank.eq.0) print*,’initial wind profile’, & 343 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-033: INPUT-005: Cadence inputs are not validated before being used as mod divisors Source report: aa-Jul8_completed/INPUT-005.md Files • input.F90 • compress.F90 • domainUpdates.F90 • xeVariation/input_xeVar.F90 • xeVariation/windfield.F90 • Sensors/input_sense.F90 input.F90 reads cadence values without range checks: call QueryGridlist_integer(’frqoutput’,frqoutput,48) ... call QueryGridlist_integer(’frqlspgf’,frqlspgf,48) Those values are later used as divisors in mod: if(mod(it,frqoutput).eq.0)then Child input routines read more cadence values that are also used as divisors: call QueryGridlist_integer(’itinterp’,itinterp,48) ... if(ittot.ge.itwindfield.and.mod(ittot,itinterp).eq.0)then call QueryGridlist_integer(’se_frq_write’,se_frq_write,48) ... if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then call QueryGridlist_integer(’freqSensor’,freqSensor,48) ... if(mod(ittot,freqSensor).eq.0) then 344 Problem If any of these gridlist values are zero, Fortran evaluates mod(value,0), which is invalid and commonly crashes at runtime. Negative cadence values are also nonsensical and can produce confusing scheduling behavior. These are user-input errors, so they should be caught in the input layer with a specific message. Waiting until the time loop or xe-variation update makes the failure later and harder to connect back to the bad gridlist key. Validate cadence values immediately after reading them, and validate conditional cadences only when their feature is enabled. +++ b/CODE-dev/input.F90 @@ ! General I/O call QueryGridlist_integer(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_integer(’frqfilstr’,frqfilstr,48) @@ call QueryGridlist_integer(’ilspgf’,ilspgf,48) call QueryGridlist_integer(’izlspgf’,izlspgf,48) call QueryGridlist_integer(’frqlspgf’,frqlspgf,48) + if(ilspgf.ge.1.and.frqlspgf.le.0)then + print*,’ERROR: frqlspgf must be greater than zero when ilspgf is enabled’ + STOP + endif diff --git a/CODE-dev/xeVariation/input_xeVar.F90 b/CODE-dev/xeVariation/input_xeVar.F90 --- a/CODE-dev/xeVariation/input_xeVar.F90 +++ b/CODE-dev/xeVariation/input_xeVar.F90 @@ call QueryGridlist_integer(’itwindfield’,itwindfield,48) call QueryGridlist_integer(’itinterp’,itinterp,48) + if(itinterp.le.0)then + print*,’ERROR: itinterp must be greater than zero for windfield input’ + STOP + endif @@ call QueryGridlist_integer(’freqSensor’,freqSensor,48) + if(freqSensor.le.0)then + print*,’ERROR: freqSensor must be greater than zero for dense sensors’ + STOP + endif @@ call QueryGridlist_integer(’itwindfield’,itwindfield,48) call QueryGridlist_integer(’itinterp’,itinterp,48) + if(itinterp.le.0)then 345 + print*,’ERROR: itinterp must be greater than zero for windfield output’ + STOP + endif +++ b/CODE-dev/Sensors/input_sense.F90 @@ call QueryGridlist_integer(’se_frq_write’,se_frq_write,48) + if(se_frq_write.le.0)then + print*,’ERROR: se_frq_write must be greater than zero’ + STOP + endif That turns a late arithmetic failure into a clear gridlist validation error. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 38a57e9 (2026-08-14, readgridlist, rmaxmin, and wind initialization fixes). The validation pass added cadence guardrails, and the readgridlist rework made assignment parsing less brittle before cadence values are consumed by mod checks. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/input.F90 CODE-dev/ ,→ domainUpdates.F90 CODE-dev/xeVariation/input_xeVar.F90 index e8fb65c..4c0d91f 100644 +++ b/CODE-dev/domainUpdates.F90 @@ -86,7 +86,7 @@ end subroutine implicit_domain_updates !----------------------------------------------------------------------- use gridlist_variables, only : l,ilspgf,frqlspgf,ixevariation,ih, & - iheatsource,iturb + iturb use gridsetup, only : np,mp,ittot +++ b/CODE-dev/input.F90 @@ -9,6 +9,7 @@ subroutine input ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input ! General I/O 346 call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP + endif ... [diff excerpt truncated; run the command above for the full commit diff] # 38a57e9 readgridlist and rmaxmin small reworks. Also rinit if uswitch/vswitch= 0 or 1 working ,→ correctly again. # Full command: git show --find-renames --unified=3 38a57e9 -- CODE-dev/compress.F90 index cc4b9eb..6fe11bc 100644 +++ b/CODE-dev/compress.F90 @@ -14,7 +14,7 @@ program compress use xvall, only : xv,xvrho,nv,xv_list,xvfuel,xvfuel_list,nvfuel, & isies use sensor_gridlist_variables, only : se_frq_write + use rmaxmin_mod, only : rmaxmin ! Local variables @@ -42,18 +42,18 @@ program compress ! Write to the standard out state variables do kv=1,nv-1 - call rmaxmin_3D(xvrho(:,:,1:l,kv),xv_list(kv)) + call rmaxmin(xvrho(:,:,1:l,kv),xv_list(kv)) enddo - call rmaxmin_3D(xv(:,:,1:l,nv),xv_list(nv)) - call rmaxmin_3D(tempg,’Tempg’) - call rmaxmin_3D(pr,’pr’) + call rmaxmin(xv(:,:,1:l,nv),xv_list(nv)) + call rmaxmin(tempg,’Tempg’) + call rmaxmin(pr,’pr’) do ift=1,nfuel if(mpi_rank.eq.0) print*,’Fuel Type’,ift do kv=1,nvfuel - call rmaxmin_3D(xvfuel(ift,:,:,:,kv),xvfuel_list(kv)) + call rmaxmin(xvfuel(ift,:,:,:,kv),xvfuel_list(kv)) enddo if(isies.ne.1) then - call rmaxmin_3D(temps(ift,:,:,:),’Temps’) + call rmaxmin(temps(ift,:,:,:),’Temps’) endif enddo 347 BUG-2026-07-034: INPUT-009: topofile is truncated to 60 characters before topo.F90 opens it Source report: aa-Jul8_completed/INPUT-009.md Files • input.F90 • variables.F90 • rinit.F90 • topo.F90 Most file-name inputs in gridlist_variables use 257 characters: character(len=257) :: outname = ’comp.out’ character(len=257) :: restartfile = ’’ But topofile is only 60 characters: character(len=60) :: topofile = ’’ ! Name of topo file input.F90 reads the gridlist value directly into that variable: call QueryGridlist_string (’topofile’,topofile,48) rinit.F90 and topo.F90 then use the stored value: if(topofile(1:1)/=’*’.and.topofile/=’␣’) call topo open(25,file=topofile,form=’unformatted’,status=’old’) Problem An absolute topography file path can easily exceed 60 characters. For example, paths under the versioned tree in this workspace already have long prefixes. Reading such a path into character(len=60) truncates it before topo.F90 opens the file, so a valid gridlist path can become a nonexistent path at runtime. The rest of the I/O-related path variables already use 257 characters, so topofile is an inconsistent and surprisingly short limit. 348 Use the same length as the other major file-name inputs. +++ b/CODE-dev/variables.F90 @@ - character(len=60) :: topofile = ’’ ! Name of topo file + character(len=257) :: topofile = ’’ ! Name of topo file If longer paths are expected, define a shared path-length parameter and use it consistently for all path-like gridlist variables. The topography file path is now opened with the full trimmed topofile string, and the shared filename buffers were cleaned up so valid long paths are not truncated at the old short limit. # a8b1c58 tinitF90, topoF90, and variablesF90 ’bug lists’. # Full command: git show --find-renames --unified=3 a8b1c58 -- CODE-dev/topo.F90 CODE-dev/variables. ,→ F90 diff --git a/CODE-dev/topo.F90 b/CODE-dev/topo.F90 index 3119604..68c67d4 100644 --- a/CODE-dev/topo.F90 +++ b/CODE-dev/topo.F90 @@ -1,7 +1,7 @@ -!---------------------------------------------------------------- -! topo reads in topography data and populates the zs domain with -! said data for all the processors -!---------------------------------------------------------------- +!----------------------------------------------------------------------- +! topo reads in topography data and populates the zs domain with said +! data for all the processors +!----------------------------------------------------------------------- subroutine topo use gridlist_variables, only : topofile,n,m,ih,wp @@ -15,13 +15,13 @@ subroutine topo real(wp),allocatable :: zsio(:,:) ! Executable Code - ! Read topo data into master if present allocate(zsio(n,m)) - open(25,file=topofile,form=’unformatted’,status=’old’) + open(25,file=trim(topofile),form=’unformatted’,status=’old’) read(25) zsio close(25) - zs(1:np,1:mp)=zsio((npos-1)*np+1:(npos-1)*np+np,(mpos-1)*mp+1:(mpos-1)*mp+mp) - if(mpi_rank.eq.0) print*,’Read topography file ’,topofile + zs(1:np,1:mp)=zsio((npos-1)*np+1:(npos-1)*np+np, & + (mpos-1)*mp+1:(mpos-1)*mp+mp) + if(mpi_rank.eq.0) print*,’Read topography file ’,trim(topofile) deallocate(zsio) 349 ! Initialize topo values for ghost points @@ -30,7 +30,6 @@ subroutine topo ! Set edges of the domain (corners?) if(leftedge.eq.1) then do j=1-ih,mp+ih - zs(1,j)=zs(2,j) !zero gradient do i=1,ih zs(1-i,j)=zs(1,j) enddo ... [diff excerpt truncated; run the command above for the full commit diff] 350 BUG-2026-07-035: INPUT-010: Relaxation inputs can trigger divisions by zero in tinit Source report: aa-Jul8_completed/INPUT-010.md Files • input.F90 • tinit.F90 • variables.F90 input.F90 reads relaxation controls without checking their ranges: call QueryGridlist_integer(’nr’,nr,48) ... call QueryGridlist_real (’zab’,zab,48) call QueryGridlist_real (’tow’,tow,48) tinit.F90 allocates relb from nr, writes the first two columns, and divides by expressions involving nr: allocate(relb(4,nr+1)); relb = 0.0_wp ... real(nr-1,kind=wp)**2.0_wp)) ... real(nr-1,kind=wp)) ... (0.5_wp*real(nr,kind=wp)-1.0_wp))**2.0_wp)) ... relb(:,1:2)=1.0_wp The top absorber also divides by tow: relaxxv(i,j,k,:)=t1/((zb-zab)+1.e-10_wp)/tow**2.0_wp ... relaxxv(i,j,k,1:3)=0.66_wp*0.25_wp*(1.0_wp-cos(pi*(zl-zab)/(zb-zab)))/tow Problem Several invalid gridlist values fail inside tinit instead of at input time: • nr=0 allocates only one relb column, then relb(:,1:2)=1.0_wp writes beyond the allocation. • nr=1 makes real(nr-1) zero in relaxation cases 1, 3, and 4. • nr=2 makes (0.5*nr - 1) zero in relaxation case 2. • tow=0 makes top absorber formulas divide by zero. 351 The defaults are safe, but a bad gridlist can create invalid relaxation coefficients or crash later in initialization. Validate the absorber controls after resolving per-side defaults. +++ b/CODE-dev/input.F90 @@ if(ibc_top.eq.7825) ibc_top = ibcy if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + if(nr.lt.1)then + print*,’ERROR: nr must be at least 1’ + STOP + endif + if((ibc_top.ge.1.and.ibc_top.lt.5 .or. & + ibc_bot.ge.1.and.ibc_bot.lt.5 .or. & + ibc_left.ge.1.and.ibc_left.lt.5 .or. & + ibc_right.ge.1.and.ibc_right.lt.5) .and. nr.lt.3)then + print*,’ERROR: nr must be at least 3 for relaxation boundary options 1-4’ + STOP + endif Parentheses can be adjusted to match the project’s style; the key point is to reject invalid relaxation inputs before tinit allocates or divides. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); a8b1c58 (2026-08-17, tinit/topo/variables bug-list pass). Relaxation/top-absorber inputs received validation and the exponential absorber formula was corrected in CODE-dev/tinit.F90. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/input.F90 CODE-dev/tinit.F90 ,→ CODE-dev/variables.F90 +++ b/CODE-dev/input.F90 @@ -9,6 +9,7 @@ subroutine input ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input 352 ! General I/O call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP + endif call QueryGridlist_variable(’ihdf’,ihdf,48) ! Relaxation @@ -52,6 +61,44 @@ subroutine input if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + call validate_lateral_ibc(’ibc_top’,ibc_top) + call validate_lateral_ibc(’ibc_bot’,ibc_bot) + call validate_lateral_ibc(’ibc_left’,ibc_left) + call validate_lateral_ibc(’ibc_right’,ibc_right) + ... [diff excerpt truncated; run the command above for the full commit diff] # a8b1c58 tinitF90, topoF90, and variablesF90 ’bug lists’. # Full command: git show --find-renames --unified=3 a8b1c58 -- CODE-dev/tinit.F90 CODE-dev/variables. ,→ F90 +++ b/CODE-dev/tinit.F90 @@ -7,7 +7,7 @@ subroutine tinit + use constants, only : pi,tolerance @@ -63,7 +63,7 @@ subroutine tinit write(*,*) ’WARNING: top absorption layer is inactive.’ - write(*,*) ’ zab is at or above the model top.’ + write(*,*) ’ zab is at or above the domain top.’ write(*,*) ’ zab = ’, zab, ’ zb = ’, zb write(*,*) ’ No vertical/top damping will be applied.’ write(*,*) ’ To enable it, set zab < zb in the gridlist.’ @@ -77,17 +77,13 @@ subroutine tinit ! Upper dampers 353 - t1=max(0.0_wp,zl-zab) - print*,’ERROR: iab=2 requires tow > 1’ + t1=max(0._wp,zl-zab) case(1) - relaxxv(i,j,k,:)=t1/((zb-zab)+1.e-10_wp)/tow**2._wp + relaxxv(i,j,k,:)=t1/((zb-zab)+tolerance)/tow**2._wp case(2) relaxxv(i,j,k,:)=0.05_wp* & - exp(-t1/(-(zb-zab)/log(tow**(-2._wp)))) + exp(-t1/((zb-zab)/log(tow**(-2._wp)))) case(3) relaxxv(i,j,k,1:3)= & ... [diff excerpt truncated; run the command above for the full commit diff] 354 BUG-2026-07-036: INPUT-011: Unsupported iheatsource values are accepted as enabled heat sources Source report: aa-Jul8_completed/INPUT-011.md Files • input.F90 • HeatSource/input_heat.F90 • HeatSource/heatsource_heat.F90 • domainUpdates.F90 input.F90 treats any value greater than or equal to 1 as enabled: call QueryGridlist_integer(’iheatsource’,iheatsource,48) if(iheatsource.ge.1) call input_heatsource(iheatsource) input_heatsource only allocates geometry arrays for modes 1 and 2: if(iheatsource.eq.1)then allocate(xcen_hs(nsource_hs),ycen_hs(nsource_hs), & radius_hs(nsource_hs)) ... elseif(iheatsource.eq.2)then allocate(xl_hs(nsource_hs),xu_hs(nsource_hs), & yl_hs(nsource_hs),yu_hs(nsource_hs)) ... endif The heat-source implementation also only handles modes 1 and 2: if(iheatsource.eq.1) then ! Circular ... elseif(iheatsource.eq.2) then ! Rectangular ... endif if(iheatsource.eq.1)then !Circular source ... elseif(iheatsource.eq.2)then !Rectangular source ... endif 355 Problem A gridlist value like iheatsource=3 is accepted and causes heat-source input arrays to be allocated, rinitHeatSource to run, domainUpdates to call updateHeatSourcePosition, and force.F90 to call heatSource. But no geometry is read and the heat-source routines do not apply any source for that mode. That is a silent no-op for a user who explicitly enabled heat sources. It should fail during input parsing instead of running a simulation with the requested source absent. Validate iheatsource before calling the heat-source input routine, and validate nsource_hs when the feature is enabled. +++ b/CODE-dev/input.F90 @@ !Heat source call QueryGridlist_integer(’iheatsource’,iheatsource,48) + if(iheatsource.ne.0.and.iheatsource.ne.1.and.iheatsource.ne.2)then + print*,’ERROR: iheatsource must be 0, 1 circular, or 2 rectangular’ + STOP + endif if(iheatsource.ge.1) call input_heatsource(iheatsource) +++ b/CODE-dev/HeatSource/input_heat.F90 @@ call QueryGridlist_integer(’nsource_hs’,nsource_hs,48) + if(nsource_hs.le.0)then + print*,’ERROR: nsource_hs must be greater than zero when heat sources are enabled’ + STOP + endif That keeps unsupported heat-source modes from being mistaken for active configurations. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 93d691b (2026-08-12, heat-source/windfield warning downgrade); 0774ad4 (2026-08-10, dormant heat-source allocation guard). Heat-source mode validation and allocation guards were added so unsupported values do not silently select an unintended forcing path. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/input.F90 CODE-dev/HeatSource/ ,→ input_heat.F90 CODE-dev/HeatSource/heatsource_heat.F90 index 120bde8..09c29df 100644 356 +++ b/CODE-dev/HeatSource/heatsource_heat.F90 @@ -162,6 +162,11 @@ subroutine heatSource(iheatsource,force,il,iu,jl,ju,lls,nv) (freq_hs(itsource)*time.le.1.0_wp))then source_function = 1.0_wp endif + case default + if(mpi_rank.eq.0) print*, & + ’ERROR: unsupported isource_function_hs for heat source ’, & + itsource,isource_function_hs(itsource) + STOP index ea888e7..1b3c50b 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -14,6 +14,10 @@ subroutine input_heatsource(iheatsource) ! Executable Code call QueryGridlist_variable(’nsource_hs’,nsource_hs,48) + if(nsource_hs.le.0)then + print*,’ERROR: nsource_hs must be greater than zero when heat sources are enabled’ + STOP + endif allocate(tmp(nsource_hs)) @@ -29,9 +33,17 @@ subroutine input_heatsource(iheatsource) call QueryGridlist_array(’isource_function_hs’,tmp,nsource_hs,48) isource_function_hs = nint(tmp) + if(any(isource_function_hs.lt.0).or.any(isource_function_hs.gt.3))then + print*,’ERROR: isource_function_hs entries must be 0, 1, 2, or 3’ + STOP + endif call QueryGridlist_array(’starttime_hs’,starttime_hs,nsource_hs,48) call QueryGridlist_array(’endtime_hs’,endtime_hs,nsource_hs,48) ... [diff excerpt truncated; run the command above for the full commit diff] # 93d691b Changed a kill statement to a warning regarding the heat source being turned on while the ,→ windfield is developing. # Full command: git show --find-renames --unified=3 93d691b -- CODE-dev/HeatSource/input_heat.F90 index 3b06cf1..3c2917b 100644 +++ b/CODE-dev/HeatSource/input_heat.F90 @@ -144,10 +144,9 @@ subroutine input_heatsource(iheatsource) STOP endif if(any(starttime_hs.le.real(nt,wp)*dt))then - print*,’ERROR: heat source activates during windfield production.’ - print*,’Delay starttime_hs beyond the wind run or set & - &iheatsource=0.’ + print*,’WARNING: heat source activates during windfield production.’ + print*,’This may affect how the windfield develops.’ + endif 357 if(any(endtime_hs.le.starttime_hs))then print*,’ERROR: each endtime_hs must be greater than starttime_hs’ @@ -158,10 +157,7 @@ subroutine input_heatsource(iheatsource) print*,’ERROR: av_hs and flux_hs must be nonnegative’ STOP endif - if(any(av_hs.lt.0._wp).or.any(flux_hs.lt.0._wp))then - print*,’ERROR: av_hs and flux_hs must be nonnegative’ - endif + if(any(depth_hs.le.0._wp))then print*,’ERROR: depth_hs entries must be greater than zero’ STOP # 0774ad4 Split if statement to avoid seg faulting if starttime_hs is not allocated. # Full command: git show --find-renames --unified=3 0774ad4 -- CODE-dev/force.F90 index 87aa64b..e2f469d 100644 +++ b/CODE-dev/force.F90 @@ -151,9 +151,11 @@ subroutine large_explicit_forcings ! Ignite new cells if(ifire.eq.1) call ignite(forceLE_xvfuel(:,:,:,:,isies),xvfuel, & - if(iheatsource.ge.1.and.any(time.ge.starttime_hs))then - call heatSource(iheatsource, & - forceLE_xv,1,np,1,mp,l,nv) + if(iheatsource.ge.1) then + if(any(time.ge.starttime_hs))then + call heatSource(iheatsource, & + forceLE_xv,1,np,1,mp,l,nv) + endif endif !!!!! Firebrand Forcings !!!!! 358 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-037: INPUT-012: Xe-variation input ranges can cause divide-by-zero or out-of-bounds windfield access Source report: aa-Jul8_completed/INPUT-012.md Files • input.F90 • xeVariation/input_xeVar.F90 • xeVariation/rinit_xeVar.F90 • xeVariation/xevariation.F90 • xeVariation/windfield.F90 input_xevariation reads windfield and sensor dimensions without range checks: call QueryGridlist_integer(’windspeedupfactor’,windspeedupfactor,48) call QueryGridlist_integer(’itwindfield’,itwindfield,48) call QueryGridlist_integer(’itinterp’,itinterp,48) call QueryGridlist_integer(’ibcells’,ibcells,48) call QueryGridlist_integer(’jbcells’,jbcells,48) call QueryGridlist_integer(’nSensors’,nSensors,48) allocate(SensorX(nSensors),SensorY(nSensors),SensorZ(nSensors), & SensorTimes(nSensors),SensorUvel(nSensors),SensorVvel(nSensors)) Those values are later used as divisors and array bounds: if(npos.eq.1) xvdatanew(1:ibcells,:,:,:)= & indatai(1:ibcells,mp*(mpos-1)+1:mp*mpos,:,:) if(npos.eq.nprocx) xvdatanew(np-ibcells+1:np,:,:,:)= & indatai(ibcells+1:ibcells*2,mp*(mpos-1)+1:mp*mpos,:,:) Sensor mode also divides by sensor heights: (zcart(z(k),j,k)/SensorZ(kv))**(1.0_wp/7.0_wp) Problem Several invalid xe-variation inputs are accepted until they fail later: 359 • windspeedupfactor=0 causes integer division by zero in rinit_xeVar and xevariation. • ibcells > np or jbcells > mp causes out-of-bounds slices in windfld_read; np and mp are n/nprocx and m/nprocy. • nSensors <= 0 allocates empty sensor arrays and can silently zero the velocity fields in sensor-driven xe-variation modes. • SensorZ <= 0 causes division by zero or invalid fractional powers in sensor interpolation. INPUT-005 covers cadence divisors like itinterp and freqSensor; this issue covers the other xe-variation dimensions and divisors. Validate windfield dimensions against the configured domain decomposition and validate sensor arrays after reading them. diff --git a/CODE-dev/xeVariation/input_xeVar.F90 b/CODE-dev/xeVariation/input_xeVar.F90 --- a/CODE-dev/xeVariation/input_xeVar.F90 +++ b/CODE-dev/xeVariation/input_xeVar.F90 @@ - use gridlist_variables, only : n,m + use gridlist_variables, only : n,m,nprocx,nprocy,wp @@ call QueryGridlist_integer(’windspeedupfactor’,windspeedupfactor,48) call QueryGridlist_integer(’itwindfield’,itwindfield,48) call QueryGridlist_integer(’itinterp’,itinterp,48) call QueryGridlist_integer(’ibcells’,ibcells,48) call QueryGridlist_integer(’jbcells’,jbcells,48) + if(windspeedupfactor.le.0)then + print*,’ERROR: windspeedupfactor must be greater than zero’ + STOP + endif + if(ibcells.le.0.or.ibcells.gt.n/nprocx.or. & + jbcells.le.0.or.jbcells.gt.m/nprocy)then + print*,’ERROR: ibcells/jbcells must be positive and fit within each MPI subdomain’ + STOP + endif @@ call QueryGridlist_integer(’nSensors’,nSensors,48) + if(nSensors.le.0)then + print*,’ERROR: nSensors must be greater than zero’ + STOP + endif allocate(SensorX(nSensors),SensorY(nSensors),SensorZ(nSensors), & SensorTimes(nSensors),SensorUvel(nSensors),SensorVvel(nSensors)) @@ call QueryGridlist_real_array(’SensorZ’,SensorZ,nSensors,48) + if(any(SensorZ.le.0.0_wp))then + print*,’ERROR: all SensorZ values must be greater than zero’ + STOP + endif @@ call QueryGridlist_integer(’nSensors’,nSensors,48) + if(nSensors.le.0)then + print*,’ERROR: nSensors must be greater than zero’ + STOP + endif 360 allocate(SensorX(nSensors),SensorY(nSensors),SensorZ(nSensors)) @@ call QueryGridlist_real_array(’SensorZ’,SensorZ,nSensors,48) + if(any(SensorZ.le.0.0_wp))then + print*,’ERROR: all SensorZ values must be greater than zero’ + STOP + endif Apply the same windspeedupfactor and boundary-width checks in the windfieldout.eq.1 block, since output-only windfield runs read the same values there. Git evidence: 8122925 (2026-08-05, xeVariation fixes); 6aed633 (2026-08-11, dense sensors use times- tamps). xeVariation range and dense-sensor advancement logic was reworked. The later dense-sensor commit removes reliance on freqSensor and advances records by the timestamps already present in the data. # 8122925 Addressing problems in xeVariation. # Full command: git show --find-renames --unified=3 8122925 -- CODE-dev/xeVariation/rinit_xeVar.F90 ,→ CODE-dev/xeVariation/xevariation.F90 CODE-dev/xeVariation/windfield.F90 index fc613a2..354ce89 100644 +++ b/CODE-dev/xeVariation/rinit_xeVar.F90 @@ -51,13 +51,18 @@ subroutine rinitXeVariation(xevariation) ! Need to initiate xvdataold itabsold=itrestart itabsnew=itrestart+itinterp - - do kv=1,nvwind - xvdataold(:,:,:,kv)=xv(1:np,1:mp,:,w2f_index(kv)) + if(irst.eq.1)then + call namefile(int(itabsold/windspeedupfactor),xvdataname,fxvdataname) + if(mpi_rank.eq.0) print*,’reading old windfield file ’,fxvdataname + call windfld_read(fxvdataname,xvdataold) + else + do kv=1,nvwind + xvdataold(:,:,:,kv)=xv(1:np,1:mp,:,w2f_index(kv)) + enddo + endif if(mpi_rank.eq.0) print*,’reading file ’,fxvdataname - call windfld_read(fxvdataname) + call windfld_read(fxvdataname,xvdatanew) case (3) allocate(senw(nSensors)) @@ -70,7 +75,7 @@ subroutine rinitXeVariation(xevariation) read(4884+kv,*) ! File Headers read(4884+kv,*) ! File Headers - do it=1,int(time/dt/freqSensor)-1 + do it=1,int(time/dt/freqSensor) read(4884+kv,*) ! Get to appropriate line 361 enddo endif index cc128a1..c3144eb 100644 +++ b/CODE-dev/xeVariation/windfield.F90 @@ -86,15 +86,16 @@ end subroutine windfld_write ... [diff excerpt truncated; run the command above for the full commit diff] # 6aed633 Completing the recommendation by the AI to get rid of the freq of read for dense sensors and ,→ instead simply use the time stamp already in the data to determine when to read and use the ,→ next line. # Full command: git show --find-renames --unified=3 6aed633 -- CODE-dev/xeVariation/rinit_xeVar.F90 ,→ CODE-dev/xeVariation/xevariation.F90 index 354ce89..124293c 100644 +++ b/CODE-dev/xeVariation/rinit_xeVar.F90 @@ -3,10 +3,10 @@ ! temporal evolutions in the environmental variables !----------------------------------------------------------------------- subroutine rinitXeVariation(xevariation) - use gridlist_variables, only : l,irst,dt - use gridsetup, only : np,mp,itrestart,time + use gridlist_variables, only : l,irst + use gridsetup, only : np,mp,itrestart use sensor_variables, only : nSensors,senw,senDataOld,senDataNew, & - senDataName,freqSensor + senDataName use windfieldio, only : windfieldstartfile,nvwind,xvwind_list, & w2f_index,xvdataold,xvdatanew,itinterp,windspeedupfactor, & itabsnew,itabsold,xvdataname @@ -17,7 +17,7 @@ subroutine rinitXeVariation(xevariation) ! Local Variables integer,intent(in) :: xevariation - integer :: kv,kv2,it + integer :: kv,kv2 character(len=257) :: fxvdataname character(len=257) :: sensorDataName @@ -70,20 +70,15 @@ subroutine rinitXeVariation(xevariation) allocate(senw(nSensors*2)) allocate(senDataOld(nSensors,4),senDataNew(nSensors,4)) do kv=1,nSensors + if(mpi_rank.eq.0) print*,’Reading Sensor’,kv,’datum’ call namefile(kv,senDataName,sensorDataName) open(4884+kv,file=sensorDataName,form=’formatted’,status=’old’) read(4884+kv,*) ! File Headers read(4884+kv,*) ! File Headers - if(irst.eq.1)then - do it=1,int(time/dt/freqSensor) - read(4884+kv,*) ! Get to appropriate line - enddo - endif read(4884+kv,*) senDataOld(kv,1),senDataOld(kv,2), & ... [diff excerpt truncated; run the command above for the full commit diff] 362 BUG-2026-07-038: RADIATION-007: icallrad is not validated before use as a MOD divisor Source report: aa-Jul8_completed/RADIATION-007.md Files • Radiation/input_rad.F90 • Radiation/monteCarlo_rad.F90 input_radiation reads icallrad directly from the gridlist: call QueryGridlist_integer(’icallrad’,icallrad,48) call QueryGridlist_real (’crad’,crad,48) call QueryGridlist_integer(’irandseed’,irandseed,48) call QueryGridlist_integer(’iseed’,iseed,48) call QueryGridlist_integer(’isootmodel’,isootmodel,48) call QueryGridlist_integer(’iradeastflux’,iradeastflux,48) endif The Monte Carlo radiation driver uses it as the divisor in mod: call papv_defs ! define papvtotAZ,papvgas,papvtot call source_defs ! define sourcegas, sourcesol, EAZ, Etot, and lmc if(Etot.ge.Emin) call montecarlo Problem A gridlist value of icallrad=0 causes an immediate integer divide-by-zero in mod(ittot,icallrad). Negative values do not crash consistently, but they make the call-frequency semantics ambiguous and can suppress or mis-schedule Monte Carlo updates. This is a configuration error that should fail at input time with a clear message. Validate icallrad as soon as it is read. Since it only controls the Monte Carlo path, the validation can be limited to irad=2; accepting it for all radiation modes is also fine if the gridlist always contains it. +++ b/CODE-dev/Radiation/input_rad.F90 @@ ! Executable Code call QueryGridlist_integer(’icallrad’,icallrad,48) 363 + if(irad.eq.2.and.icallrad.le.0)then + print*,’ERROR: icallrad must be greater than zero for Monte Carlo radiation’ + STOP + endif It would also be useful to validate irandseed, isootmodel, and iradeastflux as enumerated options in the same routine so typos do not silently choose unintended model branches. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 9ce10f9 (2026-08-13, radiation bug-list pass); 46f574d (2026-07-29, custom firerad gridlist argument). Radiation mode validation was tightened and the Monte Carlo implementation was substantially reworked in the August radiation pass, including cleaner source selection and firerad gridlist handling. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Radiation/input_rad.F90 index 8a121df..87fe348 100644 +++ b/CODE-dev/Radiation/input_rad.F90 @@ -4,6 +4,7 @@ subroutine input_radiation(irad) use radiation_gridlist_variables, only : icallrad,crad,irandseed, & iseed,isootmodel,iradeastflux + use gridlist_variables, only : wp @@ -12,12 +13,32 @@ subroutine input_radiation(irad) ! Executable Code call QueryGridlist_variable(’icallrad’,icallrad,48) + if(irad.eq.2.and.icallrad.le.0)then + print*,’ERROR: icallrad must be greater than zero for Monte Carlo radiation’ + STOP + endif call QueryGridlist_variable (’crad’,crad,48) call QueryGridlist_variable(’irandseed’,irandseed,48) call QueryGridlist_variable(’iseed’,iseed,48) call QueryGridlist_variable(’isootmodel’,isootmodel,48) call QueryGridlist_variable(’iradeastflux’,iradeastflux,48) + if(irandseed.lt.0.or.irandseed.gt.1)then + print*,’ERROR: irandseed must be 0 or 1’ + STOP + endif + if(isootmodel.lt.0.or.isootmodel.gt.1)then + print*,’ERROR: isootmodel must be 0 or 1’ + STOP + endif + if(iradeastflux.lt.0.or.iradeastflux.gt.1)then + print*,’ERROR: iradeastflux must be 0 or 1’ + STOP + endif 364 + if(isootmodel.eq.0.and.crad.lt.0.0_wp)then + print*,’ERROR: crad must be nonnegative’ + STOP + endif ... [diff excerpt truncated; run the command above for the full commit diff] # 9ce10f9 Significant fixes to Radiation bugs. This commit needs to be vetted thoroughly. # Full command: git show --find-renames --unified=3 9ce10f9 -- CODE-dev/Radiation/input_rad.F90 CODE- ,→ dev/Radiation/monteCarlo_rad.F90 index 87fe348..13bc636 100644 +++ b/CODE-dev/Radiation/input_rad.F90 @@ -2,8 +2,8 @@ ! Reads basic user input for vegetation in HIGRAD/FIRETEC !----------------------------------------------------------------------- subroutine input_radiation(irad) - use radiation_gridlist_variables, only : icallrad,crad,irandseed, & - iseed,isootmodel,iradeastflux + use radiation_gridlist_variables, only : icallrad,crad,isootmodel, & + isolar,unixTimeStart,plotLong,plotLat @@ -13,28 +13,31 @@ subroutine input_radiation(irad) ! Executable Code call QueryGridlist_variable(’icallrad’,icallrad,48) + if(irad.eq.2)then + call QueryGridlist_variable(’crad’,crad,48) + call QueryGridlist_variable(’isootmodel’,isootmodel,48) + endif + + ! Solar Heating + call QueryGridlist_variable(’isolar’,isolar,48) + call QueryGridlist_variable(’unixT’,unixTimeStart,48) + call QueryGridlist_variable(’plotLong’,plotLong,48) + call QueryGridlist_variable(’plotLat’,plotLat,48) + +!----------------------------------------------------------------------- +! Everything below here is where others put all the warnings of garbage +! that a user may try unintentionally to run with. It’s put down here +! because in clunks up the code and makes it hard to read. +!----------------------------------------------------------------------- if(irad.eq.2.and.icallrad.le.0)then print*,’ERROR: icallrad must be greater than zero for Monte Carlo radiation’ STOP endif - call QueryGridlist_variable (’crad’,crad,48) - call QueryGridlist_variable(’irandseed’,irandseed,48) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 365 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-039: RADIATION-010: Invalid radiation modes and options are silently accepted Source report: aa-Jul8_completed/RADIATION-010.md Files • input.F90 • force.F90 • Radiation/input_rad.F90 • Radiation/monteCarlo_rad.F90 The main input routine reads irad and accepts any positive value: ! Radiation call QueryGridlist_integer(’irad’,irad,48) if(irad.gt.0) call input_radiation(irad) The forcing routine only handles modes 1, 2, and 3: if(irad.eq.1)then ! Diffusive Radiation Scheme if(mpi_rank.eq.0) print*,’Diffusive␣Radiation␣Not␣implemented’ call mpi_finalize(ierror) STOP elseif(irad.eq.2)then ! Monte-Carlo Radiation Scheme call firerad_MC(forceSE_xv(:,:,:,itheta), & forceSE_xvfuel(:,:,:,:,isies), & xvfuel(:,:,:,:,irhof)+xvfuel(:,:,:,:,irhow), & 1-ih,np+ih,1-ih,mp+ih,1,np,1,mp,l,nfuel) elseif(irad.eq.3)then ! Radiation Sink call radiationSink(forceSE_xv(:,:,:,itheta), & For Monte Carlo radiation, several option values are read without validation: call QueryGridlist_real (’crad’,crad,48) call QueryGridlist_integer(’irandseed’,irandseed,48) call QueryGridlist_integer(’iseed’,iseed,48) call QueryGridlist_integer(’isootmodel’,isootmodel,48) call QueryGridlist_integer(’iradeastflux’,iradeastflux,48) endif isootmodel treats every value except 1 as the alternate model: if(isootmodel.eq.1)then ... else 366 ... papvgas(i,j,k)=crad*aemit*absemis*0.25_wp Problem Invalid radiation settings can silently produce the wrong behavior: • irad=4 or any other unsupported positive value calls input_radiation and rinitrad, but no radiation branch runs in force.F90. The user gets no radiation and no error. • invalid isootmodel values fall into the else branch and select the non-soot-model formula. • invalid irandseed values behave like "do not randomize". • invalid iradeastflux values behave like "do not output east flux". • negative crad makes papvgas negative in the non-soot-model branch, which can create negative gas emission/absorption terms and nonsensical Etot. These are gridlist mistakes that should fail before the simulation starts. Validate the mode and enumerated options at input time. +++ b/CODE-dev/input.F90 @@ ! Radiation call QueryGridlist_integer(’irad’,irad,48) + if(irad.lt.0.or.irad.gt.3)then + print*,’ERROR: irad must be 0, 1, 2, or 3’ + STOP + endif if(irad.gt.0) call input_radiation(irad) +++ b/CODE-dev/Radiation/input_rad.F90 @@ call QueryGridlist_integer(’iseed’,iseed,48) call QueryGridlist_integer(’isootmodel’,isootmodel,48) call QueryGridlist_integer(’iradeastflux’,iradeastflux,48) + if(irandseed.lt.0.or.irandseed.gt.1)then + print*,’ERROR: irandseed must be 0 or 1’ + STOP + endif + if(isootmodel.lt.0.or.isootmodel.gt.1)then + print*,’ERROR: isootmodel must be 0 or 1’ + STOP + endif + if(iradeastflux.lt.0.or.iradeastflux.gt.1)then + print*,’ERROR: iradeastflux must be 0 or 1’ + STOP + endif 367 + if(isootmodel.eq.0.and.crad.lt.0.0_wp)then + print*,’ERROR: crad must be nonnegative’ + STOP + endif endif If crad=0 is not a supported way to disable gas radiation, tighten that last check to crad.le.0.0_wp. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 9ce10f9 (2026-08-13, radiation bug-list pass); 46f574d (2026-07-29, custom firerad gridlist argument). Radiation mode validation was tightened and the Monte Carlo implementation was substantially reworked in the August radiation pass, including cleaner source selection and firerad gridlist handling. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/input.F90 CODE-dev/Radiation/ ,→ input_rad.F90 index 8a121df..87fe348 100644 +++ b/CODE-dev/Radiation/input_rad.F90 @@ -4,6 +4,7 @@ subroutine input_radiation(irad) use radiation_gridlist_variables, only : icallrad,crad,irandseed, & iseed,isootmodel,iradeastflux + use gridlist_variables, only : wp @@ -12,12 +13,32 @@ subroutine input_radiation(irad) ! Executable Code call QueryGridlist_variable(’icallrad’,icallrad,48) + if(irad.eq.2.and.icallrad.le.0)then + print*,’ERROR: icallrad must be greater than zero for Monte Carlo radiation’ + STOP + endif call QueryGridlist_variable (’crad’,crad,48) call QueryGridlist_variable(’irandseed’,irandseed,48) call QueryGridlist_variable(’iseed’,iseed,48) call QueryGridlist_variable(’isootmodel’,isootmodel,48) call QueryGridlist_variable(’iradeastflux’,iradeastflux,48) + if(irandseed.lt.0.or.irandseed.gt.1)then + print*,’ERROR: irandseed must be 0 or 1’ + STOP + endif + if(isootmodel.lt.0.or.isootmodel.gt.1)then + print*,’ERROR: isootmodel must be 0 or 1’ + STOP + endif + if(iradeastflux.lt.0.or.iradeastflux.gt.1)then + print*,’ERROR: iradeastflux must be 0 or 1’ + STOP + endif 368 + if(isootmodel.eq.0.and.crad.lt.0.0_wp)then + print*,’ERROR: crad must be nonnegative’ + STOP + endif ... [diff excerpt truncated; run the command above for the full commit diff] # 9ce10f9 Significant fixes to Radiation bugs. This commit needs to be vetted thoroughly. # Full command: git show --find-renames --unified=3 9ce10f9 -- CODE-dev/input.F90 CODE-dev/force.F90 ,→ CODE-dev/Radiation/input_rad.F90 index 87fe348..13bc636 100644 +++ b/CODE-dev/Radiation/input_rad.F90 @@ -2,8 +2,8 @@ ! Reads basic user input for vegetation in HIGRAD/FIRETEC !----------------------------------------------------------------------- subroutine input_radiation(irad) - use radiation_gridlist_variables, only : icallrad,crad,irandseed, & - iseed,isootmodel,iradeastflux + use radiation_gridlist_variables, only : icallrad,crad,isootmodel, & + isolar,unixTimeStart,plotLong,plotLat @@ -13,28 +13,31 @@ subroutine input_radiation(irad) ! Executable Code call QueryGridlist_variable(’icallrad’,icallrad,48) + if(irad.eq.2)then + call QueryGridlist_variable(’crad’,crad,48) + call QueryGridlist_variable(’isootmodel’,isootmodel,48) + endif + + ! Solar Heating + call QueryGridlist_variable(’isolar’,isolar,48) + call QueryGridlist_variable(’unixT’,unixTimeStart,48) + call QueryGridlist_variable(’plotLong’,plotLong,48) + call QueryGridlist_variable(’plotLat’,plotLat,48) + +!----------------------------------------------------------------------- +! Everything below here is where others put all the warnings of garbage +! that a user may try unintentionally to run with. It’s put down here +! because in clunks up the code and makes it hard to read. +!----------------------------------------------------------------------- if(irad.eq.2.and.icallrad.le.0)then print*,’ERROR: icallrad must be greater than zero for Monte Carlo radiation’ STOP endif - call QueryGridlist_variable (’crad’,crad,48) - call QueryGridlist_variable(’irandseed’,irandseed,48) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 369 BUG-2026-07-040: SUBGRIDTURB-006: Invalid isa leaves turbulence length scales undefined Source report: aa-Jul8_completed/SUBGRIDTURB-006.md Files • subGridTurb/input_turb.F90 • subGridTurb/rinit_turb.F90 isa is read from the gridlist without range checking: ! subGridTurb/input_turb.F90 13 if(iturb.eq.2)then ! Rod Linn subgrid Turbulence Model 14 call QueryGridlist_integer(’isa’,isa,48) 15 call QueryGridlist_real (’rturbprandtl’,rturbprandtl,48) 16 endif rinitSubTurb only assigns saxy and saz for isa=1:5, but it always uses those values afterward: ! subGridTurb/rinit_turb.F90 24 if(isa.eq.1)then ! saxy=saz=cst 25 saxy(i,j,k)=2.0_wp ... 40 elseif(isa.eq.5)then ! similar to isa=3 with a correction in the lower part of the domain 41 saxy(i,j,k)=(dx*dy)**0.5_wp/ & 42 sqrt(1.0_wp+(saxy(i,j,k)/(0.4_wp/0.23_wp*zcart(z(k),i,j)))**2.0_wp) 43 saz(i,j,k)=zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j)/ & 44 sqrt(1.0_wp+(saxy(i,j,k)/(0.4_wp/0.23_wp*zcart(z(k),i,j)))**2.0_wp) 45 endif 46 sa(i,j,k)=(saxy(i,j,k)**2.0_wp*saz(i,j,k))**(1.0_wp/3.0_wp) Problem If a gridlist sets isa=0, isa=6, or any other unsupported value, none of the assignment branches run. saxy(i,j,k) and saz(i,j,k) are then undefined when line 46 computes sa, and the corrupted scales feed the turbulence coefficients in turbFieldUpdate. This failure mode is silent unless runtime checks happen to catch an uninitialized allocation. Otherwise the simulation can proceed with arbitrary eddy length scales. Validate isa as soon as it is read, and add a defensive else in rinitSubTurb so direct callers cannot bypass the check. diff --git a/CODE-dev/subGridTurb/input_turb.F90 b/CODE-dev/subGridTurb/input_turb.F90 370 --- a/CODE-dev/subGridTurb/input_turb.F90 +++ b/CODE-dev/subGridTurb/input_turb.F90 @@ if(iturb.eq.2)then ! Rod Linn subgrid Turbulence Model call QueryGridlist_integer(’isa’,isa,48) call QueryGridlist_real (’rturbprandtl’,rturbprandtl,48) + if(isa.lt.1.or.isa.gt.5)then + print*,’Unsupported turbulence length-scale option isa=’,isa + print*,’Supported values are isa=1,2,3,4,5’ + STOP + endif endif end subroutine input_subGridTurb +++ b/CODE-dev/subGridTurb/rinit_turb.F90 @@ elseif(isa.eq.5)then ! similar to isa=3 with a correction in the lower part of the domain saxy(i,j,k)=(dx*dy)**0.5_wp/ & sqrt(1.0_wp+(saxy(i,j,k)/(0.4_wp/0.23_wp*zcart(z(k),i,j)))**2.0_wp) saz(i,j,k)=zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j)/ & sqrt(1.0_wp+(saxy(i,j,k)/(0.4_wp/0.23_wp*zcart(z(k),i,j)))**2.0_wp) + else + print*,’Unsupported turbulence length-scale option isa=’,isa + STOP endif sa(i,j,k)=(saxy(i,j,k)**2.0_wp*saz(i,j,k))**(1.0_wp/3.0_wp) Git evidence: fd65110 (2026-08-11, metric/MOA fixes and fuel limits); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). The turbulence length-scale branch for isa=5 was corrected to use height above ground and fixed formulas; the later turbulence cleanup removed unsupported-kernel assumptions. # fd65110 metric and MOA bugs. Biggest one is enforcing limits on the fuels. # Full command: git show --find-renames --unified=3 fd65110 -- CODE-dev/subGridTurb/rinit_turb.F90 index e899a9e..a2cc47b 100644 +++ b/CODE-dev/subGridTurb/rinit_turb.F90 @@ -8,7 +8,7 @@ subroutine rinitSubTurb use linn_turb_variables, only : saxy,saz,sa,sb - use metric_variables, only : z,zedge + use metric_variables, only : z,zedge,zs use xvall, only : xe,iuvel,ivvel,iwvel,ika,ikb,irho @@ -40,19 +40,17 @@ subroutine rinitSubTurb saxy(i,j,k)=(dx*dy*(zcart(zedge(k+1),i,j)- & zcart(zedge(k),i,j)))**(1._wp/3._wp) saxy(i,j,k)=saxy(i,j,k)/sqrt(1._wp+ & 371 - (saxy(i,j,k)/(0.4_wp/0.23_wp*zcart(z(k),i,j)))**2) + (saxy(i,j,k)/(0.4_wp/0.23_wp* & + (zcart(z(k),i,j)-zs(i,j)))**2)) saz(i,j,k)=saxy(i,j,k) elseif(isa.eq.5)then ! similar to isa=3 with a correction in the lower part of the domain saxy(i,j,k)=sqrt(dx*dy) saxy(i,j,k)=saxy(i,j,k)/sqrt(1._wp+ & - (saxy(i,j,k)/(0.4_wp/0.23_wp*zcart(z(k),i,j)))**2) + (saxy(i,j,k)/(0.4_wp/0.23_wp* & + (zcart(z(k),i,j)-zs(i,j)))**2)) saz(i,j,k)=zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j)/ & sqrt(1._wp+(saxy(i,j,k)/ & - (0.4_wp/0.23_wp*zcart(z(k),i,j)))**2) - else - print*,’Unsupported turbulence length-scale option isa=’ & - ,isa + (0.4_wp/0.23_wp*(zcart(z(k),i,j)-zs(i,j)))**2)) endif sa(i,j,k)=(saxy(i,j,k)**2._wp*saz(i,j,k))**(1._wp/3._wp) sb(i,j,k)=0.25_wp # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/subGridTurb/diffuse_turb.F90 CODE-dev/subGridTurb/force_turb.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -43,7 +43,7 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 + integer :: i,j,k,kp1 real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a,sqrtG_KG31a & ,sqrtG_KG32a,sqrtG_KG33a ! edge values of sqrtG_KGij @@ -104,31 +104,25 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) enddo enddo - ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (kk=l when k=l+1) 372 - do k=1,lls+1 - km1=max(1,k-1) - kk=min(k,lls) + ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (k=l when k=l+1) + do k=1,lls do j=1,mp do i=1,np !at k-1/2 ... [diff excerpt truncated; run the command above for the full commit diff] 373 BUG-2026-07-041: SUBGRIDTURB-009: Negative rturbprandtl turns scalar turbulence diffusion into anti-diffusion Source report: aa-Jul8_completed/SUBGRIDTURB-009.md Files • subGridTurb/input_turb.F90 • subGridTurb/force_turb.F90 • subGridTurb/diffuse_turb.F90 • subGridTurb/variables_turb.F90 rturbprandtl is read directly from the gridlist without a range check: ! subGridTurb/input_turb.F90 13 if(iturb.eq.2)then ! Rod Linn subgrid Turbulence Model 14 call QueryGridlist_integer(’isa’,isa,48) 15 call QueryGridlist_real (’rturbprandtl’,rturbprandtl,48) 16 endif The variable is documented as the scalar diffusion multiplier: ! subGridTurb/variables_turb.F90 10 real(wp) :: rturbprandtl = 2.0_wp ! Inverse of turb prandtl number for scalar diffusion calcForceTurb applies it to every non-TKE scalar in the turbulence diffusion loop: ! subGridTurb/force_turb.F90 46 ! turbulent diffusion of all non-wind fields 47 do kv=itheta,nv-1 48 if(kv.eq.ika.or.kv.eq.ikb)then 49 call diffuse(force_xv(:,:,:,kv),xvrho(:,:,:,kv), & 50 1-ih,np+ih,1-ih,mp+ih,l,one) 51 else 52 call diffuse(force_xv(:,:,:,kv),xvrho(:,:,:,kv), & 53 1-ih,np+ih,1-ih,mp+ih,l,rturbprandtl) 54 endif 55 enddo Inside diffuse, cdiff multiplies the divergence of the turbulent flux directly: ! subGridTurb/diffuse_turb.F90 40 real(wp),intent(in) :: cdiff ! ratio between vt of variable iv and simple vt (ie rturbprandtl ,→ for theta and o2) ... 142 r=cdiff*gi(i,j,k)*(dxi*(hxc(i+1,j,k)-hxc(i,j,k))+dyi*(hyc(i,j+1,k)-hyc(i,j,k)) & 143 +dzi*(hzc(i,j,k+1)-hzc(i,j,k))) 374 144 fphi(i,j,k)=fphi(i,j,k)+r Problem A negative rturbprandtl is accepted and passed straight into diffuse as cdiff. Since cdiff is a direct multiplier on the scalar diffusion tendency, a negative value reverses the sign of the operator for theta, emissions/species, water vapor, oxygen, mixture fraction, and other non-TKE scalars. That turns turbulent diffusion into anti-diffusion: gradients are sharpened instead of smoothed. The failure can look like a numerical instability in thermodynamics, emissions, or fire coupling even though the root cause is a bad turbulence input value. The default value is positive, so normal cases are unaffected. The bug is that an invalid gridlist value is not rejected before it reaches the physics. Reject negative scalar diffusion multipliers when reading the turbulence inputs. diff --git a/CODE-dev/subGridTurb/input_turb.F90 b/CODE-dev/subGridTurb/input_turb.F90 --- a/CODE-dev/subGridTurb/input_turb.F90 +++ b/CODE-dev/subGridTurb/input_turb.F90 @@ subroutine input_subGridTurb(iturb) + use gridlist_variables, only : wp use turb_gridlist_variables, only : isa,rturbprandtl @@ if(iturb.eq.2)then ! Rod Linn subgrid Turbulence Model call QueryGridlist_integer(’isa’,isa,48) call QueryGridlist_real (’rturbprandtl’,rturbprandtl,48) + if(rturbprandtl.lt.0.0_wp)then + print*,’ERROR: rturbprandtl must be non-negative for scalar turbulence diffusion’ + STOP + endif endif If zero is not intended to mean "disable turbulent scalar diffusion," tighten this to rturbprandtl.le.0.0_wp instead. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass); 44f9732 (2026-08-25, subgrid diffusion cleanup and small bug fix). Subgrid turbulence validation and diffusion cleanup were applied, including later fixes to scalar-diffusion cross terms and loop bounds. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/subGridTurb/input_turb.F90 diff --git a/CODE-dev/subGridTurb/input_turb.F90 b/CODE-dev/subGridTurb/input_turb.F90 375 index 7ba3a72..c1ee34b 100644 --- a/CODE-dev/subGridTurb/input_turb.F90 +++ b/CODE-dev/subGridTurb/input_turb.F90 @@ -3,6 +3,7 @@ ! HIGRAD/FIRETEC !----------------------------------------------------------------------- subroutine input_subGridTurb(iturb) + use gridlist_variables, only : wp use turb_gridlist_variables, only : isa,rturbprandtl @@ -14,6 +15,15 @@ subroutine input_subGridTurb(iturb) if(iturb.eq.2)then ! Rod Linn subgrid Turbulence Model call QueryGridlist_variable(’isa’,isa,48) call QueryGridlist_variable(’rturbprandtl’,rturbprandtl,48) + if(rturbprandtl.lt.0.0_wp)then + print*,’ERROR: rturbprandtl must be non-negative for scalar turbulence diffusion’ + STOP + endif + if(isa.lt.1.or.isa.gt.5)then + print*,’Unsupported turbulence length-scale option isa=’,isa + print*,’Supported values are isa=1,2,3,4,5’ + STOP + endif endif end subroutine input_subGridTurb # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/subGridTurb/force_turb.F90 ,→ CODE-dev/subGridTurb/diffuse_turb.F90 +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -43,7 +43,7 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 + integer :: i,j,k,kp1 real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a,sqrtG_KG31a & ,sqrtG_KG32a,sqrtG_KG33a ! edge values of sqrtG_KGij @@ -104,31 +104,25 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) enddo enddo - ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (kk=l when k=l+1) - do k=1,lls+1 - km1=max(1,k-1) - kk=min(k,lls) + ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (k=l when k=l+1) + do k=1,lls do j=1,mp do i=1,np !at k-1/2 - sqrtG_KG31a=0.5_wp*(sqrtG_Kxy(i,j,kk)*c13(i,j)*gmul(kk)+sqrtG_Kxy(i,j,km1)*c13(i,j)*gmul(km1) 376 ,→ ) - sqrtG_KG32a=0.5_wp*(sqrtG_Kxy(i,j,kk)*c23(i,j)*gmul(kk)+sqrtG_Kxy(i,j,km1)*c23(i,j)*gmul(km1) ,→ ) - sqrtG_KG33a=0.5_wp*(sqrtG_KG33(i,j,kk)+sqrtG_KG33(i,j,km1)) + sqrtG_KG31a=0.5_wp*(sqrtG_Kxy(i,j,k)*c13(i,j)*gmul(k)+sqrtG_Kxy(i,j,k-1)*c13(i,j)*gmul(k-1)) + sqrtG_KG32a=0.5_wp*(sqrtG_Kxy(i,j,k)*c23(i,j)*gmul(k)+sqrtG_Kxy(i,j,k-1)*c23(i,j)*gmul(k-1)) + sqrtG_KG33a=0.5_wp*(sqrtG_KG33(i,j,k)+sqrtG_KG33(i,j,k-1)) !noise filter for px and py - phi_diff1 = phi(i+1,j,kk)-phi(i-1,j,kk) - if(abs(phi_diff1*1d+6).LT.phi(i,j,kk)) phi_diff1=0.0_wp - phi_diff2 = phi(i+1,j,km1)-phi(i-1,j,km1) - if(abs(phi_diff2*1d+6).LT.phi(i,j,kk)) phi_diff2=0.0_wp + phi_diff1 = phi(i+1,j,k)-phi(i-1,j,k) + phi_diff2 = phi(i+1,j,k-1)-phi(i-1,j,k-1) px = 0.5_wp * (phi_diff1 + phi_diff2) * hdxi ... [diff excerpt truncated; run the command above for the full commit diff] # 44f9732 Cleaning up unused variables and a small bug in the subgrid turbulent diffusion. # Full command: git show --find-renames --unified=3 44f9732 -- CODE-dev/subGridTurb/diffuse_turb.F90 index cca0b8e..09b9fbc 100644 +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -39,19 +39,18 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) real(wp),intent(in) :: phi(il:iu,jl:ju,0:lls) ! variable to diffuse (defined on 0:l) real(wp),intent(in) :: cdiff ! ratio between vt of variable iv and simple vt (ie rturbprandtl for ,→ theta and o2) + integer :: i,j,k,kp1,km1 + real(wp) :: hdxi,hdyi,hdzi + real(wp) :: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a, & + sqrtG_KG31a,sqrtG_KG32a,sqrtG_KG33a ! edge values of sqrtG_KGij + real(wp) :: px,py,pz ! phi derivative on model grid + real(wp) :: r + real(wp) :: phi_diff1, phi_diff2, phi_diff3, phi_diff4 ! noise filter + real(wp),allocatable:: & hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 - integer :: i,j,k,kp1 - real(wp) :: hdxi,hdyi,hdzi - real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a, & - sqrtG_KG31a,sqrtG_KG32a,sqrtG_KG33a ! edge values of sqrtG_KGij - real(wp):: px,py,pz ! phi derivative on model grid - real(wp) ::r - - !noise filter - real(wp) :: phi_diff1, phi_diff2, phi_diff3, phi_diff4 ! Executable Code ... [diff excerpt truncated; run the command above for the full commit diff] 377 BUG-2026-07-042: TINIT-003: Invalid top-absorber settings silently disable or corrupt damping Source report: aa-Jul8_completed/TINIT-003.md Files • tinit.F90 • input.F90 • variables.F90 input.F90 reads the top absorber controls without checking their ranges: call QueryGridlist_integer(’ibctopopen’,ibctopopen,48) call QueryGridlist_integer(’iab’,iab,48) call QueryGridlist_real (’zab’,zab,48) call QueryGridlist_real (’tow’,tow,48) tinit.F90 has no case default for a bad iab value. In the June 26 tree only iab=1:3 do anything in the closed-top branch: case(1) relaxxv(i,j,k,:)=t1/((zb-zab)+1.e-10_wp)/tow**2.0_wp case(2) relaxxv(i,j,k,:)=0.05_wp*exp(-t1/(-(zb-zab)/log(tow**(-2.0_wp)))) case(3) relaxxv(i,j,k,1:3)=0.66_wp*0.25_wp*(1.0_wp-cos(pi*(zl-zab)/(zb-zab)))/tow The open-top branch still divides by tow: relaxxv(i,j,k,3)=0.66_wp*0.25_wp*(1.0_wp-cos(pi*(zl-zab)/(zb-zab)))/tow Problem Several invalid settings survive input and fail later in less obvious ways: • Any iab value without an implemented branch silently leaves the closed-top absorber unset because the select case has no default. • tow=0 divides by zero in options 1 and 3, the open-top branch, and lateral boundary option 2. • tow<0 can produce negative damping for /tow branches and NaNs in tow**(-2.0_wp) because that expression uses a real exponent. • iab=2 with tow=1 evaluates log(1) in the denominator, causing division by zero. 378 Older 1.5.x trees also had an iab=4 scalar/theta top-damper path using zabt. If that path is restored as in TINIT-004, iab=4 should be treated as valid. If it is not restored, iab=4 should be rejected instead of silently doing nothing. The result is either no top damping, invalid relaxation coefficients, or damping with the wrong sign. Because boundary.F90 applies relaxxv every small step, these bad coefficients directly affect the momentum and scalar forcing. Fail early in input.F90, while the bad values are still clearly tied to the gridlist. +++ b/CODE-dev/input.F90 @@ call QueryGridlist_integer(’ibctopopen’,ibctopopen,48) call QueryGridlist_integer(’iab’,iab,48) call QueryGridlist_real (’zab’,zab,48) call QueryGridlist_real (’tow’,tow,48) + if(iab.lt.1.or.iab.gt.4) then + print*,’INVALID TOP ABSORBER OPTION: iab must be in the range 1:4’ + STOP + endif + if(tow.le.0.0_wp) then + print*,’INVALID RELAXATION PARAMETER: tow must be positive’ + STOP + endif + if(iab.eq.2.and.tow.le.1.0_wp) then + print*,’INVALID TOP ABSORBER PARAMETER: iab=2 requires tow > 1’ + STOP + endif if(ibc_top.eq.7825) ibc_top = ibcy Use iab.gt.3 instead of iab.gt.4 if the legacy iab=4 scalar-damper path from TINIT-004 is intentionally not restored. If ibctopopen is meant to make iab irrelevant, move the iab range check under if(ibctopopen ,→ .eq.0) but keep the tow check because the open-top branch still uses it. The top-absorber branch in CODE-dev/tinit.F90 now validates unsupported modes and fixes the expo- nential profile denominator/sign behavior. # a8b1c58 tinitF90, topoF90, and variablesF90 ’bug lists’. # Full command: git show --find-renames --unified=3 a8b1c58 -- CODE-dev/tinit.F90 CODE-dev/variables. ,→ F90 +++ b/CODE-dev/tinit.F90 @@ -7,7 +7,7 @@ subroutine tinit 379 + use constants, only : pi,tolerance @@ -63,7 +63,7 @@ subroutine tinit write(*,*) ’WARNING: top absorption layer is inactive.’ - write(*,*) ’ zab is at or above the model top.’ + write(*,*) ’ zab is at or above the domain top.’ write(*,*) ’ zab = ’, zab, ’ zb = ’, zb write(*,*) ’ No vertical/top damping will be applied.’ write(*,*) ’ To enable it, set zab < zb in the gridlist.’ @@ -77,17 +77,13 @@ subroutine tinit ! Upper dampers - t1=max(0.0_wp,zl-zab) - print*,’ERROR: iab=2 requires tow > 1’ + t1=max(0._wp,zl-zab) case(1) - relaxxv(i,j,k,:)=t1/((zb-zab)+1.e-10_wp)/tow**2._wp + relaxxv(i,j,k,:)=t1/((zb-zab)+tolerance)/tow**2._wp case(2) relaxxv(i,j,k,:)=0.05_wp* & - exp(-t1/(-(zb-zab)/log(tow**(-2._wp)))) + exp(-t1/((zb-zab)/log(tow**(-2._wp)))) case(3) relaxxv(i,j,k,1:3)= & ... [diff excerpt truncated; run the command above for the full commit diff] 380 BUG-2026-07-043: TINIT-008: Over-wide lateral sponge regions can cover the whole domain Source report: aa-Jul8_completed/TINIT-008.md Files • tinit.F90 • input.F90 • variables.F90 nr is the lateral relaxation width: integer :: nr = 5 ! Number of cells for lateral relaxation (irlx, irly) tinit.F90 applies the bottom/left sponge to cells whose global index is at most nr: if(ja.le.nr)then relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(2,ja)) endif ... if(ia.le.nr)then relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(3,ia)) endif It applies the top/right sponge to cells whose global index is within nr cells of the far side: if(ja.gt.m-nr)then relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(1,m-ja+1)) endif ... if(ia.gt.n-nr)then relaxxv(i,j,k,it)=max(relaxxv(i,j,k,it),relb(4,n-ia+1)) endif input.F90 does not validate nr against n or m. Problem If nr is too large for the horizontal domain, the lateral sponge can cover the whole domain instead of only boundary-adjacent cells. For example, if both left and right boundaries are active and 2*nr >= n, every x-column is in at least one x-direction sponge. If nr >= n, even a single active x-side sponge covers every x-column. The same issue applies in y with m. The index expressions remain in bounds because relb is allocated to nr+1, so this does not necessarily 381 crash. It silently turns a boundary buffer into a domain-wide relaxation force toward xe, which can suppress interior dynamics and make small-domain tests misleading. After resolving the explicit boundary options, reject lateral sponge widths that leave no undamped interior in an active direction. +++ b/CODE-dev/input.F90 @@ ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax @@ if(ibc_top.eq.7825) ibc_top = ibcy if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + x_left_relax=(ibc_left.ge.1.and.ibc_left.lt.5) + x_right_relax=(ibc_right.ge.1.and.ibc_right.lt.5) + y_bot_relax=(ibc_bot.ge.1.and.ibc_bot.lt.5) + y_top_relax=(ibc_top.ge.1.and.ibc_top.lt.5) + if((x_left_relax.or.x_right_relax).and.nr.ge.n) then + print*,’INVALID RELAXATION WIDTH: nr must be smaller than n’ + STOP + endif + if((y_bot_relax.or.y_top_relax).and.nr.ge.m) then + print*,’INVALID RELAXATION WIDTH: nr must be smaller than m’ + STOP + endif + if(x_left_relax.and.x_right_relax.and.2*nr.ge.n) then + print*,’INVALID RELAXATION WIDTH: left/right sponge regions cover the x domain’ + STOP + endif + if(y_bot_relax.and.y_top_relax.and.2*nr.ge.m) then + print*,’INVALID RELAXATION WIDTH: bottom/top sponge regions cover the y domain’ + STOP + endif if(ibc_top.eq.0.and.ibc_bot.ne.0) then If full-domain nudging is ever desired, it should be a separate named option rather than an accidental consequence of an over-wide lateral boundary buffer. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); a8b1c58 (2026-08-17, tinit/topo/variables bug-list pass). The relaxation-width inputs were covered by the validation pass and by the later tinit cleanup so over-wide or invalid sponge settings are caught instead of silently corrupting damping. 382 # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/tinit.F90 CODE-dev/input.F90 ,→ CODE-dev/variables.F90 +++ b/CODE-dev/input.F90 @@ -9,6 +9,7 @@ subroutine input ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input ! General I/O call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP + endif call QueryGridlist_variable(’ihdf’,ihdf,48) ! Relaxation @@ -52,6 +61,44 @@ subroutine input if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + call validate_lateral_ibc(’ibc_top’,ibc_top) + call validate_lateral_ibc(’ibc_bot’,ibc_bot) + call validate_lateral_ibc(’ibc_left’,ibc_left) + call validate_lateral_ibc(’ibc_right’,ibc_right) + ... [diff excerpt truncated; run the command above for the full commit diff] # a8b1c58 tinitF90, topoF90, and variablesF90 ’bug lists’. # Full command: git show --find-renames --unified=3 a8b1c58 -- CODE-dev/tinit.F90 CODE-dev/variables. ,→ F90 +++ b/CODE-dev/tinit.F90 @@ -7,7 +7,7 @@ subroutine tinit + use constants, only : pi,tolerance 383 @@ -63,7 +63,7 @@ subroutine tinit write(*,*) ’WARNING: top absorption layer is inactive.’ - write(*,*) ’ zab is at or above the model top.’ + write(*,*) ’ zab is at or above the domain top.’ write(*,*) ’ zab = ’, zab, ’ zb = ’, zb write(*,*) ’ No vertical/top damping will be applied.’ write(*,*) ’ To enable it, set zab < zb in the gridlist.’ @@ -77,17 +77,13 @@ subroutine tinit ! Upper dampers - t1=max(0.0_wp,zl-zab) - print*,’ERROR: iab=2 requires tow > 1’ + t1=max(0._wp,zl-zab) case(1) - relaxxv(i,j,k,:)=t1/((zb-zab)+1.e-10_wp)/tow**2._wp + relaxxv(i,j,k,:)=t1/((zb-zab)+tolerance)/tow**2._wp case(2) relaxxv(i,j,k,:)=0.05_wp* & - exp(-t1/(-(zb-zab)/log(tow**(-2._wp)))) + exp(-t1/((zb-zab)/log(tow**(-2._wp)))) case(3) relaxxv(i,j,k,1:3)= & ... [diff excerpt truncated; run the command above for the full commit diff] 384 BUG-2026-07-044: VARIABLES-008: icfmeflag promises slice-grid input but has no runtime consumer Source report: aa-Jul8_completed/VARIABLES-008.md Files • variables.F90 • input.F90 variables.F90 declares a gridlist flag for reading grid slices: integer :: icfmeflag = 0 ! Option to read-in slices of the grid input.F90 reads it: call QueryGridlist_string (’outname’,outname,48) call QueryGridlist_string (’restartfile’,restartfile,48) call QueryGridlist_integer(’icfmeflag’,icfmeflag,48) call QueryGridlist_integer(’ihdf’,ihdf,48) But in the current source tree, there are no other references to icfmeflag. Problem icfmeflag is accepted as a configuration option, but it does not control any code path. A user can enable the documented "read-in slices of the grid" option and the model will silently run the normal initialization/restart path instead. That is dangerous for workflows that expect a slice-based initialization or partial-domain input. The run can complete using the wrong initial condition while the gridlist still suggests that slice input was enabled. If slice-grid input is not supported in this branch, reject nonzero values during input parsing: +++ b/CODE-dev/input.F90 @@ call QueryGridlist_string (’outname’,outname,48) call QueryGridlist_string (’restartfile’,restartfile,48) call QueryGridlist_integer(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP 385 + endif call QueryGridlist_integer(’ihdf’,ihdf,48) If slice input is intended, replace the guard with a real branch that initializes the grid from the slice files and documents how it interacts with irst, restartfile, topofile, and MPI decomposition. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs). The July validation pass added a runtime guard for this unsupported slice-grid path rather than implementing a full consumer for icfmeflag. # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/variables.F90 CODE-dev/input. ,→ F90 +++ b/CODE-dev/input.F90 @@ -9,6 +9,7 @@ subroutine input ! Local Variables + logical :: x_left_relax,x_right_relax,y_bot_relax,y_top_relax ! Executable Code open(unit=48,file="gridlist",action="read") @@ -32,11 +33,19 @@ subroutine input ! General I/O call QueryGridlist_variable(’frqoutput’,frqoutput,48) + if(frqoutput.le.0)then + print*,’ERROR: frqoutput must be greater than zero’ + STOP + endif call QueryGridlist_variable(’frqfilstr’,frqfilstr,48) call QueryGridlist_variable(’outname’,outname,48) call QueryGridlist_variable(’restartfile’,restartfile,48) call QueryGridlist_variable(’icfmeflag’,icfmeflag,48) + if(icfmeflag.ne.0)then + print*,’ERROR: icfmeflag is configured, but slice-grid input is not implemented in this tree’ + STOP + endif call QueryGridlist_variable(’ihdf’,ihdf,48) ! Relaxation @@ -52,6 +61,44 @@ subroutine input if(ibc_bot.eq.7825) ibc_bot = ibcy if(ibc_left.eq.7825) ibc_left = ibcx if(ibc_right.eq.7825) ibc_right = ibcx + + call validate_lateral_ibc(’ibc_top’,ibc_top) + call validate_lateral_ibc(’ibc_bot’,ibc_bot) + call validate_lateral_ibc(’ibc_left’,ibc_left) + call validate_lateral_ibc(’ibc_right’,ibc_right) 386 + ... [diff excerpt truncated; run the command above for the full commit diff] 387 FIRETEC Bug Resolution Log July 2026 BUG-2026-07-045: VARIABLES-009: isensor > 1 reads sensor input but never initializes or writes sensors Source report: aa-Jul8_completed/VARIABLES-009.md Files • variables.F90 • input.F90 • rinit.F90 • compress.F90 • Sensors/input_sense.F90 variables.F90 defines the sensor switch as a generic integer: integer :: isensor = 0 ! Switch for using sensors input.F90 treats any positive value as enabled: call QueryGridlist_integer(’isensor’,isensor,48) if(isensor.gt.0) call input_sensors Sensors/input_sense.F90 then allocates and reads the sensor configuration: call QueryGridlist_integer(’se_frq_write’,se_frq_write,48) call QueryGridlist_integer(’numsensors’,numsensors,48) call QueryGridlist_integer(’ncycle’,ncycle,48) call QueryGridlist_integer(’locfile’,locfile,48) allocate(se_xloc(numsensors)) allocate(se_yloc(numsensors)) allocate(se_zloc(numsensors)) But initialization and writing only run for exactly isensor == 1: ! rinit.F90 if(isensor.eq.1) call rinitSense ! compress.F90 if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then endif 388 Problem isensor = 2 or any other positive unsupported value takes the input path, so the run reads and allocates sensor configuration. Later, the model skips rinitSense and skips sensors_write, because those guards only accept isensor.eq.1. That gives users a silent no-op mode: sensors look enabled during input parsing, but no sensor ownership is initialized and no sensor data are written. If future code assumes the positive input guard means sensor arrays are fully initialized, the inconsistent state can also become an allocation/initialization hazard. If only one sensor mode is supported, validate isensor immediately after reading it and keep the downstream eq.1 guards. +++ b/CODE-dev/input.F90 @@ ! Sensors call QueryGridlist_integer(’isensor’,isensor,48) + if(isensor.ne.0.and.isensor.ne.1)then + print*,’ERROR: isensor must be 0=off or 1=enabled’ + STOP + endif if(isensor.gt.0) call input_sensors Git evidence: 2d390f3 (2026-08-18, sensor recording/user-friendliness fixes); 4a0c95f (2026-08-17, sensor out-of-domain stop). Sensor initialization and output were made operational and safer, including domain checks, file I/O checks, header handling, and per-call CSV row writing. # 2d390f3 Finished bug list making sensors more user friendly and fixing the way they are recorded. # Full command: git show --find-renames --unified=3 2d390f3 -- CODE-dev/Sensors/input_sense.F90 index ffd82ce..fff5ab9 100644 +++ b/CODE-dev/Sensors/input_sense.F90 @@ -6,10 +6,11 @@ subroutine input_sensors use QueryGridlist_mod, only : QueryGridlist_variable, & + use msga_variables, only : mpi_rank ! Local Variables - integer :: s + integer :: s, ios ! Executable Code 389 call QueryGridlist_variable(’se_frq_write’,se_frq_write,48) @@ -30,9 +31,20 @@ subroutine input_sensors call QueryGridlist_variable(’sensorlocs’,sensorlocs,48) - open(unit=7825,file=sensorlocs, form=’formatted’,status=’old’) + open(unit=7825,file=sensorlocs,form=’formatted’,status=’old’, & + iostat=ios) + if(ios.ne.0) then + write(*,*) ’ERROR: unable to open sensor location file: ’, & + trim(sensorlocs) + stop + endif do s=1,numsensors - read(7825,*) se_xloc(s),se_yloc(s),se_zloc(s) + read(7825,*,iostat=ios) se_xloc(s),se_yloc(s),se_zloc(s) + if(ios.ne.0) then + write(*,*) ’ERROR: failed reading sensor location ’, s, & + ’ from ’,trim(sensorlocs) + stop + endif enddo else @@ -40,7 +52,6 @@ subroutine input_sensors call QueryGridlist_array(’se_yloc’,se_yloc,numsensors,48) ... [diff excerpt truncated; run the command above for the full commit diff] # 4a0c95f Added stop if sensors are out of domain and removed fuzz from subroutine finding sensor ,→ processors. # Full command: git show --find-renames --unified=3 4a0c95f -- CODE-dev/Sensors/input_sense.F90 index 5de684e..c025f37 100644 +++ b/CODE-dev/Sensors/input_sense.F90 @@ -2,9 +2,11 @@ ! Reads basic user input for emissions in HIGRAD/FIRETEC !----------------------------------------------------------------------- subroutine input_sensors + use gridlist_variables, only : n,m,l,dx,dy,dz use QueryGridlist_mod, only : QueryGridlist_variable, & + use msga_variables, only : mpi_rank ! Local Variables @@ -40,4 +42,13 @@ subroutine input_sensors call QueryGridlist_array(’se_zloc’,se_zloc,numsensors,48) endif + !---------------- Below are warnings and stop functions ----------------! + do s=1,numsensors + if((se_xloc(s).gt.n*dx).or.(se_yloc(s).gt.m*dy).or.(se_zloc(s).gt.l*dz)) then + print*,’SENSOR’,s,’OUTSIDE OF DOMAIN’ + print*,’LOCATION x,y,z:’,se_xloc(s),se_yloc(s),se_zloc(s) + STOP + endif + enddo + 390 FIRETEC Bug Resolution Log July 2026 end subroutine input_sensors 391 BUG-2026-07-046: VEGETATION-007: Fire chemistry can use the u velocity slot as oxygen Source report: aa-Jul8_completed/VEGETATION-007.md Files • Vegetation/burn_veg.F90 • definearray.F90 • variables.F90 • force.F90 The xvall module initializes optional species indices to 1: integer :: itheta=1,ika=1,ikb=1,iO2=1,iH2O=1,irho=1 xvpointers only changes iO2 if an emitted species is named O2: if(iemissions.gt.0)then iEmitStart = nv+1 if(nEmit.gt.0)then ... do i=1,nEmit if(spEmit(i).eq.’O2’) iO2 = iEmitStart-1+i if(spEmit(i).eq.’H2O’) iH2O = iEmitStart-1+i enddo endif endif ... iuvel = 1 burnFuel always uses iO2 when ifire.eq.1: hydroFactor=exp(-rno/rnfuel*psif* & xvfuel(ift,i,j,k,irhof)/xv(i,j,k,iO2)) slambdaof=sum(xvfuel(:,i,j,k,irhof))*xv(i,j,k,iO2) & /(sum(xvfuel(:,i,j,k,irhof))/rnfuel+xv(i,j,k,iO2)/rno)**2 ... force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno The fire path is enabled independently of emissions: if(ifire.eq.1)then call evapPDF(...) call burnFuel(...) endif 392 Problem ifire defaults to enabled, while iemissions defaults to disabled. In that common configuration, iO2 remains 1, which is also the u velocity/momentum slot. burnFuel then treats the u field as oxygen density. Depending on wind sign and magnitude, this can produce negative oxygen, division by zero, exp overflow, or an oxygen sink applied to velocity instead of a species tracer. The water-vapor paths try to avoid this sentinel with if(iH2O.ne.1), but the fire chemistry has no equivalent guard for iO2. Fail fast when fire is enabled without a real O2 transported species. A broader fix should change optional indices to a 0 sentinel, but this local guard prevents silent velocity-as-oxygen chemistry. +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ - use xvall, only : ikb,iO2,irho,irhof,irhow,isies,itheta + use xvall, only : ikb,iO2,irho,irhof,irhow,isies,itheta,iuvel @@ real(wp) :: cfchar=0.015_wp*6.0_wp ! Coef. of mass reaction rates. (found through ! Executable Code + if(iO2.eq.iuvel)then + print*,’ERROR: ifire=1 requires an O2 transported species’ + print*,’ Add O2 to spEmit/iemissions or disable fire chemistry.’ + STOP + endif + do k=1,lls Longer term, initialize iO2 and iH2O to 0 in variables.F90, test iO2.gt.0, and validate the required species once during setup. Git evidence: 561333f (2026-08-01, heat-source, no-emission, and O2 fixes); 9ce10f9 (2026-08-13, radiation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). The no-explicit-O2 path now initializes iO2 safely and uses a default oxygen fraction where needed; later thermodynamics/emissions changes make humidity and O2 species handling explicit. # 561333f finally fixed my splashing issue # Full command: git show --find-renames --unified=3 561333f -- CODE-dev/definearray.F90 CODE-dev/force ,→ .F90 +++ b/CODE-dev/definearray.F90 @@ -78,6 +78,7 @@ subroutine xvpointers 393 ! Executable Code + iO2 = 0 ! Transported array pointers iuvel = 1 ivvel = 2 index cc799bb..87aa64b 100644 +++ b/CODE-dev/force.F90 @@ -128,10 +128,11 @@ end subroutine small_explicit_forcings !----------------------------------------------------------------------- + use heatsource_gridlist_variables, only : starttime_hs use vegetation_gridlist_variables, only : nfuel,ifire,imoist use forcings, only : forceSE_xv,forceLE_xv,forceSE_xvfuel, & + use gridsetup, only : np,mp,time use xvall, only : xv,xvrho,xvfuel,nv,iuvel,ivvel,iwvel,irho, & nvfuel,irhof,isies,iH2O,irhow,irhof @@ -150,9 +151,10 @@ subroutine large_explicit_forcings ! Ignite new cells if(ifire.eq.1) call ignite(forceLE_xvfuel(:,:,:,:,isies),xvfuel, & - if(iheatsource.ge.1) & + if(iheatsource.ge.1.and.any(time.ge.starttime_hs))then call heatSource(iheatsource, & - forceLE_xv(1:np,1:mp,:,:),1,np,1,mp,l,nv) + forceLE_xv,1,np,1,mp,l,nv) + endif !!!!! Firebrand Forcings !!!!! if(ifbrand.eq.1) call firebrand(xvrho(:,:,:,iuvel), & # 9ce10f9 Significant fixes to Radiation bugs. This commit needs to be vetted thoroughly. # Full command: git show --find-renames --unified=3 9ce10f9 -- CODE-dev/definearray.F90 CODE-dev/force ,→ .F90 index 816c91d..b5fd714 100644 +++ b/CODE-dev/definearray.F90 @@ -66,8 +66,8 @@ end subroutine definearray !----------------------------------------------------------------------- subroutine xvpointers use gridlist_variables, only : iturb,iemissions - use vegetation_gridlist_variables, only : ifire,imoist,inonlocal - use radiation_gridlist_variables, only : irad + use vegetation_gridlist_variables, only : ifire,inonlocal + use radiation_gridlist_variables, only : irad,isolar use emission_gridlist_variables, only : nEmit,nAero,nMAero use emission_general_variables, only : spEmit,spAero use xvall @@ -144,7 +144,7 @@ subroutine xvpointers irhof = 1 irhow = 2 nvfuel = 2 - if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then 394 + if(isolar.eq.1.or.ifire.eq.1.or.irad.gt.0)then isies = nvfuel+1 nvfuel = nvfuel+1 endif index b765a72..7b542f4 100644 +++ b/CODE-dev/force.F90 @@ -133,7 +133,8 @@ end subroutine small_explicit_forcings use heatsource_gridlist_variables, only : starttime_hs + use vegetation_gridlist_variables, only : nfuel,ifire + use radiation_gridlist_variables, only : isolar use forcings, only : forceSE_xv,forceLE_xv,forceSE_xvfuel, & @@ -170,13 +171,13 @@ subroutine large_explicit_forcings !!!!! Solar heating and evaporation Forcings !!!!! ... [diff excerpt truncated; run the command above for the full commit diff] # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/variables.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo index afe73ea..5210fb3 100644 ... [diff excerpt truncated; run the command above for the full commit diff] 395 BUG-2026-07-047: VEGETATION-009: Invalid ifuel leaves psif undefined Source report: aa-Jul8_completed/VEGETATION-009.md Files • Vegetation/burn_veg.F90 • Vegetation/input_veg.F90 • Vegetation/variables_veg.F90 ifuel is user-configurable: integer :: ifuel = 1 ! Option for burning fuel pdf choice ... call QueryGridlist_integer(’ifuel’,ifuel,48) burnFuel calls computePsif and immediately uses the result: call computePsif(psif,temps(ift,i,j,k)) ... ff=cf*xvfuel(ift,i,j,k,irhof)*xv(i,j,k,iO2)*sigmac*psif* & slambdaof/(100.0_wp*sizescale(ift,i,j,k)**2.0_wp) computePsif assigns psif only for ifuel values 1, 2, or 3: if(ifuel.eq.1)then ... psif=... elseif(ifuel.eq.2)then ... psif = c1*(c3+er) elseif(ifuel.eq.3)then ... psif = 1.0_wp endif Problem If a gridlist sets ifuel to any value other than 1, 2, or 3, computePsif returns without assigning psif. That leaves burnFuel using an undefined local value in the fuel reaction rate. Depending on compil- er/runtime state, the burn rate can be random, negative, enormous, or NaN. Because this is inside the innermost burn loop, one bad option can poison the whole simulation quickly. 396 The minimal fix is to reject unsupported ifuel values during vegetation input processing so the bad option never reaches the burn loop. +++ b/CODE-dev/Vegetation/input_veg.F90 @@ endif if(idiffsies.eq.1.and.ifire.ne.1)then print*,’ERROR: idiffsies=1 requires ifire=1’ STOP endif call QueryGridlist_variable(’ifuel’,ifuel,48) + if(ifuel.lt.1.or.ifuel.gt.3)then + print*,’ERROR: ifuel must be 1, 2, or 3; received ’,ifuel + STOP + endif call QueryGridlist_variable(’ignfile’,ignfile,48) This catches the bad option at setup time instead of letting burn_veg encounter an undefined psif. A defense-in-depth guard in computePsif is still reasonable, but it is no longer the primary fix. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 798df8b (2026-08-18, vegetation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/Vegetation/input_veg.F90 index 9c3e25c..cca6c8b 100644 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -5,7 +5,7 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ilh,iuh,jlh,juh,ku,il,iu,jl,ju,lls,nvp,nvf,nfuel) use vegetation_gridlist_variables, only : cpwood - use xvall, only : ikb,iO2,irho,irhof,irhow,isies,itheta + use xvall, only : ikb,iO2,irho,irhof,irhow,isies,itheta,iuvel use thermo_variables, only : cp_gas,cv_gas,pr use fuel_variables, only : temps,rhoFuelInitial,rno,rnfuel, & sizeScale,hf,tcrit @@ -39,6 +39,12 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & real(wp) :: cfchar=0.015_wp*6.0_wp ! Coef. of mass reaction rates. (found through ! Executable Code + if(iO2.eq.iuvel)then + print*,’ERROR: ifire=1 requires an O2 transported species’ + print*,’ Add O2 to spEmit/iemissions or disable fire chemistry.’ + STOP 397 + endif + do k=1,lls do j=jl,ju do i=il,iu index 7c0602c..7cf24df 100644 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -2,6 +2,7 @@ ! Reads basic user input for vegetation in HIGRAD/FIRETEC !----------------------------------------------------------------------- + use gridlist_variables, only : wp use vegetation_gridlist_variables, only : nfuel,ivegread,rhoMicro, & cpwood,ifire,inonlocal,idiffsies,ifuel,ignfile,imoist, & @@ -13,20 +14,51 @@ subroutine input_vegetation() ! Executable Code call QueryGridlist_variable(’nfuel’,nfuel,48) call QueryGridlist_variable(’ivegread’,ivegread,48) ... [diff excerpt truncated; run the command above for the full commit diff] # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/Vegetation/diffusesies_veg.F90 ,→ CODE-dev/Vegetation/evaporation_veg.F90 CODE-dev/subGridTurb/diffuse_turb.F90 diff --git a/CODE-dev/Vegetation/diffusesies_veg.F90 b/CODE-dev/Vegetation/diffusesies_veg.F90 index 4cf245c..de6493c 100644 --- a/CODE-dev/Vegetation/diffusesies_veg.F90 +++ b/CODE-dev/Vegetation/diffusesies_veg.F90 @@ -24,10 +24,10 @@ subroutine diffusesies(xvrhoFuel,xvrhoWater,frhof,fsies, & real(wp),allocatable :: hxc(:,:,:),hyc(:,:,:) ! Executable Code - allocate(tempsdiff(il:iu,jl:ju,lls)); tempsdiff=0.0_wp + allocate(tempsdiff(il:iu,jl:ju,lls)); tempsdiff=0._wp - allocate(hxc(il:iu+1,jl:ju,lls)); hxc=0.0_wp - allocate(hyc(il:iu,jl:ju+1,lls)); hyc=0.0_wp + allocate(hxc(il:iu+1,jl:ju,lls)); hxc=0._wp + allocate(hyc(il:iu,jl:ju+1,lls)); hyc=0._wp do ift=1,nfuel call update(temps(ift,:,:,:),iu,ju,lls, & @@ -68,7 +68,7 @@ subroutine diffusesies(xvrhoFuel,xvrhoWater,frhof,fsies, & do j=jl,ju do i=il,iu tempsdiff(i,j,k)=tempsdiff(i,j,k) & ! units [J*s ,→ ^-1*m^-3] - +max(0.0_wp,gi(i,j,k)*((hxc(i+1,j,k)-hxc(i,j,k))*dxi & ! ,→ originally there was a random 2 in front of max that was removed and combined into the coef ,→ term + +max(0._wp,gi(i,j,k)*((hxc(i+1,j,k)-hxc(i,j,k))*dxi & ! originally ,→ there was a random 2 in front of max that was removed and combined into the coef term +(hyc(i,j+1,k)-hyc(i,j,k))*dyi)) enddo enddo 398 +++ b/CODE-dev/Vegetation/evaporation_veg.F90 @@ -49,7 +49,7 @@ subroutine evapPDF(force_xv,force_xvfuel,xvfuel,ilh,iuh,jlh,juh,ku, & *(psiw-xvfuel(it,i,j,k,ipsiw)) & else - fw=0.0_wp + fw=0._wp endif ! Energy Changes @@ -180,7 +180,7 @@ subroutine evapBulk(force_xv,force_xvfuel,xv,xvrho,xvfuel, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 399 BUG-2026-07-048: VEGETATION-013: Ignition file coordinates are never bounds-checked before indexing fuel arrays Source report: aa-Jul8_completed/VEGETATION-013.md Files • Vegetation/rinit_veg.F90 • Vegetation/ignite_veg.F90 rinitVeg reads ignition locations directly from the ignition file: do i=1,nIgn read(1000,*) ignLocation(i,1),ignLocation(i,2),ignLocation(i,3), & ignTime(i) enddo ignite later converts the global x/y coordinates to local indices and uses the z coordinate directly as k: if(time.ge.ignTime(iign).and. & time.le.ignTime(iign)+(targetTemp-tambient)/rampRate.and. & npos.eq.(ignLocation(iign,1)-1)/np+1.and. & mpos.eq.(ignLocation(iign,2)-1)/mp+1)then i=mod(ignLocation(iign,1)-1,np)+1 j=mod(ignLocation(iign,2)-1,mp)+1 k=ignLocation(iign,3) do ift=1,nfuel temps(ift,i,j,k)=max(temps(ift,i,j,k), & min((time-ignTime(iign))*rampRate+tambient,targetTemp)) Problem Ignition coordinates are treated as trusted input. A typo in the ignition file can create out-of-bounds fuel-array accesses: • ignLocation(:,3) < 1 or > lfuel is assigned directly to k and then used to index temps, xvfuel, and force_sies. • ignLocation(:,1) <= 0 or ignLocation(:,2) <= 0 can produce invalid owner-rank tests and local mod results. For example, a global x coordinate of 0 gives mod(-1,np)+1, which can be 0 with Fortran’s sign-of-dividend mod. • ignLocation(:,1) > n or ignLocation(:,2) > m is silently ignored if no MPI rank owns it, making a bad ignition look like a valid but ineffective case. This failure mode is distinct from empty schedules or invalid rampRate: even with a valid namelist and positive ramp rate, one bad coordinate can crash the run or silently suppress ignition. 400 Validate each ignition entry while reading the file, before the values reach ignite. +++ b/CODE-dev/Vegetation/rinit_veg.F90 @@ do i=1,nIgn read(1000,*) ignLocation(i,1),ignLocation(i,2),ignLocation(i,3), & ignTime(i) + if(ignLocation(i,1).lt.1.or.ignLocation(i,1).gt.n.or. & + ignLocation(i,2).lt.1.or.ignLocation(i,2).gt.m.or. & + ignLocation(i,3).lt.1.or.ignLocation(i,3).gt.lfuel)then + print*,’ERROR: ignition location out of bounds in ’,trim(ignfile) + print*,’Entry ’,i,’ location = ’,ignLocation(i,1), & + ignLocation(i,2),ignLocation(i,3) + print*,’Valid ranges: x=1..’,n,’ y=1..’,m,’ z=1..’,lfuel + STOP + endif enddo ignite can also defensively skip or stop on invalid entries, but setup-time validation gives the user a clear input-file diagnostic before the time loop begins. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 798df8b (2026-08-18, vegetation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Vegetation/rinit_veg.F90 index 86da441..db48241 100644 +++ b/CODE-dev/Vegetation/rinit_veg.F90 @@ -57,6 +57,10 @@ subroutine rinitVeg call rmaxmin_3D(rmoist(ift,:,:,:),’moist’,1,np,1,mp,1,lfuel) call rmaxmin_3D(fuelDepth(ift,:,:,1),’afd’,1,np,1,mp,1,1) enddo + if(any(rmoist.lt.0.0_wp))then + print*,’ERROR: treesmoist.dat contains negative vegetation moisture ratios’ + STOP + endif xvfuel(:,:,:,:,irhof)=max(min_rhoFuel,xvfuel(:,:,:,:,irhof)) xvfuel(:,:,:,:,irhow)=rmoist*xvfuel(:,:,:,:,irhof) actualFuelDepth=max(0.000001_wp,fuelDepth(:,:,:,1)) @@ -130,6 +134,15 @@ subroutine rinitVeg do i=1,nIgn read(1000,*) ignLocation(i,1),ignLocation(i,2),ignLocation(i,3), & ignTime(i) + if(ignLocation(i,1).lt.1.or.ignLocation(i,1).gt.n.or. & + ignLocation(i,2).lt.1.or.ignLocation(i,2).gt.m.or. & 401 + ignLocation(i,3).lt.1.or.ignLocation(i,3).gt.lfuel)then + print*,’ERROR: ignition location out of bounds in ’,trim(ignfile) + print*,’Entry ’,i,’ location = ’,ignLocation(i,1), & + ignLocation(i,2),ignLocation(i,3) + print*,’Valid ranges: x=1..’,n,’ y=1..’,m,’ z=1..’,lfuel + STOP + endif enddo close(1000) endif # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/Vegetation/diffusesies_veg.F90 ,→ CODE-dev/Vegetation/evaporation_veg.F90 CODE-dev/subGridTurb/diffuse_turb.F90 diff --git a/CODE-dev/Vegetation/diffusesies_veg.F90 b/CODE-dev/Vegetation/diffusesies_veg.F90 index 4cf245c..de6493c 100644 --- a/CODE-dev/Vegetation/diffusesies_veg.F90 +++ b/CODE-dev/Vegetation/diffusesies_veg.F90 @@ -24,10 +24,10 @@ subroutine diffusesies(xvrhoFuel,xvrhoWater,frhof,fsies, & real(wp),allocatable :: hxc(:,:,:),hyc(:,:,:) ! Executable Code - allocate(tempsdiff(il:iu,jl:ju,lls)); tempsdiff=0.0_wp + allocate(tempsdiff(il:iu,jl:ju,lls)); tempsdiff=0._wp - allocate(hxc(il:iu+1,jl:ju,lls)); hxc=0.0_wp - allocate(hyc(il:iu,jl:ju+1,lls)); hyc=0.0_wp + allocate(hxc(il:iu+1,jl:ju,lls)); hxc=0._wp + allocate(hyc(il:iu,jl:ju+1,lls)); hyc=0._wp do ift=1,nfuel call update(temps(ift,:,:,:),iu,ju,lls, & @@ -68,7 +68,7 @@ subroutine diffusesies(xvrhoFuel,xvrhoWater,frhof,fsies, & do j=jl,ju do i=il,iu tempsdiff(i,j,k)=tempsdiff(i,j,k) & ! units [J*s ,→ ^-1*m^-3] - +max(0.0_wp,gi(i,j,k)*((hxc(i+1,j,k)-hxc(i,j,k))*dxi & ! ,→ originally there was a random 2 in front of max that was removed and combined into the coef ,→ term + +max(0._wp,gi(i,j,k)*((hxc(i+1,j,k)-hxc(i,j,k))*dxi & ! originally ,→ there was a random 2 in front of max that was removed and combined into the coef term +(hyc(i,j+1,k)-hyc(i,j,k))*dyi)) enddo enddo +++ b/CODE-dev/Vegetation/evaporation_veg.F90 @@ -49,7 +49,7 @@ subroutine evapPDF(force_xv,force_xvfuel,xvfuel,ilh,iuh,jlh,juh,ku, & *(psiw-xvfuel(it,i,j,k,ipsiw)) & else - fw=0.0_wp + fw=0._wp endif ! Energy Changes @@ -180,7 +180,7 @@ subroutine evapBulk(force_xv,force_xvfuel,xv,xvrho,xvfuel, & 402 ... [diff excerpt truncated; run the command above for the full commit diff] # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/subGridTurb/diffuse_turb.F90 CODE-dev/subGridTurb/force_turb.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -43,7 +43,7 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 + integer :: i,j,k,kp1 real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a,sqrtG_KG31a & ... [diff excerpt truncated; run the command above for the full commit diff] 403 BUG-2026-07-049: VEGETATION-020: nfuel is not validated before allocation and file-size arithmetic Source report: aa-Jul8_completed/VEGETATION-020.md Files • Vegetation/input_veg.F90 • Vegetation/rinit_veg.F90 • Vegetation/define_veg.F90 ! Vegetation/input_veg.F90 call QueryGridlist_integer(’nfuel’,nfuel,48) call QueryGridlist_integer(’ivegread’,ivegread,48) ! Vegetation/rinit_veg.F90 inquire(file=’treesrhof.dat’, size=fsize) lfuel=(fsize-8)/(4*n*m*nfuel) call defineFuelArray ! Vegetation/define_veg.F90 allocate(fuelVelocityCorrection(nfuel,n,m,lfuel,1:3)) allocate(actualFuelDepth(nfuel,n,m,lfuel)) Problem nfuel is read from input and used directly. If nfuel is zero and ivegread == 1, rinitVeg divides by zero while computing lfuel. If nfuel is negative, later array allocations have invalid extents. If nfuel is zero with default vegetation, the run can continue with zero-length fuel arrays and skipped loops even though the vegetation configuration is invalid. The code should reject nfuel < 1 immediately after reading the vegetation input, before any file-size arithmetic or allocations depend on it. diff --git a/Vegetation/input_veg.F90 b/Vegetation/input_veg.F90 --- a/Vegetation/input_veg.F90 +++ b/Vegetation/input_veg.F90 @@ call QueryGridlist_integer(’nfuel’,nfuel,48) call QueryGridlist_integer(’ivegread’,ivegread,48) + 404 + if(nfuel.lt.1)then + print*,’ERROR: nfuel must be at least 1; received ’,nfuel + STOP + endif + + if(ivegread.ne.0 .and. ivegread.ne.1)then + print*,’ERROR: ivegread must be 0 or 1; received ’,ivegread + STOP + endif end subroutine input_vegetation The ivegread check overlaps with VEGETATION-019; either location is acceptable, but validating both input scalars together in input_vegetation keeps the bad configuration from reaching initialization. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 798df8b (2026-08-18, vegetation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Vegetation/input_veg.F90 CODE- ,→ dev/Vegetation/rinit_veg.F90 index 7c0602c..7cf24df 100644 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -2,6 +2,7 @@ ! Reads basic user input for vegetation in HIGRAD/FIRETEC !----------------------------------------------------------------------- + use gridlist_variables, only : wp use vegetation_gridlist_variables, only : nfuel,ivegread,rhoMicro, & cpwood,ifire,inonlocal,idiffsies,ifuel,ignfile,imoist, & @@ -13,20 +14,51 @@ subroutine input_vegetation() ! Executable Code call QueryGridlist_variable(’nfuel’,nfuel,48) call QueryGridlist_variable(’ivegread’,ivegread,48) + if(nfuel.lt.1)then + print*,’ERROR: nfuel must be at least 1; received ’,nfuel + STOP + endif call QueryGridlist_variable(’rhoMicro’,rhoMicro,48) call QueryGridlist_variable(’cpwood’,cpwood,48) + if(rhoMicro.le.0.0_wp)then + print*,’ERROR: rhoMicro must be positive; received ’,rhoMicro + STOP + endif + if(cpwood.le.0.0_wp)then + print*,’ERROR: cpwood must be positive; received ’,cpwood + STOP + endif ! Burning 405 call QueryGridlist_variable(’ifire’,ifire,48) call QueryGridlist_variable(’imoist’,imoist,48) call QueryGridlist_variable(’inonlocal’,inonlocal,48) call QueryGridlist_variable(’idiffsies’,idiffsies,48) - if((idiffsies.eq.1).and.ifire.lt.0)then - print*,"You’re an idiot!!! idiffsies.eq.1 but ifire.eq.0, you& - & can’t have creeping fire without fire." + if(ifire.ne.0.and.ifire.ne.1)then + print*,’ERROR: ifire must be 0 or 1; received ’,ifire + STOP ... [diff excerpt truncated; run the command above for the full commit diff] # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/Vegetation/diffusesies_veg.F90 ,→ CODE-dev/Vegetation/evaporation_veg.F90 CODE-dev/subGridTurb/diffuse_turb.F90 diff --git a/CODE-dev/Vegetation/diffusesies_veg.F90 b/CODE-dev/Vegetation/diffusesies_veg.F90 index 4cf245c..de6493c 100644 --- a/CODE-dev/Vegetation/diffusesies_veg.F90 +++ b/CODE-dev/Vegetation/diffusesies_veg.F90 @@ -24,10 +24,10 @@ subroutine diffusesies(xvrhoFuel,xvrhoWater,frhof,fsies, & real(wp),allocatable :: hxc(:,:,:),hyc(:,:,:) ! Executable Code - allocate(tempsdiff(il:iu,jl:ju,lls)); tempsdiff=0.0_wp + allocate(tempsdiff(il:iu,jl:ju,lls)); tempsdiff=0._wp - allocate(hxc(il:iu+1,jl:ju,lls)); hxc=0.0_wp - allocate(hyc(il:iu,jl:ju+1,lls)); hyc=0.0_wp + allocate(hxc(il:iu+1,jl:ju,lls)); hxc=0._wp + allocate(hyc(il:iu,jl:ju+1,lls)); hyc=0._wp do ift=1,nfuel call update(temps(ift,:,:,:),iu,ju,lls, & @@ -68,7 +68,7 @@ subroutine diffusesies(xvrhoFuel,xvrhoWater,frhof,fsies, & do j=jl,ju do i=il,iu tempsdiff(i,j,k)=tempsdiff(i,j,k) & ! units [J*s ,→ ^-1*m^-3] - +max(0.0_wp,gi(i,j,k)*((hxc(i+1,j,k)-hxc(i,j,k))*dxi & ! ,→ originally there was a random 2 in front of max that was removed and combined into the coef ,→ term + +max(0._wp,gi(i,j,k)*((hxc(i+1,j,k)-hxc(i,j,k))*dxi & ! originally ,→ there was a random 2 in front of max that was removed and combined into the coef term +(hyc(i,j+1,k)-hyc(i,j,k))*dyi)) enddo enddo +++ b/CODE-dev/Vegetation/evaporation_veg.F90 @@ -49,7 +49,7 @@ subroutine evapPDF(force_xv,force_xvfuel,xvfuel,ilh,iuh,jlh,juh,ku, & *(psiw-xvfuel(it,i,j,k,ipsiw)) & else - fw=0.0_wp + fw=0._wp endif ! Energy Changes @@ -180,7 +180,7 @@ subroutine evapBulk(force_xv,force_xvfuel,xv,xvrho,xvfuel, & 406 ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 407 BUG-2026-07-050: VEGETATION-021: Negative moisture ratios initialize negative water density Source report: aa-Jul8_completed/VEGETATION-021.md Files • Vegetation/rinit_veg.F90 ! Vegetation/rinit_veg.F90 call readLegacyVegArray(rmoist(ift,:,:,:),94,lfuel) ... xvfuel(:,:,:,:,irhof)=rrhof xvfuel(:,:,:,:,irhow)=rmoist*xvfuel(:,:,:,:,irhof) xvfuel(:,:,:,:,itemp)=temps ... xvfuelLim(1,irhow)=0.0_wp xvfuelLim(2,irhow)=1.e30_wp Problem The initial water density is computed directly from treesmoist.dat, but the lower limit for irhow is only assigned after initialization. There is no validation or clipping of the initial rmoist values. If a vegetation moisture file contains a negative moisture ratio, rhoWater is initialized negative. That can corrupt several later calculations, including vegetation heat capacity, latent heating, drag layer mass, solar heating, and ignition tests. The existing limiter may protect future tendency updates, but it does not guarantee that the initial state entering the physics is valid. diff --git a/Vegetation/rinit_veg.F90 b/Vegetation/rinit_veg.F90 --- a/Vegetation/rinit_veg.F90 +++ b/Vegetation/rinit_veg.F90 @@ endif + if(any(rmoist.lt.0.0_wp))then + print*,’ERROR: treesmoist.dat contains negative vegetation moisture ratios’ + STOP + endif + xvfuel(:,:,:,:,irhof)=rrhof xvfuel(:,:,:,:,irhow)=rmoist*xvfuel(:,:,:,:,irhof) xvfuel(:,:,:,:,itemp)=temps If the model prefers forgiving input handling, replace the stop with an explicit clamp and warning: 408 if(any(rmoist.lt.0.0_wp))then print*,’WARNING:␣clipping␣negative␣vegetation␣moisture␣ratios␣to␣zero’ rmoist=max(rmoist,0.0_wp) endif Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 798df8b (2026-08-18, vegetation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Vegetation/rinit_veg.F90 index 86da441..db48241 100644 +++ b/CODE-dev/Vegetation/rinit_veg.F90 @@ -57,6 +57,10 @@ subroutine rinitVeg call rmaxmin_3D(rmoist(ift,:,:,:),’moist’,1,np,1,mp,1,lfuel) call rmaxmin_3D(fuelDepth(ift,:,:,1),’afd’,1,np,1,mp,1,1) enddo + if(any(rmoist.lt.0.0_wp))then + print*,’ERROR: treesmoist.dat contains negative vegetation moisture ratios’ + STOP + endif xvfuel(:,:,:,:,irhof)=max(min_rhoFuel,xvfuel(:,:,:,:,irhof)) xvfuel(:,:,:,:,irhow)=rmoist*xvfuel(:,:,:,:,irhof) actualFuelDepth=max(0.000001_wp,fuelDepth(:,:,:,1)) @@ -130,6 +134,15 @@ subroutine rinitVeg do i=1,nIgn read(1000,*) ignLocation(i,1),ignLocation(i,2),ignLocation(i,3), & ignTime(i) + if(ignLocation(i,1).lt.1.or.ignLocation(i,1).gt.n.or. & + ignLocation(i,2).lt.1.or.ignLocation(i,2).gt.m.or. & + ignLocation(i,3).lt.1.or.ignLocation(i,3).gt.lfuel)then + print*,’ERROR: ignition location out of bounds in ’,trim(ignfile) + print*,’Entry ’,i,’ location = ’,ignLocation(i,1), & + ignLocation(i,2),ignLocation(i,3) + print*,’Valid ranges: x=1..’,n,’ y=1..’,m,’ z=1..’,lfuel + STOP + endif enddo close(1000) endif # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/Radiation/solarHeat_rad.F90 ,→ CODE-dev/Vegetation/diffusesies_veg.F90 CODE-dev/Vegetation/evaporation_veg.F90 +++ b/CODE-dev/Radiation/solarHeat_rad.F90 @@ -10,7 +10,7 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & 409 use radiation_gridlist_variables, only : unixTimeStart,plotLong, & plotLat + use msga_variables, only : mpos,npos,numprocs,mpi_comm_world,ierror @@ -56,8 +56,10 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & do k=1,nfuel do j=1,mp do i=1,np - zlayer=(sum(zCartEdgeAZGlobal(:,i,j,k)- & + ia=(npos-1)*np+i + ja=(mpos-1)*mp+j + zlayer=(sum(zCartEdgeAZGlobal(:,ia,ja,k)- & + zCartEdgeAZGlobal(:,ia,ja,k-1)))/4._wp LAIlocal(i,j,k)=sum(rhoFuel(kfindex(i,j,k:nfuel),i,j,1)/ & sizeScale(kfindex(i,j,k:nfuel),i,j,1)*zlayer/rhoMicro) enddo @@ -67,9 +69,12 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & do k=nfuel+2,lfuel+nfuel do j=1,mp do i=1,np + ia=(npos-1)*np+i + ja=(mpos-1)*mp+j + zlayer=(sum(zCartEdgeAZGlobal(:,ia,ja,k)- & + zCartEdgeAZGlobal(:,ia,ja,k-1)))/4._wp LAIlocal(i,j,k)=sum(rhoFuel(:,i,j,k-nfuel)/rhoMicro & - *(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j)) & + *zlayer/sizeScale(:,i,j,k-nfuel)) enddo enddo enddo @@ -109,14 +114,15 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & ... [diff excerpt truncated; run the command above for the full commit diff] # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/subGridTurb/diffuse_turb.F90 CODE-dev/subGridTurb/force_turb.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo 410 +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -43,7 +43,7 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 + integer :: i,j,k,kp1 real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a,sqrtG_KG31a & ... [diff excerpt truncated; run the command above for the full commit diff] 411 BUG-2026-07-051: VEGETATION-023: Nonpositive vegetation material constants are accepted and used as divisors Source report: aa-Jul8_completed/VEGETATION-023.md Files • Vegetation/input_veg.F90 • Vegetation/variables_veg.F90 • Vegetation/drag_veg.F90 • Vegetation/convection_veg.F90 • Vegetation/solarHeat_veg.F90 ! Vegetation/input_veg.F90 call QueryGridlist_real (’rhoMicro’,rhoMicro,48) call QueryGridlist_real (’cpwood’,cpwood,48) ! Vegetation/drag_veg.F90 av=2.0_wp/pi/sizeScale(ift,i,j,k)* & xvfuel(ift,i,j,k,irhof)/rhoMicro ! Vegetation/convection_veg.F90 av=2.0_wp*(xvfuel(ift,i,j,k,irhof)/rhoMicro)/sizeScale(ift,i,j,k) ! Vegetation/solarHeat_veg.F90 LAIlocal(i,j,k)=sum(rhoFuel(:,i,j,k)/sizeScale(:,i,j,k) & *(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j))/rhoMicro) ... av=2.0_wp*(rhoFuel(it,i,j,k)/rhoMicro)/sizeScale(it,i,j,k) Problem rhoMicro and cpwood are read directly from the gridlist without validation. rhoMicro is used as a divisor in the vegetation projected-area and LAI calculations. If it is zero, the run can produce infinities or trap on division by zero. If it is negative, the projected area and LAI become negative, reversing drag, heat-transfer, and solar-heating terms. cpwood is a heat capacity used to initialize and force the solid internal energy. A zero or negative heat capacity gives nonphysical solid energy, ignition forcing, and burn heat-loss terms. Because both values are core material constants, the input path should reject nonpositive values before any vegetation arrays are initialized. 412 diff --git a/Vegetation/input_veg.F90 b/Vegetation/input_veg.F90 --- a/Vegetation/input_veg.F90 +++ b/Vegetation/input_veg.F90 @@ + use gridlist_variables, only : wp use vegetation_gridlist_variables, only : nfuel,ivegread,rhoMicro, & cpwood,ifire,inonlocal,idiffsies,ifuel,ignfile,imoist, & @@ call QueryGridlist_real (’rhoMicro’,rhoMicro,48) call QueryGridlist_real (’cpwood’,cpwood,48) + + if(rhoMicro.le.0.0_wp)then + print*,’ERROR: rhoMicro must be positive; received ’,rhoMicro + STOP + endif + + if(cpwood.le.0.0_wp)then + print*,’ERROR: cpwood must be positive; received ’,cpwood + STOP + endif ! Burning Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 798df8b (2026-08-18, vegetation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Vegetation/input_veg.F90 index 7c0602c..7cf24df 100644 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -2,6 +2,7 @@ ! Reads basic user input for vegetation in HIGRAD/FIRETEC !----------------------------------------------------------------------- + use gridlist_variables, only : wp use vegetation_gridlist_variables, only : nfuel,ivegread,rhoMicro, & cpwood,ifire,inonlocal,idiffsies,ifuel,ignfile,imoist, & @@ -13,20 +14,51 @@ subroutine input_vegetation() ! Executable Code call QueryGridlist_variable(’nfuel’,nfuel,48) call QueryGridlist_variable(’ivegread’,ivegread,48) + if(nfuel.lt.1)then + print*,’ERROR: nfuel must be at least 1; received ’,nfuel 413 + STOP + endif call QueryGridlist_variable(’rhoMicro’,rhoMicro,48) call QueryGridlist_variable(’cpwood’,cpwood,48) + if(rhoMicro.le.0.0_wp)then + print*,’ERROR: rhoMicro must be positive; received ’,rhoMicro + STOP + endif + if(cpwood.le.0.0_wp)then + print*,’ERROR: cpwood must be positive; received ’,cpwood + STOP + endif ! Burning call QueryGridlist_variable(’ifire’,ifire,48) call QueryGridlist_variable(’imoist’,imoist,48) call QueryGridlist_variable(’inonlocal’,inonlocal,48) call QueryGridlist_variable(’idiffsies’,idiffsies,48) - if((idiffsies.eq.1).and.ifire.lt.0)then - print*,"You’re an idiot!!! idiffsies.eq.1 but ifire.eq.0, you& - & can’t have creeping fire without fire." + if(ifire.ne.0.and.ifire.ne.1)then + print*,’ERROR: ifire must be 0 or 1; received ’,ifire + STOP ... [diff excerpt truncated; run the command above for the full commit diff] # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/Radiation/solarHeat_rad.F90 ,→ CODE-dev/Vegetation/diffusesies_veg.F90 CODE-dev/Vegetation/evaporation_veg.F90 +++ b/CODE-dev/Radiation/solarHeat_rad.F90 @@ -10,7 +10,7 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & use radiation_gridlist_variables, only : unixTimeStart,plotLong, & plotLat + use msga_variables, only : mpos,npos,numprocs,mpi_comm_world,ierror @@ -56,8 +56,10 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & do k=1,nfuel do j=1,mp do i=1,np - zlayer=(sum(zCartEdgeAZGlobal(:,i,j,k)- & + ia=(npos-1)*np+i + ja=(mpos-1)*mp+j + zlayer=(sum(zCartEdgeAZGlobal(:,ia,ja,k)- & + zCartEdgeAZGlobal(:,ia,ja,k-1)))/4._wp LAIlocal(i,j,k)=sum(rhoFuel(kfindex(i,j,k:nfuel),i,j,1)/ & sizeScale(kfindex(i,j,k:nfuel),i,j,1)*zlayer/rhoMicro) enddo @@ -67,9 +69,12 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & do k=nfuel+2,lfuel+nfuel do j=1,mp do i=1,np + ia=(npos-1)*np+i 414 FIRETEC Bug Resolution Log July 2026 + ja=(mpos-1)*mp+j + zlayer=(sum(zCartEdgeAZGlobal(:,ia,ja,k)- & + zCartEdgeAZGlobal(:,ia,ja,k-1)))/4._wp LAIlocal(i,j,k)=sum(rhoFuel(:,i,j,k-nfuel)/rhoMicro & - *(zcart(zedge(k+1),i,j)-zcart(zedge(k),i,j)) & + *zlayer/sizeScale(:,i,j,k-nfuel)) enddo enddo enddo @@ -109,14 +114,15 @@ subroutine solarHeating(force_sies,rhoFuel,rhoWater,atmWater, & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 415 BUG-2026-07-052: VEGETATION-025: Vegetation feature switches accept invalid values that silently change physics Source report: aa-Jul8_completed/VEGETATION-025.md Files • Vegetation/input_veg.F90 • definearray.F90 • force.F90 ! Vegetation/input_veg.F90 call QueryGridlist_integer(’ifire’,ifire,48) call QueryGridlist_integer(’imoist’,imoist,48) call QueryGridlist_integer(’inonlocal’,inonlocal,48) call QueryGridlist_integer(’idiffsies’,idiffsies,48) ! definearray.F90 if(inonlocal.eq.1)then nv = nv+1 imixfrac = nv endif ... if(imoist.eq.1.or.ifire.eq.1.or.irad.gt.0)then isies = nvfuel+1 nvfuel = nvfuel+1 endif ! force.F90 if(idiffsies.eq.1) call diffusesies(...) ... if(imoist.eq.1)then call solarHeating(...) call evapBulk(...) endif if(ifire.eq.1)then call evapPDF(...) call burnFuel(...) endif Problem The vegetation feature switches are treated as binary flags by the rest of the code, but input_vegetation accepts any integer value. A typo such as ifire = 2 does not fail; it silently behaves like fire is off because the code only checks ifire.eq.1. The same pattern applies to imoist, inonlocal, and idiffsies. 416 This is a dangerous configuration failure because it can change the model state layout and physics ownership without any diagnostic: • ifire = 2 skips ignition, evapPDF, and burnFuel. • imoist = 2 skips solar moisture and bulk evaporation. • inonlocal = 2 skips allocation of the mix-fraction field. • idiffsies = 2 skips creeping-fire diffusion. Invalid values should be rejected as soon as they are read. diff --git a/Vegetation/input_veg.F90 b/Vegetation/input_veg.F90 --- a/Vegetation/input_veg.F90 +++ b/Vegetation/input_veg.F90 @@ call QueryGridlist_integer(’ifire’,ifire,48) call QueryGridlist_integer(’imoist’,imoist,48) call QueryGridlist_integer(’inonlocal’,inonlocal,48) call QueryGridlist_integer(’idiffsies’,idiffsies,48) call QueryGridlist_integer(’ifuel’,ifuel,48) call QueryGridlist_string (’ignfile’,ignfile,48) + + if(ifire.ne.0.and.ifire.ne.1)then + print*,’ERROR: ifire must be 0 or 1; received ’,ifire + STOP + endif + if(imoist.ne.0.and.imoist.ne.1)then + print*,’ERROR: imoist must be 0 or 1; received ’,imoist + STOP + endif + if(inonlocal.ne.0.and.inonlocal.ne.1)then + print*,’ERROR: inonlocal must be 0 or 1; received ’,inonlocal + STOP + endif + if(idiffsies.ne.0.and.idiffsies.ne.1)then + print*,’ERROR: idiffsies must be 0 or 1; received ’,idiffsies + STOP + endif ! Moisture Apply this alongside the ivegread validation from VEGETATION-019/VEGETATION-020 and the ifuel validation from VEGETATION-009 so every vegetation option has one explicit contract. Git evidence: 6e02566 (2026-07-09, validation crutches to reduce bad runs); 798df8b (2026-08-18, vegetation bug-list pass); 27c7afa (2026-08-17, subgrid turbulence and thermodynamics bug-list pass). 417 # 6e02566 crutches reduce emails # Full command: git show --find-renames --unified=3 6e02566 -- CODE-dev/Vegetation/input_veg.F90 index 7c0602c..7cf24df 100644 +++ b/CODE-dev/Vegetation/input_veg.F90 @@ -2,6 +2,7 @@ ! Reads basic user input for vegetation in HIGRAD/FIRETEC !----------------------------------------------------------------------- + use gridlist_variables, only : wp use vegetation_gridlist_variables, only : nfuel,ivegread,rhoMicro, & cpwood,ifire,inonlocal,idiffsies,ifuel,ignfile,imoist, & @@ -13,20 +14,51 @@ subroutine input_vegetation() ! Executable Code call QueryGridlist_variable(’nfuel’,nfuel,48) call QueryGridlist_variable(’ivegread’,ivegread,48) + if(nfuel.lt.1)then + print*,’ERROR: nfuel must be at least 1; received ’,nfuel + STOP + endif call QueryGridlist_variable(’rhoMicro’,rhoMicro,48) call QueryGridlist_variable(’cpwood’,cpwood,48) + if(rhoMicro.le.0.0_wp)then + print*,’ERROR: rhoMicro must be positive; received ’,rhoMicro + STOP + endif + if(cpwood.le.0.0_wp)then + print*,’ERROR: cpwood must be positive; received ’,cpwood + STOP + endif ! Burning call QueryGridlist_variable(’ifire’,ifire,48) call QueryGridlist_variable(’imoist’,imoist,48) call QueryGridlist_variable(’inonlocal’,inonlocal,48) call QueryGridlist_variable(’idiffsies’,idiffsies,48) - if((idiffsies.eq.1).and.ifire.lt.0)then - print*,"You’re an idiot!!! idiffsies.eq.1 but ifire.eq.0, you& - & can’t have creeping fire without fire." + if(ifire.ne.0.and.ifire.ne.1)then + print*,’ERROR: ifire must be 0 or 1; received ’,ifire + STOP ... [diff excerpt truncated; run the command above for the full commit diff] # 798df8b Vegetation ’bug-list’. # Full command: git show --find-renames --unified=3 798df8b -- CODE-dev/force.F90 index 7b542f4..e37eb46 100644 +++ b/CODE-dev/force.F90 @@ -176,7 +176,7 @@ subroutine large_explicit_forcings if(isolar.eq.1)then call solarHeating(forceLE_xvfuel(:,:,:,:,isies), & xvfuel(:,:,:,:,irhof),xvfuel(:,:,:,:,irhow), & - xv(:,:,:,iH2O),1-ih,np+ih,1-ih,mp+ih,l, & + xvrho(:,:,:,iH2O),1-ih,np+ih,1-ih,mp+ih,l, & 418 endif endif # 27c7afa Gone through subGridTurb and thermodynamic ’bug lists’. # Full command: git show --find-renames --unified=3 27c7afa -- CODE-dev/Vegetation/burn_veg.F90 CODE- ,→ dev/subGridTurb/diffuse_turb.F90 CODE-dev/subGridTurb/force_turb.F90 +++ b/CODE-dev/Vegetation/burn_veg.F90 @@ -82,9 +82,9 @@ subroutine burnFuel(force_xv,force_xvfuel,xv,xvfuel, & ! Forcings for gas physical terms force_xv(i,j,k,itheta)=force_xv(i,j,k,itheta)+ & energyGas/cp_gas(i,j,k)* & - (Pref/pr(i,j,k))**(1.0_wp-cv_gas(i,j,k)/cp_gas(i,j,k)) + (Pref/pr(i,j,k))**(1._wp-cv_gas(i,j,k)/cp_gas(i,j,k)) force_xv(i,j,k,irho)=force_xv(i,j,k,irho)+ff*rnfuel - force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno + !force_xv(i,j,k,iO2)=force_xv(i,j,k,iO2)-ff*rno enddo enddo enddo +++ b/CODE-dev/subGridTurb/diffuse_turb.F90 @@ -43,7 +43,7 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) hxc(:, :,:), & ! contravariant coordinate of x phi-flux component*sqrt(G) at i-1/2 hyc(:, :,:), & ! contravariant coordinate of y phi-flux component*sqrt(G) at j-1/2 hzc(:, :,:) ! contravariant coordinate of z phi-flux component*sqrt(G) at k-1/2 + integer :: i,j,k,kp1 real(wp):: sqrtG_KG11a,sqrtG_KG13a,sqrtG_KG22a,sqrtG_KG23a,sqrtG_KG31a & ,sqrtG_KG32a,sqrtG_KG33a ! edge values of sqrtG_KGij @@ -104,31 +104,25 @@ subroutine diffuse(fphi,phi,il,iu,jl,ju,lls,cdiff) enddo enddo - ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (kk=l when k=l+1) - do k=1,lls+1 - km1=max(1,k-1) - kk=min(k,lls) + ! compute contravariant component z-flux at i,j,k-1/2 hzc (sqrtg burried in) top boundary ,→ condition on phi, rvtxy, rvtya is burried here (k=l when k=l+1) + do k=1,lls do j=1,mp do i=1,np !at k-1/2 ... [diff excerpt truncated; run the command above for the full commit diff] 419 BUG-2026-07-053: XEVARIATION-009: Windfield Subdomain Bounds Are Accepted But Ignored Source report: aa-Jul8_completed/XEVARIATION-009.md Files • xeVariation/variables_xeVar.F90 • xeVariation/input_xeVar.F90 • xeVariation/windfield.F90 • xeVariation/xevariation.F90 ! xeVariation/variables_xeVar.F90 30 integer :: is = 0 ! Lower x indice for production xvdata file on subdomain (0 ,→ = whole domain is used) 31 integer :: ie = 0 ! Upper x indice for production xvdata file on subdomain (0 ,→ = whole domain is used) 32 integer :: js = 0 ! Lower y indice for production xvdata file on subdomain (0 ,→ = whole domain is used) 33 integer :: je = 0 ! Upper y indice for production xvdata file on subdomain (0 ,→ = whole domain is used) ! xeVariation/input_xeVar.F90 28 is=1; call QueryGridlist_integer(’is’,is,48) 29 ie=n; call QueryGridlist_integer(’ie’,ie,48) 30 js=1; call QueryGridlist_integer(’js’,js,48) 31 je=m; call QueryGridlist_integer(’je’,je,48) ! xeVariation/windfield.F90 28 use windfieldio, only : ibcells,jbcells ... 51 allocate(outdatai(ibcells*2,m,l,nv),outdataj(n,jbcells*2,l,nv)) ... 60 if(ia.le.ibcells)then ... 68 elseif(ja.gt.m-jbcells)then Problem is, ie, js, and je are read from the gridlist and documented as windfield subdomain controls, but no windfield writer, reader, or application path uses them. The writer always saves strips on the global domain boundary, and xevariation applies data only at the global boundary strips. That makes non-default subdomain input silently ineffective. A user can request a subdomain windfield and still get full-domain edge files and full-domain boundary application. 420 Either implement true subdomain windfield files, or fail fast when non-default subdomain bounds are requested. The minimal safe fix is to reject unsupported bounds instead of silently ignoring them. diff --git a/xeVariation/input_xeVar.F90 b/xeVariation/input_xeVar.F90 --- a/xeVariation/input_xeVar.F90 +++ b/xeVariation/input_xeVar.F90 @@ is=1; call QueryGridlist_integer(’is’,is,48) ie=n; call QueryGridlist_integer(’ie’,ie,48) js=1; call QueryGridlist_integer(’js’,js,48) je=m; call QueryGridlist_integer(’je’,je,48) + if(is.ne.1.or.ie.ne.n.or.js.ne.1.or.je.ne.m)then + print*,’ERROR: xeVariation windfield subdomain bounds are not implemented’ + STOP + endif @@ is=1; call QueryGridlist_integer(’is’,is,48) ie=n; call QueryGridlist_integer(’ie’,ie,48) js=1; call QueryGridlist_integer(’js’,js,48) je=m; call QueryGridlist_integer(’je’,je,48) + if(is.ne.1.or.ie.ne.n.or.js.ne.1.or.je.ne.m)then + print*,’ERROR: xeVariation windfield subdomain bounds are not implemented’ + STOP + endif Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 811932f (2026-07-23, cross-wind and corner fix set); 8122925 (2026-08-05, xeVariation fixes). xeVariation and windfield input/output handling was corrected across the July cleanup and August xeVariation pass, including subdomain bounds, local/global coordinates, and dense-sensor/windfield buffer use. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/xeVariation/xevariation.F90 index a3b853d..6d64a23 100644 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -35,8 +35,8 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do i=il,iu xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & (time*uramp/uramptime+u0)*xe(i,j,k,irho)) & - *max(0.0_wp,(1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))) & - *(min(100.0_wp,zcart(z(k),1,1))/zu)**(1.0_wp/7.0_wp) + *max(0._wp,(1._wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))) & + *(min(100._wp,zcart(z(k),1,1))/zu)**(1._wp/7._wp) enddo enddo 421 enddo @@ -45,7 +45,7 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do i=il,iu xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & (time*uramp/uramptime+u0)*xe(i,j,k,irho)) & - *(min(100.0_wp,zcart(z(k),1,1))/zu)**(1.0_wp/7.0_wp) + *(min(100._wp,zcart(z(k),1,1))/zu)**(1._wp/7._wp) enddo enddo enddo @@ -56,8 +56,8 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do i=il,iu xe(i,j,k,ivvel)=min(vramp*xe(i,j,k,irho), & (time*vramp/vramptime+v0)*xe(i,j,k,irho)) & - *max(0.0_wp,(1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))) & - *(min(100.0_wp,zcart(z(k),1,1))/zu)**(1.0_wp/7.0_wp) + *max(0._wp,(1._wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))) & + *(min(100._wp,zcart(z(k),1,1))/zu)**(1._wp/7._wp) enddo enddo enddo @@ -94,10 +94,6 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) (real(itabsold,kind=wp)-real(itabsnew,kind=wp))* & (xvdataold(i,j,k,kv)-xvdatanew(i,j,k,kv)) & +xvdatanew(i,j,k,kv) - - !lin_interp(real(ittot,kind=wp),real(itabsnew,kind=wp), & - ! real(itabsold,kind=wp),xvdatanew(i,j,k,kv), & ... [diff excerpt truncated; run the command above for the full commit diff] # 811932f Small changes trying to fix a problem with a cross-wind where corners seem to create a wake. # Full command: git show --find-renames --unified=3 811932f -- CODE-dev/xeVariation/windfield.F90 CODE ,→ -dev/xeVariation/xevariation.F90 +++ b/CODE-dev/xeVariation/windfield.F90 @@ -11,7 +11,7 @@ subroutine windField(ittot) character(len=257) :: fname ! Executable Code - if(ittot.ge.itwindfield.and.mod(ittot,itinterp).eq.0)then + if(ittot.ge.itwindfield.and.mod(ittot-itwindfield,itinterp).eq.0)then endif +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -13,6 +13,7 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) + use constants, only : tolerance ! Local Variables @@ -68,7 +69,7 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) enddo 422 endif case (2) + if(ittot.ge.itabsnew) then xvdataold = xvdatanew itabsold = itabsnew itabsnew=itabsold+itinterp @@ -107,10 +108,10 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do k=1,lfuel do j=jl,ju do i=il,iu - totw=0.0_wp + totw=0._wp do kv=1,nSensors - senw(kv)=sqrt((time-SensorTimes(kv))**2+ & ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 423 BUG-2026-07-054: XEVARIATION-016: Overlapping Windfield Boundary Strips Leave Part Of The Output Buffer Unfilled Source report: aa-Jul8_completed/XEVARIATION-016.md Files • xeVariation/input_xeVar.F90 • xeVariation/windfield.F90 ! xeVariation/input_xeVar.F90 26 call QueryGridlist_integer(’ibcells’,ibcells,48) 27 call QueryGridlist_integer(’jbcells’,jbcells,48) ! xeVariation/windfield.F90 51 allocate(outdatai(ibcells*2,m,l,nv),outdataj(n,jbcells*2,l,nv)) ... 60 if(ia.le.ibcells)then 61 outdatai(ia,ja,:,:)=tmparray(i,j,:,:,iproc) 62 elseif(ia.gt.n-ibcells)then 63 ii=2*ibcells-n+ia 64 outdatai(ii,ja,:,:)=tmparray(i,j,:,:,iproc) 65 endif ! xeVariation/windfield.F90 66 if(ja.le.jbcells)then 67 outdataj(ia,ja,:,:)=tmparray(i,j,:,:,iproc) 68 elseif(ja.gt.m-jbcells)then 69 jj=2*jbcells-m+ja 70 outdataj(ia,jj,:,:)=tmparray(i,j,:,:,iproc) 71 endif Problem The writer allocates separate left/right and bottom/top slots, each with 2*ibcells or 2*jbcells entries. But if 2*ibcells > n or 2*jbcells > m, the two global boundary strips overlap. For overlapping cells, the elseif means the left or bottom branch wins and the right or top slot is not filled. Later, write(21) outdatai,outdataj writes those uninitialized buffer entries. A read-in run can then apply uninitialized boundary data on the opposite side. This is distinct from the local-subdomain limit: even a single-process run can set ibcells <= np but still have 2*ibcells > n. 424 Reject overlapping strip widths unless the file format is changed to handle overlap explicitly. diff --git a/xeVariation/input_xeVar.F90 b/xeVariation/input_xeVar.F90 --- a/xeVariation/input_xeVar.F90 +++ b/xeVariation/input_xeVar.F90 @@ call QueryGridlist_integer(’ibcells’,ibcells,48) call QueryGridlist_integer(’jbcells’,jbcells,48) + if(2*ibcells.gt.n.or.2*jbcells.gt.m)then + print*,’ERROR: windfield boundary strips overlap; reduce ibcells/jbcells’ + STOP + endif @@ call QueryGridlist_integer(’ibcells’,ibcells,48) call QueryGridlist_integer(’jbcells’,jbcells,48) + if(2*ibcells.gt.n.or.2*jbcells.gt.m)then + print*,’ERROR: windfield boundary strips overlap; reduce ibcells/jbcells’ + STOP + endif Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 811932f (2026-07-23, cross-wind and corner fix set); 8122925 (2026-08-05, xeVariation fixes). xeVariation and windfield input/output handling was corrected across the July cleanup and August xeVariation pass, including subdomain bounds, local/global coordinates, and dense-sensor/windfield buffer use. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/Sensors/CMakeLists.txt CODE- ,→ dev/Sensors/input_sense.F90 CODE-dev/xeVariation/xevariation.F90 diff --git a/CODE-dev/Sensors/CMakeLists.txt b/CODE-dev/Sensors/CMakeLists.txt index 2ad5cb2..cf4802e 100644 --- a/CODE-dev/Sensors/CMakeLists.txt +++ b/CODE-dev/Sensors/CMakeLists.txt @@ -8,7 +8,7 @@ set(SENSE_VERSION "${SENSE_VERSION_MAJOR}.${SENSE_VERSION_MINOR}") # Build set(SENSOR_SRCS ../variables.F90 ../metric.F90 # Other Dependencies - ../readgridlist.F90 + ../readgridlist.F90 ../input.F90 rinit_sense.F90 variables_sense.F90 input_sense.F90 # Standard files sensors.F90) # Source calculation files index 43fed0f..0cb6850 100644 +++ b/CODE-dev/Sensors/input_sense.F90 @@ -21,6 +21,7 @@ subroutine input_sensors 425 allocate(se_zloc(numsensors)) call QueryGridlist_variable(’sensorfile’,sensorfile,48) + call ensure_directory_exists(sensorfile) call QueryGridlist_variable(’sensorlocs’,sensorlocs,48) index a3b853d..6d64a23 100644 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -35,8 +35,8 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do i=il,iu xe(i,j,k,iuvel)=min(uramp*xe(i,j,k,irho), & (time*uramp/uramptime+u0)*xe(i,j,k,irho)) & - *max(0.0_wp,(1.0_wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))) & - *(min(100.0_wp,zcart(z(k),1,1))/zu)**(1.0_wp/7.0_wp) + *max(0._wp,(1._wp-1.5_wp*sum(xvfuel(:,i,j,k,irhof)))) & + *(min(100._wp,zcart(z(k),1,1))/zu)**(1._wp/7._wp) enddo enddo enddo @@ -45,7 +45,7 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) do i=il,iu ... [diff excerpt truncated; run the command above for the full commit diff] # 811932f Small changes trying to fix a problem with a cross-wind where corners seem to create a wake. # Full command: git show --find-renames --unified=3 811932f -- CODE-dev/xeVariation/windfield.F90 +++ b/CODE-dev/xeVariation/windfield.F90 @@ -11,7 +11,7 @@ subroutine windField(ittot) character(len=257) :: fname ! Executable Code - if(ittot.ge.itwindfield.and.mod(ittot,itinterp).eq.0)then + if(ittot.ge.itwindfield.and.mod(ittot-itwindfield,itinterp).eq.0)then endif # 8122925 Addressing problems in xeVariation. # Full command: git show --find-renames --unified=3 8122925 -- CODE-dev/xeVariation/windfield.F90 index cc128a1..c3144eb 100644 +++ b/CODE-dev/xeVariation/windfield.F90 @@ -86,15 +86,16 @@ end subroutine windfld_write ! windfld_read reads xv data along domain boundaries from a wind field ! to buffer those boundaries !----------------------------------------------------------------------- -subroutine windfld_read(fname) +subroutine windfld_read(fname,xvdata) use gridlist_variables, only : n,m,l,nprocx,nprocy,wp - use windfieldio, only : ibcells,jbcells,xvdatanew,nvwind + use windfieldio, only : ibcells,jbcells,nvwind 426 ! Local Variables character(*),intent(in) :: fname + real(wp),intent(inout) :: xvdata(np,mp,l,nvwind) real(wp),allocatable :: indatai(:,:,:,:),indataj(:,:,:,:) ! Executable Code @@ -102,13 +103,13 @@ subroutine windfld_read(fname) open(41,file=fname,form=’unformatted’,status=’old’) read(41) indatai,indataj close(41) - if(npos.eq.1) xvdatanew(1:ibcells,:,:,:)= & + if(npos.eq.1) xvdata(1:ibcells,:,:,:)= & indatai(1:ibcells,mp*(mpos-1)+1:mp*mpos,:,:) - if(npos.eq.nprocx) xvdatanew(np-ibcells+1:np,:,:,:)= & + if(npos.eq.nprocx) xvdata(np-ibcells+1:np,:,:,:)= & indatai(ibcells+1:ibcells*2,mp*(mpos-1)+1:mp*mpos,:,:) - if(mpos.eq.1) xvdatanew(:,1:jbcells,:,:)= & + if(mpos.eq.1) xvdata(:,1:jbcells,:,:)= & indataj(np*(npos-1)+1:np*npos,1:jbcells,:,:) - if(mpos.eq.nprocy) xvdatanew(:,mp-jbcells+1:mp,:,:)= & + if(mpos.eq.nprocy) xvdata(:,mp-jbcells+1:mp,:,:)= & indataj(np*(npos-1)+1:np*npos,jbcells+1:jbcells*2,:,:) deallocate(indatai,indataj) 427 BUG-2026-07-055: XEVARIATION-017: windfieldin/out = 2 Is Documented But Ignored Source report: aa-Jul8_completed/XEVARIATION-017.md Files • input.F90 • compress.F90 • xeVariation/input_xeVar.F90 • TOOLS/Gridlist/gridlist-fire • TOOLS/Gridlist/gridlist-windrun ! input.F90 129 call QueryGridlist_integer(’ixevariation’,ixevariation,48) 130 call QueryGridlist_integer(’windfieldin’,windfieldin,48) 131 if(windfieldin.eq.1) ixevariation=2 132 call QueryGridlist_integer(’windfieldout’,windfieldout,48) 133 if(ixevariation.gt.0.or.windfieldout.eq.1) & 134 call input_xevariation(ixevariation,windfieldout) ! compress.F90 74 if(windfieldout.eq.1) call windField(ittot) ! TOOLS/Gridlist/gridlist-fire windfieldout = 0 ! Windfield output switch: 1->interpolate, 2-> one file windfieldin = 0 ! Windfield input switch: 1->interpolate, 2-> one file Problem The sample gridlists document windfieldin/out = 2 as a one-file windfield mode, but the code only handles value 1. If a user sets windfieldin = 2, ixevariation is not set to windfield mode and input_xevariation may not be called. If a user sets windfieldout = 2, compress never calls windField. The run silently behaves as if windfield input/output is disabled, even though the gridlist value is documented as meaningful. Either implement the one-file mode or reject unsupported values explicitly. The minimal safe fix is to stop when either switch is greater than 1. 428 diff --git a/input.F90 b/input.F90 --- a/input.F90 +++ b/input.F90 @@ call QueryGridlist_integer(’ixevariation’,ixevariation,48) call QueryGridlist_integer(’windfieldin’,windfieldin,48) + if(windfieldin.gt.1)then + print*,’ERROR: windfieldin=2 one-file mode is documented but not implemented’ + STOP + endif if(windfieldin.eq.1) ixevariation=2 call QueryGridlist_integer(’windfieldout’,windfieldout,48) + if(windfieldout.gt.1)then + print*,’ERROR: windfieldout=2 one-file mode is documented but not implemented’ + STOP + endif if(ixevariation.gt.0.or.windfieldout.eq.1) & Git evidence: c21d0ea (2026-07-08, broad bug-list cleanup); 811932f (2026-07-23, cross-wind and corner fix set); 8122925 (2026-08-05, xeVariation fixes). xeVariation and windfield input/output handling was corrected across the July cleanup and August xeVariation pass, including subdomain bounds, local/global coordinates, and dense-sensor/windfield buffer use. # c21d0ea Another one of Colby’s bug lists. No real bugs here but more crutches. # Full command: git show --find-renames --unified=3 c21d0ea -- CODE-dev/input.F90 CODE-dev/compress. ,→ F90 +++ b/CODE-dev/compress.F90 @@ -24,10 +24,6 @@ program compress ! Initialize MPI - - ! Create output directory - @@ -63,8 +59,7 @@ program compress print*,’NaNs or Infinity in XV array’ + exit endif 429 call small_explicit_forcings ! Calculates explicit large timestep forcings @@ -81,12 +76,12 @@ program compress !!! IO - if((isensor.eq.1).and.(mod(it,se_frq_write).eq.0))then + if((isensor.eq.1).and.(mod(ittot,se_frq_write).eq.0))then endif - if(mod(it,frqoutput).eq.0)then + if(mod(ittot,frqoutput).eq.0)then + if(ifbrand.ge.1) call writeio_fb(ittot) endif it=it+1 enddo ... [diff excerpt truncated; run the command above for the full commit diff] # 811932f Small changes trying to fix a problem with a cross-wind where corners seem to create a wake. # Full command: git show --find-renames --unified=3 811932f -- CODE-dev/xeVariation/windfield.F90 CODE ,→ -dev/xeVariation/xevariation.F90 CODE-dev/readgridlist.F90 index c30fd75..66f123c 100644 +++ b/CODE-dev/readgridlist.F90 @@ -13,7 +13,7 @@ module QueryGridlist_mod ! Local Variables character(len=*),intent(in) :: variableName - class(*),intent(out) :: variable + class(*),intent(inout) :: variable @@ -57,7 +57,7 @@ module QueryGridlist_mod character(len=*),intent(in) :: variableName integer,intent(in) :: size - class(*),intent(out) :: array(size) + class(*),intent(inout) :: array(size) character(len=1) :: equal +++ b/CODE-dev/xeVariation/windfield.F90 @@ -11,7 +11,7 @@ subroutine windField(ittot) character(len=257) :: fname ! Executable Code - if(ittot.ge.itwindfield.and.mod(ittot,itinterp).eq.0)then + if(ittot.ge.itwindfield.and.mod(ittot-itwindfield,itinterp).eq.0)then endif 430 +++ b/CODE-dev/xeVariation/xevariation.F90 @@ -13,6 +13,7 @@ subroutine xevariation(ixevariation,xe,il,iu,jl,ju,lls,nvp) ... [diff excerpt truncated; run the command above for the full commit diff] # Additional evidence commits omitted from this excerpt to keep the report readable. 431 BUG-2026-07-056: Top Absorption Layer Disabled by Invalid zab Source report: aa-Jul8_completed/aa-easy_BOUND_1.md Files • tinit.F90 • variables.F90 • input.F90 • rinit.F90 Issue The default top absorption-layer start height is: real(prec) :: zab = 400.0_prec For a run with l = 220 and dz = 1, the domain top is computed as: zb = zedge(l+1) which gives zb = 220 m. Because zab = 400 m is above the model top, this condition in tinit.F90 is never true: As a result, the vertical/top absorption layer is never applied. This leaves the model without the intended top damping unless the user explicitly overrides zab to a value below zb in the gridlist. Impact With zab >= zb, the run silently proceeds with no active top absorber. This can allow vertically propagating disturbances to reflect from the top boundary instead of being attenuated, which may contribute to instability or boundary-driven oscillations. Recommended Fix Do not silently continue when the requested damping layer starts outside the domain. Kill the program with a clear error message so the user must set a valid zab. +++ b/CODE-dev/tinit.F90 @@ -75,6 +75,14 @@ ! ... existing initialization code ... + if (zab .ge. zb) then 432 + write(*,*) ’WARNING: top absorption layer is inactive.’ + write(*,*) ’ zab is at or above the model top.’ + write(*,*) ’ zab = ’, zab, ’ zb = ’, zb + write(*,*) ’ No vertical/top damping will be applied.’ + write(*,*) ’ To enable it, set zab < zb in the gridlist.’ + endif + do k=1,l do j=0,n do i=0,m Notes This is a configuration-validation bug rather than a formula bug. When zab > zb, the damping formulas are not reached at all because the guard condition prevents entry. The failure mode is therefore silent deactivation of the top absorber. The tinit cleanup validates unsupported absorber modes and corrects the top-absorption formula so invalid zab settings no longer silently disable the intended layer. # a8b1c58 tinitF90, topoF90, and variablesF90 ’bug lists’. # Full command: git show --find-renames --unified=3 a8b1c58 -- CODE-dev/tinit.F90 CODE-dev/variables. ,→ F90 +++ b/CODE-dev/tinit.F90 @@ -7,7 +7,7 @@ subroutine tinit + use constants, only : pi,tolerance @@ -63,7 +63,7 @@ subroutine tinit write(*,*) ’WARNING: top absorption layer is inactive.’ - write(*,*) ’ zab is at or above the model top.’ + write(*,*) ’ zab is at or above the domain top.’ write(*,*) ’ zab = ’, zab, ’ zb = ’, zb write(*,*) ’ No vertical/top damping will be applied.’ write(*,*) ’ To enable it, set zab < zb in the gridlist.’ @@ -77,17 +77,13 @@ subroutine tinit ! Upper dampers - t1=max(0.0_wp,zl-zab) 433 - print*,’ERROR: iab=2 requires tow > 1’ + t1=max(0._wp,zl-zab) case(1) - relaxxv(i,j,k,:)=t1/((zb-zab)+1.e-10_wp)/tow**2._wp + relaxxv(i,j,k,:)=t1/((zb-zab)+tolerance)/tow**2._wp case(2) relaxxv(i,j,k,:)=0.05_wp* & - exp(-t1/(-(zb-zab)/log(tow**(-2._wp)))) + exp(-t1/((zb-zab)/log(tow**(-2._wp)))) case(3) relaxxv(i,j,k,1:3)= & ... [diff excerpt truncated; run the command above for the full commit diff] 434 BUG-2026-07-057: Invalid Positive Boundary-Mode Values Silently Become Inconsistent Boundary Modes Source report: aa-Jul8_completed/aa-easy_BOUND_16.md Disposition: Completed Original ID: BUG-Jun22-Boundary_008 Files • variables.F90 • input.F90 • msga.F90 • tinit.F90 • update.F90 • Firebrands/evolve_fb.F90 • Radiation/monteCarlo_rad.F90 • Vegetation/solarHeat_veg.F90 Evidence variables.F90 31 integer :: ibcx = 1 ! X/Y boundary conditions (0=cyclic,1<= different relaxation ,→ options) 32 integer :: ibcy = 1 ! X/Y boundary conditions (0=cyclic,1<= different relaxation ,→ options) 33 integer :: ibc_top = 7825 ! Lateral Top boundary conditions (0=cyclic,1<=4 different ,→ relaxation options,5=symmetric) 34 integer :: ibc_bot = 7825 ! Lateral Bottom boundary conditions (0=cyclic,1<=4 ,→ different relaxation options,5=symmetric) 35 integer :: ibc_left = 7825 ! Lateral Left boundary conditions (0=cyclic,1<=4 different ,→ relaxation options,5=symmetric) 36 integer :: ibc_right = 7825 ! Lateral Right boundary conditions (0=cyclic,1<=4 different ,→ relaxation options,5=symmetric) input.F90 54 if(ibc_top.eq.7825) ibc_top = ibcy 55 if(ibc_bot.eq.7825) ibc_bot = ibcy 56 if(ibc_left.eq.7825) ibc_left = ibcx 57 if(ibc_right.eq.7825) ibc_right = ibcx 59 if(ibc_top.eq.0.and.ibc_bot.ne.0) then ... 71 if(ibc_left.eq.0.and.ibc_right.ne.0) then msga.F90 56 if((ibc_right.gt.0).and.(mod((mpi_rank+1),nprocx)==0)) rightedge=1 57 if((ibc_left.gt.0).and.(mod((mpi_rank+1),nprocx)==1.or.nprocx==1)) & 58 leftedge=1 59 if ((ibc_bot.gt.0).and.((mpi_rank+1).le.nprocx)) botedge=1 60 if ((ibc_top.gt.0).and.(((numprocs)-(mpi_rank+1))