46 real(dp),
dimension(-256:255),
private :: c_int_table
50 real(dp),
dimension(-524288:524287),
private :: c_int_inv_table
54 integer(i4b),
private :: n_temp_min
58 integer(i4b),
private :: n_temp_max
62 integer(i4b),
private :: n_enth_min
66 integer(i4b),
private :: n_enth_max
69 real(dp),
private :: l
72 real(dp),
private :: l_inv
76 private :: c_int_val, c_int_inv_val
88 integer(i4b),
intent(in) :: n_tmp_min, n_tmp_max
89 real(dp),
dimension(n_tmp_min:n_tmp_max),
intent(in) :: c_table
90 real(dp),
optional,
intent(in) :: l_val
93 real(dp) :: c_int_zero
99 n_temp_min = n_tmp_min
100 n_temp_max = n_tmp_max
102 if ((n_temp_min <= -256).or.(n_temp_max >= 255)) &
103 stop
' calc_c_int_table: Temperature indices out of allowed range!'
108 do n=n_temp_min+1, n_temp_max
109 c_int_table(n) = c_int_table(n-1) + 0.5_dp*(c_table(n-1)+c_table(n))
113 do n=n_temp_max+1, 255
114 c_int_table(n) = c_int_table(n_temp_max)
119 c_int_zero = c_int_table(0)
122 c_int_table(n) = c_int_table(n) - c_int_zero
127 if ( present(l_val) )
then
146 integer(i4b) :: n_temp_1, n_temp_2
147 real(dp) :: enth_min, enth_max
148 real(dp) :: enth_val, enth_1, enth_2
152 c_int_inv_table = 0.0_dp
154 enth_min = c_int_val(
real(n_temp_min,dp))
155 enth_max = c_int_val(
real(n_temp_max,dp))
157 n_enth_min = ceiling(enth_min)
158 n_enth_max = floor(enth_max)
160 if ((n_enth_min <= -524288).or.(n_enth_max >= 524287)) &
161 stop
' calc_c_int_inv_table: Enthalpy indices out of allowed range!'
165 n_temp_1 = n_temp_min
166 n_temp_2 = n_temp_min+1
168 do n=n_enth_min, n_enth_max
170 enth_val =
real(n,dp)
174 if ((n_temp_1 > n_temp_max).or.(n_temp_2 > n_temp_max)) &
175 stop
' calc_c_int_inv_table: Temperature indices out of allowed range!'
177 enth_1 = c_int_val(
real(n_temp_1,dp))
178 enth_2 = c_int_val(
real(n_temp_2,dp))
180 if ( (enth_1 <= enth_val).and.(enth_2 >= enth_val) )
exit
182 n_temp_1 = n_temp_1+1
183 n_temp_2 = n_temp_2+1
187 c_int_inv_table(n) =
real(n_temp_1,dp) &
188 + (
real(n_temp_2,dp)-
real(n_temp_1,dp)) &
189 * (enth_val-enth_1)/(enth_2-enth_1)
193 do n=-524288, n_enth_min-1
194 c_int_inv_table(n) = c_int_inv_table(n_enth_min)
197 do n=n_enth_max+1, 524287
198 c_int_inv_table(n) = c_int_inv_table(n_enth_max)
207 function c_int_val(temp_val)
211 real(dp) :: c_int_val
213 real(dp),
intent(in) :: temp_val
215 integer(i4b) :: n_temp_1, n_temp_2
217 n_temp_1 = floor(temp_val)
218 n_temp_2 = n_temp_1 + 1
224 c_int_val = c_int_table(n_temp_1) &
225 + (c_int_table(n_temp_2)-c_int_table(n_temp_1)) &
226 * (temp_val-
real(n_temp_1,dp))
228 end function c_int_val
233 function c_int_inv_val(enth_val)
237 real(dp) :: c_int_inv_val
239 real(dp),
intent(in) :: enth_val
241 integer(i4b) :: n_enth_1, n_enth_2
243 n_enth_1 = floor(enth_val)
244 n_enth_2 = n_enth_1 + 1
250 c_int_inv_val = c_int_inv_table(n_enth_1) &
251 + (c_int_inv_table(n_enth_2)-c_int_inv_table(n_enth_1)) &
252 * (enth_val-
real(n_enth_1,dp))
254 end function c_int_inv_val
265 real(dp),
intent(in) :: temp_val, omega_val
280 real(dp),
intent(in) :: enth_val
281 real(dp),
intent(in) :: temp_m_val
285 enth_i = c_int_val(temp_m_val)
287 if (enth_val < enth_i)
then
304 real(dp),
intent(in) :: enth_val
305 real(dp),
intent(in) :: temp_m_val
309 enth_i = c_int_val(temp_m_val)
Declarations of kind types for SICOPOLIS.
real(dp) function, public temp_fct_enth(enth_val, temp_m_val)
Temperature as a function of enthalpy.
real(dp) function, public omega_fct_enth(enth_val, temp_m_val)
Water content as a function of enthalpy.
subroutine, public calc_c_int_table(c_table, n_tmp_min, n_tmp_max, L_val)
Computation of the temperature integral of the specific heat of ice as a table (c_int_table). Further, definition of the latent heat of ice.
subroutine, public calc_c_int_inv_table()
Computation of the inverse of the temperature integral of the specific heat of ice as a table (c_int_...
Conversion from temperature (temp) and water content (omega) to enthalpy (enth) and vice versa...
real(dp) function, public enth_fct_temp_omega(temp_val, omega_val)
Enthalpy as a function of temperature and water content.