|
| 1 | +@testset "surface_temperature_jl tests" begin |
| 2 | + T_air = 2.0 # Air temperature in Celsius |
| 3 | + rh_air = 0.5 # Relative humidity |
| 4 | + depth_snow = 0.03 # Depth of snow in meters |
| 5 | + depth_water = 0.1 # Depth of water in meters |
| 6 | + cp_soil1 = 1000.0 # Heat capacity of soil layer 1 |
| 7 | + cp_soil0 = 800.0 # Heat capacity of soil layer 0 |
| 8 | + Gheat_g = 0.1 # Ground heat flux |
| 9 | + depth_soil1 = 0.5 # Depth of soil layer 1 in meters |
| 10 | + ρ_snow = 300.0 # Density of snow in kg/m^3 |
| 11 | + tempL_u = 0.0 # Temperature of the lower layer in Celsius |
| 12 | + Rn_g = 200.0 # Net radiation on the ground |
| 13 | + E_soil = 0.1 # Evaporation from soil |
| 14 | + E_water_g = 0.05 # Evaporation from water on the ground |
| 15 | + E_snow_g = 0.02 # Evaporation from snow on the ground |
| 16 | + λ_soil1 = 0.5 # Thermal conductivity of soil layer 1 |
| 17 | + perc_snow_g = 0.3 # Percentage of snow cover on the ground |
| 18 | + G_soil1 = 0.2 # Soil heat flux in layer 1 |
| 19 | + T_ground_last = 0.001 # Last ground temperature in Celsius |
| 20 | + T_soil1_last = 0.001 # Last soil layer 1 temperature in Celsius |
| 21 | + T_any0_last = 0.001 # Last temperature of any layer 0 in Celsius |
| 22 | + T_soil0_last = 0.001 # Last soil layer 0 temperature in Celsius |
| 23 | + T_snow_last = 0.001 # Last snow temperature in Celsius |
| 24 | + T_snow1_last = 0.001 # Last snow layer 1 temperature in Celsius |
| 25 | + T_snow2_last = 0.001 # Last snow layer 2 temperature in Celsius |
| 26 | + |
| 27 | + # T_ground, T_any0, T_soil0, T_snow, T_snow1, T_snow2, G |
| 28 | + for depth_snow = [0.01, 0.03, 0.06] |
| 29 | + r_jl = surface_temperature_jl( |
| 30 | + T_air, rh_air, |
| 31 | + depth_snow, depth_water, |
| 32 | + cp_soil1, cp_soil0, Gheat_g, |
| 33 | + depth_soil1, ρ_snow, tempL_u, Rn_g, E_soil, E_water_g, E_snow_g, λ_soil1, perc_snow_g, G_soil1, |
| 34 | + T_ground_last, T_soil1_last, T_any0_last, T_soil0_last, T_snow_last, T_snow1_last, T_snow2_last |
| 35 | + ) |
| 36 | + r_c = clang.surface_temperature_c( |
| 37 | + T_air, rh_air, |
| 38 | + depth_snow, depth_water, |
| 39 | + cp_soil1, cp_soil0, Gheat_g, |
| 40 | + depth_soil1, ρ_snow, tempL_u, Rn_g, E_soil, E_water_g, E_snow_g, λ_soil1, perc_snow_g, G_soil1, |
| 41 | + T_ground_last, T_soil1_last, T_any0_last, T_soil0_last, T_snow_last, T_snow1_last, T_snow2_last |
| 42 | + ) |
| 43 | + # println(r_jl) |
| 44 | + # println(r_c) |
| 45 | + @test all(isapprox.(r_jl, r_c, rtol=1e-8)) |
| 46 | + end |
| 47 | +end |
0 commit comments