Skip to content

Fix temperature drift caused by ekh timing mismatch in flux-type top BC#318

Open
Xinzhe20 wants to merge 1 commit into
uDALES:masterfrom
Xinzhe20:fix-fluxtop-pr
Open

Fix temperature drift caused by ekh timing mismatch in flux-type top BC#318
Xinzhe20 wants to merge 1 commit into
uDALES:masterfrom
Xinzhe20:fix-fluxtop-pr

Conversation

@Xinzhe20

@Xinzhe20 Xinzhe20 commented Jul 2, 2026

Copy link
Copy Markdown

closure() updates ekh to ekh_{N+1} at the start of each RK3 substep, but fluxtop() (called via boundary()) had already set the top ghost cell thl0(ke+1) using the previous ekh_N. diffc() then computed the top-boundary flux using the mismatched ekh_{N+1}, causing the realized flux to deviate from the prescribed wttop by ~0.72%, producing a systematic linear domain-temperature drift (dT/dt not converging to zero, scaling with dt).

Fix: call fluxtop() again immediately after closure() inside subgrid(), using the just-updated ekh, before diffc() consumes the ghost cell. Only active when ltempeq .and. BCtopT == BCtopT_flux.

Verified on hpc: drift reduced from +7.93e-04 K.m/s to -2.10e-05 K.m/s (97% reduction), case 001 (unpatched) vs case 002 (patched), bctfz = wttop = -0.1. Re-verified with a clean rebuild (case 005, 26000s run) to confirm the cleaned-up patch reproduces identical convergence behavior.
Closes #317

closure() updates ekh to ekh_{N+1} at the start of each RK3 substep,
but fluxtop() (called via boundary()) had already set the top ghost
cell thl0(ke+1) using the previous ekh_N. diffc() then computed the
top-boundary flux using the mismatched ekh_{N+1}, causing the
realized flux to deviate from the prescribed wttop by ~0.72%,
producing a systematic linear domain-temperature drift (dT/dt not
converging to zero, scaling with dt).

Fix: call fluxtop() again immediately after closure() inside
subgrid(), using the just-updated ekh, before diffc() consumes the
ghost cell. Only active when ltempeq .and. BCtopT == BCtopT_flux.

Verified on Imperial CX3: drift reduced from +7.93e-04 K.m/s to
-2.10e-05 K.m/s (97% reduction), case 001 (unpatched) vs case 002
(patched), bctfz = wttop = -0.1. Re-verified with a clean rebuild
(case 005, 26000s run) to confirm the cleaned-up patch reproduces
identical convergence behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Abnormal temperature drift under equal in/out heat flux (Neumann boundary condition)

1 participant