Skip to content

Commit

Permalink
Merge pull request #491 from CliMA/js/deprecate
Browse files Browse the repository at this point in the history
rm ClimaCore deprecated functions
  • Loading branch information
juliasloan25 authored Feb 9, 2024
2 parents e034827 + b7fa096 commit 97022c0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
14 changes: 10 additions & 4 deletions src/shared_utilities/Domains.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ end
ylim::Tuple{FT,FT},
nelements::Tuple{Int,Int},
periodic::Tuple{Bool,Bool},
npolynomial::Int
npolynomial::Int,
comms_ctx = ClimaComms.SingletonCommsContext(),
) where {FT}
Outer constructor for the `Plane` domain, using keyword arguments.
"""
Expand All @@ -205,6 +206,7 @@ function Plane(;
nelements::Tuple{Int, Int},
periodic::Tuple{Bool, Bool} = (true, true),
npolynomial::Int,
comms_ctx = ClimaComms.SingletonCommsContext(),
) where {FT}
@assert xlim[1] < xlim[2]
@assert ylim[1] < ylim[2]
Expand All @@ -222,7 +224,7 @@ function Plane(;
plane = ClimaCore.Domains.RectangleDomain(domain_x, domain_y)

mesh = ClimaCore.Meshes.RectilinearMesh(plane, nelements[1], nelements[2])
grid_topology = ClimaCore.Topologies.Topology2D(mesh)
grid_topology = ClimaCore.Topologies.Topology2D(comms_ctx, mesh)
if npolynomial == 0
quad = ClimaCore.Spaces.Quadratures.GL{npolynomial + 1}()
else
Expand Down Expand Up @@ -408,6 +410,7 @@ end
nelements::Tuple{Int, Int},
npolynomial::Int,
dz_tuple::Union{Tuple{FT, FT}, Nothing} = nothing,
comms_ctx = ClimaComms.SingletonCommsContext(),
) where {FT}
Outer constructor for the `SphericalShell` domain, using keyword arguments.
Expand All @@ -425,6 +428,7 @@ function SphericalShell(;
nelements::Tuple{Int, Int},
npolynomial::Int,
dz_tuple::Union{Tuple{FT, FT}, Nothing} = nothing,
comms_ctx = ClimaComms.SingletonCommsContext(),
) where {FT}
@assert 0 < radius
@assert 0 < depth
Expand All @@ -451,7 +455,7 @@ function SphericalShell(;

horzdomain = ClimaCore.Domains.SphereDomain(radius)
horzmesh = ClimaCore.Meshes.EquiangularCubedSphere(horzdomain, nelements[1])
horztopology = ClimaCore.Topologies.Topology2D(horzmesh)
horztopology = ClimaCore.Topologies.Topology2D(comms_ctx, horzmesh)
quad = ClimaCore.Spaces.Quadratures.GLL{npolynomial + 1}()
horzspace = ClimaCore.Spaces.SpectralElementSpace2D(horztopology, quad)

Expand Down Expand Up @@ -502,18 +506,20 @@ end
radius::FT,
nelements::Int
npolynomial::Int,
comms_ctx = ClimaComms.SingletonCommsContext(),
) where {FT}
Outer constructor for the `SphericalSurface` domain, using keyword arguments.
"""
function SphericalSurface(;
radius::FT,
nelements::Int,
npolynomial::Int,
comms_ctx = ClimaComms.SingletonCommsContext(),
) where {FT}
@assert 0 < radius
horzdomain = ClimaCore.Domains.SphereDomain(radius)
horzmesh = Meshes.EquiangularCubedSphere(horzdomain, nelements)
horztopology = Topologies.Topology2D(horzmesh)
horztopology = Topologies.Topology2D(comms_ctx, horzmesh)
quad = Spaces.Quadratures.GLL{npolynomial + 1}()
horzspace = Spaces.SpectralElementSpace2D(horztopology, quad)
space = (; surface = horzspace)
Expand Down
18 changes: 12 additions & 6 deletions test/shared_utilities/file_reader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ end
if !Sys.iswindows()
@testset "test PrescribedDataStatic construction, FT = $FT" begin
# setup for test
comms_ctx = ClimaComms.SingletonCommsContext()
radius = FT(6731e3)
Nq = 4
domain = ClimaCore.Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
surface_space_t = Spaces.SpectralElementSpace2D(topology, quad)

Expand Down Expand Up @@ -119,11 +120,12 @@ if !Sys.iswindows()
date_idx0 = Int[1]

# construct space and dummy field
comms_ctx = ClimaComms.SingletonCommsContext()
radius = FT(6731e3)
Nq = 4
domain_sphere = ClimaCore.Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain_sphere, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
surface_space_t = Spaces.SpectralElementSpace2D(topology, quad)
data_field = ones(surface_space_t) .* FT(0.5)
Expand Down Expand Up @@ -167,11 +169,12 @@ if !Sys.iswindows()

@testset "test PrescribedDataTemporal construction, FT = $FT" begin
# setup for test
comms_ctx = ClimaComms.SingletonCommsContext()
radius = FT(6731e3)
Nq = 4
domain = ClimaCore.Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
surface_space_t = Spaces.SpectralElementSpace2D(topology, quad)

Expand Down Expand Up @@ -240,11 +243,12 @@ if !Sys.iswindows()
[Int(2) * ((date_ref - dummy_dates[Int(date_idx0[1])]).value)]

# construct space and dummy field
comms_ctx = ClimaComms.SingletonCommsContext()
radius = FT(6731e3)
Nq = 4
domain_sphere = ClimaCore.Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain_sphere, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
surface_space_t = Spaces.SpectralElementSpace2D(topology, quad)
data_fields = (zeros(surface_space_t), ones(surface_space_t))
Expand Down Expand Up @@ -366,11 +370,12 @@ if !Sys.iswindows()
date_ref = date0
t_start = Float64(0)

comms_ctx = ClimaComms.SingletonCommsContext()
radius = FT(6731e3)
Nq = 4
domain = ClimaCore.Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
surface_space_t = Spaces.SpectralElementSpace2D(topology, quad)

Expand Down Expand Up @@ -530,11 +535,12 @@ if !Sys.iswindows()
date_ref = date0
t_start = Float64(0)

comms_ctx = ClimaComms.SingletonCommsContext()
radius = FT(6731e3)
Nq = 4
domain = ClimaCore.Domains.SphereDomain(radius)
mesh = Meshes.EquiangularCubedSphere(domain, 4)
topology = Topologies.Topology2D(mesh)
topology = Topologies.Topology2D(comms_ctx, mesh)
quad = Spaces.Quadratures.GLL{Nq}()
surface_space_t = Spaces.SpectralElementSpace2D(topology, quad)

Expand Down

0 comments on commit 97022c0

Please sign in to comment.