SICOPOLIS V3.2
 All Classes Files Functions Variables Macros
sico_main_loop.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : s i c o _ m a i n _ l o o p
4 !
5 !> @file
6 !!
7 !! Main loop of SICOPOLIS.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2016 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Main loop of SICOPOLIS.
34 !<------------------------------------------------------------------------------
35 subroutine sico_main_loop(delta_ts, glac_index, &
36  mean_accum, &
37  dtime, dtime_temp, dtime_wss, dtime_out, dtime_ser, &
38  time, time_init, time_end, time_output, &
39  dxi, deta, dzeta_c, dzeta_t, dzeta_r, &
40  z_sl, dzsl_dtau, z_mar, &
41  ii, jj, nn, &
42  ndat2d, ndat3d, n_output, &
43  runname)
44 
45 use sico_types
47 use sico_vars
48 
49 implicit none
50 
51 integer(i4b), intent(in) :: ii((imax+1)*(jmax+1)), &
52  jj((imax+1)*(jmax+1)), &
53  nn(0:jmax,0:imax)
54 integer(i4b), intent(in) :: n_output
55 real(dp), intent(in) :: mean_accum
56 real(dp), intent(in) :: dtime, dtime_temp, dtime_wss, &
57  dtime_out, dtime_ser
58 real(dp), intent(in) :: time_init, time_end, time_output(100)
59 real(dp), intent(in) :: dxi, deta, dzeta_c, dzeta_t, dzeta_r
60 character(len=100), intent(in) :: runname
61 
62 integer(i4b), intent(inout) :: ndat2d, ndat3d
63 real(dp), intent(inout) :: delta_ts, glac_index
64 real(dp), intent(inout) :: time
65 real(dp), intent(inout) :: z_sl, dzsl_dtau, z_mar
66 
67 integer(i4b) :: i, j, kc, kt, kr, n
68 integer(i4b) :: itercount, itercount_max
69 integer(i4b) :: iter_temp, iter_wss, iter_ser, iter_out, iter_output(100)
70 real(dp) :: dtime_temp_inv
71 logical :: flag_3d_output
72 
73 !-------- Begin of main loop --------
74 
75 write(unit=6, fmt='(a)') ' '
76 
77 itercount_max = nint((time_end-time_init)/dtime)
78 
79 iter_temp = nint(dtime_temp/dtime)
80 #if (REBOUND==2)
81 iter_wss = nint(dtime_wss/dtime)
82 #endif
83 iter_ser = nint(dtime_ser/dtime)
84 #if (OUTPUT==1 || OUTPUT==3)
85 iter_out = nint(dtime_out/dtime)
86 #endif
87 #if (OUTPUT==2 || OUTPUT==3)
88 do n=1, n_output
89  iter_output(n) = nint((time_output(n)-time_init)/dtime)
90 end do
91 #endif
92 
93 main_loop : do itercount=1, itercount_max
94 
95 write(unit=6, fmt='(i7)') itercount
96 
97 !-------- Update of time --------
98 
99 time = time_init + real(itercount,dp)*dtime
100 
101 !-------- Save old mask --------
102 
103 maske_help = maske
104 
105 !-------- Boundary conditions --------
106 
107 call boundary(time, dtime, dxi, deta, delta_ts, glac_index, &
108  z_sl, dzsl_dtau, z_mar)
109 
110 !-------- Temperature, water content, age, flow enhancement factor --------
111 
112 if ( mod(itercount, iter_temp) == 0 ) then
113 
114  write(unit=6, fmt='(a)') ' -------- Computation of T'
115 
116 ! ------ Temperature, water content, age
117 
118 #if (CALCMOD==1)
119  call calc_temp_poly(dxi, deta, dzeta_c, dzeta_t, dzeta_r, dtime_temp)
120  ! polythermal scheme (POLY)
121 
122 #elif (CALCMOD==0)
123  call calc_temp_cold(dxi, deta, dzeta_c, dzeta_t, dzeta_r, dtime_temp)
124  ! cold-ice scheme (COLD)
125 
126 #elif (CALCMOD==2 || CALCMOD==3)
127  call calc_temp_enth(dxi, deta, dzeta_c, dzeta_t, dzeta_r, dtime_temp)
128  ! enthalpy scheme (ENTC or ENTM)
129 
130 #elif (CALCMOD==-1)
131  call calc_temp_const() ! isothermal scheme (ISOT)
132 
133 #else
134  stop ' sico_main_loop: Parameter CALCMOD must be either -1, 0, 1, 2 or 3!'
135 #endif
136 
137 ! ------ Time derivative of H_t (further time derivatives are
138 ! computed in subroutine calc_top_xxx)
139 
140  dtime_temp_inv = 1.0_dp/dtime_temp
141 
142  dh_t_dtau = (h_t_neu - h_t)*dtime_temp_inv
143 
144 ! ------ New values --> old values
145 
146  n_cts = n_cts_neu
147  kc_cts = kc_cts_neu
148  zm = zm_neu
149  h_c = h_c_neu
150  h_t = h_t_neu
151  temp_c = temp_c_neu
152  age_c = age_c_neu
153  omega_t = omega_t_neu
154  age_t = age_t_neu
155  temp_r = temp_r_neu
156 
157 #if (CALCMOD==2 || CALCMOD==3)
158  enth_c = enth_c_neu
159  enth_t = enth_t_neu
160  omega_c = omega_c_neu
161 #endif
162 
163 ! ------ Flow enhancement factor
164 
165  call calc_enhance(time)
166 
167 end if
168 ! End of computation of temperature, water content, age and
169 ! enhancement factor
170 
171 !-------- Velocity --------
172 
173 #if (DYNAMICS==1 || DYNAMICS==2)
174 
175 call calc_vxy_b_sia(time, z_sl)
176 call calc_vxy_sia(dzeta_c, dzeta_t)
177 
178 #if (MARGIN==3 || DYNAMICS==2)
179 call calc_vxy_ssa(z_sl, dxi, deta, dzeta_c, dzeta_t, ii, jj, nn)
180 #endif
181 
182 call calc_vz_sia(dxi, deta, dzeta_c, dzeta_t)
183 
184 #if (MARGIN==3)
185 call calc_vz_ssa(z_sl, dxi, deta, dzeta_c)
186 #endif
187 
188 #elif (DYNAMICS==0)
189 
190 call calc_vxy_static()
191 call calc_vz_static()
192 
193 #else
194  stop ' sico_main_loop: DYNAMICS must be either 0, 1 or 2!'
195 #endif
196 
197 call calc_dxyz(dxi, deta, dzeta_c, dzeta_t)
198 
199 !-------- Glacial isostatic adjustment and ice topography --------
200 
201 call calc_gia(time, z_sl, dtime, dxi, deta, itercount, iter_wss)
202 
203 #if (MARGIN==3) /* coupled SIA/SSA or SIA/SStA/SSA dynamics */
204 call calc_top_3(time, z_sl, z_mar, dtime, dxi, deta, mean_accum, ii, jj, nn)
205 #elif (DYNAMICS==2) /* hybrid SIA/SStA dynamics */
206 call calc_top_2(time, z_sl, z_mar, dtime, dxi, deta, mean_accum, ii, jj, nn)
207 #else /* SIA-only dynamics */
208 call calc_top_1(time, z_sl, z_mar, dtime, dxi, deta, mean_accum, ii, jj, nn)
209 #endif
210 
211 ! ------ New values --> old values
212 
213 zs = zs_neu
214 zm = zm_neu
215 zb = zb_neu
216 zl = zl_neu
217 h_c= h_c_neu
218 h_t= h_t_neu
219 
220 !-------- Melting temperature --------
221 
222 call calc_temp_melt()
223 
224 !-------- Basal temperature --------
225 
226 call calc_temp_bas()
227 
228 !-------- Basal melting rate --------
229 
230 call calc_qbm(time, z_sl, dzeta_c, dzeta_r)
231 
232 !-------- Effective thickness of subglacial water --------
233 
234 call calc_water_bas(z_sl)
235 
236 !-------- Data output --------
237 
238 #if (OUTPUT==1)
239 
240 if ( mod(itercount, iter_out) == 0 ) then
241 
242 #if (ERGDAT==0)
243  flag_3d_output = .false.
244 #elif (ERGDAT==1)
245  flag_3d_output = .true.
246 #endif
247 
248 #if (NETCDF==1)
249  call output1(runname, time, delta_ts, glac_index, z_sl, &
250  flag_3d_output, ndat2d, ndat3d)
251 #elif (NETCDF==2)
252  call output_nc(runname, time, delta_ts, glac_index, z_sl, &
253  flag_3d_output, ndat2d, ndat3d)
254 #endif
255 
256 end if
257 
258 #elif (OUTPUT==2)
259 
260 do n=1, n_output
261 
262  if (itercount == iter_output(n)) then
263 
264 #if (ERGDAT==0)
265  flag_3d_output = .false.
266 #elif (ERGDAT==1)
267  flag_3d_output = .true.
268 #endif
269 
270 #if (NETCDF==1)
271  call output1(runname, time, delta_ts, glac_index, z_sl, &
272  flag_3d_output, ndat2d, ndat3d)
273 #elif (NETCDF==2)
274  call output_nc(runname, time, delta_ts, glac_index, z_sl, &
275  flag_3d_output, ndat2d, ndat3d)
276 #endif
277 
278  end if
279 
280 end do
281 
282 #elif (OUTPUT==3)
283 
284 if ( mod(itercount, iter_out) == 0 ) then
285 
286  flag_3d_output = .false.
287 
288 #if (NETCDF==1)
289  call output1(runname, time, delta_ts, glac_index, z_sl, &
290  flag_3d_output, ndat2d, ndat3d)
291 #elif (NETCDF==2)
292  call output_nc(runname, time, delta_ts, glac_index, z_sl, &
293  flag_3d_output, ndat2d, ndat3d)
294 #endif
295 
296 end if
297 
298 do n=1, n_output
299 
300  if (itercount == iter_output(n)) then
301 
302  flag_3d_output = .true.
303 
304 #if (NETCDF==1)
305  call output1(runname, time, delta_ts, glac_index, z_sl, &
306  flag_3d_output, ndat2d, ndat3d)
307 #elif (NETCDF==2)
308  call output_nc(runname, time, delta_ts, glac_index, z_sl, &
309  flag_3d_output, ndat2d, ndat3d)
310 #endif
311 
312  end if
313 
314 end do
315 
316 #endif
317 
318 if ( mod(itercount, iter_ser) == 0 ) then
319  call output2(time, dxi, deta, delta_ts, glac_index, z_sl)
320 #if (OUTSER==2)
321  call output3(time, delta_ts, glac_index, z_sl)
322 #endif
323 #if (OUTSER==3)
324  call output4(time, dxi, deta, delta_ts, glac_index, z_sl)
325 #endif
326 #if (defined(ASF) && OUTSER==4)
327  call output5(time, dxi, deta, delta_ts, glac_index, z_sl)
328 #endif
329 
330 end if
331 
332 end do main_loop ! End of main loop
333 
334 end subroutine sico_main_loop
335 !
subroutine calc_vz_ssa(z_sl, dxi, deta, dzeta_c)
Computation of the vertical velocity vz in the shallow shelf approximation.
Definition: calc_vz_ssa.F90:35
subroutine calc_temp_enth(dxi, deta, dzeta_c, dzeta_t, dzeta_r, dtime_temp)
Computation of temperature, water content and age with the enthalpy method.
subroutine calc_vxy_static()
Computation of the horizontal velocity vx, vy, the horizontal volume flux qx, qy etc. for static ice.
subroutine calc_vxy_sia(dzeta_c, dzeta_t)
Computation of the shear stresses txz, tyz, the effective shear stress sigma, the depth-averaged flui...
subroutine output2(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data on file in ASCII format.
Definition: output2.F90:35
subroutine calc_top_3(time, z_sl, z_mar, dtime, dxi, deta, mean_accum, ii, jj, nn)
Computation of the ice topography (including gradients) for coupled SIA/SSA or SIA/SStA/SSA dynamics ...
Definition: calc_top_3.F90:37
subroutine calc_temp_bas()
Computation of the basal temperatures.
subroutine calc_water_bas(z_sl)
Computation of the thickness of the water column under the ice base.
Declarations of kind types for SICOPOLIS.
Definition: sico_types.F90:35
subroutine output3(time, delta_ts, glac_index, z_sl)
Writing of time-series data of the ice thickness field on file in ASCII format.
Definition: output3.F90:38
subroutine calc_temp_melt()
Computation of the melting temperatures.
subroutine output_nc(runname, time, delta_ts, glac_index, z_sl, flag_3d_output, ndat2d, ndat3d)
Writing of time-slice files in NetCDF format.
Definition: output_nc.F90:35
subroutine calc_vxy_ssa(z_sl, dxi, deta, dzeta_c, dzeta_t, ii, jj, nn)
Computation of the horizontal velocity vx, vy, the horizontal volume flux qx, qy and the flux across ...
subroutine calc_top_2(time, z_sl, z_mar, dtime, dxi, deta, mean_accum, ii, jj, nn)
Computation of the ice topography (including gradients) for hybrid SIA/SStA dynamics of ice sheets wi...
Definition: calc_top_2.F90:37
Declarations of global variables for SICOPOLIS (for the ANT domain).
Definition: sico_vars.F90:35
subroutine calc_qbm(time, z_sl, dzeta_c, dzeta_r)
Computation of the basal melting rate Q_bm. Summation of Q_bm and Q_tld.
Definition: calc_qbm.F90:37
subroutine calc_gia(time, z_sl, dtime, dxi, deta, itercount, iter_wss)
Computation of the glacial isostatic adjustment of the lithosphere surface.
Definition: calc_gia.F90:35
subroutine calc_vz_static()
Computation of the vertical velocity vz for static ice.
subroutine calc_dxyz(dxi, deta, dzeta_c, dzeta_t)
Computation of all components of the strain-rate tensor, the full effective strain rate and the shear...
Definition: calc_dxyz.F90:37
subroutine calc_enhance(time)
Computation of the flow enhancement factor.
subroutine calc_temp_poly(dxi, deta, dzeta_c, dzeta_t, dzeta_r, dtime_temp)
Computation of temperature, water content and age in polythermal mode.
subroutine output5(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data for all defined surface points on file in ASCII format. Modification of Tolly&#39;s output7 by Thorben Dunse.
Definition: output5.F90:37
subroutine calc_top_1(time, z_sl, z_mar, dtime, dxi, deta, mean_accum, ii, jj, nn)
Computation of the ice topography (including gradients) for SIA-only dynamics of ice sheets without i...
Definition: calc_top_1.F90:37
subroutine calc_vxy_b_sia(time, z_sl)
Computation of the basal horizontal velocity vx_b, vy_b in the shallow ice approximation.
subroutine sico_main_loop(delta_ts, glac_index, mean_accum, dtime, dtime_temp, dtime_wss, dtime_out, dtime_ser, time, time_init, time_end, time_output, dxi, deta, dzeta_c, dzeta_t, dzeta_r, z_sl, dzsl_dtau, z_mar, ii, jj, nn, ndat2d, ndat3d, n_output, runname)
Main loop of SICOPOLIS.
subroutine boundary(time, dtime, dxi, deta, delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
Computation of the surface temperature (must be less than 0 deg C!) and of the accumulation-ablation ...
Definition: boundary.F90:37
subroutine output4(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data of the deep ice cores on file in ASCII format.
Definition: output4.F90:35
Declarations of global variables for SICOPOLIS.
subroutine calc_vz_sia(dxi, deta, dzeta_c, dzeta_t)
Computation of the vertical velocity vz in the shallow ice approximation.
Definition: calc_vz_sia.F90:35
subroutine calc_temp_const()
Isothermal mode: Setting of the temperature and age to constant values.
subroutine output1(runname, time, delta_ts, glac_index, z_sl, flag_3d_output, ndat2d, ndat3d)
Writing of time-slice files in binary format.
Definition: output1.F90:35
subroutine calc_temp_cold(dxi, deta, dzeta_c, dzeta_t, dzeta_r, dtime_temp)
Computation of temperature and age in cold-ice mode.