source: LMDZ.3.3/trunk/libf/bibio/initfluxsto.F @ 348

Last change on this file since 348 was 348, checked in by lmdz, 22 years ago

Regle le probleme de decalage de 1 jour au debut de chaque simulation
LF

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1      subroutine initfluxsto
2     .  (infile,tstep,t_ops,t_wrt,nq,
3     .                    fileid,filevid,filedid)
4
5       USE IOIPSL
6
7      implicit none
8
9C
10C   Routine d'initialisation des ecritures des fichiers histoires LMDZ
11C   au format IOIPSL
12C
13C   Appels succesifs des routines: histbeg
14C                                  histhori
15C                                  histver
16C                                  histdef
17C                                  histend
18C
19C   Entree:
20C
21C      infile: nom du fichier histoire a creer
22C      day0,anne0: date de reference
23C      tstep: duree du pas de temps en seconde
24C      t_ops: frequence de l'operation pour IOIPSL
25C      t_wrt: frequence d'ecriture sur le fichier
26C      nq: nombre de traceurs
27C
28C   Sortie:
29C      fileid: ID du fichier netcdf cree
30C      filevid:ID du fichier netcdf pour la grille v
31C
32C   L. Fairhead, LMD, 03/99
33C
34C =====================================================================
35C
36C   Declarations
37#include "dimensions.h"
38#include "paramet.h"
39#include "comconst.h"
40#include "comvert.h"
41#include "comgeom.h"
42#include "temps.h"
43#include "ener.h"
44#include "logic.h"
45#include "description.h"
46#include "serre.h"
47
48C   Arguments
49C
50      character*(*) infile
51      integer*4 itau
52      real tstep, t_ops, t_wrt
53      integer fileid, filevid,filedid
54      integer nq,ndex(1)
55      real nivd(1)
56
57C   Variables locales
58C
59      integer tau0
60      real zjulian
61      character*3 str
62      character*10 ctrac
63      integer iq
64      real rlong(iip1,jjp1), rlat(iip1,jjp1),rl(1,1)
65      integer uhoriid, vhoriid, thoriid, zvertiid,dhoriid,dvertiid
66      integer ii,jj
67      integer zan, idayref
68      logical ok_sync
69C
70C  Initialisations
71C
72      pi = 4. * atan (1.)
73      str='q  '
74      ctrac = 'traceur   '
75      ok_sync = .true.
76C
77C  Appel a histbeg: creation du fichier netcdf et initialisations diverses
78C         
79
80      zan = anne_ini
81      idayref = day_ini
82      CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
83      tau0 = 0
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, jjp1, rlat,
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
101      do jj = 1, jjm
102        do ii = 1, iip1
103          rlong(ii,jj) = rlonv(ii) * 180. / pi
104          rlat(ii,jj) = rlatv(jj) * 180. / pi
105        enddo
106      enddo
107
108      call histbeg('fluxstokev.nc', iip1, rlong, jjm, rlat,
109     .             1, iip1, 1, jjm,
110     .             tau0, zjulian, tstep, vhoriid, filevid)
111       
112        rl(1,1) = 1.   
113      call histbeg('defstoke.nc', 1, rl, 1, rl,
114     .             1, 1, 1, 1,
115     .             tau0, zjulian, tstep, dhoriid, filedid)
116
117C
118C  Appel a histhori pour rajouter les autres grilles horizontales
119C
120      do jj = 1, jjp1
121        do ii = 1, iip1
122          rlong(ii,jj) = rlonv(ii) * 180. / pi
123          rlat(ii,jj) = rlatu(jj) * 180. / pi
124        enddo
125      enddo
126
127      call histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar',
128     .              'Grille points scalaires', thoriid)
129       
130C
131C  Appel a histvert pour la grille verticale
132C
133      call histvert(fileid, 'sig_s', 'Niveaux sigma',
134     . 'sigma_level',
135     .              llm, nivsigs, zvertiid)
136C Pour le fichier V
137      call histvert(filevid, 'sig_s', 'Niveaux sigma',
138     .  'sigma_level',
139     .              llm, nivsigs, zvertiid)
140c pour le fichier def
141      nivd(1) = 1
142      call histvert(filedid, 'sig_s', 'Niveaux sigma',
143     .  'sigma_level',
144     .              1, nivd, dvertiid)
145
146C
147C  Appels a histdef pour la definition des variables a sauvegarder
148       
149        CALL histdef(fileid, "phis", "Surface geop. height", "-",
150     .                iip1,jjp1,thoriid, 1,1,1, -99, 32,
151     .                "once", t_ops, t_wrt)
152
153         CALL histdef(fileid, "aire", "Grid area", "-",
154     .                iip1,jjp1,thoriid, 1,1,1, -99, 32,
155     .                "once", t_ops, t_wrt)
156       
157        CALL histdef(filedid, "dtvr", "tps dyn", "s",
158     .                1,1,dhoriid, 1,1,1, -99, 32,
159     .                "once", t_ops, t_wrt)
160       
161         CALL histdef(filedid, "istdyn", "tps stock", "s",
162     .                1,1,dhoriid, 1,1,1, -99, 32,
163     .                "once", t_ops, t_wrt)
164         
165         CALL histdef(filedid, "istphy", "tps stock phy", "s",
166     .                1,1,dhoriid, 1,1,1, -99, 32,
167     .                "once", t_ops, t_wrt)
168
169
170C
171C Masse
172C
173      call histdef(fileid, 'masse', 'Masse', 'kg',
174     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
175     .             32, 'inst(X)', t_ops, t_wrt)
176C
177C  Pbaru
178C
179      call histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s',
180     .             iip1, jjp1, uhoriid, llm, 1, llm, zvertiid,
181     .             32, 'inst(X)', t_ops, t_wrt)
182
183C
184C  Pbarv
185C
186      call histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s',
187     .             iip1, jjm, vhoriid, llm, 1, llm, zvertiid,
188     .             32, 'inst(X)', t_ops, t_wrt)
189C
190C  w
191C
192      call histdef(fileid, 'w', 'flx de masse vert', 'kg m/s',
193     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
194     .             32, 'inst(X)', t_ops, t_wrt)
195
196C
197C  Temperature potentielle
198C
199      call histdef(fileid, 'teta', 'temperature potentielle', '-',
200     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
201     .             32, 'inst(X)', t_ops, t_wrt)
202C
203
204C
205C Geopotentiel
206C
207      call histdef(fileid, 'phi', 'geopotentiel instantane', '-',
208     .             iip1, jjp1, thoriid, llm, 1, llm, zvertiid,
209     .             32, 'inst(X)', t_ops, t_wrt)
210C
211C  Fin
212C
213      call histend(fileid)
214      call histend(filevid)
215      call histend(filedid)
216      if (ok_sync) then
217        call histsync(fileid)
218        call histsync(filevid)
219        call histsync(filedid)
220      endif
221       
222      return
223      end
Note: See TracBrowser for help on using the repository browser.