Skip to content

Commit

Permalink
Merge pull request #3472 from CliMA/zs/conservation
Browse files Browse the repository at this point in the history
lower conservation error threshold
  • Loading branch information
szy21 authored Dec 6, 2024
2 parents 373f108 + 8ff76e9 commit 898cf2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
16 changes: 3 additions & 13 deletions examples/hybrid/driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,9 @@ if config.parsed_args["check_conservation"]
@info " Net mass change / total mass: $mass_conservation"
@info " Net water change / total water: $water_conservation"

sfc = p.atmos.surface_model

if CA.has_no_source_or_sink(config.parsed_args)
@test energy_conservation 0 atol = 50 * eps(FT)
@test mass_conservation 0 atol = 50 * eps(FT)
@test water_conservation 0 atol = 50 * eps(FT)
else
@test energy_conservation 0 atol = sqrt(eps(FT))
@test mass_conservation 0 atol = sqrt(eps(FT))
if sfc isa CA.PrognosticSurfaceTemperature
@test water_conservation 0 atol = sqrt(eps(FT))
end
end
@test energy_conservation 0 atol = 100 * eps(FT)
@test mass_conservation 0 atol = 100 * eps(FT)
@test water_conservation 0 atol = 100 * eps(FT)
end

# Visualize the solution
Expand Down
7 changes: 0 additions & 7 deletions src/utils/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ is_tracer_var(symbol) = !(
is_turbconv_var(symbol)
)

has_no_source_or_sink(parsed_args) = all((
isnothing(parsed_args["forcing"]),
parsed_args["vert_diff"] == "false",
isnothing(parsed_args["turbconv"]),
isnothing(parsed_args["precip_model"]),
))

# we may be hitting a slow path:
# https://stackoverflow.com/questions/14687665/very-slow-stdpow-for-bases-very-close-to-1
fast_pow(x, y) = exp(y * log(x))
Expand Down

0 comments on commit 898cf2e

Please sign in to comment.