Skip to content

Commit

Permalink
debugging partitioned fluxes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Jun 18, 2024
1 parent 8bdbc74 commit 80d3493
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
8 changes: 4 additions & 4 deletions experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ parsed_args = parse_commandline(argparse_settings())

## modify parsed args for fast testing from REPL #hide
if isinteractive()
parsed_args["config_file"] =
isnothing(parsed_args["config_file"]) ? joinpath(pkg_dir, "config/ci_configs/interactive_debug.yml") :
parsed_args["config_file"]
parsed_args["job_id"] = "interactive_debug"
parsed_args["job_id"] = "slabplanet_partitioned_fluxes"
parsed_args["config_file"] = joinpath(pkg_dir, "config/ci_configs/slabplanet_partitioned_fluxes.yml")
# isnothing(parsed_args["config_file"]) ? joinpath(pkg_dir, "config/ci_configs/interactive_debug.yml") :
# parsed_args["config_file"]
end

## the unique job id should be passed in via the command line
Expand Down
26 changes: 22 additions & 4 deletions src/FluxCalculator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ function partitioned_turbulent_fluxes!(

# atmos state of center level 1
z_int = Interfacer.get_field(atmos_sim, Val(:height_int))
uₕ_int = Interfacer.get_field(atmos_sim, Val(:uv_int))
thermo_state_int = Interfacer.get_field(atmos_sim, Val(:thermo_state_int))
z_sfc = Interfacer.get_field(atmos_sim, Val(:height_sfc))
uₕ_int = Interfacer.get_field(atmos_sim, Val(:uv_int)) # axes(z_int) == axes(uₕ_int) true
thermo_state_int = Interfacer.get_field(atmos_sim, Val(:thermo_state_int)) # axes(thermo_state_int) == axes(z_int) true; axes(thermo_state_int) == axes(z_sfc) false
z_sfc = Interfacer.get_field(atmos_sim, Val(:height_sfc)) # axes(z_int) == axes(z_sfc) false

for sim in model_sims
# iterate over all surface models with non-zero area fractions
Expand All @@ -159,11 +159,21 @@ function partitioned_turbulent_fluxes!(

if !iszero(parent(area_mask))

thermo_state_sfc = surface_thermo_state(sim, thermo_params, thermo_state_int)
thermo_state_sfc = surface_thermo_state(sim, thermo_params, thermo_state_int) # axes(thermo_state_sfc) == axes(z_sfc) false

# set inputs based on whether the surface_scheme is `MoninObukhovScheme` or `BulkScheme`
surface_params = get_surface_params(atmos_sim)
scheme_properties = get_scheme_properties(surface_scheme, sim)

# julia> axes(scheme_properties.beta) == axes(z_sfc)
# false

# julia> axes(scheme_properties.beta) == axes(z_int)
# false

# julia> axes(scheme_properties.beta) == axes(thermo_state_sfc)
# true

input_args = (;
thermo_state_sfc,
thermo_state_int,
Expand Down Expand Up @@ -275,6 +285,14 @@ function surface_inputs(::MoninObukhovScheme, input_args::NamedTuple)
gustiness, # gustiness
beta, # beta
)
# julia> axes(state_in) == axes(state_sfc)
# false

# julia> axes(state_in) == axes(beta)
# false

# julia> axes(state_sfc) == axes(beta)
# false

end

Expand Down

0 comments on commit 80d3493

Please sign in to comment.