source: trunk/SOURCES/steps_time_loop.f90 @ 136

Last change on this file since 136 was 136, checked in by dumas, 7 years ago

Flux output and short netcdf output for initMIP

File size: 14.2 KB
Line 
1!> \file steps_time_loop.f90
2!! TOOOOOOOOO DOOOOOOOOOOOOO
3!! Step_grisli contient
4!<
5
6!--------------------------------------------------------------------------
7! step_time_loop est a l'interieur de la boucle temps.
8! il commence par icethick, qui détermine dt, isynchro
9
10! ensuite contient les appels aux diverses sorties
11! puis un appel a step_grisli
12
13
14subroutine step_time_loop       
15
16  use module3d_phy
17  use module_choix ! module de choix du type de run
18                   !  module_choix donne acces a tous les modules
19                   !  de declaration des packages
20  use sorties_ncdf_grisli
21  use flottab_mod
22  use icetempmod
23  use diagno_mod
24  use bilan_eau_mod
25  use bilan_flux_mod
26  !  use track_debug
27
28  implicit none
29  integer :: nt_init = 0      ! number of loops for initialisation of ice thickness
30  integer :: iter_visco       ! number of iterations for ssa viscosity
31
32  if (itracebug.eq.1)  call tracebug('Entree dans step_time_loop ')
33  if (itracebug.eq.1) write(num_tracebug,*) 'nt = ',nt,'  iter_beta = ',iter_beta
34
35
36  ! ice thickness evolution
37  !=============================
38
39
40  spinup_icethick: if ((ispinup.eq.0.or.ispinup.eq.2.or.nt.lt.nt_init) &
41       .and.(iter_beta.eq.0)) then 
42
43     !-------------------------------------------------------------------
44     ! spinup_icethick : Le calcul changement d'epaisseur (icethick)
45     !----------------
46     !   - est fait dans tous les cas pour les premieres boucles temporelles
47     !   - pour ispinup = 0 (run standard) sauf si iter_beta = 0
48     !   - pour ispinup = 2 (force avec vitesses de bilan)
49     !
50     ! else
51     !   juste un increment pour le temps
52     !    -  pour ispinup = 1 et  ispinup = 3  temperature calculation
53     
54     !-------------------------------------------------------------------
55
56     if (itracebug.eq.1)  call tracebug(' Dans spinup_icethick : appelle icethick')
57
58     call icethick3
59
60     call flottab
61
62     call calving
63
64     call ablation_bord
65
66     call bilan_eau
67     call bilan_flux_output
68     if (isynchro.eq.1) then
69         call shortoutput
70         diff_H = 0.
71         Bm_dtt(:,:) = 0.
72         bmelt_dtt(:,:) = 0.
73         calv_dtt(:,:)=0.
74         ablbord_dtt(:,:)=0.
75         diff_H_2D(:,:)=0.
76         grline_dtt(:,:)=0.
77      endif
78     
79     call flottab
80
81     if (itracebug.eq.1)  call tracebug('apres calving')
82
83     ! new calculation of ice surface elevation
84     where(.not.flot(:,:))
85        S(:,:)=Bsoc(:,:)+H(:,:)
86        S(:,:)=max(S(:,:),sealevel)
87        B(:,:)=Bsoc(:,:)
88     end where
89
90     ! calcul de Hmx et Hmy -> shift=-1, dim=1 -> H(i-1,j)
91
92     hmx(:,:)=0.5*(H(:,:)+eoshift(H(:,:),shift=-1,boundary=0.,dim=1))
93     hmy(:,:)=0.5*(H(:,:)+eoshift(H(:,:),shift=-1,boundary=0.,dim=2))
94     hmx(1,:)=0.
95     hmy(:,1)=0.
96
97     ! mise a 0 des vitesses quand epaisseur nulle
98     where (hmx(:,:).le.1.)
99        uxbar(:,:)=0.
100     endwhere
101     where (hmy(:,:).le.1.)
102        uybar(:,:)=0.
103     endwhere
104
105  else   ! time increment when no icethick : ispinup= 1 or 3    ! loop spinup_icethick
106
107     hdot(:,:)=0.
108     time=nt*dtmax
109
110     if (itracebug.eq.1) write(num_tracebug,*) ' Dans spinup_icethick:  no icethick ',ispinup, &
111          '    time=',time
112
113
114  end if spinup_icethick
115  ! end of ice thickness evolution
116  !====================================================================
117
118
119
120  ! outputs
121  !====================================================================
122
123  ! horizontal plan snapshots
124  !------------------------------------------------------------------
125  !  Premiere partie des sorties horizontales
126
127  !     if (mod(abs(dble(TIME)),dble(DTSORTIE)).lt.dble(dtmin)) then
128  !
129
130
131  if ((mod(abs(TIME),dtt).lt.dtmin).or.(isynchro.eq.1)) then
132     isynchro=1
133
134     !  sorties hz
135     call testsort_time(real(time))
136     if (iglob_hz.eq.1) then
137        call sortie_hz_multi   ! pour les variables déclarées dans 3D
138        !              call hz_output(real(time))
139     endif
140
141  else
142     iglob_hz=0
143
144  endif
145
146
147  !   vertical plan snapshots (profiles)
148  !------------------------------------------------------------------
149
150  !if ((NT.eq.1) &    !   .or.(NT.eq.2)
151  !     .or.(mod(abs(dble(TIME)),dble(DTPROFILE)).lt.dble(dtmin)) &
152  !     .or.(abs(TIME-TEND).lt.dtmin)) then
153
154     !        call sortieprofile()
155
156  !endif
157
158  !  sorties netcdf Hassine (aout 2010)  (2D and 3D)
159  !------------------------------------------------------------------
160
161  call testsort_time_ncdf(time)
162  if (iglob_ncdf .EQ. 1) call sortie_ncdf_cat
163
164
165  !   sortie compteur tous les dtcpt ans
166  !------------------------------------------------------------------
167  !iout == 1 sortie cptr
168  !iout == 2 sortie nc
169  if (itracebug.eq.1)  call tracebug('dans steps_time_loop avant call out_recovery ')
170
171  call out_recovery(iout)
172 
173  ! end of outputs
174
175  !====================================================================
176  !
177  call step_thermomeca()
178  !
179  ! contient tout le reste de la dynamique et du forçage
180  !====================================================================
181
182end subroutine step_time_loop
183
184
185
186
187
188
189!---------------------------------------------------------------------
190! The subroutine  step_thermomeca() calls the following processes
191!
192! - climatic forcing and its impact on surface mass balance
193! - dynamic velocities (SIA)
194! - ice temperature
195
196subroutine step_thermomeca()
197
198
199  use module3d_phy
200  use module_choix ! module de choix du type de run
201  !  module_choix donne acces a tous les modules
202  !  de declaration des packages
203  use icetempmod
204  use sorties_ncdf_grisli
205  use flottab_mod
206  use diagno_mod
207  use resolmeca_SIA_L1
208!  use track_debug
209
210
211  implicit none
212
213  integer :: m
214  logical :: shelf_vitbil = .true.   ! si vrai on prend les vitesses de bilan pour le shelf
215  integer :: nt_init_tm = 0          ! number of loops for initialisation of thermo mechanical
216  integer :: iter_visco              ! number of iterations for ssa viscosity
217
218  if (ispinup.le.1) shelf_vitbil = .false.         ! general case, ice shelves velocities are computed by diagnoshelf
219
220  timemax=time
221  if (itracebug.eq.1) write(num_tracebug,*) 'entree dans step_thermomeca', &
222       '   nt=',nt,'iter_beta=',iter_beta
223
224  !--------------------------------------------------------------------
225  !     lecture dans un petit fichier "runname.limit" au cas ou les
226  !     parametres du run seraient changes 
227  !                                                   
228  !--------------------------------------------------------------------
229
230!  call limit_file(nt,real(time),dt,tend,dtsortie,dtcpt,testdiag,dtt,runname)
231
232  !if (time.lt.tgrounded) then
233  !   marine=.false.
234  !else
235  marine=.true.
236  !endif
237
238  ! update the regions (floating, ice ...)
239  !-------------------------------------------
240  call masque()
241
242  if (iter_beta.gt.0)   call init_dragging
243
244
245  !-----------------------------------------------------------------------!
246  !   debut d'un bloc appels tous les dtt (pas de temps long- asynchrone) !
247  !-------------   -------------------------------------------------------!
248
249
250
251  isync_1: if (ISYNCHRO.eq.1) then          ! debut bloc appels tous les dtt   
252
253     ! climatic forcing
254     !=====================
255     call forclim                             
256     call ablation
257
258
259
260     ! SIA dynamic velocities  (deformation + loi de glissement )
261     !========================
262
263     ! remark : velocity is 3D
264     !          to update the velocity for ice temperature calculation
265     !            - surface mass balance for velocity (because ablation was called)
266     !            - impact of surface slope
267
268
269     spinup_1_veloc: if ((ispinup.ne.2).or.(nt.lt.nt_init_tm)) then        ! cas general
270
271        !---------------------------------------------------------------------------------
272        ! spinup_1 : calcul des vitesses dynamiques :
273        !------------
274        !            - est fait dans tous les cas pour les premieres boucles temporelles
275        !            - est fait pour ispinup=3 pour calibration forme de vitesse
276        !            - n'est pas fait pour ispinup=2 (test balance vel sur icethick)
277        !
278        !---------------------------------------------------------------------------------
279
280        if (itracebug.eq.1)  call tracebug(' Dans spinup_1_veloc : calculer SIA_velocities')
281
282        call Neffect()                                             
283        call SIA_velocities()
284
285     else    ! ispinup = 2
286
287        call force_balance_vel   ! fait l'ensemble du champ (flgz ou pas)
288
289     endif spinup_1_veloc
290
291
292     ! ice temperature
293     !===================================================================
294
295     ! update values in the structures Geom_g, Temperature_g, ...
296
297     calc_temp:     if ((nt.gt.2).and.(geoplace(1:5).ne.'mism3')) then
298        if (itracebug.eq.1)  call tracebug('avant appel icetemp')
299        call icetemp
300        ! subroutines pour le calcul de la fusion basale
301        call bmeltshelf
302        call bmelt_grounded
303
304     endif calc_temp
305
306
307     ! flowlaw
308     !===================================================================
309
310     spinup_2_flowlaw: if ((ispinup.ne.2).or.(nt.lt.nt_init_tm)) then    ! cas general
311
312        !---------------------------------------------------------------------------------
313        ! spinup_2_flowlaw
314        !----------------
315        ! si ispinup =   2 , on ne fait pas le calcul de flowlaw, ni de diffusiv
316        !                    puisque les vitesses de bilan sont imposees
317        !                                             (initialisee nt < nt_init_tm)
318        !                   
319        ! Flowlaw et diffusiv : servent soit directement (ispinup = 0,1) soit pour le
320        !                       rescaling (ispinup = 3)
321        !---------------------------------------------------------------------------------
322
323        if (itracebug.eq.1)  call tracebug(' Dans spinup_2_flowlaw')
324
325           call flow_general
326           do iglen=n1poly,n2poly
327              call flowlaw(iglen)
328           end do
329
330
331     end if spinup_2_flowlaw
332
333     if (ispinup.eq.3) then
334        call calc_coef_vitbil                    ! recalibre sa_mx et s2a_mx et ddbx pour toute la zone posee
335     end if                                      ! Dans le shelf flgz = Ubar = Vbil et udef=0
336
337
338     ! isostasy
339     !=================
340
341
342     spinup_3_bed: if (ispinup.eq.0.or.nt.lt.nt_init_tm) then
343        !---------------------------------------------------------------------------------
344        ! spinup_3_bed
345        !----------------
346        ! Ne passe dans ce bloc que quand on veut l'isostasie, donc si variations epaisseur
347        ! run standard  (ispinup=0) et pour les initialisations                 
348        !---------------------------------------------------------------------------------
349
350        if (itracebug.eq.1)  call tracebug(' Dans spinup_3_bed')
351
352!        if ((nbed.eq.1).and.nt.ne.1.and.isynchro.eq.1) then
353         if ((nbed.eq.1).and.nt.ne.1.and.isynchro.eq.1.and.(mod(abs(TIME),50.).lt.dtmin)) then
354           call bedrock                                              !  bedrock adjustment
355        endif
356
357        call lake_to_slv                                             ! pour traiter dynamiquement les shelves sur lac
358
359     end if spinup_3_bed
360
361     call tracer      ! aurel neem (attention, position a verifier)   
362
363  endif isync_1
364
365
366  ! fin du bloc tous les dtt isync_1
367  !------------------------------------
368
369
370  spinup_4_vitdyn: if  ((ispinup.le.1).or.(nt.lt.nt_init_tm)) then 
371
372     !---------------------------------------------------------------------------------
373     ! spinup_4_vitdyn
374     !----------------
375     ! Passe dans ce bloc que quand on veut calculer les vitesses dynamiques :
376     ! - initialisations (nt.lt.nt_init_tm)
377     ! - run standard  (ispinup=0) (y compris iter_beta.ne.0)
378     ! - spinup temperature avec vitesses dynamiques  (ispinup = 1)               
379     !---------------------------------------------------------------------------------
380
381
382
383     call Neffect()
384
385     call diffusiv()
386
387
388     iterbeta:     if (iter_beta.ne.0) then          ! only for iterations on beta
389
390        if (.not.shelf_vitbil) then    !  bloc si les vitesses shelves viennent de diagnoshelf
391
392           !  Vcol declare dans le module spinup_mod
393           !  ou dans le dragging si no_spinup
394
395           where (flotmx(:,:))
396              uxbar(:,:)=uxflgz(:,:)
397           elsewhere
398              uxbar(:,:)=Vcol_x(:,:)
399           end where
400
401           where (flotmy(:,:))
402              uybar(:,:)=uyflgz(:,:)
403           elsewhere
404              uybar(:,:)=Vcol_y(:,:)
405           end where
406        else
407           uxbar(:,:)=Vcol_x(:,:)
408           uybar(:,:)=Vcol_y(:,:)
409        end if
410     end if iterbeta
411
412
413     ! strain rate calculations
414     !===========================
415
416     call strain_rate()
417
418
419     if (iter_beta.ne.0) then               ! on n'a utilise les vitesses de bilan que pour strain_rate "Dirichlet ?"
420        uxbar(:,:)=uxflgz(:,:)+uxdef(:,:)
421        uybar(:,:)=uyflgz(:,:)+uydef(:,:)
422     end if
423
424
425
426     ! ice shelves and ice streams velocities : SSA
427     !==============================================
428
429     !-----------------------------------------------------------------------
430     !              debut d'un deuxieme bloc appels tous les dtt                         
431     !-------------   -------------------------------------------------------
432
433     isync_2:    if ((shelfy).and.(marine).and.(isynchro.eq.1)) then               
434
435        !les 3 lignes ci-dessous pour avoir les champs avant diagno (en cas de pb colineaire)
436        !call init_sortie_ncdf
437        !call sortie_ncdf_cat
438
439        if (icompteur.eq.1) then    ! reprise de tout le vecteur d'etat   
440           iter_visco = 1
441
442        else if ((icompteur.ne.1).and.(nt.le.1)) then  ! initialisation avec reprise partielle
443                                                       ! ou nulle du vecteur d' etat
444          iter_visco =  10
445        else
446           iter_visco = 2
447        end if
448 
449!cdc        iter_visco= 10                                 ! warning, test sur l'impact iteration dragging et visco
450                                                       ! Cat 18 janv 2013
451
452           do m=1,iter_visco             
453              call diagnoshelf
454              call  mix_SIA_L1 
455              call strain_rate()
456              if (iter_beta.eq.0) then
457                call dragging         
458              endif
459              if (test_iter_diag.lt.1.e-2) exit
460           end do
461        endif isync_2
462
463     call  mix_SIA_L1 
464
465  end if spinup_4_vitdyn
466
467end subroutine step_thermomeca
Note: See TracBrowser for help on using the repository browser.