source: LMDZ5/trunk/libf/phylmd/write_histday_seri.h @ 1577

Last change on this file since 1577 was 1577, checked in by Laurent Fairhead, 13 years ago

Modifications au code qui permettent de commencer une simulation à n'importe
quelle heure de la journée. On fait toujours un nombre entier de jours de
simulation.
On spécifie cette heure de départ dans la variable starttime du run.def (la
valeur est en jour et elle est à zéro par défaut).
La valeur est sauvegardée dans le fichier restart.nc. Les valeurs lues dans
le fichier start et le run.def sont comparées en début de simulation. La
simulation s'arrête si elles ne sont pas égales sauf si une remise à zéro de
la date a été demandée.
Par ailleurs, la fréquence de lecture des conditions aux limites a été modifiée
pour qu'à chaque changement de jour, celles-ci soient mises à jour (jusqu'à
maintenant elles étaient mises à jour à une fréquence donnée qui, en cas de
départ de simulation à une heure différente de minuit, ne correspondait pas
forcèment à un changement dans la date).
Validation effectuée en traçant le flux solaire descendant au sommet de
l'atmosphère à différentes heures de la journée, après un redémarrage, en
s'assurant que le maximum est bien là où il est sensé être.


Modifications to the code to enable it to be started at any time of the day.
The code still runs for an integer number of days.
The start time is specified using variable starttime in the run.def file (the
value is in days and is zero by default).
The start time is saved in the restart.nc file at the end of the simulation.
The values read in from the start.nc file and the run.def file are compared
at the start of the simulation. If they differ, the simulation is aborted
unless the raz_date variable has been set.
Furthermore, the frequency at which boundary conditions are read in has been
modified so that they are updated everyday at midnight (until now, they were
updated at a certain frequency that, in case of a simulation starting at a time
other than midnight, did not ensure that those conditions would be updated each
day at midnight)
The modifications were validated by plotting the downward solaf flux at TOA at
different times of the day (and after having restarted the simulation) and
ensuring that the maximum of flux was at the right place according to local
time.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1c
2c $Header$
3c
4      IF (is_sequential) THEN
5     
6      IF (type_run.EQ."AMIP") THEN
7c
8      ndex2d = 0
9      itau_w = itau_phy + itap + start_time * day_step / iphysiq
10c
11c Champs 2D:
12c
13      pi = ACOS(-1.)
14      pir = 4.0*ATAN(1.0) / 180.0
15c
16      DO i=1, klon
17       zx_tmp_fi2d(i)=(topsw(i)-toplw(i))
18      ENDDO
19c
20      ok_msk=.FALSE.
21      msk(1:klon)=pctsrf(1:klon,is_ter)
22      CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy, 
23     .     ok_msk, msk, moyglo)
24      zx_tmp_fi2d(1:klon)=moyglo
25c
26      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
27      CALL histwrite(nid_day_seri,"bilTOA",itau_w,
28     .               zx_tmp_2d,iim*jjmp1,ndex2d)
29c
30      ok_msk=.FALSE.
31      CALL moyglo_pondaire(klon, bils, airephy, 
32     .     ok_msk, msk, moyglo)
33      zx_tmp_fi2d(1:klon)=moyglo
34c
35      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
36      CALL histwrite(nid_day_seri,"bils",itau_w,
37     .               zx_tmp_2d,iim*jjmp1,ndex2d)
38c
39      DO k=1, klev
40      DO i=1, klon
41cIM 080904    zx_tmp_fi3d(i,k)=u(i,k)**2+v(i,k)**2
42       zx_tmp_fi3d(i,k)=(u(i,k)**2+v(i,k)**2)/2.
43      ENDDO
44      ENDDO
45c
46      CALL moyglo_pondaima(klon, klev, zx_tmp_fi3d, 
47     .     airephy, paprs, moyglo)
48      zx_tmp_fi2d(1:klon)=moyglo
49c
50      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
51      CALL histwrite(nid_day_seri,"ecin",itau_w,
52     .               zx_tmp_2d,iim*jjmp1,ndex2d) 
53c
54cIM 151004 BEG
55      IF(1.EQ.0) THEN
56c
57      DO k=1, klev
58      DO i=1, klon
59       zx_tmp_fi3d(i,k)=u_seri(i,k)*RA*cos(pir* rlat(i))
60      ENDDO
61      ENDDO
62c
63      CALL moyglo_pondaima(klon, klev, zx_tmp_fi3d, 
64     .     airephy, paprs, moyglo)
65      zx_tmp_fi2d(1:klon)=moyglo
66c
67      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
68      CALL histwrite(nid_day_seri,"momang",itau_w,zx_tmp_2d,
69     .               iim*jjmp1,ndex2d)
70c
71c friction torque
72c
73      DO i=1, klon
74       zx_tmp_fi2d(i)=zxfluxu(i,1)*RA* cos(pir* rlat(i))
75      ENDDO
76c
77      ok_msk=.FALSE.
78      CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy, 
79     .     ok_msk, msk, moyglo)
80      zx_tmp_fi2d(1:klon)=moyglo
81c
82      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
83      CALL histwrite(nid_day_seri,"frictor",itau_w,zx_tmp_2d,
84     .               iim*jjmp1,ndex2d)
85c
86c mountain torque
87c
88cIM 190504 BEG
89      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,airephy,airedyn)
90      CALL gr_fi_dyn(klev+1,klon,iim+1,jjm+1,paprs,padyn)
91      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,rlat,rlatdyn)
92      mountor=0.
93      airetot=0.
94      DO j = 1, jjmp1
95       DO i = 1, iim+1
96        ij=i+(iim+1)*(j-1)
97        zx_tmp(ij)=0.
98        DO k = 1, klev
99         zx_tmp(ij)=zx_tmp(ij)+dudyn(i,j,k)*airedyn(i,j)*
100     $              (padyn(i,j,k+1)-padyn(i,j,k))/RG
101         airetot=airetot+airedyn(i,j)
102        ENDDO
103cIM 190504 mountor=mountor+zx_tmp(ij)*airedyn(i,j)*RA*
104        mountor=mountor+zx_tmp(ij)*RA*
105     $           cos(pir* rlatdyn(i,j))
106       ENDDO
107      ENDDO
108cIM 151004 BEG
109      IF(itap.EQ.1) PRINT*,'airetot=',airetot,airetot/klev
110cIM 151004 END
111cIM 190504      mountor=mountor/(airetot*airetot)
112      mountor=mountor/airetot
113c
114cIM 190504 END
115      zx_tmp_2d(1:iim,1:jjmp1)=mountor
116      CALL histwrite(nid_day_seri,"mountor",itau_w,zx_tmp_2d,
117     .               iim*jjmp1,ndex2d)
118c
119      ENDIF !(1.EQ.0) THEN
120c
121c
122      CALL gr_fi_dyn(1,klon,iim+1,jjm+1,airephy,airedyn)
123      CALL gr_fi_ecrit(1,klon,iim,jjmp1,airephy,zx_tmp_2d)
124      airetot=0.
125c     DO j = 1, jjmp1
126c      DO i = 1, iim+1
127c       ij=i+(iim+1)*(j-1)
128c       DO k = 1, klev
129c        airetot=airetot+airedyn(i,j)
130c        airetot=airetot+airedyn(i,j)
131c       ENDDO !k
132c      ENDDO !i
133c     ENDDO !j
134c
135      DO i=1, klon
136       airetot=airetot+airephy(i)
137      ENDDO
138c     IF(itap.EQ.1) PRINT*,'airetotphy=',airetot
139c
140      airetot=0.
141      DO j=1, jjmp1
142       DO i=1, iim
143        airetot=airetot+zx_tmp_2d(i,j)
144       ENDDO
145      ENDDO
146c
147c     IF(itap.EQ.1) PRINT*,'airetotij=',airetot,
148c    $ '4piR2',4.*pi*RA*RA
149c
150      zx_tmp_fi2d(1:klon)=aam/airetot
151      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
152      CALL histwrite(nid_day_seri,"momang",itau_w,zx_tmp_2d,
153     .               iim*jjmp1,ndex2d)
154c
155      zx_tmp_fi2d(1:klon)=torsfc/airetot
156      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
157      CALL histwrite(nid_day_seri,"torsfc",itau_w,zx_tmp_2d,
158     .               iim*jjmp1,ndex2d)
159c
160cIM 151004 END
161c
162      CALL moyglo_pondmass(klon, klev, t_seri,
163     .     airephy, paprs, moyglo)
164      zx_tmp_fi2d(1:klon)=moyglo
165c
166      CALL gr_fi_ecrit(1,klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
167      CALL histwrite(nid_day_seri,"tamv",itau_w,
168     .               zx_tmp_2d,iim*jjmp1,ndex2d)
169c
170      ok_msk=.FALSE.
171      CALL moyglo_pondaire(klon, paprs(:,1), airephy, 
172     .     ok_msk, msk, moyglo)
173      zx_tmp_fi2d(1:klon)=moyglo
174c
175      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
176      CALL histwrite(nid_day_seri,"psol",itau_w,
177     .               zx_tmp_2d,iim*jjmp1,ndex2d)
178c
179      ok_msk=.FALSE.
180      CALL moyglo_pondaire(klon, evap, airephy, 
181     .     ok_msk, msk, moyglo)
182      zx_tmp_fi2d(1:klon)=moyglo
183c
184      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d,zx_tmp_2d)
185      CALL histwrite(nid_day_seri,"evap",itau_w,
186     .               zx_tmp_2d,iim*jjmp1,ndex2d)
187c
188c     DO i=1, klon
189c      zx_tmp_fi2d(i)=SnowFrac(i,is_ter)
190c     ENDDO
191c
192c     ok_msk=.TRUE.
193c     msk(1:klon)=pctsrf(1:klon,is_ter)
194c     CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy, 
195c    .                     ok_msk, msk, moyglo)
196c     zx_tmp_fi2d(1:klon)=moyglo
197c
198c     CALL gr_fi_ecrit(1, klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
199c     CALL histwrite(nid_day_seri,"SnowFrac",
200c    .               itau_w,zx_tmp_2d,iim*jjmp1,ndex2d) 
201c
202c     DO i=1, klon
203cIM 080904    zx_tmp_fi2d(i)=zsnow_mass(i)/330.*rowl
204c      zx_tmp_fi2d(i)=zsnow_mass(i)
205c     ENDDO
206c
207cIM 140904   ok_msk=.FALSE.
208c     ok_msk=.TRUE.
209c     msk(1:klon)=pctsrf(1:klon,is_ter)
210c     CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy, 
211c    .     ok_msk, msk, moyglo)
212c     zx_tmp_fi2d(1:klon)=moyglo
213c
214c     CALL gr_fi_ecrit(1, klon,iim,jjmp1,zx_tmp_fi2d,zx_tmp_2d)
215c     CALL histwrite(nid_day_seri,"snow_depth",itau_w,
216c    .               zx_tmp_2d,iim*jjmp1,ndex2d)
217c
218      DO i=1, klon
219       zx_tmp_fi2d(i)=ftsol(i,is_oce)
220      ENDDO
221c
222      ok_msk=.TRUE.
223      msk(1:klon)=pctsrf(1:klon,is_oce)
224      CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy, 
225     .     ok_msk, msk, moyglo)
226      zx_tmp_fi2d(1:klon)=moyglo
227c
228      CALL gr_fi_ecrit(1, klon,iim,jjmp1, zx_tmp_fi2d, zx_tmp_2d)
229      CALL histwrite(nid_day_seri,"tsol_"//clnsurf(is_oce),
230     $               itau_w,zx_tmp_2d,iim*jjmp1,ndex2d) 
231c
232c=================================================================
233c=================================================================
234c=================================================================
235c
236      if (ok_sync) then
237        call histsync(nid_day_seri)
238      endif
239c
240      ENDIF !fin test sur type_run.EQ."AMIP"
241     
242      ENDIF  ! mono_cpu
Note: See TracBrowser for help on using the repository browser.