source: branches/iLoveclim/SOURCES/branche-Cat-spinup-dec2011/steps_time_loop.f90 @ 254

Last change on this file since 254 was 244, checked in by aquiquet, 5 years ago

Grisli-iloveclim branch merged to trunk at revision 243

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