@@ -139,20 +139,19 @@ end
139139
140140
141141"""
142- Interfacer.get_field(atmos_sim ::ClimaAtmosSimulation, ::Val{:radiative_energy_flux_toa})
142+ Interfacer.get_field(sim ::ClimaAtmosSimulation, ::Val{:radiative_energy_flux_toa})
143143
144144Extension of Interfacer.get_field to get the net TOA radiation, which is a sum of the
145145upward and downward longwave and shortwave radiation.
146146"""
147- function Interfacer. get_field (atmos_sim :: ClimaAtmosSimulation , :: Val{:radiative_energy_flux_toa} )
148- FT = eltype (atmos_sim . integrator. u)
147+ function Interfacer. get_field (sim :: ClimaAtmosSimulation , :: Val{:radiative_energy_flux_toa} )
148+ FT = eltype (sim . integrator. u)
149149
150- if hasradiation (atmos_sim . integrator)
151- face_space = axes (atmos_sim . integrator. u. f)
150+ if hasradiation (sim . integrator)
151+ face_space = axes (sim . integrator. u. f)
152152 nz_faces = length (CC. Spaces. vertical_topology (face_space). mesh. faces)
153153
154- (; face_lw_flux_dn, face_lw_flux_up, face_sw_flux_dn, face_sw_flux_up) =
155- atmos_sim. integrator. p. radiation. rrtmgp_model
154+ (; face_lw_flux_dn, face_lw_flux_up, face_sw_flux_dn, face_sw_flux_up) = sim. integrator. p. radiation. rrtmgp_model
156155
157156 LWd_TOA = CC. Fields. level (CC. Fields. array2field (FT .(face_lw_flux_dn), face_space), nz_faces - CC. Utilities. half)
158157 LWu_TOA = CC. Fields. level (CC. Fields. array2field (FT .(face_lw_flux_up), face_space), nz_faces - CC. Utilities. half)
@@ -165,8 +164,8 @@ function Interfacer.get_field(atmos_sim::ClimaAtmosSimulation, ::Val{:radiative_
165164 end
166165end
167166
168- function Interfacer. get_field (atmos_sim :: ClimaAtmosSimulation , :: Val{:energy} )
169- integrator = atmos_sim . integrator
167+ function Interfacer. get_field (sim :: ClimaAtmosSimulation , :: Val{:energy} )
168+ integrator = sim . integrator
170169 p = integrator. p
171170
172171
@@ -179,7 +178,7 @@ function Interfacer.get_field(atmos_sim::ClimaAtmosSimulation, ::Val{:energy})
179178 else
180179 ᶜS_ρq_tot = p. precipitation. ᶜS_ρq_tot
181180 end
182- thermo_params = get_thermo_params (atmos_sim )
181+ thermo_params = get_thermo_params (sim )
183182 return integrator. u. c. ρe_tot .-
184183 ᶜS_ρq_tot .* CA. e_tot_0M_precipitation_sources_helper .(Ref (thermo_params), ᶜts, ᶜΦ) .*
185184 float (integrator. dt)
@@ -274,8 +273,8 @@ Interfacer.get_field(sim::ClimaAtmosSimulation, ::Val{:turbulent_moisture_flux})
274273 moisture_flux (sim. integrator. p. atmos. moisture_model, sim. integrator)
275274Interfacer. get_field (sim:: ClimaAtmosSimulation , :: Val{:thermo_state_int} ) =
276275 CC. Spaces. level (sim. integrator. p. precomputed. ᶜts, 1 )
277- Interfacer. get_field (atmos_sim :: ClimaAtmosSimulation , :: Val{:water} ) =
278- ρq_tot (atmos_sim . integrator. p. atmos. moisture_model, atmos_sim . integrator)
276+ Interfacer. get_field (sim :: ClimaAtmosSimulation , :: Val{:water} ) =
277+ ρq_tot (sim . integrator. p. atmos. moisture_model, sim . integrator)
279278function Interfacer. update_field! (sim:: ClimaAtmosSimulation , :: Val{:surface_temperature} , field)
280279 # note that this field is also being updated internally by the surface thermo state in ClimaAtmos
281280 # if turbulent fluxes are calculated, to ensure consistency. In case the turbulent fluxes are not
@@ -361,33 +360,33 @@ function Interfacer.add_coupler_fields!(coupler_field_names, ::ClimaAtmosSimulat
361360 push! (coupler_field_names, atmos_coupler_fields... )
362361end
363362
364- function FieldExchanger. update_sim! (atmos_sim :: ClimaAtmosSimulation , csf, turbulent_fluxes)
363+ function FieldExchanger. update_sim! (sim :: ClimaAtmosSimulation , csf, turbulent_fluxes)
365364
366- u = atmos_sim . integrator. u
367- p = atmos_sim . integrator. p
368- t = atmos_sim . integrator. t
365+ u = sim . integrator. u
366+ p = sim . integrator. p
367+ t = sim . integrator. t
369368
370369 # Perform radiation-specific updates
371- if hasradiation (atmos_sim . integrator)
370+ if hasradiation (sim . integrator)
372371 ! (p. atmos. insolation isa CA. IdealizedInsolation) && CA. set_insolation_variables! (u, p, t, p. atmos. insolation)
373- Interfacer. update_field! (atmos_sim , Val (:surface_direct_albedo ), csf. surface_direct_albedo)
374- Interfacer. update_field! (atmos_sim , Val (:surface_diffuse_albedo ), csf. surface_diffuse_albedo)
375- Interfacer. update_field! (atmos_sim , Val (:surface_temperature ), csf. T_sfc)
372+ Interfacer. update_field! (sim , Val (:surface_direct_albedo ), csf. surface_direct_albedo)
373+ Interfacer. update_field! (sim , Val (:surface_diffuse_albedo ), csf. surface_diffuse_albedo)
374+ Interfacer. update_field! (sim , Val (:surface_temperature ), csf. T_sfc)
376375 end
377376
378377 if turbulent_fluxes isa FluxCalculator. PartitionedStateFluxes
379- Interfacer. update_field! (atmos_sim , Val (:turbulent_fluxes ), csf)
378+ Interfacer. update_field! (sim , Val (:turbulent_fluxes ), csf)
380379 end
381380end
382381
383382"""
384- FluxCalculator.calculate_surface_air_density(atmos_sim ::ClimaAtmosSimulation, T_sfc::CC.Fields.Field)
383+ FluxCalculator.calculate_surface_air_density(sim ::ClimaAtmosSimulation, T_sfc::CC.Fields.Field)
385384
386385Extension for this function to calculate surface density.
387386"""
388- function FluxCalculator. calculate_surface_air_density (atmos_sim :: ClimaAtmosSimulation , T_sfc:: CC.Fields.Field )
389- thermo_params = get_thermo_params (atmos_sim )
390- ts_int = Interfacer. get_field (atmos_sim , Val (:thermo_state_int ))
387+ function FluxCalculator. calculate_surface_air_density (sim :: ClimaAtmosSimulation , T_sfc:: CC.Fields.Field )
388+ thermo_params = get_thermo_params (sim )
389+ ts_int = Interfacer. get_field (sim , Val (:thermo_state_int ))
391390 FluxCalculator. extrapolate_ρ_to_sfc .(Ref (thermo_params), ts_int, Utilities. swap_space! (axes (ts_int. ρ), T_sfc))
392391end
393392
@@ -519,18 +518,18 @@ function coupler_surface_setup(
519518end
520519
521520"""
522- get_new_cache(atmos_sim ::ClimaAtmosSimulation, csf)
521+ get_new_cache(sim ::ClimaAtmosSimulation, csf)
523522
524523Returns a new `p` with the updated surface conditions.
525524"""
526- function get_new_cache (atmos_sim :: ClimaAtmosSimulation , csf)
527- if hasmoisture (atmos_sim . integrator)
525+ function get_new_cache (sim :: ClimaAtmosSimulation , csf)
526+ if hasmoisture (sim . integrator)
528527 csf_sfc = (csf. T_sfc, csf. z0m_sfc, csf. z0b_sfc, csf. beta, csf. q_sfc)
529528 else
530529 csf_sfc = (csf. T_sfc, csf. z0m_sfc, csf. z0b_sfc, csf. beta)
531530 end
532531
533- p = atmos_sim . integrator. p
532+ p = sim . integrator. p
534533
535534 coupler_sfc_setup = coupler_surface_setup (CoupledMoninObukhov (), p, csf_sfc... )
536535
@@ -541,7 +540,7 @@ function get_new_cache(atmos_sim::ClimaAtmosSimulation, csf)
541540end
542541
543542"""
544- FluxCalculator.atmos_turbulent_fluxes_most!(atmos_sim ::ClimaAtmosSimulation, csf)
543+ FluxCalculator.atmos_turbulent_fluxes_most!(sim ::ClimaAtmosSimulation, csf)
545544
546545Computes turbulent surface fluxes using ClimaAtmos's `update_surface_conditions!` and
547546and the Monin Obukhov Similarity Theory. This
@@ -556,12 +555,12 @@ For debigging atmos, we can set the following atmos defaults:
556555 csf.beta .= 1
557556 csf = merge(csf, (;q_sfc = nothing))
558557"""
559- function FluxCalculator. atmos_turbulent_fluxes_most! (atmos_sim :: ClimaAtmosSimulation , csf)
558+ function FluxCalculator. atmos_turbulent_fluxes_most! (sim :: ClimaAtmosSimulation , csf)
560559
561- if isnothing (atmos_sim . integrator. p. sfc_setup) # trigger flux calculation if not done in Atmos internally
562- new_p = get_new_cache (atmos_sim , csf)
563- CA. SurfaceConditions. update_surface_conditions! (atmos_sim . integrator. u, new_p, atmos_sim . integrator. t)
564- atmos_sim . integrator. p. precomputed. sfc_conditions .= new_p. precomputed. sfc_conditions
560+ if isnothing (sim . integrator. p. sfc_setup) # trigger flux calculation if not done in Atmos internally
561+ new_p = get_new_cache (sim , csf)
562+ CA. SurfaceConditions. update_surface_conditions! (sim . integrator. u, new_p, sim . integrator. t)
563+ sim . integrator. p. precomputed. sfc_conditions .= new_p. precomputed. sfc_conditions
565564 end
566565end
567566
@@ -590,28 +589,28 @@ function dss_state!(sim::ClimaAtmosSimulation)
590589end
591590
592591"""
593- FluxCalculator.water_albedo_from_atmosphere!(atmos_sim ::ClimaAtmosSimulation, direct_albedo::CC.Fields.Field, diffuse_albedo::CC.Fields.Field)
592+ FluxCalculator.water_albedo_from_atmosphere!(sim ::ClimaAtmosSimulation, direct_albedo::CC.Fields.Field, diffuse_albedo::CC.Fields.Field)
594593
595594Extension to calculate the water surface albedo from wind speed and insolation. It can be used for prescribed ocean and lakes.
596595"""
597596function FluxCalculator. water_albedo_from_atmosphere! (
598- atmos_sim :: ClimaAtmosSimulation ,
597+ sim :: ClimaAtmosSimulation ,
599598 direct_albedo:: CC.Fields.Field ,
600599 diffuse_albedo:: CC.Fields.Field ,
601600)
602601
603- Y = atmos_sim . integrator. u
604- p = atmos_sim . integrator. p
605- t = atmos_sim . integrator. t
602+ Y = sim . integrator. u
603+ p = sim . integrator. p
604+ t = sim . integrator. t
606605
607- rrtmgp_model = atmos_sim . integrator. p. radiation. rrtmgp_model
606+ rrtmgp_model = sim . integrator. p. radiation. rrtmgp_model
608607 FT = eltype (Y)
609608 λ = FT (0 ) # spectral wavelength (not used for now)
610609
611610 # update for current zenith angle
612611 bottom_coords = CC. Fields. coordinate_field (CC. Spaces. level (Y. c, 1 ))
613612 μ = CC. Fields. array2field (rrtmgp_model. cos_zenith, axes (bottom_coords))
614- FT = eltype (atmos_sim . integrator. u)
613+ FT = eltype (sim . integrator. u)
615614 α_model = CA. RegressionFunctionAlbedo {FT} ()
616615
617616 # set the direct and diffuse surface albedos
0 commit comments