From 4ca8770d4b5b929018b22d93415c3226962c7b65 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Mon, 17 Jun 2024 21:37:04 -0400 Subject: [PATCH] Pass context to FiniteDifferenceSpace --- experiments/ClimaCore/heat-diffusion/run.jl | 3 ++- experiments/ClimaCore/sea_breeze/atmos_rhs.jl | 4 +++- src/Regridder.jl | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/experiments/ClimaCore/heat-diffusion/run.jl b/experiments/ClimaCore/heat-diffusion/run.jl index 2aee50c831..b4d8a767b2 100644 --- a/experiments/ClimaCore/heat-diffusion/run.jl +++ b/experiments/ClimaCore/heat-diffusion/run.jl @@ -195,8 +195,9 @@ domain_atm = CC.Domains.IntervalDomain( CC.Geometry.ZPoint{FT}(parameters.zmax_atm); boundary_names = (:bottom, :top), ); +context = ClimaComms.context() mesh_atm = CC.Meshes.IntervalMesh(domain_atm, nelems = parameters.n); # struct, allocates face boundaries to 5,6: atmos -center_space_atm = CC.Spaces.CenterFiniteDifferenceSpace(mesh_atm); # collection of the above, discretises space into FD and provides coords +center_space_atm = CC.Spaces.CenterFiniteDifferenceSpace(context, mesh_atm); # collection of the above, discretises space into FD and provides coords # - initialize prognostic variables, either as ClimaCore's Field objects or as Arrays T_atm_0 = CC.Fields.ones(FT, center_space_atm) .* parameters.T_atm_ini; # initiates a spatially uniform atm progostic var diff --git a/experiments/ClimaCore/sea_breeze/atmos_rhs.jl b/experiments/ClimaCore/sea_breeze/atmos_rhs.jl index aebce6b126..c838e141d5 100644 --- a/experiments/ClimaCore/sea_breeze/atmos_rhs.jl +++ b/experiments/ClimaCore/sea_breeze/atmos_rhs.jl @@ -109,6 +109,7 @@ import TerminalLoggers import ClimaCore as CC import ClimaCore.Geometry: ⊗ +import ClimaComms Logging.global_logger(TerminalLoggers.TerminalLogger()) @@ -123,8 +124,9 @@ function hvspace_2D(xlim = (-π, π), zlim = (0, 4π), helem = 20, velem = 20, n CC.Geometry.ZPoint{FT}(zlim[2]); boundary_names = (:bottom, :top), ) + context = ClimaComms.context() vertmesh = CC.Meshes.IntervalMesh(vertdomain, nelems = velem) - vert_center_space = CC.Spaces.CenterFiniteDifferenceSpace(vertmesh) + vert_center_space = CC.Spaces.CenterFiniteDifferenceSpace(context, vertmesh) horzdomain = CC.Domains.IntervalDomain(CC.Geometry.XPoint{FT}(xlim[1]) .. CC.Geometry.XPoint{FT}(xlim[2]), periodic = true) diff --git a/src/Regridder.jl b/src/Regridder.jl index bef60e3b9a..cb6cd37360 100644 --- a/src/Regridder.jl +++ b/src/Regridder.jl @@ -179,7 +179,7 @@ function hdwrite_regridfile_rll_to_cgll( space2d_undistributed = CC.Spaces.SpectralElementSpace2D(topology, CC.Spaces.Quadratures.GLL{Nq}()) if space isa CC.Spaces.ExtrudedFiniteDifferenceSpace - vert_center_space = CC.Spaces.CenterFiniteDifferenceSpace(CC.Spaces.vertical_topology(space).mesh) + vert_center_space = CC.Spaces.CenterFiniteDifferenceSpace(CC.Spaces.vertical_topology(space)) space_undistributed = CC.Spaces.ExtrudedFiniteDifferenceSpace(space2d_undistributed, vert_center_space) else space_undistributed = space2d_undistributed