Skip to content

Commit

Permalink
rev eps(FT)
Browse files Browse the repository at this point in the history
  • Loading branch information
LenkaNovak committed Jun 24, 2023
1 parent e199dbf commit 078b229
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ steps:
artifact_paths: "experiments/AMIP/modular/output/slabplanet/target_params_in_slab_artifacts/total_energy*.png"

# - label: "Moist earth with slab surface - test: monin allsky sponge idealinsol infreq_dt_cpl"
command: "julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --FLOAT_TYPE Float64 --enable_threading true --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge true --alpha_rayleigh_uh 0 --alpha_rayleigh_w 10 --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 21600 --dt 200secs --dt_rad 6hours --mono_surface true --h_elem 4 --precip_model 0M --run_name target_params_in_slab_test1 --job_id target_params_in_slab_test1" # FT32 error with --idealized_insolation true, if removed then Domain error
artifact_paths: "experiments/AMIP/modular/output/slabplanet/target_params_in_slab_test1_artifacts/total_energy*.png"
# command: "julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --FLOAT_TYPE Float64 --enable_threading true --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge true --alpha_rayleigh_uh 0 --alpha_rayleigh_w 10 --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 21600 --dt 200secs --dt_rad 6hours --mono_surface true --h_elem 4 --precip_model 0M --run_name target_params_in_slab_test1 --job_id target_params_in_slab_test1" # Unconverged SF (reproduced locally)
# artifact_paths: "experiments/AMIP/modular/output/slabplanet/target_params_in_slab_test1_artifacts/total_energy*.png"

- label: "Moist earth with slab surface - test: bulk allsky sponge realinsol infreq_dt_cpl"
command: "julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --FLOAT_TYPE Float64 --enable_threading true --coupled true --surface_setup PrescribedSurface --moist equil --vert_diff true --rad allskywithclear --rayleigh_sponge true --alpha_rayleigh_uh 0 --alpha_rayleigh_w 10 --energy_check true --mode_name slabplanet --t_end 10days --dt_save_to_sol 3600secs --dt_cpl 3600 --dt 200secs --dt_rad 6hours --idealized_insolation false --mono_surface true --h_elem 6 --precip_model 0M --run_name target_params_in_slab_test2 --job_id target_params_in_slab_test2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function slab_ocean_rhs!(dY, Y, cache, t)
p, F_turb_energy, F_radiative, area_fraction = cache
FT = eltype(Y.T_sfc)
rhs = @. -(F_turb_energy + F_radiative) / (p.h * p.ρ * p.c)
parent(dY.T_sfc) .= parent(rhs .* Regridder.binary_mask.(area_fraction, threshold = eps()))
parent(dY.T_sfc) .= parent(rhs .* Regridder.binary_mask.(area_fraction, threshold = eps(FT)))
end

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function ice_rhs!(du, u, p, _)

# do not count tendencies that lead to temperatures above freezing, and mask out no-ice areas
unphysical = @. Regridder.binary_mask.(T_freeze - (Y.T_sfc + FT(rhs) * p.dt), threshold = FT(0)) .*
Regridder.binary_mask.(area_fraction, threshold = eps())
Regridder.binary_mask.(area_fraction, threshold = eps(FT))
parent(dY.T_sfc) .= parent(rhs .* unphysical)
end

Expand Down
2 changes: 1 addition & 1 deletion experiments/AMIP/modular/coupler_driver_modular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,10 @@ function solve_coupler!(cs)
!isnothing(cs.conservation_checks) ? check_conservation!(cs, get_slab_energy, get_land_energy) : nothing

## run component models sequentially for one coupling timestep (Δt_cpl)
ClimaComms.barrier(comms_ctx)
update_model_sims!(cs.model_sims, cs.fields, turbulent_fluxes)

## step sims
ClimaComms.barrier(comms_ctx)
step_model_sims!(cs.model_sims, t)

# exchange combined fields and (if specified) calculate fluxes using combined states
Expand Down
7 changes: 4 additions & 3 deletions src/FieldExchanger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,25 @@ Updates the surface component model cache with the current coupler fields of F_t
"""
function update_sim!(sim::Interfacer.SurfaceModelSimulation, csf, area_fraction = nothing)

FT = eltype(area_fraction)
Interfacer.update_field!(sim, Val(:air_density), csf.ρ_sfc)

Interfacer.update_field!(
sim,
Val(:turbulent_energy_flux),
Regridder.binary_mask.(area_fraction, threshold = eps()) .* csf.F_turb_energy,
Regridder.binary_mask.(area_fraction, threshold = eps(FT)) .* csf.F_turb_energy,
)

Interfacer.update_field!(
sim,
Val(:turbulent_moisture_flux),
Regridder.binary_mask.(area_fraction, threshold = eps()) .* csf.F_turb_moisture,
Regridder.binary_mask.(area_fraction, threshold = eps(FT)) .* csf.F_turb_moisture,
)

Interfacer.update_field!(
sim,
Val(:radiative_energy_flux),
Regridder.binary_mask.(area_fraction, threshold = eps()) .* csf.F_radiative,
Regridder.binary_mask.(area_fraction, threshold = eps(FT)) .* csf.F_radiative,
)

Interfacer.update_field!(sim, Val(:liquid_precipitation), .-csf.P_liq)
Expand Down

0 comments on commit 078b229

Please sign in to comment.