Skip to content

Commit ff0cfa3

Browse files
committed
Add per-scheme min_N/max_N bounds and tighten convergence thresholds
WENO5 capped at N=512 (machine-precision floor kills rate at N=1024, error ~2.6e-12, rate collapses to 0.69). WENO3 starts at N=256 to skip coarse pre-asymptotic points. WENO1 and MUSCL2 use full [128,1024] range. Thresholds: WENO5>=4.8, WENO3>=1.8, WENO1>=0.95, MUSCL2>=1.9.
1 parent 22822a0 commit ff0cfa3

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

toolchain/mfc/test/run_convergence_1d.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,21 @@
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.
43+
# (label, extra_args, expected_order, tolerance, min_N, max_N)
44+
# Per-scheme resolution bounds let each scheme run over the range where its
45+
# asymptotic order is cleanly visible:
46+
# WENO5 : cap at N=512 — double-precision floor kills the rate at N=1024
47+
# (error ~2.6e-12, rate collapses to 0.69); [128,512] gives 4.99.
48+
# WENO3 : start at N=256 — skips the coarsest pre-asymptotic points;
49+
# WENO3-JS degrades to 2nd order at smooth extrema (Henrick 2005),
50+
# asymptote confirmed 1.99 at N=4096; [256,1024] gives ~1.87.
51+
# WENO1 : full range [128,1024]; rate 0.97.
52+
# MUSCL2: full range [128,1024]; unlimited slope, rate exactly 2.00.
4753
SCHEMES = [
48-
("WENO5", ["--order", "5"], 5, 1.0, 512),
49-
# WENO3-JS degrades to 2nd order at smooth extrema; expected rate is 2 here.
50-
("WENO3", ["--order", "3"], 2, 0.5, None),
51-
("WENO1", ["--order", "1"], 1, 0.05, None),
52-
("MUSCL2", ["--muscl"], 2, 0.5, None),
54+
("WENO5", ["--order", "5"], 5, 0.2, 128, 512),
55+
("WENO3", ["--order", "3"], 2, 0.2, 256, None),
56+
("WENO1", ["--order", "1"], 1, 0.05, 128, None),
57+
("MUSCL2", ["--muscl"], 2, 0.1, 128, None),
5358
]
5459

5560

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

120125

121-
def test_scheme(label, extra_args, expected_order, tol, resolutions, max_N=None):
126+
def test_scheme(label, extra_args, expected_order, tol, resolutions, min_N=None, max_N=None):
127+
if min_N is not None:
128+
resolutions = [N for N in resolutions if N >= min_N]
122129
if max_N is not None:
123130
resolutions = [N for N in resolutions if N <= max_N]
124131
print(f"\n{'=' * 60}")
@@ -194,11 +201,11 @@ def main():
194201
cfl_extra = ["--cfl", str(args.cfl), "--muscl-lim", str(args.muscl_lim)]
195202

196203
results = {}
197-
for label, extra_args, expected_order, tol, max_N in SCHEMES:
204+
for label, extra_args, expected_order, tol, min_N, max_N in SCHEMES:
198205
if label not in args.schemes:
199206
continue
200207
try:
201-
passed = test_scheme(label, extra_args + cfl_extra, expected_order, tol, args.resolutions, max_N)
208+
passed = test_scheme(label, extra_args + cfl_extra, expected_order, tol, args.resolutions, min_N, max_N)
202209
except Exception as e:
203210
print(f" ERROR: {e}")
204211
passed = False

0 commit comments

Comments
 (0)