diff --git a/src/Grids/spectralelement.jl b/src/Grids/spectralelement.jl index e49fe84b9b..e6dd452f48 100644 --- a/src/Grids/spectralelement.jl +++ b/src/Grids/spectralelement.jl @@ -129,6 +129,7 @@ mutable struct SpectralElementGrid2D{ D, IS, BS, + EM, } <: AbstractSpectralElementGrid topology::T quadrature_style::Q @@ -138,11 +139,12 @@ mutable struct SpectralElementGrid2D{ internal_surface_geometry::IS boundary_surface_geometries::BS enable_bubble::Bool + element_mask::EM end local_geometry_type( - ::Type{SpectralElementGrid2D{T, Q, GG, LG, D, IS, BS}}, -) where {T, Q, GG, LG, D, IS, BS} = eltype(LG) # calls eltype from DataLayouts + ::Type{SpectralElementGrid2D{T, Q, GG, LG}}, +) where {T, Q, GG, LG} = eltype(LG) # calls eltype from DataLayouts """ SpectralElementSpace2D(topology, quadrature_style; enable_bubble, horizontal_layout_type = DataLayouts.IJFH) @@ -155,6 +157,7 @@ flag `enable_bubble` enables the `bubble correction` for more accurate element a - quadrature_style: QuadratureStyle - enable_bubble: Bool - horizontal_layout_type: Type{<:AbstractData} +- mask spectral element (default is `true`) The idea behind the so-called `bubble_correction` is that the numerical area of the domain (e.g., the sphere) is given by the sum of nodal integration weights @@ -176,12 +179,15 @@ where ``\\tilde{A}^e`` is the approximated area given by the sum of the interior Note: This is accurate only for cubed-spheres of the [`Meshes.EquiangularCubedSphere`](@ref) and [`Meshes.EquidistantCubedSphere`](@ref) type, not for [`Meshes.ConformalCubedSphere`](@ref). + +The element mask can be used to block evaluation of tendencies for spectral elements for which it is set to `false`. """ function SpectralElementGrid2D( topology::Topologies.Topology2D, quadrature_style::Quadratures.QuadratureStyle; horizontal_layout_type = DataLayouts.IJFH, enable_bubble::Bool = false, + element_mask = Vector{Bool}(ones(Topologies.nlocalelems(topology))), ) get!( Cache.OBJECT_CACHE, @@ -191,6 +197,7 @@ function SpectralElementGrid2D( quadrature_style, enable_bubble, horizontal_layout_type, + element_mask, ), ) do _SpectralElementGrid2D( @@ -198,6 +205,7 @@ function SpectralElementGrid2D( quadrature_style, horizontal_layout_type; enable_bubble, + element_mask, ) end end @@ -217,12 +225,14 @@ _SpectralElementGrid2D( quadrature_style::Quadratures.QuadratureStyle, horizontal_layout_type = DataLayouts.IJFH; enable_bubble::Bool, + element_mask::Vector{Bool}, ) = _SpectralElementGrid2D( topology, quadrature_style, Val(Topologies.nlocalelems(topology)), horizontal_layout_type; enable_bubble, + element_mask, ) function _SpectralElementGrid2D( @@ -231,6 +241,7 @@ function _SpectralElementGrid2D( ::Val{Nh}, ::Type{horizontal_layout_type}; enable_bubble::Bool, + element_mask, ) where {Nh, horizontal_layout_type} @assert horizontal_layout_type <: Union{DataLayouts.IJHF, DataLayouts.IJFH} surface_layout_type = if horizontal_layout_type <: DataLayouts.IJFH @@ -502,6 +513,7 @@ function _SpectralElementGrid2D( internal_surface_geometry, boundary_surface_geometries, enable_bubble, + DA(element_mask), ) end