Skip to content

Commit 22822a0

Browse files
committed
1D convergence: raise resolutions to 128-1024, tighten WENO1 threshold to 0.95
Default and CI resolutions: 128 256 512 1024. WENO5 is capped at N=512 per-scheme (hits double-precision floor at N=1024 after 111k steps; error ~2.6e-12 vs 4.2e-12 at N=512, rate collapses to 0.69). N=128-512 gives fitted rate 4.99. WENO1 threshold tightened from 0.6 to 0.95 (tol 0.05): pairwise rates 0.95->0.97->0.99 at N=128-1024, fitted 0.97. MUSCL2 shows exact rate 2.00 at all doublings N=128-1024.
1 parent da94a26 commit 22822a0

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

.github/workflows/convergence.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Run 1D convergence tests
3838
run: |
3939
python toolchain/mfc/test/run_convergence_1d.py \
40-
--resolutions 32 64 128 256
40+
--resolutions 128 256 512 1024
4141
4242
convergence-2d:
4343
name: "2D Isentropic Vortex Convergence"

toolchain/mfc/test/run_convergence_1d.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@
4040
CASE = "examples/1D_euler_convergence/case.py"
4141
MFC = "./mfc.sh"
4242

43+
# (label, extra_args, expected_order, tolerance, max_N)
44+
# max_N caps the resolution list per scheme. WENO5 hits the double-precision
45+
# floor around N=512 (error ~4e-12 after 56k steps); capping at 512 keeps the
46+
# fitted rate clean. Other schemes are not limited.
4347
SCHEMES = [
44-
("WENO5", ["--order", "5"], 5, 1.0),
48+
("WENO5", ["--order", "5"], 5, 1.0, 512),
4549
# WENO3-JS degrades to 2nd order at smooth extrema; expected rate is 2 here.
46-
("WENO3", ["--order", "3"], 2, 0.5),
47-
("WENO1", ["--order", "1"], 1, 0.4),
48-
("MUSCL2", ["--muscl"], 2, 0.5),
50+
("WENO3", ["--order", "3"], 2, 0.5, None),
51+
("WENO1", ["--order", "1"], 1, 0.05, None),
52+
("MUSCL2", ["--muscl"], 2, 0.5, None),
4953
]
5054

5155

@@ -114,7 +118,9 @@ def run_case(tmpdir: str, N: int, extra_args: list):
114118
return Nt, os.path.join(tmpdir, f"N{N}")
115119

116120

117-
def test_scheme(label, extra_args, expected_order, tol, resolutions):
121+
def test_scheme(label, extra_args, expected_order, tol, resolutions, max_N=None):
122+
if max_N is not None:
123+
resolutions = [N for N in resolutions if N <= max_N]
118124
print(f"\n{'=' * 60}")
119125
print(f" {label} (need rate >= {expected_order - tol:.1f})")
120126
print(f"{'=' * 60}")
@@ -163,8 +169,8 @@ def main():
163169
"--resolutions",
164170
type=int,
165171
nargs="+",
166-
default=[32, 64, 128],
167-
help="Grid resolutions to test (default: 32 64 128)",
172+
default=[128, 256, 512, 1024],
173+
help="Grid resolutions to test (default: 128 256 512 1024)",
168174
)
169175
parser.add_argument(
170176
"--schemes",
@@ -188,11 +194,11 @@ def main():
188194
cfl_extra = ["--cfl", str(args.cfl), "--muscl-lim", str(args.muscl_lim)]
189195

190196
results = {}
191-
for label, extra_args, expected_order, tol in SCHEMES:
197+
for label, extra_args, expected_order, tol, max_N in SCHEMES:
192198
if label not in args.schemes:
193199
continue
194200
try:
195-
passed = test_scheme(label, extra_args + cfl_extra, expected_order, tol, args.resolutions)
201+
passed = test_scheme(label, extra_args + cfl_extra, expected_order, tol, args.resolutions, max_N)
196202
except Exception as e:
197203
print(f" ERROR: {e}")
198204
passed = False

0 commit comments

Comments
 (0)