source: LMDZ.3.3/branches/rel-1-0-patch/libf/bibio/initfluxsto.F @ 488

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