Use direct momentum in opt-in shifted blocked equilibrium

This commit is contained in:
Codex committed 2026-10-17 00:18:00 -07:00
1 parent c33caf636d
commit b77f2238dd
7 files changed
+66 -1

No files matched your search

@@ -19,6 +19,15 @@ def test_retained_density_and_shifted_planar_headers(tmp_path):
if u==0:
np.testing.assert_allclose(a.sum(),delta,rtol=5e-8,atol=0)
if delta: assert np.any(a!=0)
elif kind=='J':
delta,jx,jy,ux,uy=np.array(numbers,dtype=np.float32).astype(float)
jd=cx*jx+cy*jy;ud=cx*ux+cy*uy
expected=w*(delta+3*jd+4.5*jd*ud-1.5*(jx*ux+jy*uy))
np.testing.assert_allclose(a,expected,rtol=3e-6,atol=2e-9)
actual=np.array([a.sum(),a@cx,a@cy,a@(cx*cx),a@(cx*cy),a@(cy*cy)])
target=np.array([delta,jx,jy,delta/3+jx*ux,jx*uy,delta/3+jy*uy])
np.testing.assert_allclose(actual,target,atol=4e-9,rtol=3e-6)
if jx==0 and delta: assert np.any(a!=0)
else:
mode=int(numbers[0]);rho,u,v=np.array(numbers[1:],dtype=np.float32).astype(float)
b=np.fromstring(next(it),sep=' ',dtype=np.float32).astype(float)