Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1032:11767fbb29f4 | 1033:0cb4c6b15d8e |
|---|---|
| 25 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights) | 25 dissipation_upper_closure_size(weights) = length(weights) - midpoint(weights) |
| 26 | 26 |
| 27 dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i ), dissipation_lower_closure_size(interior_weights)) | 27 dissipation_lower_closure_stencils(interior_weights) = ntuple(i->Stencil(interior_weights..., center=i ), dissipation_lower_closure_size(interior_weights)) |
| 28 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)) | 28 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)) |
| 29 | 29 |
| 30 dissipation_transpose_lower_closure_stencils(interior_weights) = ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights)) | 30 function dissipation_transpose_lower_closure_stencils(interior_weights) |
| 31 dissipation_transpose_upper_closure_stencils(interior_weights) = reverse(ntuple(i->dissipation_transpose_upper_closure_stencil(interior_weights, i), length(interior_weights))) | 31 closure = ntuple(i->dissipation_transpose_lower_closure_stencil(interior_weights, i), length(interior_weights)) |
| 32 | |
| 33 N = maximum(s->length(s.weights), closure) | |
| 34 return right_pad.(closure, N) | |
| 35 end | |
| 36 | |
| 37 function dissipation_transpose_upper_closure_stencils(interior_weights) | |
| 38 closure = reverse(ntuple(i->dissipation_transpose_upper_closure_stencil(interior_weights, i), length(interior_weights))) | |
| 39 | |
| 40 N = maximum(s->length(s.weights), closure) | |
| 41 return left_pad.(closure, N) | |
| 42 end | |
| 32 | 43 |
| 33 | 44 |
| 34 function dissipation_transpose_lower_closure_stencil(interior_weights, i) | 45 function dissipation_transpose_lower_closure_stencil(interior_weights, i) |
| 35 w = ntuple(k->interior_weights[i], dissipation_lower_closure_size(interior_weights)) | 46 w = ntuple(k->interior_weights[i], dissipation_lower_closure_size(interior_weights)) |
| 36 | 47 |
