source: LMDZ4/trunk/libf/bibio/inithist.F @ 1279

Last change on this file since 1279 was 1279, checked in by Laurent Fairhead, 14 years ago

Merged LMDZ4-dev branch changes r1241:1278 into the trunk
Running trunk and LMDZ4-dev in LMDZOR configuration on local
machine (sequential) and SX8 (4-proc) yields identical results
(restart and restartphy are identical binarily)
Log history from r1241 to r1278 is available by switching to
source:LMDZ4/branches/LMDZ4-dev-20091210

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1!
2! $Id: inithist.F 1279 2009-12-10 09:02:56Z fairhead $
3!
4      subroutine inithist(infile,day0,anne0,tstep,t_ops,t_wrt,fileid,
5     .                    filevid)
6
7#ifdef CPP_IOIPSL
8       USE IOIPSL
9#endif
10       USE infotrac, ONLY : nqtot, ttext
11
12      implicit none
13
14C
15C   Routine d'initialisation des ecritures des fichiers histoires LMDZ
16C   au format IOIPSL
17C
18C   Appels succesifs des routines: histbeg
19C                                  histhori
20C                                  histver
21C                                  histdef
22C                                  histend
23C
24C   Entree:
25C
26C      infile: nom du fichier histoire a creer
27C      day0,anne0: date de reference
28C      tstep: duree du pas de temps en seconde
29C      t_ops: frequence de l'operation pour IOIPSL
30C      t_wrt: frequence d'ecriture sur le fichier
31C      nq: nombre de traceurs
32C
33C   Sortie:
34C      fileid: ID du fichier netcdf cree
35C      filevid:ID du fichier netcdf pour la grille v
36C
37C   L. Fairhead, LMD, 03/99
38C
39C =====================================================================
40C
41C   Declarations
42#include "dimensions.h"
43#include "paramet.h"
44#include "comconst.h"
45#include "comvert.h"
46#include "comgeom.h"
47#include "temps.h"
48#include "ener.h"
49#include "logic.h"
50#include "description.h"
51#include "serre.h"
52#include "iniprint.h"
53
54C   Arguments
55C
56      character*(*) infile
57      integer day0, anne0
58      real tstep, t_ops, t_wrt
59      integer fileid, filevid
60
61#ifdef CPP_IOIPSL
62! This routine needs IOIPSL to work
63C   Variables locales
64C
65      integer tau0
66      real zjulian
67      integer iq
68      real rlong(iip1,jjp1), rlat(iip1,jjp1)
69      integer uhoriid, vhoriid, thoriid, zvertiid
70      integer ii,jj
71      integer zan, dayref
72C
73C  Initialisations
74C
75      pi = 4. * atan (1.)
76C
77C  Appel a histbeg: creation du fichier netcdf et initialisations diverses
78C         
79
80      zan = anne0
81      dayref = day0
82      CALL ymds2ju(zan, 1, dayref, 0.0, zjulian)
83      tau0 = itau_dyn
84     
85      do jj = 1, jjp1
86        do ii = 1, iip1
87          rlong(ii,jj) = rlonu(ii) * 180. / pi
88          rlat(ii,jj) = rlatu(jj) * 180. / pi
89        enddo
90      enddo
91       
92      call histbeg(infile, iip1, rlong(:,1), jjp1, rlat(1,:),
93     .             1, iip1, 1, jjp1,
94     .             tau0, zjulian, tstep, uhoriid, fileid)
95C
96C  Creation du fichier histoire pour la grille en V (oblige pour l'instant,
97C  IOIPSL ne permet pas de grilles avec des nombres de point differents dans
98C  un meme fichier)
99
100      do jj = 1, jjm
101        do ii = 1, iip1
102          rlong(ii,jj) = rlonv(ii) * 180. / pi
103          rlat(ii,jj) = rlatv(jj) * 180. / pi
104        enddo
105      enddo
106
107      call histbeg('dyn_histv.nc', iip1, rlong(:,1), jjm, rlat(1,:),
108     .             1, iip1, 1, jjm,
109     .             tau0, zjulian, tstep, vhoriid, filevid)
110C
111C  Appel a histhori pour rajouter les autres grilles horizontales
112C
113      do jj = 1, jjp1
114        do ii = 1, iip1
115          rlong(ii,jj) = rlonv(ii) * 180. / pi
116          rlat(ii,jj) = rlatu(jj) * 180. / pi
117        enddo
118      enddo
119
120      call histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar',
121     .              'Grille points scalaires', thoriid)
122C
123C  Appel a histvert pour la grille verticale
124C
125      call histvert(fileid, 'sig_s', 'Niveaux sigma','-',
126     .              llm, nivsigs, zvertiid)
127C Pour le fichier V
128      call histvert(filevid, 'sig_s', 'Niveaux sigma','-',
129     .              llm, nivsigs, zvertiid)
130C
131C  Appels a histdef pour la definition des variables a sauvegarder
132C
133C  Vents U
134C
135      call histdef(fileid, 'ucov', 'vents u covariants', 'm/s',
136     .             iip1, jjp1, uhoriid, llm, 1, llm, zvertiid,
137     .             32, 'inst(X)', t_ops, t_wrt)
138C
139C  Vents V
140C
141      call histdef(filevid, 'vcov', 'vents v covariants', 'm/s',
142     .             iip1, jjm, vhoriid, llm, 1, llm, zvertiid,
143     .             32, 'inst(X)', t_ops, t_wrt)
144
145C
146C  Temperature potentielle
147C
148      call histdef(fileid, 'teta', 'temperature potentielle', '-',
149     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
150     .             32, 'inst(X)', t_ops, t_wrt)
151C
152C  Geopotentiel
153C
154      call histdef(fileid, 'phi', 'geopotentiel instantane', '-',
155     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
156     .             32, 'inst(X)', t_ops, t_wrt)
157C
158C  Traceurs
159C
160        DO iq=1,nqtot
161          call histdef(fileid, ttext(iq),  ttext(iq), '-',
162     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
163     .             32, 'inst(X)', t_ops, t_wrt)
164        enddo
165C
166C  Masse
167C
168      call histdef(fileid, 'masse', 'masse', 'kg',
169     .             iip1, jjp1, thoriid, 1, 1, 1, -99,
170     .             32, 'inst(X)', t_ops, t_wrt)
171C
172C  Pression au sol
173C
174      call histdef(fileid, 'ps', 'pression naturelle au sol', 'Pa',
175     .             iip1, jjp1, thoriid, 1, 1, 1, -99,
176     .             32, 'inst(X)', t_ops, t_wrt)
177C
178C  Pression au sol
179C
180      call histdef(fileid, 'phis', 'geopotentiel au sol', '-',
181     .             iip1, jjp1, thoriid, 1, 1, 1, -99,
182     .             32, 'inst(X)', t_ops, t_wrt)
183C
184C  Fin
185C
186      call histend(fileid)
187      call histend(filevid)
188#else
189! tell the user this routine should be run with ioipsl
190      write(lunout,*)"inithist: Warning this routine should not be",
191     &               " used without ioipsl"
192#endif
193! of #ifdef CPP_IOIPSL
194      return
195      end
Note: See TracBrowser for help on using the repository browser.