diff src/SbpOperators/volumeops/derivatives/dissipation.jl @ 1035:ceda69b8f27a feature/dissipation_operators

Add test for transpose equality and fix bugs found
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 22 Mar 2022 13:28:06 +0100
parents ed19c549c506
children c89c6b63c7f4
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/dissipation.jl	Tue Mar 22 12:33:58 2022 +0100
+++ b/src/SbpOperators/volumeops/derivatives/dissipation.jl	Tue Mar 22 13:28:06 2022 +0100
@@ -33,8 +33,16 @@
 midpoint(weights) = length(weights)รท2 + 1
 midpoint_transpose(weights) = length(weights)+1 - midpoint(weights)
 
-dissipation_interior_stencil(weights) =           Stencil(weights..., center=midpoint(weights))
-dissipation_transpose_interior_stencil(weights) = Stencil(weights..., center=midpoint_transpose(weights))
+function dissipation_interior_stencil(weights)
+    return Stencil(weights..., center=midpoint(weights))
+end
+function dissipation_transpose_interior_stencil(weights)
+    if iseven(length(weights))
+        weights = map(-, weights)
+    end
+
+    return Stencil(weights..., center=midpoint_transpose(weights))
+end
 
 dissipation_lower_closure_size(weights) = midpoint(weights) - 1
 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights)