@@ -98,6 +98,8 @@ def paramlist(parameters, keys):
9898 stencil = lbmpy .stencils .LBStencil (lbmpy .enums .Stencil .D3Q19 )
9999 fields = pystencils_espresso .generate_fields (config , stencil )
100100 force_field = fields ["force" ]
101+ lbm_opt = lbmpy .LBMOptimisation (symbolic_field = fields ["pdfs" ])
102+ streaming_pattern = "push"
101103
102104 # LB Method definition
103105 method = lbmpy .creationfunctions .create_mrt_orthogonal (
@@ -133,12 +135,11 @@ def paramlist(parameters, keys):
133135 force_model = lbmpy .ForceModel .GUO ,
134136 force = force_field .center_vector ,
135137 kernel_type = "collide_only" )
136- lbm_opt = lbmpy .LBMOptimisation (symbolic_field = fields ["pdfs" ])
137- le_collision_rule_unthermalized = lbmpy .create_lb_update_rule (
138+ le_update_rule_unthermalized = lbmpy .create_lb_update_rule (
138139 lbm_config = le_config ,
139140 lbm_optimisation = lbm_opt )
140141 le_collision_rule_unthermalized = lees_edwards .add_lees_edwards_to_collision (
141- config , le_collision_rule_unthermalized ,
142+ config , le_update_rule_unthermalized ,
142143 fields ["pdfs" ], stencil , 1 ) # shear_dir_normal y
143144 for params , target_suffix in paramlist (parameters , ("GPU" , "CPU" , "AVX" )):
144145 pystencils_espresso .generate_collision_sweep (
@@ -153,8 +154,8 @@ def paramlist(parameters, keys):
153154 ps .TypedSymbol (f"block_offset_{ i } " , np .uint32 )
154155 for i in range (3 ))
155156
156- # generate thermalized LB
157- collision_rule_thermalized = lbmpy .creationfunctions .create_lb_collision_rule (
157+ # generate thermalized LB collision rule
158+ lb_collision_rule_thermalized = lbmpy .creationfunctions .create_lb_collision_rule (
158159 method ,
159160 zero_centered = False ,
160161 fluctuating = {
@@ -170,7 +171,7 @@ def paramlist(parameters, keys):
170171 pystencils_espresso .generate_collision_sweep (
171172 ctx ,
172173 method ,
173- collision_rule_thermalized ,
174+ lb_collision_rule_thermalized ,
174175 stem ,
175176 params ,
176177 block_offset = block_offsets ,
@@ -192,6 +193,30 @@ def paramlist(parameters, keys):
192193 ctx , config , method , templates
193194 )
194195
196+ # generate PackInfo
197+ assignments = pystencils_espresso .generate_pack_info_pdfs_field_assignments (
198+ fields , streaming_pattern = "pull" )
199+ spec = pystencils_espresso .generate_pack_info_vector_field_specifications (
200+ config , stencil , force_field .layout )
201+ for params , target_suffix in paramlist (parameters , ["CPU" ]):
202+ pystencils_walberla .generate_pack_info_from_kernel (
203+ ctx , f"PackInfoPdf{ precision_prefix } { target_suffix } " , assignments ,
204+ kind = "pull" , ** params )
205+ pystencils_walberla .generate_pack_info (
206+ ctx , f"PackInfoVec{ precision_prefix } { target_suffix } " , spec , ** params )
207+ if target_suffix == "CUDA" :
208+ continue
209+ token = "\n //TODO: optimize by generating kernel for this case\n "
210+ for field_suffix in ["Pdf" , "Vec" ]:
211+ class_name = f"PackInfo{ field_suffix } { precision_prefix } { target_suffix } " # nopep8
212+ with open (f"{ class_name } .h" , "r+" ) as f :
213+ content = f .read ()
214+ assert token in content
215+ content = content .replace (token , "\n " )
216+ f .seek (0 )
217+ f .truncate ()
218+ f .write (content )
219+
195220 # boundary conditions
196221 ubb_dynamic = lbmpy_espresso .UBB (
197222 lambda * args : None , dim = 3 , data_type = config .data_type .default_factory ())
@@ -202,7 +227,7 @@ def paramlist(parameters, keys):
202227 lbmpy_walberla .generate_boundary (
203228 ctx , f"Dynamic_UBB_{ precision_suffix } { target_suffix } " , ubb_dynamic ,
204229 method , additional_data_handler = ubb_data_handler ,
205- streaming_pattern = "push" , target = target )
230+ streaming_pattern = streaming_pattern , target = target )
206231
207232 with open (f"Dynamic_UBB_{ precision_suffix } { target_suffix } .h" , "r+" ) as f :
208233 content = f .read ()
0 commit comments