Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
jagoosw committed Nov 12, 2024
1 parent 1277e12 commit 8bde52e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/radiative_transfer/homogeneous_body_heating.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,3 @@ summary(::HomogeneousBodyHeating) = string("Single band light attenuation and bo
show(io::IO, body_heating::HomogeneousBodyHeating) = println(io, string(summary(body_heating), " with: \n",
" Attenuation coefficient: ", body_heating.water_attenuation_coefficient, " (1 / m)\n",
" Heat capacity: ", body_heating.water_heat_capacity, " (J / K / kg)"))

26 changes: 19 additions & 7 deletions test/test_heating.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ required_biogeochemical_tracers(::JustPhytoplankton) = (:P, )
# Density and specific head are 1 so the water should have increased in temp by ~6.3212 K
@test Array(interior(model.tracers.T, 1, 1, 10))[1] 10 * (1 - exp(-1))

# TODO: change this test so it is actually correct when spacing is not 1 in all dimensions
# TODO: change this test so it is actually correct when spacing is not 1 in all dimensions - dw I checked it is (23/8/24)

#####
##### Test radiative heating/cooling (no sensible or latent flux)
Expand Down Expand Up @@ -97,21 +97,27 @@ required_biogeochemical_tracers(::JustPhytoplankton) = (:P, )
# no heat exchange when temperatures equal
set!(model, T = 0)

time_step!(model, 1)
for n in 1:2
time_step!(model, 1)
end

@test Array(interior(model.tracers.T, 1, 1, 10))[1] 0

# when the water is warmer, it looses heat
set!(model, T = 1)

time_step!(model, 1)
for n in 1:2
time_step!(model, 1)
end

@test Array(interior(model.tracers.T, 1, 1, 10))[1] < 1

# when the water is colder, it gains heat
set!(model, T = -1)

time_step!(model, 1)
for n in 1:2
time_step!(model, 1)
end

@test Array(interior(model.tracers.T, 1, 1, 10))[1] > -1

Expand All @@ -137,21 +143,27 @@ required_biogeochemical_tracers(::JustPhytoplankton) = (:P, )
# no heat exchange when vapour pressure equalised
set!(model, T = 0)

time_step!(model, 1)
for n in 1:2
time_step!(model, 1)
end

@test Array(interior(model.tracers.T, 1, 1, 10))[1] 0

# when the water has higher saturation pressure, it looses heat
set!(model, T = 1)

time_step!(model, 1)
for n in 1:2
time_step!(model, 1)
end

@test Array(interior(model.tracers.T, 1, 1, 10))[1] < 1

# when the water has lower saturation pressure, it gains heat
set!(model, T = -1)

time_step!(model, 1)
for n in 1:2
time_step!(model, 1)
end

@test Array(interior(model.tracers.T, 1, 1, 10))[1] > -1

Expand Down

0 comments on commit 8bde52e

Please sign in to comment.