comparison 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
comparison
equal deleted inserted replaced
1034:ed19c549c506 1035:ceda69b8f27a
31 end 31 end
32 32
33 midpoint(weights) = length(weights)÷2 + 1 33 midpoint(weights) = length(weights)÷2 + 1
34 midpoint_transpose(weights) = length(weights)+1 - midpoint(weights) 34 midpoint_transpose(weights) = length(weights)+1 - midpoint(weights)
35 35
36 dissipation_interior_stencil(weights) = Stencil(weights..., center=midpoint(weights)) 36 function dissipation_interior_stencil(weights)
37 dissipation_transpose_interior_stencil(weights) = Stencil(weights..., center=midpoint_transpose(weights)) 37 return Stencil(weights..., center=midpoint(weights))
38 end
39 function dissipation_transpose_interior_stencil(weights)
40 if iseven(length(weights))
41 weights = map(-, weights)
42 end
43
44 return Stencil(weights..., center=midpoint_transpose(weights))
45 end
38 46
39 dissipation_lower_closure_size(weights) = midpoint(weights) - 1 47 dissipation_lower_closure_size(weights) = midpoint(weights) - 1
40 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights) 48 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights)
41 49
42 dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i ), dissipation_lower_closure_size(interior_weights)) 50 dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i ), dissipation_lower_closure_size(interior_weights))