Skip to content

Commit 3cc137e

Browse files
committed
remove extra get_field functions
1 parent 55a6946 commit 3cc137e

File tree

13 files changed

+10
-27
lines changed

13 files changed

+10
-27
lines changed

NEWS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ ClimaCoupler.jl Release Notes
66

77
### ClimaCoupler features
88

9-
### Coupler fields surface variable names all use `_sfc` PR[#1195](https://github.com/CliMA/ClimaCoupler.jl/pull/1195)
9+
#### Remove extra `get_field` functions PR[#1203](https://github.com/CliMA/ClimaCoupler.jl/pull/1203)
10+
Removes the `get_field` functions for `air_density` for all models, which
11+
were unused except for the `BucketSimulation` method, which is replaced by a
12+
function call to `extrapolate_ρ_to_sfc`. Also removes the `get_field` function
13+
for `ClimaAtmosSimulation` `air_temperature`, which was unused.
14+
15+
#### Coupler fields surface variable names all use `_sfc` PR[#1195](https://github.com/CliMA/ClimaCoupler.jl/pull/1195)
1016
`T_S`, `z0m_S`, and `z0b_S` are renamed to `T_sfc`, `z0m_sfc`, and `z0b_sfc`.
1117
This makes them consistent with the other surface fields, e.g. `ρ_sfc` and `q_sfc`.
1218

docs/src/interfacer.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ for the following properties:
7373
| Coupler name | Description | Units |
7474
|-------------------|-------------|-------|
7575
| `air_density` | air density of the atmosphere | kg m^-3 |
76-
| `air_temperature` | air temperature at the surface of the atmosphere | K |
7776
| `energy` | globally integrated energy | J |
7877
| `height_int` | height at the first internal model level | m |
7978
| `height_sfc` | height at the surface (only required when using `PartitionedStateFluxes`) | m |
@@ -120,7 +119,6 @@ for the following properties:
120119

121120
| Coupler name | Description | Units |
122121
|-------------------|-------------|-------|
123-
| `air_density` | surface air density | kg m^-3 |
124122
| `area_fraction` | fraction of the simulation grid surface area this model covers | |
125123
| `beta` | factor that scales evaporation based on its estimated level of saturation | |
126124
| `roughness_buoyancy` | aerodynamic roughness length for buoyancy | m |
@@ -170,7 +168,6 @@ which is extended by `SurfaceStub`
170168
in the `surface_stub.jl` file, with
171169
the cache variables specified as:
172170
```
173-
get_field(sim::AbstractSurfaceStub, ::Val{:air_density}) = sim.cache.ρ_sfc
174171
get_field(sim::AbstractSurfaceStub, ::Val{:area_fraction}) = sim.cache.area_fraction
175172
get_field(sim::AbstractSurfaceStub, ::Val{:beta}) = sim.cache.beta
176173
get_field(sim::AbstractSurfaceStub, ::Val{:energy}) = nothing

experiments/ClimaEarth/components/atmosphere/climaatmos.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,6 @@ moisture_flux(::Union{CA.EquilMoistModel, CA.NonEquilMoistModel}, integrator) =
170170
ρq_tot(::Union{CA.EquilMoistModel, CA.NonEquilMoistModel}, integrator) = integrator.u.c.ρq_tot
171171

172172
# extensions required by the Interfacer
173-
Interfacer.get_field(sim::ClimaAtmosSimulation, ::Val{:air_density}) =
174-
TD.air_density.(thermo_params, sim.integrator.p.precomputed.ᶜts)
175-
Interfacer.get_field(sim::ClimaAtmosSimulation, ::Val{:air_temperature}) =
176-
TD.air_temperature.(thermo_params, sim.integrator.p.precomputed.ᶜts)
177173
Interfacer.get_field(sim::ClimaAtmosSimulation, ::Val{:liquid_precipitation}) =
178174
surface_rain_flux(sim.integrator.p.atmos.moisture_model, sim.integrator)
179175
Interfacer.get_field(sim::ClimaAtmosSimulation, ::Val{:radiative_energy_flux_sfc}) =

experiments/ClimaEarth/components/land/climaland_bucket.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ function BucketSimulation(
229229
end
230230

231231
# extensions required by Interfacer
232-
Interfacer.get_field(sim::BucketSimulation, ::Val{:air_density}) = sim.integrator.p.bucket.ρ_sfc
233232
Interfacer.get_field(sim::BucketSimulation, ::Val{:area_fraction}) = sim.area_fraction
234233
Interfacer.get_field(sim::BucketSimulation, ::Val{:beta}) =
235234
CL.surface_evaporative_scaling(sim.model, sim.integrator.u, sim.integrator.p)
@@ -323,7 +322,7 @@ function FluxCalculator.surface_thermo_state(
323322
# Note that the surface air density, ρ_sfc, is computed using the atmospheric state at the first level and making ideal gas
324323
# and hydrostatic balance assumptions. The land model does not compute the surface air density so this is
325324
# a reasonable stand-in.
326-
ρ_sfc = Interfacer.get_field(sim, Val(:air_density))
325+
ρ_sfc = FluxCalculator.extrapolate_ρ_to_sfc.(thermo_params, thermo_state_int, T_sfc) # ideally the # calculate elsewhere, here just getter...
327326
q_sfc = Interfacer.get_field(sim, Val(:surface_humidity)) # already calculated in rhs! (cache)
328327
@. TD.PhaseEquil_ρTq.(thermo_params, ρ_sfc, T_sfc, q_sfc)
329328
end

experiments/ClimaEarth/components/ocean/eisenman_seaice.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function EisenmanIceSimulation(
9292
end
9393

9494
# extensions required by Interfacer
95-
Interfacer.get_field(sim::EisenmanIceSimulation, ::Val{:air_density}) = sim.integrator.p.Ya.ρ_sfc
9695
Interfacer.get_field(sim::EisenmanIceSimulation, ::Val{:area_fraction}) = sim.integrator.p.area_fraction
9796
Interfacer.get_field(sim::EisenmanIceSimulation, ::Val{:beta}) = convert(eltype(sim.integrator.u), 1.0)
9897
Interfacer.get_field(sim::EisenmanIceSimulation, ::Val{:roughness_buoyancy}) =

experiments/ClimaEarth/components/ocean/prescr_seaice.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ function PrescribedIceSimulation(
154154
end
155155

156156
# extensions required by Interfacer
157-
Interfacer.get_field(sim::PrescribedIceSimulation, ::Val{:air_density}) = sim.integrator.p.ρ_sfc
158157
Interfacer.get_field(sim::PrescribedIceSimulation, ::Val{:area_fraction}) = sim.integrator.p.area_fraction
159158
Interfacer.get_field(sim::PrescribedIceSimulation, ::Val{:beta}) = convert(eltype(sim.integrator.u), 1.0)
160159
Interfacer.get_field(sim::PrescribedIceSimulation, ::Val{:roughness_buoyancy}) = sim.integrator.p.params.z0b

experiments/ClimaEarth/components/ocean/slab_ocean.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ function SlabOceanSimulation(
107107
end
108108

109109
# extensions required by Interfacer
110-
Interfacer.get_field(sim::SlabOceanSimulation, ::Val{:air_density}) = sim.integrator.p.ρ_sfc
111110
Interfacer.get_field(sim::SlabOceanSimulation, ::Val{:area_fraction}) = sim.integrator.p.area_fraction
112111
Interfacer.get_field(sim::SlabOceanSimulation, ::Val{:beta}) = convert(eltype(sim.integrator.u), 1.0)
113112
Interfacer.get_field(sim::SlabOceanSimulation, ::Val{:roughness_buoyancy}) = sim.integrator.p.params.z0b

experiments/ClimaEarth/test/component_model_tests/prescr_ocean_tests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ end
6363
@test !isnothing(sim.cache.SST_timevaryinginput)
6464

6565
# Test `Interfacer.get_field` function
66-
@test Interfacer.get_field(sim, Val(:air_density)) == sim.cache.ρ_sfc
6766
@test Interfacer.get_field(sim, Val(:area_fraction)) == sim.cache.area_fraction
6867
@test Interfacer.get_field(sim, Val(:beta)) == sim.cache.beta
6968
@test Interfacer.get_field(sim, Val(:roughness_buoyancy)) == sim.cache.z0b

experiments/ClimaEarth/user_io/debug_plots.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ Interfacer.get_field(sim::BucketSimulation, ::Val{:W}) = sim.integrator.u.bucket
230230

231231
# currently selected plot fields
232232
plot_field_names(sim::Interfacer.SurfaceModelSimulation) = (:area_fraction, :surface_temperature, :surface_humidity)
233-
plot_field_names(sim::BucketSimulation) =
234-
(:area_fraction, :surface_temperature, :surface_humidity, :air_density, :σS, :Ws, :W)
233+
plot_field_names(sim::BucketSimulation) = (:area_fraction, :surface_temperature, :surface_humidity, :σS, :Ws, :W)
235234
plot_field_names(sim::ClimaAtmosSimulation) = (:w, :ρq_tot, :ρe_tot, :liquid_precipitation, :snow_precipitation)
236235

237236

src/Interfacer.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ an atmosphere component model.
119119
get_field(
120120
sim::AtmosModelSimulation,
121121
val::Union{
122-
Val{:air_density},
123-
Val{:air_temperature},
124122
Val{:energy},
125123
Val{:height_int},
126124
Val{:height_sfc},
@@ -146,7 +144,6 @@ a surface component model.
146144
get_field(
147145
sim::SurfaceModelSimulation,
148146
val::Union{
149-
Val{:air_density},
150147
Val{:area_fraction},
151148
Val{:beta},
152149
Val{:roughness_buoyancy},

0 commit comments

Comments
 (0)