Generate SW4 input files from a realisation - #141
Draft
lispandfound wants to merge 1 commit into
Draft
Conversation
lispandfound
force-pushed
the
nzvm/sw4-template
branch
from
September 2, 2026 02:23
a7e01fb to
43823b5
Compare
lispandfound
force-pushed
the
nzvm/sw4-template
branch
from
September 2, 2026 02:52
43823b5 to
5622e57
Compare
`create-sw4-input` renders the SW4 input file for a realisation: the grid, the refinement stack, the source, the stations, and whatever commands the `sw4` section carries. The requested domain becomes the grid's *interior*. The grid is padded laterally by one supergrid width on each side, so the sponge sits outside the region anyone asked to simulate rather than eating into it. `adjust_for_topography` handles the interaction between topography and the refinement stack. Topography lifts the top of the grid above z=0, which thins the first layer; SW4 requires every grid in the stack to hold at least `nz_min` cells, so any layer left too thin is pushed down until it does. The topography surface participates in that count as a boundary but is not itself returned as a refinement -- the caller gets back the real layers plus the depth used. Commands come from the realisation rather than being hard-coded, so a run can add or override any SW4 command without a code change. Output commands that take a time window are merged with the simulation duration on the way out. `test_bottom_refinement_holds_the_sponge` asserts against the shipped v26.7.1Hz configuration rather than a synthetic one: the invariant that matters is that the bottom refinement of a *real* domain is thick enough to hold the bottom sponge, at every depth we support. Requires nzcvm (for `nzcvm.formats.sfile`, used to read the model's lateral footprint), which in turn forces `requires-python >= 3.13`. nzcvm is currently a git dependency and this cannot merge until it is released. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lispandfound
force-pushed
the
nzvm/sw4-template
branch
from
September 4, 2026 01:44
5622e57 to
5ac8a39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
create-sw4-inputrenders the SW4 input file for a realisation: thegrid, the refinement stack, the source, the stations, and whatever
commands the
sw4section carries.The requested domain becomes the grid's interior. The grid is padded
laterally by one supergrid width on each side, so the sponge sits
outside the region anyone asked to simulate rather than eating into it.
adjust_for_topographyhandles the interaction between topography andthe refinement stack. Topography lifts the top of the grid above z=0,
which thins the first layer; SW4 requires every grid in the stack to
hold at least
nz_mincells, so any layer left too thin is pushed downuntil it does. The topography surface participates in that count as a
boundary but is not itself returned as a refinement -- the caller gets
back the real layers plus the depth used.
Commands come from the realisation rather than being hard-coded, so a
run can add or override any SW4 command without a code change. Output
commands that take a time window are merged with the simulation
duration on the way out.
test_bottom_refinement_holds_the_spongeasserts against the shippedv26.7.1Hz configuration rather than a synthetic one: the invariant that
matters is that the bottom refinement of a real domain is thick enough
to hold the bottom sponge, at every depth we support.
Requires nzcvm (for
nzcvm.formats.sfile, used to read the model'slateral footprint), which in turn forces
requires-python >= 3.13.nzcvm is currently a git dependency and this cannot merge until it is
released.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Stack created with GitHub Stacks CLI • Give Feedback 💬