Skip to content

Commit

Permalink
added mass_matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Jan 5, 2018
1 parent 062aafd commit 2cf5f6f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/SBP_operators.jl
Expand Up @@ -368,6 +368,21 @@ function integrate(func, u::AbstractVector, D::DerivativeOperator)
end


"""
mass_matrix(D::DerivativeOperator)
Create the diagonal mass matrix for the SBP derivative operator `D`.
"""
function mass_matrix(D::DerivativeOperator)
m = ones(grid(D))
@unpack left_weights, right_weights = D.coefficients

m[1:length(left_weights)] = left_weights
m[end:-1:end-length(right_weights)+1] = right_weights
Diagonal(D.Δx * m)
end


"""
derivative_operator(source_of_coefficients, derivative_order, accuracy_order,
xmin, xmax, N, parallel=Val{:serial}())
Expand Down
1 change: 1 addition & 0 deletions src/SummationByPartsOperators.jl
Expand Up @@ -38,6 +38,7 @@ include("SBP_coefficients/MattssonAlmquistCarpenter2014Optimal.jl")
# exports
export PeriodicDerivativeOperator, DerivativeOperator, SourceOfCoefficients
export derivative_order, accuracy_order, source_of_coeffcients, grid
export mass_matrix
export mul!, integrate, derivative_left, derivative_right
export periodic_central_derivative_operator, periodic_derivative_operator, derivative_operator,
dissipation_operator
Expand Down

0 comments on commit 2cf5f6f

Please sign in to comment.