Skip to content

Commit

Permalink
use Array(parent())
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Mar 20, 2024
1 parent a28c5be commit 4b48092
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions experiments/AMIP/user_io/debug_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
)
cpu_field = ClimaCore.Fields.ones(cpu_space)

parent(cpu_field) .= parent(field)
parent(cpu_field) .= Array(parent(field))
# Check what we're doing is correct on CPU
if comms_ctx isa ClimaComms.SingletonCommsContext
@assert cpu_field == field
end

push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field)))
if (field_name == :T_S) && (@isdefined debug_csf0)
Expand All @@ -90,6 +94,11 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
# Copy field onto cpu space
parent(cpu_field) .= parent(field)

# Check what we're doing is correct on CPU
if comms_ctx isa ClimaComms.SingletonCommsContext
@assert cpu_field == field
end

push!(
all_plots,
Plots.plot(
Expand Down Expand Up @@ -149,7 +158,7 @@ function debug(sim::ComponentModelSimulation, dir)
nz = nz,
)
cpu_field = ClimaCore.Fields.ones(cpu_space)
parent(cpu_field) .= parent(field)
parent(cpu_field) .= Array(parent(field))

push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field)))
end
Expand Down

0 comments on commit 4b48092

Please sign in to comment.