Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OLD: Add 100km targets to longruns #751

Closed
wants to merge 17 commits into from
539 changes: 269 additions & 270 deletions .buildkite/longruns/pipeline.yml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions config/longrun_configs/amip_target_topo_diagedmf.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FLOAT_TYPE: "Float32"
anim: true
anim: false
apply_limiter: false
atmos_config_file: "config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz63_allsky_diagedmf_0M.yml"
coupler_toml_file: "toml/amip_target_topo_diagedmf.toml"
atmos_config_file: "config/gpu_configs/gpu_aquaplanet_diagedmf.yml"
dt: "100secs"
dt_cloud_fraction: "1hours"
dt_cpl: 100
Expand All @@ -17,10 +16,12 @@ land_albedo_type: "map_temporal"
mode_name: "amip"
mono_surface: false
netcdf_output_at_levels: true
output_default_diagnostics: true
run_name: "amip_target_topo_diagedmf"
start_date: "19790301"
surface_setup: "PrescribedSurface"
t_end: "40days"
t_end: "30days"
topo_smoothing: true
topography: "Earth"
turb_flux_partition: "CombinedStateFluxes"
use_reference_state: false
11 changes: 6 additions & 5 deletions config/longrun_configs/gpu_amip_target_topo_diagedmf.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
FLOAT_TYPE: "Float32"
anim: false
apply_limiter: false
atmos_config_file: "config/longrun_configs/longrun_aquaplanet_rhoe_equil_55km_nz63_allsky_diagedmf_0M.yml"
dt: "100secs"
atmos_config_file: "config/gpu_configs/gpu_aquaplanet_diagedmf.yml"
dt: "120secs"
dt_cloud_fraction: "1hours"
dt_cpl: 100
dt_cpl: 120
dt_rad: "1hours"
dt_save_state_to_disk: "20days"
dt_save_to_sol: "10days"
energy_check: false
hourly_checkpoint: true
hourly_checkpoint: false
idealized_insolation: false
job_id: "gpu_amip_target_topo_diagedmf"
land_albedo_type: "map_temporal"
mode_name: "amip"
mono_surface: false
netcdf_output_at_levels: true
output_default_diagnostics: false
run_name: "gpu_amip_target_topo_diagedmf"
start_date: "19790301"
surface_setup: "PrescribedSurface"
t_end: "90days"
t_end: "400days"
topo_smoothing: true
topography: "Earth"
turb_flux_partition: "CombinedStateFluxes"
Expand Down
36 changes: 28 additions & 8 deletions experiments/AMIP/components/atmosphere/climaatmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Interfacer.name(::ClimaAtmosSimulation) = "ClimaAtmosSimulation"

function atmos_init(::Type{FT}, atmos_config_dict::Dict) where {FT}
# By passing `parsed_args` to `AtmosConfig`, `parsed_args` overwrites the default atmos config
atmos_config_dict["surface_albedo"] = "CouplerAlbedo"
atmos_config_dict["albedo_model"] = "CouplerAlbedo"
atmos_config = CA.AtmosConfig(atmos_config_dict)
simulation = CA.get_simulation(atmos_config)
(; integrator) = simulation
Expand Down Expand Up @@ -59,11 +59,29 @@ function atmos_init(::Type{FT}, atmos_config_dict::Dict) where {FT}

sim = ClimaAtmosSimulation(integrator.p.params, Y, spaces, integrator)


# DSS state to ensure we have continuous fields
dss_state!(sim)

return sim
end

# Extension of CA.set_surface_albedo! to set the surface albedo to 1.0 at the beginning of the simulation,
# so the initial callback initialization doesn't lead to NaNs in the radiation model.
function CA.set_surface_albedo!(Y, p, t, ::CA.CouplerAlbedo)
if t == 0
FT = CC.Spaces.undertype(axes(Y.c))
# set initial insolation initial conditions
!p.radiation.idealized_insolation && CA.set_insolation_variables!(Y, p, t)
# set surface albedo to 1.0
@warn "Setting surface albedo to 0.38 at the beginning of the simulation"
p.radiation.radiation_model.direct_sw_surface_albedo .= FT(0.38)
p.radiation.radiation_model.diffuse_sw_surface_albedo .= FT(0.38)
else
nothing
end
end

"""
Checkpointer.get_model_prog_state(sim::ClimaAtmosSimulation)

Expand Down Expand Up @@ -167,13 +185,11 @@ function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:surface_temp
end

function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:surface_direct_albedo}, field)
sim.integrator.p.radiation.radiation_model.direct_sw_surface_albedo .=
reshape(CA.RRTMGPI.field2array(field), 1, length(parent(field)))
sim.integrator.p.radiation.radiation_model.direct_sw_surface_albedo .= reshape(CA.RRTMGPI.field2array(field), 1, length(parent(field))) #CA.RRTMGPI.field2array(field)'
end

function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:surface_diffuse_albedo}, field)
sim.integrator.p.radiation.radiation_model.diffuse_sw_surface_albedo .=
reshape(CA.RRTMGPI.field2array(field), 1, length(parent(field)))
sim.integrator.p.radiation.radiation_model.diffuse_sw_surface_albedo .= reshape(CA.RRTMGPI.field2array(field), 1, length(parent(field))) #CA.RRTMGPI.field2array(field)'
end

function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:turbulent_fluxes}, fields)
Expand Down Expand Up @@ -208,6 +224,13 @@ Interfacer.step!(sim::ClimaAtmosSimulation, t) = Interfacer.step!(sim.integrator
Interfacer.reinit!(sim::ClimaAtmosSimulation) = Interfacer.reinit!(sim.integrator)

function FieldExchanger.update_sim!(atmos_sim::ClimaAtmosSimulation, csf, turbulent_fluxes)

u = atmos_sim.integrator.u
p = atmos_sim.integrator.p
t = atmos_sim.integrator.t

!p.radiation.idealized_insolation && CA.set_insolation_variables!(u, p, t)

Interfacer.update_field!(atmos_sim, Val(:surface_direct_albedo), csf.surface_direct_albedo)
Interfacer.update_field!(atmos_sim, Val(:surface_diffuse_albedo), csf.surface_diffuse_albedo)
Interfacer.update_field!(atmos_sim, Val(:surface_temperature), csf)
Expand Down Expand Up @@ -404,14 +427,11 @@ function FluxCalculator.water_albedo_from_atmosphere!(
λ = FT(0) # spectral wavelength (not used for now)

# update for current zenith angle
CA.set_insolation_variables!(Y, p, t)

bottom_coords = CC.Fields.coordinate_field(CC.Spaces.level(Y.c, 1))
μ = CA.RRTMGPI.array2field(radiation_model.cos_zenith, axes(bottom_coords))
FT = eltype(atmos_sim.integrator.u)
α_model = CA.RegressionFunctionAlbedo{FT}()


# set the direct and diffuse surface albedos
direct_albedo .= CA.surface_albedo_direct(α_model).(λ, μ, LinearAlgebra.norm.(CC.Fields.level(Y.c.uₕ, 1)))
diffuse_albedo .= CA.surface_albedo_diffuse(α_model).(λ, μ, LinearAlgebra.norm.(CC.Fields.level(Y.c.uₕ, 1)))
Expand Down
Loading
Loading