comparison src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 906:33c7e266e1a9 feature/variable_derivatives

Add fix for type instability in SecondDerivativeVariable along with tests
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Feb 2022 09:56:07 +0100
parents 5bbc3ea3821b
children cad3a9f82009
comparison
equal deleted inserted replaced
905:a3bc90c59e8e 906:33c7e266e1a9
28 """ 28 """
29 SecondDerivativeVariable{T,N,M,K} <: TensorOperator{T,1} 29 SecondDerivativeVariable{T,N,M,K} <: TensorOperator{T,1}
30 30
31 Implements the one-dimensional second derivative with variable coefficients. 31 Implements the one-dimensional second derivative with variable coefficients.
32 """ 32 """
33 struct SecondDerivativeVariable{Dir,T,D,N,M,K,TArray<:AbstractArray} <: TensorMapping{T,D,D} 33 struct SecondDerivativeVariable{Dir,T,D,M,IStencil<:NestedStencil{T},CStencil<:NestedStencil{T},TArray<:AbstractArray} <: TensorMapping{T,D,D}
34 inner_stencil::NestedStencil{T,N} 34 inner_stencil::IStencil
35 closure_stencils::NTuple{M,NestedStencil{T,K}} 35 closure_stencils::NTuple{M,CStencil}
36 size::NTuple{D,Int} 36 size::NTuple{D,Int}
37 coefficient::TArray 37 coefficient::TArray
38 38
39 function SecondDerivativeVariable{Dir, D}(inner_stencil::NestedStencil{T,N}, closure_stencils::NTuple{M,NestedStencil{T,K}}, size::NTuple{D,Int}, coefficient::TArray) where {Dir,T,D,N,M,K,TArray<:AbstractArray} 39 function SecondDerivativeVariable{Dir, D}(inner_stencil::NestedStencil{T}, closure_stencils::NTuple{M,NestedStencil{T}}, size::NTuple{D,Int}, coefficient::AbstractArray) where {Dir,T,D,M}
40 return new{Dir,T,D,N,M,K,TArray}(inner_stencil,closure_stencils,size, coefficient) 40 IStencil = typeof(inner_stencil)
41 CStencil = eltype(closure_stencils)
42 TArray = typeof(coefficient)
43 return new{Dir,T,D,M,IStencil,CStencil,TArray}(inner_stencil,closure_stencils,size, coefficient)
41 end 44 end
42 end 45 end
43 46
44 function SecondDerivativeVariable(grid::EquidistantGrid, coeff::AbstractArray, inner_stencil, closure_stencils, dir) 47 function SecondDerivativeVariable(grid::EquidistantGrid, coeff::AbstractArray, inner_stencil, closure_stencils, dir)
45 Δxᵢ = spacing(grid)[dir] 48 Δxᵢ = spacing(grid)[dir]