Split the vertically implicit solver calls by vertical dimension - #1468
Split the vertically implicit solver calls by vertical dimension#1468havogt wants to merge 4 commits into
Conversation
Each field-operator call from the two solver programs now has a single vertical domain: the w solve (and the corrector's vertical flux update) writes the half-level outputs, and a second call writes the model-level outputs from the solved w. The explicit terms and solver coefficients are computed by a shared field operator in both calls. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kcU44AVBRvbf5HkLHKpc1
The half-level solver call now covers half levels top+1 .. surface-1, which is the column its scans actually run on; level 0 of next_w is the top boundary condition and is written by its own one-level call, like the surface boundary condition already is. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kcU44AVBRvbf5HkLHKpc1
The w solve only needs the increment on the exner term; leaving the
incremented rho term unused behind a runtime `is_iau_active` gives gtfn
an as_fieldop with no target domain ("'target_domain' cannot be 'NEVER'")
in the variant with no static arguments.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015kcU44AVBRvbf5HkLHKpc1
The embedded backend still fails on the scalar concat_where branches of these programs; the split only removes the tuple-domain failure. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015kcU44AVBRvbf5HkLHKpc1
|
When developing, you can test your changes on CSCS CI before merge with the You can pass options to override pipeline variables, for example:
Avoid running the pipeline for all tests when you are developing. Available options are:
For each option, Multiple values can be given to each option with See The Merging Once your PR is approved and ready for merging, add it to the merge queue. The Optional Tests To run benchmarks you can use:
For more detailed information please look at CI in the EXCLAIM universe. |
Description
Each field-operator call from the two vertically implicit solver programs now has a single vertical domain.
Before,
vertically_implicit_solver_at_{predictor,corrector}_stepcalled one fused field operator with a per-output tupledomain=(KHalfDimfor the half-level outputs,KDimfor the model-level ones, same index range). That form never states the column thesolve_wscans run on: on gtfn/dace it is inferred as the union of the outputs' demands and happens to coincide with the intended one because both ranges are(top, surface-1); on embedded it fails outright (AttributeError: 'tuple' object has no attribute 'dim'). A single shared domain for mixedKDim/KHalfDimoutputs is rejected at lowering by the compiled backends, so the calls are split by output dimension instead:_solve_w_at_predictor_step(half levels, writesnext_w) +_compute_thermodynamic_variables_at_predictor_step(model levels, writesnext_rho,next_exner,next_theta_v,dwdz,exner_dynamical_increment)_solve_w_and_update_vertical_fluxes_at_corrector_step(half levels, writesnext_wand the two vertical fluxes) +_compute_thermodynamic_variables_at_corrector_step(model levels)_compute_explicit_terms_and_solver_coefficientsin both calls (no scratch fields; program signatures and callers are unchanged)top+1 .. surface-1, which is the column its scans actually operate on;next_wat the top is written by its own one-level call, like the surface boundary condition already wasis_iau_activegave gtfn'target_domain' cannot be 'NEVER'in the variant with no static argumentsThe embedded xfail (
uses_concat_where) stays on the two solver stencil-test classes: the split alone does not make the solver pass on embedded, because the scalarconcat_wherebranches (broadcast(0.0, (CellDim,))) still fail there withCannot compute length of open 'UnitRange'. #1290 fixes those withvalue_of_size_*and is expected to rebase on this PR; one more site of that kind is not covered by #1290 yet, the corrector'sat_first_substepmass/volume-flux reset.Verified
test_solve_nonhydrodatatests (test_nonhydro_{predictor,corrector}_step,test_run_solve_nonhydro_{single,multi}_step,test_vertically_implicit_solver_at_{predictor,corrector}_step, MCH_CH_R04B09 + EXCLAIM_APE) on embedded: 12/12, same combinationOpen design choice
The second call recomputes the flux divergence (2
neighbor_sumoverC2E) and 5 pointwise expressions and re-reads their inputs. The alternative is three calls with three model-level scratch fields (z_beta,z_rho_expl,z_exner_expl) threaded throughsolve_nonhydroand the bindings. The stencil-test benchmark on the simple grid cannot distinguish the two; a real-grid GPU measurement is needed.🤖 Generated with Claude Code
https://claude.ai/code/session_015kcU44AVBRvbf5HkLHKpc1