diff src/SbpOperators/volumeops/derivatives/dissipation.jl @ 1033:0cb4c6b15d8e feature/dissipation_operators

Make closures have the same number of weights in all stencils
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 22 Mar 2022 11:27:45 +0100
parents 129262c8e897
children ed19c549c506
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/dissipation.jl	Tue Mar 22 11:18:57 2022 +0100
+++ b/src/SbpOperators/volumeops/derivatives/dissipation.jl	Tue Mar 22 11:27:45 2022 +0100
@@ -27,8 +27,19 @@
 dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i                       ), dissipation_lower_closure_size(interior_weights))
 dissipation_upper_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=length(interior_weights)-dissipation_upper_closure_size(interior_weights)+i), dissipation_upper_closure_size(interior_weights))
 
-dissipation_transpose_lower_closure_stencils(interior_weights) =         ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights))
-dissipation_transpose_upper_closure_stencils(interior_weights) = reverse(ntuple(i->dissipation_transpose_upper_closure_stencil(interior_weights, i), length(interior_weights)))
+function dissipation_transpose_lower_closure_stencils(interior_weights)
+    closure = ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights))
+
+    N = maximum(s->length(s.weights), closure)
+    return right_pad.(closure, N)
+end
+
+function dissipation_transpose_upper_closure_stencils(interior_weights)
+    closure = reverse(ntuple(i->dissipation_transpose_upper_closure_stencil(interior_weights, i), length(interior_weights)))
+
+    N = maximum(s->length(s.weights), closure)
+    return left_pad.(closure, N)
+end
 
 
 function dissipation_transpose_lower_closure_stencil(interior_weights, i)