Skip to content

Commit

Permalink
Pass context to FiniteDifferenceSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski authored and Sbozzolo committed Jul 29, 2024
1 parent 588c8b5 commit 98edf35
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion experiments/ClimaCore/heat-diffusion/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ domain_atm = CC.Domains.IntervalDomain(
CC.Geometry.ZPoint{FT}(parameters.zmax_atm);
boundary_names = (:bottom, :top),
);
context = CC.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
if pkgversion(CC) >= v"0.14.10"
center_space_atm = CC.Spaces.CenterFiniteDifferenceSpace(context, mesh_atm) # collection of the above, discretises space into FD and provides coords
else
center_space_atm = CC.Spaces.CenterFiniteDifferenceSpace(mesh_atm) # collection of the above, discretises space into FD and provides coords
end

# - 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
Expand Down
8 changes: 7 additions & 1 deletion experiments/ClimaCore/sea_breeze/atmos_rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import TerminalLoggers

import ClimaCore as CC
import ClimaCore.Geometry:
import ClimaComms

Logging.global_logger(TerminalLoggers.TerminalLogger())

Expand All @@ -123,8 +124,13 @@ 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)
if pkgversion(CC) >= v"0.14.10"
vert_center_space = CC.Spaces.CenterFiniteDifferenceSpace(context, vertmesh)
else
vert_center_space = CC.Spaces.CenterFiniteDifferenceSpace(vertmesh)
end

horzdomain =
CC.Domains.IntervalDomain(CC.Geometry.XPoint{FT}(xlim[1]) .. CC.Geometry.XPoint{FT}(xlim[2]), periodic = true)
Expand Down
2 changes: 1 addition & 1 deletion src/Regridder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 98edf35

Please sign in to comment.