@@ -16,9 +16,8 @@ include("climaatmos_extra_diags.jl")
1616# ##
1717# ## Functions required by ClimaCoupler.jl for an AtmosModelSimulation
1818# ##
19- struct ClimaAtmosSimulation{P, Y, D, I} <: Interfacer.AtmosModelSimulation
19+ struct ClimaAtmosSimulation{P, D, I} <: Interfacer.AtmosModelSimulation
2020 params:: P
21- Y_init:: Y
2221 domain:: D
2322 integrator:: I
2423end
@@ -69,7 +68,7 @@ function ClimaAtmosSimulation(atmos_config)
6968 @. ᶠradiation_flux = CC. Geometry. WVector (FT (0 ))
7069 end
7170
72- sim = ClimaAtmosSimulation (integrator. p. params, Y, spaces, integrator)
71+ sim = ClimaAtmosSimulation (integrator. p. params, spaces, integrator)
7372
7473 # DSS state to ensure we have continuous fields
7574 dss_state! (sim)
@@ -191,7 +190,7 @@ function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:surface_temp
191190 # note that this field is also being updated internally by the surface thermo state in ClimaAtmos
192191 # if turbulent fluxes are calculated, to ensure consistency. In case the turbulent fluxes are not
193192 # calculated, we update the field here.
194- sim. integrator. p. radiation. rrtmgp_model. surface_temperature .= CC. Fields. field2array (csf. T_S )
193+ sim. integrator. p. radiation. rrtmgp_model. surface_temperature .= CC. Fields. field2array (csf. T_sfc )
195194end
196195# extensions required by FluxCalculator (partitioned fluxes)
197196Interfacer. get_field (sim:: ClimaAtmosSimulation , :: Val{:height_int} ) =
@@ -259,31 +258,28 @@ function FieldExchanger.update_sim!(atmos_sim::ClimaAtmosSimulation, csf, turbul
259258 p = atmos_sim. integrator. p
260259 t = atmos_sim. integrator. t
261260
262- ! isempty (atmos_sim. integrator. p. radiation) &&
263- ! (p. atmos. insolation isa CA. IdealizedInsolation) &&
264- CA. set_insolation_variables! (u, p, t, p. atmos. insolation)
265-
261+ # Perform radiation-specific updates
266262 if hasradiation (atmos_sim. integrator)
263+ ! (p. atmos. insolation isa CA. IdealizedInsolation) && CA. set_insolation_variables! (u, p, t, p. atmos. insolation)
267264 Interfacer. update_field! (atmos_sim, Val (:surface_direct_albedo ), csf. surface_direct_albedo)
268265 Interfacer. update_field! (atmos_sim, Val (:surface_diffuse_albedo ), csf. surface_diffuse_albedo)
266+ Interfacer. update_field! (atmos_sim, Val (:surface_temperature ), csf)
269267 end
270268
271- ! isempty (atmos_sim. integrator. p. radiation) && Interfacer. update_field! (atmos_sim, Val (:surface_temperature ), csf)
272-
273269 if turbulent_fluxes isa FluxCalculator. PartitionedStateFluxes
274270 Interfacer. update_field! (atmos_sim, Val (:turbulent_fluxes ), csf)
275271 end
276272end
277273
278274"""
279- FluxCalculator.calculate_surface_air_density(atmos_sim::ClimaAtmosSimulation, T_S ::CC.Fields.Field)
275+ FluxCalculator.calculate_surface_air_density(atmos_sim::ClimaAtmosSimulation, T_sfc ::CC.Fields.Field)
280276
281277Extension for this function to calculate surface density.
282278"""
283- function FluxCalculator. calculate_surface_air_density (atmos_sim:: ClimaAtmosSimulation , T_S :: CC.Fields.Field )
279+ function FluxCalculator. calculate_surface_air_density (atmos_sim:: ClimaAtmosSimulation , T_sfc :: CC.Fields.Field )
284280 thermo_params = get_thermo_params (atmos_sim)
285281 ts_int = Interfacer. get_field (atmos_sim, Val (:thermo_state_int ))
286- FluxCalculator. extrapolate_ρ_to_sfc .(Ref (thermo_params), ts_int, Utilities. swap_space! (axes (ts_int. ρ), T_S ))
282+ FluxCalculator. extrapolate_ρ_to_sfc .(Ref (thermo_params), ts_int, Utilities. swap_space! (axes (ts_int. ρ), T_sfc ))
287283end
288284
289285# FluxCalculator.get_surface_params required by FluxCalculator (partitioned fluxes)
@@ -416,9 +412,9 @@ Returns a new `p` with the updated surface conditions.
416412"""
417413function get_new_cache (atmos_sim:: ClimaAtmosSimulation , csf)
418414 if hasmoisture (atmos_sim. integrator)
419- csf_sfc = (csf. T_S , csf. z0m_S , csf. z0b_S , csf. beta, csf. q_sfc)
415+ csf_sfc = (csf. T_sfc , csf. z0m_sfc , csf. z0b_sfc , csf. beta, csf. q_sfc)
420416 else
421- csf_sfc = (csf. T_S , csf. z0m_S , csf. z0b_S , csf. beta)
417+ csf_sfc = (csf. T_sfc , csf. z0m_sfc , csf. z0b_sfc , csf. beta)
422418 end
423419
424420 p = atmos_sim. integrator. p
@@ -442,8 +438,8 @@ trigger flux calculation during Atmos `Interfacer.step!`. We only want to trigge
442438timestep from ClimaCoupler.
443439
444440For debigging atmos, we can set the following atmos defaults:
445- csf.z0m_S .= 1.0e-5
446- csf.z0b_S .= 1.0e-5
441+ csf.z0m_sfc .= 1.0e-5
442+ csf.z0b_sfc .= 1.0e-5
447443 csf.beta .= 1
448444 csf = merge(csf, (;q_sfc = nothing))
449445"""
0 commit comments