22 m_name, dim =
"UP3D_128.cgns", 3
23 meshFile = os.path.join(
24 os.path.dirname(__file__),
31 outDir =
"../data/out/test5_test"
38 "meshDirectBisect": 1,
39 "second_level_parts": int(128),
44 fv_settings={
"intOrder": 1,
"maxOrder": 1},
48 solver.BuildDataArray()
50 solver.eval.setConfig(
52 "threadsPerBlock": 128,
53 "serializeCUDAExecution":
True,
58 solver.to_device(
"CUDA")
62 numCellGlobal = mesh.NumCellGlobal()
64 u.setConstant(np.array([1, 0, 0, 0, 2.5]).reshape(-1, 1))
66 zCent = 0.5
if dim == 3
else 0.0
68 for iCell
in range(mesh.NumCell()):
69 x = fv.GetCellBary(iCell)
70 if np.linalg.norm(np.array([0.5, 0.5, zCent]) - x, np.inf) < 0.25:
73 uBox = [0.5, 1, 0, 0, 4]
75 u[iCell] = np.array(uBox, dtype=np.float64).reshape(-1, 1)
83 device_run = DNDS.DeviceBackend.Unknown
85 solver.data_to_device(
"CUDA")
86 device_run = DNDS.DeviceBackend.CUDA
87 for n, a
in data.items():
88 a.trans.initPersistentPull(device_run)
90 solver.runningDevice = device_run
91 u.trans.startPersistentPull(device_run)
92 u.trans.waitPersistentPull(device_run)
109 pr = cProfile.Profile()
114 for II
in range(1, nInt + 1):
115 tW0 = time.perf_counter()
116 iStepNew, tNew = solver.IntegrateDt_ExplicitInterval(
117 t, t + tInt, CFL=CFL, step0=iStep, max_step=iStep + 100000
119 tW1 = time.perf_counter()
123 tStep = (tW1 - tW0) / (iStepNew - iStep)
124 print(f
"Average time per step: [{tStep:.4e}]")
125 print(f
"cell step / second: [{numCellGlobal / tStep:.4e}]")
131 data[
"uPrim"].to_host()
133 solver.eval.PrintDataVTKHDF(
134 os.path.join(outDir, f
"testC_{II}"),
135 os.path.join(outDir,
"testC"),
136 arrCellCentScalar=[data[
"p"]],
137 arrCellCentScalar_names=[
"p"],
138 uPrimCell=data[
"uPrim"],
142 data[
"uPrim"].to_device(
"CUDA")
143 data[
"p"].to_device(
"CUDA")
145 pr.dump_stats(f
"profile_rank_{mpi.rank}.prof")