def run_test(tenv): nfail = 0 stdout, output = tenv.truchas(4, "steady-flow-6a.inp") # From a special run to compute vof for final exact configuration gold = tenv.output("steady-flow-6a_golden/steady-flow-6a.h5") # Test final VOFs against golden output vof_output = output.field(2, "VOF")[:, 0] vof_gold = gold.field(1, "VOF")[:, 0] nfail += truchas.compare_max(vof_output, vof_gold, 0.09, "VOF", output.time(2)) # max <= l2 <= sqrt(ncell)*max = 31*max nfail += truchas.compare_l2(vof_output, vof_gold, 3 * 0.09, "VOF", output.time(2)) # Test final velocity against exact velocity = output.field(2, "Z_VC") velocity[:, 0] -= 4 velocity[:, 1] -= 3 nfail += truchas.compare_max(velocity, 0, 1e-13, "velocity", output.time(2)) # Test pressure against exact nfail += truchas.compare_max(output.field(1, "Z_P"), 0, 1e-10, "pressure", output.time(1)) nfail += truchas.compare_max(output.field(2, "Z_P"), 0, 1e-10, "pressure", output.time(2)) truchas.report_summary(nfail) return nfail
def run_test(tenv): nfail = 0 stdout, output = tenv.truchas(4, "hydrostatic-old-7a.inp") xc = output.centroids() # pressure pex = sp.array([ -2 * (z - sp.sqrt(3)) if z < sp.sqrt(3) else -(z - sp.sqrt(3)) for z in xc[:, 2] ]) pex -= sp.mean(pex) for sid in (1, 2): pressure = output.field(sid, "Z_P") pressure -= sp.mean(pressure) error = spla.norm(pressure - pex) / pex.size nfail += truchas.compare_l2(error, 0, 8e-3, "pressure", output.time(sid)) # velocity zero everywhere nfail += truchas.compare_max(output.field(2, "Z_VC"), 0, 1e-13, "velocity", output.time(2)) truchas.report_summary(nfail) return nfail
def run_test(tenv): nfail = 0 stdout, output = tenv.truchas(4, "hydrostatic-old.inp") xc = output.centroids() cycle = 20 sid = output.series_id(cycle) time = output.time(sid) # pressure vof = output.field(sid, "VOF")[:, 0] pressure = sp.array( [p for p, vf in zip(output.field(sid, "Z_P"), vof) if vf > 0.99]) pressure -= sp.mean(pressure) dpdz = -9.81e3 pex = [dpdz * z for z, vf in zip(xc[:, 2], vof) if vf > 0.99] pex -= sp.mean(pex) error = spla.norm(pressure - pex) / sp.sqrt(pex.size) nfail += truchas.compare_l2(error, 0, 1e-5, "pressure", time) # velocity zero everywhere nfail += truchas.compare_max(output.field(sid, "Z_VC"), 0, 1e-9, "velocity", time) truchas.report_summary(nfail) return nfail
def run_test(tenv): nfail = 0 stdout, output = tenv.truchas(4, "hydrostatic-old-6b.inp") xc = output.centroids() # pressure pex = sp.array([-2*y + 1 if y < 0.5 else 0 for y in (xc[:,1]+xc[:,2])/sp.sqrt(2)]) for sid in (1, 2): pressure = output.field(sid, "Z_P") error = spla.norm(pressure - pex) / pex.size nfail += truchas.compare_l2(error, 0, 1e-2, "pressure", output.time(sid)) # velocity zero everywhere nfail += truchas.compare_max(output.field(2, "Z_VC"), 0, 1e-13, "velocity", output.time(2)) truchas.report_summary(nfail) return nfail
def run_test(tenv): nfail = 0 stdout, output = tenv.truchas(4, "advection-2b.inp") # From a special run to compute vof for final exact configuration gold = tenv.output("advection-2b_golden/advection-2b.h5") vof_gold = gold.field(1, "VOF")[:, 0] # verify volume fractions at final time sid = output.num_series() time = output.time(sid) vof = output.field(sid, "VOF")[:, 0] # max <= l2 <= sqrt(ncell)*max = 31*max nfail += truchas.compare_max(vof, vof_gold, 0.09, "vof", time) nfail += truchas.compare_l2(vof, vof_gold, 4 * 0.09, "vof", time) truchas.report_summary(nfail) return nfail
def run_test(tenv): nfail = 0 stdout, output = tenv.truchas(4, "advection-3b-exact.inp") # From a special run to compute vof for final exact configuration gold = tenv.output("advection-3b-exact_pgolden/advection-3b-exact.h5") vof_gold = gold.field(1, "VOF")[:,0] # verify volume fractions at final time time = output.time(2) vof = output.field(2, "VOF")[:,0] # max <= l2 <= sqrt(ncell)*max = sqrt(3)*31*max err = abs(vof - vof_gold) nfail += truchas.compare_max(err, 0, 0.5, "vof", time) nfail += truchas.compare_l2(err / sp.sqrt(len(err)), 0, 0.05, "vof", time) truchas.report_summary(nfail) return nfail