source: LMDZ6/branches/Amaury_dev/libf/dyn3d_common/initfluxsto.f90 @ 5139

Last change on this file since 5139 was 5136, checked in by abarral, 8 weeks ago

Put comgeom.h, comgeom2.h into modules

  • 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
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
RevLine 
[1279]1! $Id: initfluxsto.f90 5136 2024-07-28 14:17:54Z abarral $
[5099]2
[5105]3SUBROUTINE initfluxsto &
[5114]4        (infile, tstep, t_ops, t_wrt, &
5        fileid, filevid, filedid)
[524]6
[5114]7  USE IOIPSL
[5105]8  USE comconst_mod, ONLY: pi
9  USE comvert_mod, ONLY: nivsigs
10  USE temps_mod, ONLY: annee_ref, day_ref, itau_dyn
[5114]11  USE lmdz_description, ONLY: descript
[5118]12  USE lmdz_iniprint, ONLY: lunout, prt_level
[5136]13  USE lmdz_comgeom
[524]14
[5113]15  IMPLICIT NONE
[524]16
[5105]17  !
18  !   Routine d'initialisation des ecritures des fichiers histoires LMDZ
19  !   au format IOIPSL
20  !
21  !   Appels succesifs des routines: histbeg
22  !                              histhori
23  !                              histver
24  !                              histdef
25  !                              histend
26  !
27  !   Entree:
28  !
29  !  infile: nom du fichier histoire a creer
30  !  day0,anne0: date de reference
31  !  tstep: duree du pas de temps en seconde
32  !  t_ops: frequence de l'operation pour IOIPSL
33  !  t_wrt: frequence d'ecriture sur le fichier
34  !
35  !   Sortie:
36  !  fileid: ID du fichier netcdf cree
37  !  filevid:ID du fichier netcdf pour la grille v
38  !
39  !   L. Fairhead, LMD, 03/99
40  !
41  ! =====================================================================
42  !
43  !   Declarations
[5134]44  INCLUDE "dimensions.h"
45  INCLUDE "paramet.h"
[524]46
[5105]47  !   Arguments
48  !
[5116]49  CHARACTER(LEN = *) :: infile
50  REAL :: tstep, t_ops, t_wrt
51  INTEGER :: fileid, filevid, filedid
[524]52
[5105]53  ! This routine needs IOIPSL to work
54  !   Variables locales
55  !
[5116]56  REAL :: nivd(1)
57  INTEGER :: tau0
58  REAL :: zjulian
59  CHARACTER(LEN = 3) :: str
60  CHARACTER(LEN = 10) :: ctrac
61  INTEGER :: iq
62  REAL :: rlong(iip1, jjp1), rlat(iip1, jjp1), rl(1, 1)
63  INTEGER :: uhoriid, vhoriid, thoriid, zvertiid, dhoriid, dvertiid
64  INTEGER :: ii, jj
65  INTEGER :: zan, idayref
[5117]66  LOGICAL :: ok_sync
[5105]67  !
68  !  Initialisations
69  !
70  pi = 4. * atan (1.)
[5114]71  str = 'q  '
[5105]72  ctrac = 'traceur   '
73  ok_sync = .TRUE.
74  !
75  !  Appel a histbeg: creation du fichier netcdf et initialisations diverses
76  !
[5103]77
[5105]78  zan = annee_ref
79  idayref = day_ref
80  CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
81  tau0 = itau_dyn
[5103]82
[5114]83  do jj = 1, jjp1
[5105]84    do ii = 1, iip1
[5114]85      rlong(ii, jj) = rlonu(ii) * 180. / pi
86      rlat(ii, jj) = rlatu(jj) * 180. / pi
[5105]87    enddo
88  enddo
[524]89
[5114]90  CALL histbeg(infile, iip1, rlong(:, 1), jjp1, rlat(1, :), &
91          1, iip1, 1, jjp1, &
92          tau0, zjulian, tstep, uhoriid, fileid)
[5105]93  !
94  !  Creation du fichier histoire pour la grille en V (oblige pour l'instant,
95  !  IOIPSL ne permet pas de grilles avec des nombres de point differents dans
96  !  un meme fichier)
[524]97
[5105]98  do jj = 1, jjm
99    do ii = 1, iip1
[5114]100      rlong(ii, jj) = rlonv(ii) * 180. / pi
101      rlat(ii, jj) = rlatv(jj) * 180. / pi
[5105]102    enddo
103  enddo
[5103]104
[5114]105  CALL histbeg('fluxstokev.nc', iip1, rlong(:, 1), jjm, rlat(1, :), &
106          1, iip1, 1, jjm, &
107          tau0, zjulian, tstep, vhoriid, filevid)
[524]108
[5114]109  rl(1, 1) = 1.
[5105]110  CALL histbeg('defstoke.nc', 1, rl, 1, rl, &
[5114]111          1, 1, 1, 1, &
112          tau0, zjulian, tstep, dhoriid, filedid)
[524]113
[5105]114  !
115  !  Appel a histhori pour rajouter les autres grilles horizontales
116  !
117  do jj = 1, jjp1
118    do ii = 1, iip1
[5114]119      rlong(ii, jj) = rlonv(ii) * 180. / pi
120      rlat(ii, jj) = rlatu(jj) * 180. / pi
[5105]121    enddo
122  enddo
[5103]123
[5105]124  CALL histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar', &
[5114]125          'Grille points scalaires', thoriid)
[524]126
[5105]127  !
128  !  Appel a histvert pour la grille verticale
129  !
130  CALL histvert(fileid, 'sig_s', 'Niveaux sigma', &
[5114]131          'sigma_level', &
132          llm, nivsigs, zvertiid)
[5105]133  ! Pour le fichier V
134  CALL histvert(filevid, 'sig_s', 'Niveaux sigma', &
[5114]135          'sigma_level', &
136          llm, nivsigs, zvertiid)
[5105]137  ! pour le fichier def
138  nivd(1) = 1
139  CALL histvert(filedid, 'sig_s', 'Niveaux sigma', &
[5114]140          'sigma_level', &
141          1, nivd, dvertiid)
[5103]142
[5105]143  !
144  !  Appels a histdef pour la definition des variables a sauvegarder
[524]145
[5114]146  CALL histdef(fileid, "phis", "Surface geop. height", "-", &
147          iip1, jjp1, thoriid, 1, 1, 1, -99, 32, &
[5105]148          "once", t_ops, t_wrt)
[5103]149
[5114]150  CALL histdef(fileid, "aire", "Grid area", "-", &
151          iip1, jjp1, thoriid, 1, 1, 1, -99, 32, &
152          "once", t_ops, t_wrt)
[5103]153
[5114]154  CALL histdef(filedid, "dtvr", "tps dyn", "s", &
155          1, 1, dhoriid, 1, 1, 1, -99, 32, &
[5105]156          "once", t_ops, t_wrt)
[5103]157
[5114]158  CALL histdef(filedid, "istdyn", "tps stock", "s", &
159          1, 1, dhoriid, 1, 1, 1, -99, 32, &
160          "once", t_ops, t_wrt)
[524]161
[5114]162  CALL histdef(filedid, "istphy", "tps stock phy", "s", &
163          1, 1, dhoriid, 1, 1, 1, -99, 32, &
164          "once", t_ops, t_wrt)
[524]165
166
[5105]167  !
168  ! Masse
169  !
170  CALL histdef(fileid, 'masse', 'Masse', 'kg', &
[5114]171          iip1, jjp1, thoriid, llm, 1, llm, zvertiid, &
172          32, 'inst(X)', t_ops, t_wrt)
[5105]173  !
174  !  Pbaru
175  !
176  CALL histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s', &
[5114]177          iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, &
178          32, 'inst(X)', t_ops, t_wrt)
[524]179
[5105]180  !
181  !  Pbarv
182  !
183  CALL histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s', &
[5114]184          iip1, jjm, vhoriid, llm, 1, llm, zvertiid, &
185          32, 'inst(X)', t_ops, t_wrt)
[5105]186  !
187  !  w
188  !
189  CALL histdef(fileid, 'w', 'flx de masse vert', 'kg m/s', &
[5114]190          iip1, jjp1, thoriid, llm, 1, llm, zvertiid, &
191          32, 'inst(X)', t_ops, t_wrt)
[524]192
[5105]193  !
194  !  Temperature potentielle
195  !
196  CALL histdef(fileid, 'teta', 'temperature potentielle', '-', &
[5114]197          iip1, jjp1, thoriid, llm, 1, llm, zvertiid, &
198          32, 'inst(X)', t_ops, t_wrt)
[5105]199  !
[5103]200
[5105]201  !
202  ! Geopotentiel
203  !
204  CALL histdef(fileid, 'phi', 'geopotentiel instantane', '-', &
[5114]205          iip1, jjp1, thoriid, llm, 1, llm, zvertiid, &
206          32, 'inst(X)', t_ops, t_wrt)
[5105]207  !
208  !  Fin
209  !
210  CALL histend(fileid)
211  CALL histend(filevid)
212  CALL histend(filedid)
[5117]213  IF (ok_sync) THEN
[5105]214    CALL histsync(fileid)
215    CALL histsync(filevid)
216    CALL histsync(filedid)
[5117]217  ENDIF
[5105]218
[5116]219  RETURN
220END SUBROUTINE initfluxsto
Note: See TracBrowser for help on using the repository browser.