Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add element mask to SpectralElementGrid2D #2085

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Grids/spectralelement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ mutable struct SpectralElementGrid2D{
D,
IS,
BS,
EM,
} <: AbstractSpectralElementGrid
topology::T
quadrature_style::Q
Expand All @@ -138,11 +139,12 @@ mutable struct SpectralElementGrid2D{
internal_surface_geometry::IS
boundary_surface_geometries::BS
enable_bubble::Bool
element_mask::EM
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function set_mask!(space::AbstractSpace, mask::Field)

with Spaces.horizontal_space(axes(mask)) == Spaces.horizontal_space(axes(sapce))

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)
Expand All @@ -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
Expand All @@ -176,6 +179,8 @@ 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`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The element mask can be used to block evaluation of tendencies for spectral elements for which it is set to `false`.
The element mask can be used to skip evaluation of broadcast expressions for spectral elements with the mask set to `false`.

"""
function SpectralElementGrid2D(
topology::Topologies.Topology2D,
Expand Down Expand Up @@ -502,6 +507,7 @@ function _SpectralElementGrid2D(
internal_surface_geometry,
boundary_surface_geometries,
enable_bubble,
DA(Vector{Bool}(ones(Topologies.nlocalelems(topology)))),
)
end

Expand Down
Loading