Skip to content

Commit dca9af1

Browse files
committed
Remove radiative_energy_toa
`radiative_energy_toa` is a field fully owned by atmos. There is no reason for ClimaCoupler to maintain a copy. Instead, we can directly access the value from atmos if we need it (it's only needed for conservation checks).
1 parent 73194de commit dca9af1

11 files changed

+6
-19
lines changed

experiments/ClimaEarth/run_cloudless_aquaplanet.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ coupler_field_names = [
202202
:F_radiative,
203203
:P_liq,
204204
:P_snow,
205-
:radiative_energy_flux_toa,
206205
:P_net,
207206
:temp1,
208207
:temp2,

experiments/ClimaEarth/run_cloudy_aquaplanet.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ coupler_field_names = [
221221
:F_radiative,
222222
:P_liq,
223223
:P_snow,
224-
:radiative_energy_flux_toa,
225224
:P_net,
226225
:temp1,
227226
:temp2,

experiments/ClimaEarth/run_cloudy_slabplanet.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ coupler_field_names = [
262262
:F_radiative,
263263
:P_liq,
264264
:P_snow,
265-
:radiative_energy_flux_toa,
266265
:P_net,
267266
:temp1,
268267
:temp2,

experiments/ClimaEarth/run_dry_held_suarez.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ coupler_field_names = [
172172
:F_radiative,
173173
:P_liq,
174174
:P_snow,
175-
:radiative_energy_flux_toa,
176175
:P_net,
177176
:temp1,
178177
:temp2,

experiments/ClimaEarth/run_moist_held_suarez.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ coupler_field_names = [
208208
:F_radiative,
209209
:P_liq,
210210
:P_snow,
211-
:radiative_energy_flux_toa,
212211
:P_net,
213212
:temp1,
214213
:temp2,

experiments/ClimaEarth/setup_run.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ function CoupledSimulation(config_dict::AbstractDict)
425425
Interfacer.add_coupler_fields!(coupler_field_names, sim)
426426
end
427427
# add coupler fields required to track conservation, if specified
428-
energy_check && push!(coupler_field_names, :radiative_energy_flux_toa, :P_net)
428+
energy_check && push!(coupler_field_names, :P_net)
429429

430430
# allocate space for the coupler fields
431431
coupler_fields = Interfacer.init_coupler_fields(FT, coupler_field_names, boundary_space)

experiments/ClimaEarth/test/debug_plots_tests.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ plot_field_names(sim::Interfacer.SurfaceStub) = (:stub_field,)
3535
@testset "import_atmos_fields!" begin
3636

3737
boundary_space = TestHelper.create_space(FT)
38-
coupler_names = [
38+
coupler_names = (
3939
:surface_direct_albedo,
4040
:surface_diffuse_albedo,
4141
:F_radiative,
@@ -51,8 +51,7 @@ plot_field_names(sim::Interfacer.SurfaceStub) = (:stub_field,)
5151
:beta,
5252
:z0b_sfc,
5353
:z0m_sfc,
54-
:radiative_energy_flux_toa,
55-
]
54+
)
5655
atmos_names = (:atmos_field,)
5756
surface_names = (:surface_field,)
5857
stub_names = (:stub_field,)

experiments/ClimaEarth/user_io/debug_plots.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Plot useful coupler fields (in `field_names`) and save plots to a directory.
102102
If `cs_fields_ref` is provided (e.g., using a copy of cs.fields from the initialization),
103103
plot the anomalies of the fields with respect to `cs_fields_ref`.
104104
"""
105-
function debug(cs_fields::CC.Fields.Field, dir, cs_fields_ref = nothing)
105+
function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
106106
field_names = propertynames(cs_fields)
107107
fig = Makie.Figure(size = (1500, 800))
108108
min_square_len = ceil(Int, sqrt(length(field_names)))

src/ConservationChecker.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ function check_conservation!(
8383
for sim in model_sims
8484
sim_name = Symbol(Interfacer.name(sim))
8585
if sim isa Interfacer.AtmosModelSimulation
86-
radiative_energy_flux_toa = coupler_sim.fields.radiative_energy_flux_toa
87-
# save radiation source
88-
parent(radiative_energy_flux_toa) .= parent(Interfacer.get_field(sim, Val(:radiative_energy_flux_toa)))
86+
radiative_energy_flux_toa = Interfacer.get_field(sim, Val(:radiative_energy_flux_toa))
8987

9088
if isempty(ccs.toa_net_source)
9189
radiation_sources_accum = sum(radiative_energy_flux_toa .* FT(float(coupler_sim.Δt_cpl))) # ∫ J / m^2 dA

src/Interfacer.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ get_field(
189189
Val{:height_sfc},
190190
Val{:liquid_precipitation},
191191
Val{:radiative_energy_flux_sfc},
192-
Val{:radiative_energy_flux_toa},
193192
Val{:snow_precipitation},
194193
Val{:turblent_energy_flux},
195194
Val{:turbulent_moisture_flux},

test/conservation_checker_tests.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@ for FT in (Float32, Float64)
5858

5959
# coupler fields
6060
cf = (;
61-
radiative_energy_flux_toa = CC.Fields.ones(space),
6261
P_net = CC.Fields.zeros(space),
6362
P_liq = CC.Fields.zeros(space),
6463
P_snow = CC.Fields.zeros(space),
6564
F_turb_moisture = CC.Fields.zeros(space),
6665
)
67-
@. cf.radiative_energy_flux_toa = 200
6866
@. cf.P_liq = -100
6967

7068
# init
@@ -86,7 +84,7 @@ for FT in (Float32, Float64)
8684
)
8785

8886
# set non-zero radiation and precipitation
89-
F_r = cf.radiative_energy_flux_toa
87+
F_r = 200 .* CC.Fields.ones(space)
9088
P = cf.P_liq
9189
Δt = float(cs.Δt_cpl)
9290

@@ -138,13 +136,11 @@ for FT in (Float32, Float64)
138136

139137
# coupler fields
140138
cf = (;
141-
radiative_energy_flux_toa = CC.Fields.ones(space),
142139
P_net = CC.Fields.zeros(space),
143140
P_liq = CC.Fields.zeros(space),
144141
P_snow = CC.Fields.zeros(space),
145142
F_turb_moisture = CC.Fields.zeros(space),
146143
)
147-
@. cf.radiative_energy_flux_toa = 200
148144
@. cf.P_liq = -100
149145

150146
# init

0 commit comments

Comments
 (0)