30U, RE, DT, STEPS = 1.0, 100.0, 0.5, 400
36 s = pf.SolverColocated(L, H, NZ)
41 s.set_domain_bc(
"-x",
"inflow", (U, 0.0, 0.0))
42 s.set_domain_bc(
"+x",
"outflow")
43 s.set_domain_bc(
"-y",
"wall")
44 s.set_domain_bc(
"+y",
"wall")
45 s.diagnostics.set_velocity_solver_params(60)
46 s.set_pressure_pcg(
True, 400, 1e-9)
47 s.set_pressure_geometry(np.asfortranarray(np.full((L, H, NZ), 1e30)))
52 """Pytest entry point (tests/python is collected by ctest as pytest too)."""
54 for _
in range(STEPS):
56 u = np.asarray(s.get_u())
57 assert np.isfinite(u).all(),
"collocated open boundary went non-finite"
60 flux_in = float(u[2, :, k].sum())
61 flux_out = float(u[L - 3, :, k].sum())
62 mass_err = abs(flux_out - flux_in) / abs(flux_in)
63 assert mass_err < 1e-3, f
"mass not conserved: {mass_err:.2e}"
66 ratio = float(prof.max() / prof.mean())
67 assert 1.45 < ratio < 1.55, f
"profile not developed Poiseuille: u_max/U_mean = {ratio:.4f}"
69 div = float(s.max_open_divergence())
70 assert div < 1e-3, f
"face field not divergence-free: {div:.2e}"
71 return mass_err, ratio, div