Skip to content

Commit 91d2105

Browse files
committed
Remove obtain_face_space function
This functionality now exists as an exported method from ClimaCore.
1 parent 304d180 commit 91d2105

File tree

6 files changed

+19
-47
lines changed

6 files changed

+19
-47
lines changed

docs/src/APIs/shared_utilities.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ ClimaLand.Domains.Column
1414
ClimaLand.Domains.Plane
1515
ClimaLand.Domains.Point
1616
ClimaLand.Domains.coordinates
17-
ClimaLand.Domains.obtain_face_space
1817
ClimaLand.Domains.obtain_surface_space
1918
ClimaLand.Domains.obtain_surface_domain
2019
ClimaLand.Domains.top_center_to_surface

src/integrated/pond_soil_model.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Defined such that positive means into soil.
122122
"""
123123
function infiltration_capacity(Y::ClimaCore.Fields.FieldVector, p::NamedTuple)
124124
FT = eltype(Y.soil.ϑ_l)
125-
face_space = ClimaLand.Domains.obtain_face_space(axes(Y.soil.ϑ_l))
125+
face_space = ClimaCore.Spaces.face_space(axes(Y.soil.ϑ_l))
126126
N = ClimaCore.Spaces.nlevels(face_space)
127127
space = axes(Y.surface_water.η)
128128
z = ClimaCore.Fields.coordinate_field(axes(Y.soil.ϑ_l)).z

src/shared_utilities/Domains.jl

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function Column(;
169169
subsurface_space =
170170
ClimaCore.Spaces.CenterFiniteDifferenceSpace(device, mesh)
171171
surface_space = obtain_surface_space(subsurface_space)
172-
subsurface_face_space = obtain_face_space(subsurface_space)
172+
subsurface_face_space = ClimaCore.Spaces.face_space(subsurface_space)
173173
space = (;
174174
surface = surface_space,
175175
subsurface = subsurface_space,
@@ -475,7 +475,7 @@ function HybridBox(;
475475
)
476476

477477
surface_space = obtain_surface_space(subsurface_space)
478-
subsurface_face_space = obtain_face_space(subsurface_space)
478+
subsurface_face_space = ClimaCore.Spaces.face_space(subsurface_space)
479479
space = (;
480480
surface = surface_space,
481481
subsurface = subsurface_space,
@@ -603,7 +603,7 @@ function SphericalShell(;
603603
vert_center_space,
604604
)
605605
surface_space = obtain_surface_space(subsurface_space)
606-
subsurface_face_space = obtain_face_space(subsurface_space)
606+
subsurface_face_space = ClimaCore.Spaces.face_space(subsurface_space)
607607
space = (;
608608
surface = surface_space,
609609
subsurface = subsurface_space,
@@ -735,14 +735,6 @@ function obtain_surface_domain(s::SphericalShell{FT}) where {FT}
735735
return surface_domain
736736
end
737737

738-
"""
739-
obtain_face_space(cs::ClimaCore.Spaces.AbstractSpace)
740-
741-
Returns the face space, if applicable, for the center space `cs`.
742-
"""
743-
obtain_face_space(cs::ClimaCore.Spaces.AbstractSpace) =
744-
@error("No face space is defined for this space.")
745-
746738
"""
747739
obtain_surface_space(cs::ClimaCore.Spaces.AbstractSpace)
748740
@@ -751,25 +743,6 @@ Returns the surface space, if applicable, for the center space `cs`.
751743
obtain_surface_space(cs::ClimaCore.Spaces.AbstractSpace) =
752744
@error("No surface space is defined for this space.")
753745

754-
"""
755-
obtain_face_space(cs::ClimaCore.Spaces.CenterExtrudedFiniteDifferenceSpace)
756-
757-
Returns the face space for the CenterExtrudedFiniteDifferenceSpace `cs`.
758-
"""
759-
function obtain_face_space(
760-
cs::ClimaCore.Spaces.CenterExtrudedFiniteDifferenceSpace,
761-
)
762-
return ClimaCore.Spaces.FaceExtrudedFiniteDifferenceSpace(cs)
763-
end
764-
765-
"""
766-
obtain_face_space(cs::ClimaCore.Spaces.CenterFiniteDifferenceSpace)
767-
768-
Returns the face space corresponding to the CenterFiniteDifferenceSpace `cs`.
769-
"""
770-
function obtain_face_space(cs::ClimaCore.Spaces.CenterFiniteDifferenceSpace)
771-
return ClimaCore.Spaces.FaceFiniteDifferenceSpace(cs)
772-
end
773746

774747
"""
775748
obtain_surface_space(cs::ClimaCore.Spaces.CenterExtrudedFiniteDifferenceSpace)
@@ -788,7 +761,7 @@ end
788761
Returns the top level of the face space corresponding to the CenterFiniteDifferenceSpace `cs`.
789762
"""
790763
function obtain_surface_space(cs::ClimaCore.Spaces.CenterFiniteDifferenceSpace)
791-
fs = obtain_face_space(cs)
764+
fs = ClimaCore.Spaces.face_space(cs)
792765
return ClimaCore.Spaces.level(
793766
fs,
794767
ClimaCore.Utilities.PlusHalf(ClimaCore.Spaces.nlevels(fs) - 1),
@@ -891,7 +864,7 @@ both as Fields. It also returns the widths of each layer as a field.
891864
"""
892865
function get_Δz(z::ClimaCore.Fields.Field)
893866
# Extract the differences between levels of the face space
894-
fs = obtain_face_space(axes(z))
867+
fs = ClimaCore.Spaces.face_space(axes(z))
895868
z_face = ClimaCore.Fields.coordinate_field(fs).z
896869
Δz_face = ClimaCore.Fields.Δz_field(z_face)
897870
Δz_top = ClimaCore.Fields.level(
@@ -936,7 +909,7 @@ A helper function which returns additional fields and field data corresponding t
936909
domains which have a subsurface_space (Column, HybridBox, SphericalShell).
937910
The fields are the center coordinates of the subsurface space, the spacing between
938911
the top center and top surface and bottom center and bottom surface, as well as the
939-
field corresponding to the surface height z and layer widths. The field data are the
912+
field corresponding to the surface height z and layer widths. The field data are the
940913
depth of the domain and the minimum top layer thickness over the entire domain.
941914
942915
We allocate these once, upon domain construction, so that they are accessible
@@ -946,7 +919,7 @@ function get_additional_coordinate_field_data(subsurface_space)
946919
surface_space = obtain_surface_space(subsurface_space)
947920
z = ClimaCore.Fields.coordinate_field(subsurface_space).z
948921
Δz_top, Δz_bottom, Δz = get_Δz(z)
949-
face_space = obtain_face_space(subsurface_space)
922+
face_space = ClimaCore.Spaces.face_space(subsurface_space)
950923
z_face = ClimaCore.Fields.coordinate_field(face_space).z
951924
z_sfc = top_face_to_surface(z_face, surface_space)
952925
d = depth(subsurface_space)
@@ -1060,7 +1033,6 @@ end
10601033
export AbstractDomain
10611034
export Column, Plane, HybridBox, Point, SphericalShell, SphericalSurface
10621035
export coordinates,
1063-
obtain_face_space,
10641036
obtain_surface_space,
10651037
top_center_to_surface,
10661038
bottom_center_to_surface,

src/standalone/Soil/boundary_conditions.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,12 @@ function ClimaLand.set_dfluxBCdY!(
388388

389389

390390
# Get the local geometry of the face space, then extract the top level
391-
levels = ClimaCore.Spaces.nlevels(Domains.obtain_face_space(axes(p.soil.K)))
391+
levels =
392+
ClimaCore.Spaces.nlevels(ClimaCore.Spaces.face_space(axes(p.soil.K)))
392393
local_geometry_faceN = ClimaCore.Fields.level(
393-
Fields.local_geometry_field(Domains.obtain_face_space(axes(p.soil.K))),
394+
Fields.local_geometry_field(
395+
ClimaCore.Spaces.face_space(axes(p.soil.K)),
396+
),
394397
levels - ClimaCore.Utilities.half,
395398
)
396399

test/shared_utilities/domains.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ using ClimaLand.Domains:
1313
SphericalSurface,
1414
coordinates,
1515
obtain_surface_space,
16-
obtain_face_space,
1716
obtain_surface_domain,
1817
get_Δz,
1918
top_face_to_surface,
@@ -45,7 +44,7 @@ FT = Float32
4544
@test shell.fields.depth == depth
4645
@test shell.fields.z ==
4746
ClimaCore.Fields.coordinate_field(shell.space.subsurface).z
48-
face_space = obtain_face_space(shell.space.subsurface)
47+
face_space = ClimaCore.Spaces.face_space(shell.space.subsurface)
4948
z_face = ClimaCore.Fields.coordinate_field(face_space).z
5049
@test shell.fields.z_sfc == top_face_to_surface(z_face, shell.space.surface)
5150
Δz_top, Δz_bottom, Δz = get_Δz(shell.fields.z)
@@ -112,7 +111,7 @@ FT = Float32
112111
@test box.fields.depth == zlim[2] - zlim[1]
113112
@test box.fields.z ==
114113
ClimaCore.Fields.coordinate_field(box.space.subsurface).z
115-
face_space = obtain_face_space(box.space.subsurface)
114+
face_space = ClimaCore.Spaces.face_space(box.space.subsurface)
116115
z_face = ClimaCore.Fields.coordinate_field(face_space).z
117116
@test box.fields.z_sfc == top_face_to_surface(z_face, box.space.surface)
118117
Δz_top, Δz_bottom, Δz = get_Δz(box.fields.z)
@@ -221,7 +220,7 @@ FT = Float32
221220
@test longlat_box.fields.depth == zlim[2] - zlim[1]
222221
@test longlat_box.fields.z ==
223222
ClimaCore.Fields.coordinate_field(longlat_box.space.subsurface).z
224-
face_space = obtain_face_space(longlat_box.space.subsurface)
223+
face_space = ClimaCore.Spaces.face_space(longlat_box.space.subsurface)
225224
z_face = ClimaCore.Fields.coordinate_field(face_space).z
226225
@test longlat_box.fields.z_sfc ==
227226
top_face_to_surface(z_face, longlat_box.space.surface)
@@ -265,7 +264,7 @@ FT = Float32
265264
@test z_column.fields.z ==
266265
ClimaCore.Fields.coordinate_field(z_column.space.subsurface).z
267266
@test z_column.fields.depth == zlim[2] - zlim[1]
268-
face_space = obtain_face_space(z_column.space.subsurface)
267+
face_space = ClimaCore.Spaces.face_space(z_column.space.subsurface)
269268
z_face = ClimaCore.Fields.coordinate_field(face_space).z
270269
@test z_column.fields.z_sfc ==
271270
top_face_to_surface(z_face, z_column.space.surface)

test/standalone/Soil/climate_drivers.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ for FT in (Float32, Float64)
191191
@test p.drivers.P == zeros(space) .+ FT(101325)
192192
@test p.drivers.LW_d == zeros(space) .+ FT(5.67e-8 * 280.0^4.0)
193193
@test p.drivers.SW_d == zeros(space) .+ FT(500)
194-
face_space = ClimaLand.Domains.obtain_face_space(
195-
model.domain.space.subsurface,
196-
)
194+
face_space =
195+
ClimaCore.Spaces.face_space(model.domain.space.subsurface)
197196
N = ClimaCore.Spaces.nlevels(face_space)
198197
surface_space = model.domain.space.surface
199198
z_sfc = ClimaCore.Fields.Field(

0 commit comments

Comments
 (0)