67step, t, blocks, vel, pres, series = rp.load_ckpt(CKPT)
73 _dummy.set_pressure_geometry(np.full((
arg(
"--dummy", 17, int), 13, 11), 10.0, order=
"F"))
81 o.set_pressure_multigrid(
True, _L)
84if not hasattr(rp.pf.Solver,
"set_superficial_velocity")
and hasattr(rp.pf.Solver,
"set_bulk_velocity"):
85 rp.pf.Solver.set_superficial_velocity = rp.pf.Solver.set_bulk_velocity
87if "--viscous-stress" in A:
88 s.set_viscous_stress(
arg(
"--viscous-stress",
"laplacian"))
89for c, a
in enumerate(vel):
92s.diagnostics.set_vof_step_parity(step)
94for _name
in (
"set_superficial_velocity",
"set_bulk_velocity"):
96 getattr(s, _name)(FLUX ==
"device",
"x", 0.0)
99 s.set_pressure_pcg(
True, 800, RTOL)
101 s.set_pressure_fcg(
True, 800, RTOL)
103 s.set_pressure_chebyshev(
True,
arg(
"--cheb-maxit", 120, int), RTOL)
105 s.set_pressure_bottom(
arg(
"--bottom",
"auto"))
106if "--bottom-solver" in A:
107 s.diagnostics.set_pressure_bottom_solver(
arg(
"--bottom-solver",
"auto"))
108if "--vcycle-precision" in A:
109 s.diagnostics.set_pressure_vcycle_precision(
arg(
"--vcycle-precision",
"fp64"))
110if "--initial-guess" in A:
111 s.diagnostics.set_pressure_initial_guess(
arg(
"--initial-guess",
"zero"),
112 arg(
"--guess-history", 2, int))
115STATS =
"--stats" in A
116stats = {k: []
for k
in (
"volume",
"area",
"centroid",
"velocity",
"moments")}
117print(f
"build {time.time()-t_b:.2f} s", flush=
True)
122T = {
"limits": 0.0,
"step": 0.0,
"flux": 0.0}
127 t0 = time.perf_counter()
131 L = s.vof_step_limits()
132 dt = min(dtsafe * L[
"cfl_dt"], dtsafe * L[
"capillary_dt"])
134 t1 = time.perf_counter()
136 t2 = time.perf_counter()
139 s.set_velocity(0, np.asfortranarray(u - float(u.mean())))
140 t3 = time.perf_counter()
142 T[
"limits"] += t1 - t0
145 iters.append(s.diagnostics.last_pressure_iterations())
147 divs.append(s.max_open_divergence_projected())
149 st = s.diagnostics.vof_block_stats()
151 stats[k].append([b[k]
for b
in st])
159 s.diagnostics.set_vof_timing(
True)
160w0 = time.perf_counter()
161dts = [
one(
True)
for _
in range(N)]
162wall = time.perf_counter() - w0
163print(f
"steps {N} wall {wall:.3f} s {1000*wall/N:.2f} ms/step dt mean {np.mean(dts):.3e}")
164print(
"per-step ms: " +
" ".join(f
"{k} {1000*v/N:.2f}" for k, v
in T.items()))
165print(f
"pressure iters mean {np.mean(iters):.2f} min {min(iters)} max {max(iters)}")
166if "--cheb" in A
and hasattr(s.diagnostics,
"num_pressure_chebyshev_restarts"):
167 print(f
"chebyshev restarts {s.diagnostics.num_pressure_chebyshev_restarts}")
169 v = s.diagnostics.vof_timing()
171 print(
"vof_timing per step ms (steps=%d):" % n)
172 for k, x
in v.items():
173 if k
in (
"steps",
"k_sweeps",
"kc_calls"):
176 print(f
" {k:22s} {1000*x/n:8.3f}")
178 cols = {f
"col{b['id']}": np.asarray(s.vof_block_color(b[
"id"]))
179 for b
in s.diagnostics.vof_block_stats()}
180 np.savez(DUMP, u=s.get_u(), v=s.get_v(), w=s.get_w(), p=s.get_field(
"p"), C=s.get_field(
"C"),
181 dts=np.array(dts), iters=np.array(iters, dtype=np.int64), **cols,
182 **({
"div": np.array(divs)}
if DIV
else {}),
183 **({f
"st_{k}": np.array(v)
for k, v
in stats.items()}
if STATS
else {}))
184 print(
"dumped", DUMP, f
"({len(cols)} block colours)")