21 m_name, dim =
"UP3D_128.cgns", 3
22 meshFile = os.path.join(
23 os.path.dirname(__file__),
30 outDir =
"../data/out/test5_test"
37 "meshDirectBisect": 1,
38 "second_level_parts": int(128),
43 fv_settings={
"intOrder": 1,
"maxOrder": 1},
47 solver.BuildDataArray()
49 solver.eval.setConfig(
51 "threadsPerBlock": 128,
52 "serializeCUDAExecution":
True,
57 solver.to_device(
"CUDA")
61 numCellGlobal = mesh.NumCellGlobal()
63 u.setConstant(np.array([1, 0, 0, 0, 2.5]).reshape(-1, 1))
65 zCent = 0.5
if dim == 3
else 0.0
67 for iCell
in range(mesh.NumCell()):
68 x = fv.GetCellBary(iCell)
69 if np.linalg.norm(np.array([0.5, 0.5, zCent]) - x, np.inf) < 0.25:
72 uBox = [0.5, 1, 0, 0, 4]
74 u[iCell] = np.array(uBox, dtype=np.float64).reshape(-1, 1)
82 device_run = DNDS.DeviceBackend.Unknown
84 solver.data_to_device(
"CUDA")
85 device_run = DNDS.DeviceBackend.CUDA
86 for n, a
in data.items():
87 a.trans.initPersistentPull(device_run)
89 solver.runningDevice = device_run
90 u.trans.startPersistentPull(device_run)
91 u.trans.waitPersistentPull(device_run)
108 pr = cProfile.Profile()
113 for II
in range(1, nInt + 1):
114 tW0 = time.perf_counter()
115 iStepNew, tNew = solver.IntegrateDt_ExplicitInterval(
116 t, t + tInt, CFL=CFL, step0=iStep, max_step=iStep + 100000
118 tW1 = time.perf_counter()
122 tStep = (tW1 - tW0) / (iStepNew - iStep)
123 print(f
"Average time per step: [{tStep:.4e}]")
124 print(f
"cell step / second: [{numCellGlobal / tStep:.4e}]")
130 data[
"uPrim"].to_host()
132 solver.eval.PrintDataVTKHDF(
133 os.path.join(outDir, f
"testC_{II}"),
134 os.path.join(outDir,
"testC"),
135 arrCellCentScalar=[data[
"p"]],
136 arrCellCentScalar_names=[
"p"],
137 uPrimCell=data[
"uPrim"],
141 data[
"uPrim"].to_device(
"CUDA")
142 data[
"p"].to_device(
"CUDA")
144 pr.dump_stats(f
"profile_rank_{mpi.rank}.prof")