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 57411f0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/cache/precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ function instead of recomputing the value yourself. Otherwise, it will be
difficult to ensure that the duplicated computations are consistent.
"""
function set_precomputed_quantities!(Y, p, t)
_Y = deepcopy(Y)
_p = deepcopy(p)
_set_precomputed_quantities!(_Y, _p, t)
Y1 = deepcopy(_Y)
_set_precomputed_quantities!(_Y, _p, t)
Y2 = deepcopy(_Y)
@test alleqeq(Y1, Y2)

_set_precomputed_quantities!(Y, p, t)
end
using Test
alleqeq(a::Fields.FieldVector, b::Fields.FieldVector) =
all(x -> x[1] == x[2], zip(Fields._values(a), Fields._values(b)))

function _set_precomputed_quantities!(Y, p, t)
(; energy_form, moisture_model, turbconv_model) = p.atmos
thermo_params = CAP.thermodynamics_params(p.params)
n = n_mass_flux_subdomains(turbconv_model)
Expand Down

0 comments on commit 57411f0

Please sign in to comment.