File tree Expand file tree Collapse file tree 2 files changed +15
-17
lines changed
Expand file tree Collapse file tree 2 files changed +15
-17
lines changed Original file line number Diff line number Diff line change 7676}
7777
7878melt_pool = create_melt_pool (melt_pool_dict , enable_random_phases = True )
79- for path_vector in path_vectors :
80- path_vector .set_melt_pool_properties (melt_pool )
8179
8280# 4. Compute porosity using conic section / superellipse curves for melt pool mask
83- porosity = compute_porosity (
84- grid ,
85- path_vectors ,
86- melt_pool ,
87- )
81+ porosity = compute_porosity (grid , path_vectors , melt_pool , jit_warmup = True )
8882
8983# 5. Write porosity field to .VTI
9084write_vtk (grid .origin , grid .resolution , porosity , "rve.vti" )
Original file line number Diff line number Diff line change @@ -155,24 +155,28 @@ def create_melt_pool(
155155
156156
157157def compute_porosity (
158- grid : Grid , path_vectors : List [PathVector ], melt_pool : MeltPool
158+ grid : Grid ,
159+ path_vectors : List [PathVector ],
160+ melt_pool : MeltPool ,
161+ jit_warmup : Optional [bool ] = True ,
159162) -> None :
160163 """
161164 Main computation: computes porosity field.
162165 """
163166
164- print ("JIT Warmup..." )
165- t_start_warmup = time .time ()
167+ if jit_warmup :
168+ print ("JIT Warmup..." )
169+ t_start_warmup = time .time ()
166170
167- # Warm up the vector property assignment.
168- if path_vectors :
169- path_vectors [0 ].set_melt_pool_properties (melt_pool )
171+ # Warm up the vector property assignment.
172+ if path_vectors :
173+ path_vectors [0 ].set_melt_pool_properties (melt_pool )
170174
171- # Warm up the main, parallelized compute kernel.
172- if grid .n_voxels > 0 and path_vectors :
173- _ = compute_melt_mask (grid .voxels [0 :1 ], melt_pool , path_vectors [0 :1 ])
175+ # Warm up the main, parallelized compute kernel.
176+ if grid .n_voxels > 0 and path_vectors :
177+ _ = compute_melt_mask (grid .voxels [0 :1 ], melt_pool , path_vectors [0 :1 ])
174178
175- print (f" -> JIT warmup complete ({ time .time () - t_start_warmup :.8f} s)." )
179+ print (f" -> JIT warmup complete ({ time .time () - t_start_warmup :.8f} s)." )
176180
177181 print (f"Preparing { len (path_vectors )} path vectors for simulation..." )
178182 t0_setup = time .time ()
You can’t perform that action at this time.
0 commit comments