comparison src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 882:9098fc936776 feature/variable_derivatives

Add the coefficient as a part of the struct. Wrap tests in testsets
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 21 Jan 2022 09:20:58 +0100
parents aa4875f9a530
children d228d1b26729
comparison
equal deleted inserted replaced
881:aa4875f9a530 882:9098fc936776
25 # return foldl(⊗, parts) 25 # return foldl(⊗, parts)
26 # end 26 # end
27 27
28 """ 28 """
29 SecondDerivativeVariable{T,N,M,K} <: TensorOperator{T,1} 29 SecondDerivativeVariable{T,N,M,K} <: TensorOperator{T,1}
30 Implements a one-dimensional constant coefficients volume operator 30
31 Implements the one-dimensional second derivative with variable coefficients.
31 """ 32 """
32 struct SecondDerivativeVariable{T,N,M,K} <: TensorMapping{T,1,1} 33 struct SecondDerivativeVariable{T,N,M,K,TArray<:AbstractVector} <: TensorMapping{T,1,1}
33 inner_stencil::NestedStencil{T,N} 34 inner_stencil::NestedStencil{T,N}
34 closure_stencils::NTuple{M,NestedStencil{T,K}} 35 closure_stencils::NTuple{M,NestedStencil{T,K}}
35 size::NTuple{1,Int} 36 size::NTuple{1,Int}
37 coefficient::TArray
36 end 38 end
37 39
38 function SecondDerivativeVariable(grid::EquidistantGrid{1}, inner_stencil, closure_stencils) 40 function SecondDerivativeVariable(grid::EquidistantGrid{1}, coeff::AbstractVector, inner_stencil, closure_stencils)
39 return SecondDerivativeVariable(inner_stencil, Tuple(closure_stencils), size(grid)) 41 return SecondDerivativeVariable(inner_stencil, Tuple(closure_stencils), size(grid), coeff)
40 end 42 end
41 43
42 closure_size(::SecondDerivativeVariable{T,N,M}) where {T,N,M} = M 44 closure_size(::SecondDerivativeVariable{T,N,M}) where {T,N,M} = M
43 45
44 LazyTensors.range_size(op::SecondDerivativeVariable) = op.size 46 LazyTensors.range_size(op::SecondDerivativeVariable) = op.size