Skip to content

Commit

Permalink
climacore updates
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Dec 5, 2023
1 parent fe513d5 commit a266892
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ end
Returns a new `p` with the updated surface conditions.
"""
function get_new_cache(atmos_sim::ClimaAtmosSimulation, csf)

p = atmos_sim.integrator.p

csf_sfc = (; T = csf.T_S, z0m = csf.z0m_S, z0b = csf.z0b_S, beta = csf.beta, q_vap = csf.q_sfc)
modified_atmos_cache(atmos_sim, csf_sfc)
end
Expand Down
8 changes: 5 additions & 3 deletions experiments/AMIP/modular/components/land/bucket_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ function make_lsm_domain(
) where {FT}
@assert zlim[1] < zlim[2]
depth = zlim[2] - zlim[1]
radius = atmos_boundary_space.topology.mesh.domain.radius
npolynomial = ClimaCore.Spaces.Quadratures.polynomial_degree(atmos_boundary_space.quadrature_style)
nelements_horz = atmos_boundary_space.topology.mesh.ne

radius = ClimaCore.Spaces.topology(atmos_boundary_space).mesh.domain.radius
nelements_horz = ClimaCore.Spaces.topology(atmos_boundary_space).mesh.ne
npolynomial =
ClimaCore.Spaces.Quadratures.polynomial_degree(ClimaCore.Spaces.quadrature_style(atmos_boundary_space))
nelements = (nelements_horz, nelements_vert)
vertdomain = ClimaCore.Domains.IntervalDomain(
ClimaCore.Geometry.ZPoint(FT(zlim[1])),
Expand Down
2 changes: 1 addition & 1 deletion experiments/AMIP/modular/coupler_driver_modular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ the atmospheric and surface components, so exchanges are parallelized. Note this
atmosphere and surface are of the same horizontal resolution.
=#
## init a 2D boundary space at the surface
boundary_space = atmos_sim.domain.face_space.horizontal_space
boundary_space = Spaces.horizontal_space(atmos_sim.domain.face_space)

# init land-sea fraction
land_fraction =
Expand Down
2 changes: 1 addition & 1 deletion experiments/AMIP/modular/user_io/debug_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end

# additional ClimaAtmos model debug fields
function get_field(sim::ClimaAtmosSimulation, ::Val{:w})
w_c = ones(sim.domain.face_space.horizontal_space)
w_c = ones(Spaces.horizontal_space(sim.domain.face_space))
parent(w_c) .= parent(Fields.level(Geometry.WVector.(sim.integrator.u.f.u₃), 5 .+ half))
return w_c
end
Expand Down
19 changes: 11 additions & 8 deletions src/Regridder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function reshape_cgll_sparse_to_field!(field::Fields.Field, in_array::SubArray,
space = axes(field)
topology = Spaces.topology(space)
hspace = Spaces.horizontal_space(space)
Spaces.dss!(Fields.field_values(field), topology, hspace.quadrature_style)
Topologies.dss!(Fields.field_values(field), topology)
end

"""
Expand Down Expand Up @@ -105,7 +105,7 @@ function reshape_cgll_sparse_to_field!(
space = axes(field)
topology = Spaces.topology(space)
hspace = Spaces.horizontal_space(space)
Spaces.dss!(Fields.field_values(field), topology, hspace.quadrature_style)
Topologies.dss!(Fields.field_values(field), topology)
end

"""
Expand Down Expand Up @@ -162,8 +162,11 @@ function hdwrite_regridfile_rll_to_cgll(
space2d = space
end

topology = Topologies.Topology2D(space2d.topology.mesh, Topologies.spacefillingcurve(space2d.topology.mesh))
Nq = Spaces.Quadratures.polynomial_degree(space2d.quadrature_style) + 1
topology = Topologies.Topology2D(
Spaces.topology(space2d).mesh,
Topologies.spacefillingcurve(Spaces.topology(space2d).mesh),
)
Nq = Spaces.Quadratures.polynomial_degree(Spaces.quadrature_style(space2d)) + 1
space2d_undistributed = Spaces.SpectralElementSpace2D(topology, Spaces.Quadratures.GLL{Nq}())

if space isa Spaces.ExtrudedFiniteDifferenceSpace
Expand Down Expand Up @@ -279,7 +282,7 @@ function get_time(ds)
elseif "date" in ds
data_dates = TimeManager.strdate_to_datetime.(string.(Int.(ds["date"][:])))
else
@warn "No dates available in file $datafile_rll"
@warn "No dates available in input data file"
data_dates = [Dates.DateTime(0)]
end
return data_dates
Expand Down Expand Up @@ -392,12 +395,12 @@ grid using TempestRemap.
"""
function remap_field_cgll_to_rll(name, field::Fields.Field, remap_tmpdir, datafile_rll; nlat = 90, nlon = 180)
space = axes(field)
hspace = :topology in propertynames(space) ? space : space.horizontal_space
Nq = Spaces.Quadratures.polynomial_degree(hspace.quadrature_style) + 1
hspace = :topology in propertynames(space) ? space : Spaces.horizontal_space(space)
Nq = Spaces.Quadratures.polynomial_degree(Spaces.quadrature_style(hspace)) + 1

# write out our cubed sphere mesh
meshfile_cc = remap_tmpdir * "/mesh_cubedsphere.g"
write_exodus(meshfile_cc, hspace.topology)
write_exodus(meshfile_cc, Spaces.topology(hspace))

meshfile_rll = remap_tmpdir * "/mesh_rll.g"
rll_mesh(meshfile_rll; nlat = nlat, nlon = nlon)
Expand Down
2 changes: 1 addition & 1 deletion test/component_model_tests/bucket_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for FT in (Float64,)
@testset "dss_state! BucketSimulation for FT=$FT" begin
# use TestHelper to create space, extract surface space
subsurface_space = create_space(FT, nz = 2)
surface_space = subsurface_space.horizontal_space
surface_space = Spaces.horizontal_space(subsurface_space)

# set up objects for test
dss_buffer_3d = Spaces.create_dss_buffer(Fields.zeros(subsurface_space))
Expand Down

0 comments on commit a266892

Please sign in to comment.