@@ -282,8 +282,9 @@ def evaluate_stencils(df, point_type, n_stencils, left_variants, right_variants,
282282
283283 if point_type == 'paired_right' :
284284 dst = df .dist .to_numpy ()[:, np .newaxis ]
285+ # dst used to have a minus (this was wrong)
285286 eta_left = np .tile (df .eta_l .to_numpy ()[:, np .newaxis ],
286- (1 , n_stencils )) + n_stencils - dst - eta_base - 1
287+ (1 , n_stencils )) + n_stencils + dst - eta_base - 1
287288 eta_right = np .tile (df .eta_r .to_numpy ()[:, np .newaxis ],
288289 (1 , n_stencils )) + n_stencils - eta_base - 1
289290 for left_var in range (space_order + 1 ):
@@ -294,7 +295,6 @@ def evaluate_stencils(df, point_type, n_stencils, left_variants, right_variants,
294295 func = coeff_functions [left_var , right_var , coeff ]
295296 stencils [mask , coeff ] = func (eta_left [mask ],
296297 eta_right [mask ])
297-
298298 return stencils
299299
300300
@@ -531,11 +531,10 @@ def get_component_weights(data, axis, function, deriv, stencil_generator):
531531 w_shape = f_grid .shape + (ncoeffs ,)
532532 w_dims = f_grid .dimensions + (s_dim ,)
533533
534- w = Function (name = 'w' , dimensions = w_dims , shape = w_shape )
534+ w = Function (name = 'w_' + axis_dim , dimensions = w_dims , shape = w_shape )
535535
536536 w .data [:] = standard_stencil (deriv , function .space_order )
537537
538- # FIXME: All of these except "double" have a bug
539538 # Fill the stencils
540539 get_variants (first , function .space_order , 'first' ,
541540 axis_dim , stencil_generator , w )
@@ -553,7 +552,7 @@ def get_component_weights(data, axis, function, deriv, stencil_generator):
553552 get_variants (paired_right , function .space_order , 'paired_right' ,
554553 axis_dim , stencil_generator , w )
555554
556- w .data [:] /= f_grid .spacing [axis ] # Divide everything through by spacing
555+ w .data [:] /= f_grid .spacing [axis ]** deriv # Divide everything through by spacing
557556
558557 return w
559558
@@ -589,13 +588,15 @@ def get_weights(data, function, deriv, bcs, offsets=(0, 0, 0)):
589588 stencil_file = stencil_file )
590589
591590 # FIXME: This will want to cope with varying numbers of dims in the future
591+ # FIXME: Why does the name fix work?
592592 weights = [None for i in range (3 )]
593593 for axis in range (3 ):
594594 sten_gen .all_variants (deriv , offsets [axis ])
595595 axis_weights = get_component_weights (data [axis ].data , axis , function ,
596596 deriv , sten_gen )
597+ # Am I doing something dumb here?
598+ print (deriv , function , function .grid .dimensions [axis ], axis_weights )
597599 weights [axis ] = Coefficient (deriv , function ,
598600 function .grid .dimensions [axis ],
599601 axis_weights )
600-
601602 return Substitutions (* tuple (weights ))
0 commit comments