Skip to content

Commit

Permalink
Test that set_precomputed_quantities is idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Sep 6, 2023
1 parent e518ca2 commit 7cef5d5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/prognostic_equations/limited_tendencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,20 @@ using ClimaCore.Utilities: half

import ClimaCore.Fields: ColumnField

using Test
alleqeq(a::Fields.FieldVector, b::Fields.FieldVector) =
all(x -> x[1] == x[2], zip(Fields._values(a), Fields._values(b)))

function limited_tendency!(Yₜ, Y, p, t)
Yₜ .= zero(eltype(Yₜ))

# Y0 = deepcopy(Y)
set_precomputed_quantities!(Y, p, t)
Y1 = deepcopy(Y)
set_precomputed_quantities!(Y, p, t)
Y2 = deepcopy(Y)
@test alleqeq(Y1, Y2)

horizontal_tracer_advection_tendency!(Yₜ, Y, p, t)
NVTX.@range "tracer hyperdiffusion tendency" color = colorant"yellow" begin
tracer_hyperdiffusion_tendency!(Yₜ, Y, p, t)
Expand Down

0 comments on commit 7cef5d5

Please sign in to comment.