comparison src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 1355:102ebdaf7c11 feature/variable_derivatives

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 08 Feb 2023 21:21:28 +0100
parents 3bb94ce74697
children 4684c7f1c4cb
comparison
equal deleted inserted replaced
1210:fa0800591306 1355:102ebdaf7c11
24 check_coefficient(grid, coeff) 24 check_coefficient(grid, coeff)
25 25
26 Δxᵢ = spacing(grid)[dir] 26 Δxᵢ = spacing(grid)[dir]
27 scaled_inner_stencil = scale(inner_stencil, 1/Δxᵢ^2) 27 scaled_inner_stencil = scale(inner_stencil, 1/Δxᵢ^2)
28 scaled_closure_stencils = scale.(Tuple(closure_stencils), 1/Δxᵢ^2) 28 scaled_closure_stencils = scale.(Tuple(closure_stencils), 1/Δxᵢ^2)
29 return SecondDerivativeVariable{dir, dimension(grid)}(scaled_inner_stencil, scaled_closure_stencils, size(grid), coeff) 29 return SecondDerivativeVariable{dir, ndims(grid)}(scaled_inner_stencil, scaled_closure_stencils, size(grid), coeff)
30 end 30 end
31 31
32 function SecondDerivativeVariable(grid::EquidistantGrid{1}, coeff::AbstractVector, inner_stencil::NestedStencil, closure_stencils) 32 function SecondDerivativeVariable(grid::EquidistantGrid{1}, coeff::AbstractVector, inner_stencil::NestedStencil, closure_stencils)
33 return SecondDerivativeVariable(grid, coeff, inner_stencil, closure_stencils, 1) 33 return SecondDerivativeVariable(grid, coeff, inner_stencil, closure_stencils, 1)
34 end 34 end
59 59
60 return SecondDerivativeVariable(grid, coeff, inner_stencil, closure_stencils, dir) 60 return SecondDerivativeVariable(grid, coeff, inner_stencil, closure_stencils, dir)
61 end 61 end
62 62
63 function check_coefficient(grid, coeff) 63 function check_coefficient(grid, coeff)
64 if dimension(grid) != ndims(coeff) 64 if ndims(grid) != ndims(coeff)
65 throw(ArgumentError("The coefficient has dimension $(ndims(coeff)) while the grid is dimension $(dimension(grid))")) 65 throw(ArgumentError("The coefficient has dimension $(ndims(coeff)) while the grid is dimension $(ndims(grid))"))
66 end 66 end
67 67
68 if size(grid) != size(coeff) 68 if size(grid) != size(coeff)
69 throw(DimensionMismatch("the size $(size(coeff)) of the coefficient does not match the size $(size(grid)) of the grid")) 69 throw(DimensionMismatch("the size $(size(coeff)) of the coefficient does not match the size $(size(grid)) of the grid"))
70 end 70 end