Path: blob/main/src/solvers/fdsbp_tree/fdsbp.jl
5591 views
# !!! warning "Experimental implementation (upwind SBP)"1# This is an experimental feature and may change in future releases.23# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).4# Since these FMAs can increase the performance of many numerical algorithms,5# we need to opt-in explicitly.6# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.7@muladd begin8#! format: noindent910"""11FDSBP(D_SBP; surface_integral, volume_integral)1213Specialization of [`DG`](@ref) methods that uses general summation by parts (SBP)14operators from15[SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl).16In particular, this includes classical finite difference (FD) SBP methods.17These methods have the same structure as classical DG methods - local operations18on elements with connectivity through interfaces without imposing any continuity19constraints.2021`D_SBP` is an SBP derivative operator from SummationByPartsOperators.jl.22The other arguments have the same meaning as in [`DG`](@ref) or [`DGSEM`](@ref).2324!!! warning "Experimental implementation (upwind SBP)"25This is an experimental feature and may change in future releases.26"""27const FDSBP = DG{Basis} where {Basis <: AbstractDerivativeOperator}2829# Internal abbreviation for easier-to-read dispatch (not exported)30const PeriodicFDSBP = FDSBP{Basis} where {Basis <: AbstractPeriodicDerivativeOperator}3132function FDSBP(D_SBP::AbstractDerivativeOperator; surface_integral, volume_integral)33# `nothing` is passed as `mortar`34return DG(D_SBP, nothing, surface_integral, volume_integral)35end3637# General interface methods for SummationByPartsOperators.jl and Trixi.jl38nnodes(D::AbstractDerivativeOperator) = size(D, 1)39eachnode(D::AbstractDerivativeOperator) = Base.OneTo(nnodes(D))40get_nodes(D::AbstractDerivativeOperator) = grid(D)4142# TODO: This is hack to enable the FDSBP solver to use the43# `SaveSolutionCallback`.44polydeg(D::AbstractDerivativeOperator) = size(D, 1) - 145polydeg(fdsbp::FDSBP) = polydeg(fdsbp.basis)4647# TODO: FD. No mortars supported at the moment48init_mortars(cell_ids, mesh, elements, mortar::Nothing) = nothing49create_cache(mesh, equations, mortar::Nothing, uEltype) = NamedTuple()50nmortars(mortar::Nothing) = 05152function prolong2mortars!(cache, u, mesh, equations, mortar::Nothing,53dg::DG)54@assert isempty(eachmortar(dg, cache))55end5657function calc_mortar_flux!(surface_flux_values, mesh,58have_nonconservative_terms, equations,59mortar::Nothing,60surface_integral, dg::DG, cache)61@assert isempty(eachmortar(dg, cache))62end6364# We do not use a specialized setup to analyze solutions65SolutionAnalyzer(D::AbstractDerivativeOperator) = D6667# dimension-specific implementations68include("fdsbp_1d.jl")69include("fdsbp_2d.jl")70include("fdsbp_3d.jl")71end # @muladd727374