source: LMDZ5/trunk/libf/dyn3dmem/inithist_loc.F @ 2603

Last change on this file since 2603 was 2603, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: turn logic.h into module logic_mod.F90
EM

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 7.6 KB
Line 
1!
2! $Id: initdynav_p.F 1279 2009-12-10 09:02:56Z fairhead $
3!
4      subroutine inithist_loc(day0,anne0,tstep,t_ops,t_wrt)
5
6#ifdef CPP_IOIPSL
7! This routine needs IOIPSL
8       USE IOIPSL
9#endif
10       USE parallel_lmdz
11       use Write_field
12       use misc_mod
13       USE infotrac
14       use com_io_dyn_mod, only : histid,histvid,histuid,               &
15     &                        dynhist_file,dynhistv_file,dynhistu_file
16       USE comconst_mod, ONLY: pi
17       USE comvert_mod, ONLY: presnivs
18       USE temps_mod, ONLY: itau_dyn
19       
20       implicit none
21
22C
23C   Routine d'initialisation des ecritures des fichiers histoires LMDZ
24C   au format IOIPSL
25C
26C   Appels succesifs des routines: histbeg
27C                                  histhori
28C                                  histver
29C                                  histdef
30C                                  histend
31C
32C   Entree:
33C
34C      day0,anne0: date de reference
35C      tstep: duree du pas de temps en seconde
36C      t_ops: frequence de l'operation pour IOIPSL
37C      t_wrt: frequence d'ecriture sur le fichier
38C      nq: nombre de traceurs
39C
40C
41C   L. Fairhead, LMD, 03/99
42C
43C =====================================================================
44C
45C   Declarations
46      include "dimensions.h"
47      include "paramet.h"
48      include "comgeom.h"
49      include "ener.h"
50      include "description.h"
51      include "iniprint.h"
52
53C   Arguments
54C
55      integer day0, anne0
56      real tstep, t_ops, t_wrt
57
58#ifdef CPP_IOIPSL
59! This routine needs IOIPSL
60C   Variables locales
61C
62      integer tau0
63      real zjulian
64      integer iq
65      real rlong(iip1,jjp1), rlat(iip1,jjp1)
66      integer uhoriid, vhoriid, thoriid
67      integer zvertiid,zvertiidv,zvertiidu
68      integer ii,jj
69      integer zan, dayref
70      integer :: jjb,jje,jjn
71
72! definition du domaine d'ecriture pour le rebuild
73
74      INTEGER,DIMENSION(2) :: ddid
75      INTEGER,DIMENSION(2) :: dsg
76      INTEGER,DIMENSION(2) :: dsl
77      INTEGER,DIMENSION(2) :: dpf
78      INTEGER,DIMENSION(2) :: dpl
79      INTEGER,DIMENSION(2) :: dhs
80      INTEGER,DIMENSION(2) :: dhe
81     
82      INTEGER :: dynhist_domain_id
83      INTEGER :: dynhistv_domain_id
84      INTEGER :: dynhistu_domain_id
85     
86      if (adjust) return
87
88C
89C  Initialisations
90C
91      pi = 4. * atan (1.)
92C
93C  Appel a histbeg: creation du fichier netcdf et initialisations diverses
94C         
95
96      zan = anne0
97      dayref = day0
98      CALL ymds2ju(zan, 1, dayref, 0.0, zjulian)
99      tau0 = itau_dyn
100     
101      do jj = 1, jjp1
102        do ii = 1, iip1
103          rlong(ii,jj) = rlonv(ii) * 180. / pi
104          rlat(ii,jj)  = rlatu(jj) * 180. / pi
105        enddo
106      enddo
107
108
109! Creation de 3 fichiers pour les differentes grilles horizontales
110! Restriction de IOIPSL: seulement 2 coordonnees dans le meme fichier
111! Grille Scalaire       
112
113      jjb=jj_begin
114      jje=jj_end
115      jjn=jj_nb
116
117      ddid=(/ 1,2 /)
118      dsg=(/ iip1,jjp1 /)
119      dsl=(/ iip1,jjn /)
120      dpf=(/ 1,jjb /)
121      dpl=(/ iip1,jje /)
122      dhs=(/ 0,0 /)
123      dhe=(/ 0,0 /)
124
125
126      call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe,
127     .                 'box',dynhist_domain_id)
128             
129      call histbeg(dynhist_file,iip1, rlong(:,1), jjn,
130     .             rlat(1,jjb:jje), 1, iip1, 1, jjn,tau0,
131     .             zjulian, tstep, thoriid,
132     .             histid,dynhist_domain_id)
133
134
135C  Creation du fichier histoire pour les grilles en V et U (oblige pour l'instant,
136C  IOIPSL ne permet pas de grilles avec des nombres de point differents dans
137C  un meme fichier)
138! Grille V
139
140      jjb=jj_begin
141      jje=jj_end
142      jjn=jj_nb
143      IF (pole_sud) jjn=jjn-1
144      IF (pole_sud) jje=jje-1
145     
146      do jj = jjb, jje
147        do ii = 1, iip1
148          rlong(ii,jj) = rlonv(ii) * 180. / pi
149          rlat(ii,jj) = rlatv(jj) * 180. / pi
150        enddo
151      enddo
152
153      ddid=(/ 1,2 /)
154      dsg=(/ iip1,jjm /)
155      dsl=(/ iip1,jjn /)
156      dpf=(/ 1,jjb /)
157      dpl=(/ iip1,jje /)
158      dhs=(/ 0,0 /)
159      dhe=(/ 0,0 /)
160
161
162      call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe,
163     .                 'box',dynhistv_domain_id)
164
165      call histbeg(dynhistv_file,iip1, rlong(:,1), jjn,
166     .             rlat(1,jjb:jje), 1, iip1, 1, jjn,tau0,
167     .             zjulian, tstep, vhoriid,
168     .             histvid,dynhistv_domain_id)
169     
170! Grille U
171
172      do jj = 1, jjp1
173        do ii = 1, iip1
174          rlong(ii,jj) = rlonu(ii) * 180. / pi
175          rlat(ii,jj) = rlatu(jj) * 180. / pi
176        enddo
177      enddo
178
179      jjb=jj_begin
180      jje=jj_end
181      jjn=jj_nb
182
183      ddid=(/ 1,2 /)
184      dsg=(/ iip1,jjp1 /)
185      dsl=(/ iip1,jjn /)
186      dpf=(/ 1,jjb /)
187      dpl=(/ iip1,jje /)
188      dhs=(/ 0,0 /)
189      dhe=(/ 0,0 /)
190
191
192      call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe,
193     .                 'box',dynhistu_domain_id)
194             
195      call histbeg(dynhistu_file,iip1, rlong(:,1), jjn,
196     .             rlat(1,jjb:jje), 1, iip1, 1, jjn,tau0,
197     .             zjulian, tstep, uhoriid,
198     .             histuid,dynhistu_domain_id)
199     
200     
201! -------------------------------------------------------------
202C  Appel a histvert pour la grille verticale
203! -------------------------------------------------------------
204      call histvert(histid, 'presnivs', 'Niveaux pression','mb',
205     .              llm, presnivs/100., zvertiid,'down')
206      call histvert(histvid, 'presnivs', 'Niveaux pression','mb',
207     .              llm, presnivs/100., zvertiidv,'down')
208      call histvert(histuid, 'presnivs', 'Niveaux pression','mb',
209     .              llm, presnivs/100., zvertiidu,'down')
210
211C
212! -------------------------------------------------------------
213C  Appels a histdef pour la definition des variables a sauvegarder
214! -------------------------------------------------------------
215C
216C  Vents U
217C
218      jjn=jj_nb
219      call histdef(histuid, 'u', 'vent u',
220     .             'm/s', iip1, jjn, uhoriid, llm, 1, llm, zvertiidu,
221     .             32, 'inst(X)', t_ops, t_wrt)
222
223C
224C  Vents V
225C
226      if (pole_sud) jjn=jj_nb-1
227      call histdef(histvid, 'v', 'vent v',
228     .             'm/s', iip1, jjn, vhoriid, llm, 1, llm, zvertiidv,
229     .             32, 'inst(X)', t_ops, t_wrt)
230
231C
232C  Temperature
233C
234      jjn=jj_nb
235      call histdef(histid, 'temp', 'temperature', 'K',
236     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
237     .             32, 'inst(X)', t_ops, t_wrt)
238C
239C  Temperature potentielle
240C
241      call histdef(histid, 'theta', 'temperature potentielle', 'K',
242     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
243     .             32, 'inst(X)', t_ops, t_wrt)
244
245
246C
247C  Geopotentiel
248C
249      call histdef(histid, 'phi', 'geopotentiel', '-',
250     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
251     .             32, 'inst(X)', t_ops, t_wrt)
252C
253C  Traceurs
254C
255!        DO iq=1,nqtot
256!          call histdef(histid, ttext(iq), ttext(iq), '-',
257!     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
258!     .             32, 'inst(X)', t_ops, t_wrt)
259!        enddo
260C
261C  Masse
262C
263      call histdef(histid, 'masse', 'masse', 'kg',
264     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
265     .             32, 'inst(X)', t_ops, t_wrt)
266C
267C  Pression au sol
268C
269      call histdef(histid, 'ps', 'pression naturelle au sol', 'Pa',
270     .             iip1, jjn, thoriid, 1, 1, 1, -99,
271     .             32, 'inst(X)', t_ops, t_wrt)
272C
273C  Geopotentiel au sol
274C
275!      call histdef(histid, 'phis', 'geopotentiel au sol', '-',
276!     .             iip1, jjn, thoriid, 1, 1, 1, -99,
277!     .             32, 'inst(X)', t_ops, t_wrt)
278C
279C  Fin
280C
281      call histend(histid)
282      call histend(histuid)
283      call histend(histvid)
284#else
285      write(lunout,*)'inithist_loc: Needs IOIPSL to function'
286#endif
287! #endif of #ifdef CPP_IOIPSL
288      end
Note: See TracBrowser for help on using the repository browser.