@@ -44,22 +44,22 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
4444 # Test absorbed flux
4545 val_e = toa_heating * cosd (theta)
4646 val_o = atmos. flux_d_sw[1 ]
47- test_pass = isapprox (val_e, val_o; atol= 2 )
48- if ! test_pass
47+ test_check = isapprox (val_e, val_o; atol= 2 )
48+ if ! test_check
4949 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
5050 end
51- @test test_pass
51+ @test test_check
5252
5353 # Test no-scattering
5454 val_o = atmos. flux_u_sw[2 ]
5555 val_e = 0.0
5656 @info " Expected value = $(val_e) W m-2"
5757 @info " Modelled value = $(val_o) W m-2"
58- test_pass = isapprox (val_e,val_o; atol= 1.0e-10 )
59- if ! test_pass
58+ test_check = isapprox (val_e,val_o; atol= 1.0e-10 )
59+ if ! test_check
6060 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
6161 end
62- @test test_pass
62+ @test test_check
6363 atmosphere. deallocate! (atmos)
6464 end
6565
@@ -108,11 +108,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
108108 val_e = 1.0487713813847492e7 # known from previous tests
109109 val_o = atmos. r[1 ] # height of topmost layer-centre
110110
111- test_pass = isapprox (val_e, val_o; rtol= rtol)
112- if ! test_pass
111+ test_check = isapprox (val_e, val_o; rtol= rtol)
112+ if ! test_check
113113 @warn (" Expected value = $(val_e) m \n Modelled value = $(val_o) m" )
114114 end
115- @test test_pass
115+ @test test_check
116116 end
117117
118118
@@ -122,11 +122,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
122122 @testset " greenhouse" begin
123123 val_e = [270.0 , 280.0 ]
124124 val_o = atmos. flux_u_lw[1 ]
125- test_pass = ( val_o > val_e[1 ]) && (val_o < val_e[2 ])
126- if ! test_pass
125+ test_check = ( val_o > val_e[1 ]) && (val_o < val_e[2 ])
126+ if ! test_check
127127 @warn (" Expected range = $(val_e) W m-2 \n Modelled value = $(val_o) W m-2" )
128128 end
129- @test test_pass
129+ @test test_check
130130 end
131131
132132
@@ -136,11 +136,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
136136 @testset " surf_albedo" begin
137137 val_e = 29.699515011666094 # known from previous tests
138138 val_o = atmos. flux_u_sw[end ] # bottom level
139- test_pass = isapprox (val_e, val_o; rtol= 1e-3 )
140- if ! test_pass
139+ test_check = isapprox (val_e, val_o; rtol= 1e-3 )
140+ if ! test_check
141141 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
142142 end
143- @test test_pass
143+ @test test_check
144144 end
145145
146146
@@ -220,12 +220,12 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
220220
221221 val_e = 37.18288051811991
222222 val_o = atmos. flux_u_sw[20 ]
223- test_pass = isapprox (val_e, val_o; rtol= 1e-3 )
224- if ! test_pass
223+ test_check = isapprox (val_e, val_o; rtol= 1e-3 )
224+ if ! test_check
225225 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
226226 end
227227 atmosphere. deallocate! (atmos)
228- @test test_pass
228+ @test test_check
229229 end
230230
231231
@@ -269,11 +269,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
269269
270270 val_e = 6.144974916820797 # from previous tests
271271 val_o = atmos. heating_rate[atmos. nlev_c- 10 ]
272- test_pass = isapprox (val_e, val_o; rtol= 1e-3 )
273- if ! test_pass
272+ test_check = isapprox (val_e, val_o; rtol= 1e-3 )
273+ if ! test_check
274274 @warn (" Expected value = $(val_e) K/day\n Modelled value = $(val_o) K/day" )
275275 end
276- @test test_pass
276+ @test test_check
277277
278278
279279 # -------------
@@ -282,11 +282,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
282282 energy. calc_fluxes! (atmos, radiative= true , convective= true , conductive= true , sens_heat= true , latent_heat= true , deep= true )
283283 val_e = 8235.347576033042 # from previous tests
284284 val_o = atmos. flux_tot[atmos. nlev_c- 10 ]
285- test_pass = isapprox (val_e, val_o; rtol= 1e-3 )
286- if ! test_pass
285+ test_check = isapprox (val_e, val_o; rtol= 1e-3 )
286+ if ! test_check
287287 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
288288 end
289- @test test_pass
289+ @test test_check
290290
291291 # -------------
292292 # Transparent atmosphere solver (sol_type = 4)
@@ -298,11 +298,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
298298 solver. solve_transparent! (atmos; sol_type= 4 )
299299 val_e = atmos. target_olr
300300 val_o = atmos. flux_u_lw[1 ]
301- test_pass = isapprox (val_e, val_o; rtol= 1e-3 )
302- if ! test_pass
301+ test_check = isapprox (val_e, val_o; rtol= 1e-3 )
302+ if ! test_check
303303 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
304304 end
305- @test test_pass
305+ @test test_check
306306
307307 # -------------
308308 # Transparent atmosphere solver (sol_type = 3)
@@ -312,11 +312,11 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
312312 solver. solve_transparent! (atmos; sol_type= 3 )
313313 val_e = atmos. flux_int
314314 val_o = atmos. flux_tot[1 ]
315- test_pass = isapprox (val_e, val_o; rtol= 1e-2 , atol= 0.5 )
316- if ! test_pass
315+ test_check = isapprox (val_e, val_o; rtol= 1e-2 , atol= 0.5 )
316+ if ! test_check
317317 @warn (" Expected value = $(val_e) W m-2\n Modelled value = $(val_o) W m-2" )
318318 end
319- @test test_pass
319+ @test test_check
320320 end
321321
322322 # -------------
@@ -369,45 +369,45 @@ TEST_DIR = joinpath(ROOT_DIR,"test/")
369369 # pressure profile
370370 @debug (" Pressure..." )
371371 arr_e[:] .= [1.0 , 1.61372830078497 , 2.60411902875434 , 4.20234057531355 , 6.78143591592047 , 10.9433950574805 , 17.6596663109266 , 28.4979033083612 , 45.9878730817361 , 74.2119322849048 , 119.757895384089 , 193.256705023749 , 311.863814213277 , 503.263462986711 , 812.130492972705 , 1310.5579604405 , 2114.88447058187 , 3412.8489230686 , 5507.4108934593 , 8887.46482282671 , 14341.9535068263 , 23144.0162625079 , 37348.1540366365 , 60269.7731509967 , 97259.0386156535 , 156949.663121218 , 253274.113177377 , 408715.604290549 , 659555.937616089 , 1064344.08248185 , 1717562.16767397 , 2771678.67833306 , 4472736.32390834 , 7217781.18783982 , 11647537.7716905 , 18795961.3366388 , 30331574.7493941 , 48946920.5804721 , 78987030.9769821 , 127463607.282535 , 205691630.391968 , 331930405.19812 , 535645488.759229 , 646902370.004265 , 648216250.228125 ]
372- test_pass = all (abs .(arr_e[:] .- arr_o_prs[:]) .< abs .(arr_e[:]. * rtol) .+ 0.5 )
373- if ! test_pass
372+ test_check = all (abs .(arr_e[:] .- arr_o_prs[:]) .< abs .(arr_e[:]. * rtol) .+ 0.5 )
373+ if ! test_check
374374 @warn (" Fail 'prs' \n Observed: $(arr_o_prs) \n Expected: $(arr_e) " )
375375 end
376- @test test_pass
376+ @test test_check
377377
378378 # temperature profile
379379 @debug (" Temperature..." )
380380 arr_e[:] .= [160.6951945486835 , 172.1746786971098 , 178.14914386251837 , 179.3174970360867 , 179.99367397418297 , 179.36630061651562 , 179.61486432349 , 181.76182287005383 , 183.21555860820072 , 182.8310793945806 , 183.5654069142934 , 186.37892037403157 , 190.48580094893484 , 195.49508157697107 , 201.22720345759492 , 207.58851577389171 , 214.35040002077855 , 221.74153252547325 , 231.6691046616695 , 246.41073491399578 , 263.4670022579926 , 287.093684861275 , 319.6845577217464 , 355.27365904095996 , 392.97312349421725 , 429.96569214612794 , 461.0531314431462 , 487.49045050571283 , 514.8861402680147 , 543.5031606896113 , 570.52469404162 , 593.695649254799 , 610.4590899795674 , 620.0545016788653 , 624.7560661682035 , 627.2267737068485 , 628.7455649318175 , 629.6238504081975 , 630.0052214218207 , 630.1224213875696 , 630.1507066331749 , 630.1569595627943 , 630.158312274035 , 630.158413879461 , 630.1584141552416 ]
381- test_pass = all (abs .(arr_e[:] .- arr_o_tmp[:]) .< abs .(arr_e[:]. * rtol) .+ 0.5 )
382- if ! test_pass
381+ test_check = all (abs .(arr_e[:] .- arr_o_tmp[:]) .< abs .(arr_e[:]. * rtol) .+ 0.5 )
382+ if ! test_check
383383 @warn (" Fail 'tmp' \n Observed: $(arr_o_tmp) \n Expected: $(arr_e) " )
384384 end
385- @test test_pass
385+ @test test_check
386386
387387 # radiative flux
388388 @debug (" Radiative flux..." )
389389 arr_e[:] .= [1.1870906746480614e-7, -0.0001695253985758427, -4.829445401810517e-6, -1.9480345088140893e-5, 5.5380432968377136e-6, 7.924799490410805e-6, -1.28889058146342e-5, -3.178004538995083e-5, 1.6810952274681767e-6, 6.602606219985319e-6, -2.1631864171922643e-5, -0.00033096340735028207, -0.001622381046161081, -0.0051919088898557675, -0.015542161698306245, -0.042683713302892556, -0.10943129500662963, -0.30541037706086627, -1.4637689353679093, -9.831207438208537, -37.91071184320069, -40.75303719751662, -37.62829881131762, -23.043609644640355, -7.454170712616104, -0.00023558832512549088, -0.00017526234823606046, -0.00016422760828049832, -0.0001785546421331219, -0.0001712531209037138, -0.00015205559718367567, -0.0001204060679818042, -7.441142472330853e-5, -3.639908325325791e-5, -1.776827483812582e-5, -1.068927611447279e-5, -6.814122859744032e-6, -3.3173632762451e-6, -1.0873069782313394e-6, -2.681373675842043e-7, -5.9402425212115286e-8, -1.3076818613219839e-8, -6.566552094707885e-9, -1.264015736614347e-8, -6.251862942009202e-6]
390- test_pass = all (abs .(arr_e[:] .- arr_o_flN[:]) .< abs .(arr_e[:]. * rtol) .+ atol)
391- if ! test_pass
390+ test_check = all (abs .(arr_e[:] .- arr_o_flN[:]) .< abs .(arr_e[:]. * rtol) .+ atol)
391+ if ! test_check
392392 @warn (" Fail 'flN' \n Observed: $(arr_o_flN) \n Expected: $(arr_e) " )
393393 end
394- @test test_pass
394+ @test test_check
395395
396396 # convective flux
397- arr_e[:] .= [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 3.145716045044864 , 21.454737904012404 , 17.345291408293214 , 7.450548718999271 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ]
398- test_pass = all (abs .(arr_e[:] .- arr_o_flC[:]) .< abs .(arr_e[:]. * rtol) .+ atol)
399- if ! test_pass
397+ arr_e[:] .= [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 3.348941001526396 , 18.852250092162105 , 16.962217985262576 , 6.932104632558805 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ]
398+ test_check = all (abs .(arr_e[:] .- arr_o_flC[:]) .< abs .(arr_e[:]. * rtol) .+ atol)
399+ if ! test_check
400400 @warn (" Fail 'flC' \n Observed: $(arr_o_flC) \n Expected: $(arr_e) " )
401401 end
402- @test test_pass
402+ @test test_check
403403
404404 # eddy diffusion coefficients
405405 @debug (" Kzz..." )
406406 arr_e[:] .= [427059.004585827 , 352660.69825513515 , 291223.38308828394 , 240489.1139755759 , 198593.3043131531 , 163996.19868873604 , 135426.28376808832 , 111833.55761827467 , 92350.94002119426 , 76262.4055286653 , 62976.668084633005 , 52005.45007134976 , 42945.537123193695 , 35463.95918637879 , 29285.753198646 , 24183.857642759118 , 19970.767578287156 , 16491.643457278595 , 13618.620458920112 , 11246.10919976332 , 9286.915111152905 , 7669.033863158218 , 13813.003476924308 , 12130.702827887766 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 , 8567.057003230395 ]
407- test_pass = all (abs .(arr_e[:] .- arr_o_Kzz[:]) .< abs .(arr_e[:]. * rtol) .+ 1e4 )
408- if ! test_pass
407+ test_check = all (abs .(arr_e[:] .- arr_o_Kzz[:]) .< abs .(arr_e[:]. * rtol) .+ 1e4 )
408+ if ! test_check
409409 @warn (" Fail 'Kzz' \n Observed: $(arr_o_Kzz) \n Expected: $(arr_e) " )
410410 end
411- @test test_pass
411+ @test test_check
412412 end
413413end
0 commit comments