7 !! Main loop of SICOPOLIS.
11 !! Copyright 2009-2013 Ralf Greve
15 !! This file is part of SICOPOLIS.
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.
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.
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/>.
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 !> Main loop of SICOPOLIS.
34 !<------------------------------------------------------------------------------
36 sum_accum, mean_accum, mean_accum_inv, &
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, &
42 ndat2d, ndat3d, n_output, &
49 integer(i4b) :: i, j, kc, kt, kr, n
50 integer(i4b) :: itercount, itercount_max
51 integer(i4b) :: iter_temp, iter_wss, iter_ser, iter_out, iter_output(100)
52 integer(i4b) :: ndat2d, ndat3d
53 integer(i4b) :: n_output
54 integer(i4b) :: ii((imax+1)*(jmax+1)), jj((imax+1)*(jmax+1)), nn(0:jmax,0:imax)
55 real(dp) :: delta_ts, glac_index
56 real(dp) :: sum_accum, mean_accum, mean_accum_inv
57 real(dp) :: dtime, dtime_temp, dtime_wss, dtime_out, dtime_ser
58 real(dp) :: time, time_init, time_end, time_output(100)
59 real(dp) :: dxi, deta, dzeta_c, dzeta_t, dzeta_r
60 real(dp) :: dtime_temp_inv
61 real(dp) :: z_sl, dzsl_dtau, z_mar
62 character (len=100) :: runname
63 logical :: flag_3d_output
69 itercount_max = nint((time_end-time_init)/dtime)
71 iter_temp = nint(dtime_temp/dtime)
73 iter_wss = nint(dtime_wss/dtime)
75 iter_ser = nint(dtime_ser/dtime)
76 #if ( OUTPUT==1 || OUTPUT==3 )
77 iter_out = nint(dtime_out/dtime)
79 #if ( OUTPUT==2 || OUTPUT==3 )
81 iter_output(n) = nint((time_output(n)-time_init)/dtime)
85 main_loop :
do itercount=1, itercount_max
87 write(6,
'(i7)') itercount
91 time = time_init +
real(itercount,dp)*dtime
99 call
boundary(time, dtime, dxi, deta, delta_ts, glac_index, &
100 z_sl, dzsl_dtau, z_mar)
104 if ( mod(itercount, iter_temp) == 0 )
then
106 write(6,*)
' -------- Computation of T'
112 dtime_temp, mean_accum_inv)
116 dtime_temp, mean_accum_inv)
122 dtime_temp_inv = 1.0_dp/dtime_temp
124 dh_t_dtau = (h_t_neu - h_t)*dtime_temp_inv
164 z_sl, dzsl_dtau, z_mar, &
165 dtime, dxi, deta, dzeta_t, &
167 ii, jj, nn, itercount, iter_wss)
188 call
calc_qbm(time, z_sl, dzeta_c, dzeta_r)
198 if ( mod(itercount, iter_out) == 0 )
then
201 flag_3d_output = .false.
203 flag_3d_output = .true.
207 call
output1(runname, time, delta_ts, glac_index, z_sl, &
208 flag_3d_output, ndat2d, ndat3d)
210 call
output_nc(runname, time, delta_ts, glac_index, z_sl, &
211 flag_3d_output, ndat2d, ndat3d)
220 if (itercount == iter_output(n))
then
223 flag_3d_output = .false.
225 flag_3d_output = .true.
229 call
output1(runname, time, delta_ts, glac_index, z_sl, &
230 flag_3d_output, ndat2d, ndat3d)
232 call
output_nc(runname, time, delta_ts, glac_index, z_sl, &
233 flag_3d_output, ndat2d, ndat3d)
242 if ( mod(itercount, iter_out) == 0 )
then
244 flag_3d_output = .false.
247 call
output1(runname, time, delta_ts, glac_index, z_sl, &
248 flag_3d_output, ndat2d, ndat3d)
250 call
output_nc(runname, time, delta_ts, glac_index, z_sl, &
251 flag_3d_output, ndat2d, ndat3d)
258 if (itercount == iter_output(n))
then
260 flag_3d_output = .true.
263 call
output1(runname, time, delta_ts, glac_index, z_sl, &
264 flag_3d_output, ndat2d, ndat3d)
266 call
output_nc(runname, time, delta_ts, glac_index, z_sl, &
267 flag_3d_output, ndat2d, ndat3d)
276 if ( mod(itercount, iter_ser) == 0 )
then
277 call
output2(time, dxi, deta, delta_ts, glac_index, z_sl)
279 call
output3(time, delta_ts, glac_index, z_sl)
282 call
output4(time, dxi, deta, delta_ts, glac_index, z_sl)
284 #if ( defined(ASF) && OUTSER==4 )
285 call
output5(time, dxi, deta, delta_ts, glac_index, z_sl)