1 |
! |
SUBROUTINE initfluxsto(tstep, t_ops, t_wrt, nq, fileid, filevid, filedid) |
2 |
! $Header: /home/cvsroot/LMDZ4/libf/bibio/initfluxsto.F,v 1.1.1.1 2004/05/19 12:53:05 lmdzadmin Exp $ |
|
3 |
! |
! From bibio/initfluxsto.F, v 1.1.1.1 2004/05/19 12:53:05 |
4 |
subroutine initfluxsto |
|
5 |
. (infile,tstep,t_ops,t_wrt,nq, |
! Routine d'initialisation des ecritures des fichiers histoires LMDZ |
6 |
. fileid,filevid,filedid) |
! au format IOIPSL |
7 |
|
! Appels succesifs des routines: histbeg |
8 |
USE IOIPSL |
! histhori |
9 |
USE histcom |
! histver |
10 |
|
! histdef |
11 |
|
! histend |
12 |
C |
|
13 |
C Routine d'initialisation des ecritures des fichiers histoires LMDZ |
! Entree: |
14 |
C au format IOIPSL |
! day0, anne0: date de reference |
15 |
C |
! tstep: duree du pas de temps en seconde |
16 |
C Appels succesifs des routines: histbeg |
! t_ops: frequence de l'operation pour IOIPSL |
17 |
C histhori |
! t_wrt: frequence d'ecriture sur le fichier |
18 |
C histver |
! nq: nombre de traceurs |
19 |
C histdef |
|
20 |
C histend |
! Sortie: |
21 |
C |
! fileid: ID du fichier netcdf cree |
22 |
C Entree: |
! filevid:ID du fichier netcdf pour la grille v |
23 |
C |
|
24 |
C infile: nom du fichier histoire a creer |
! L. Fairhead, 03/99 |
25 |
C day0,anne0: date de reference |
|
26 |
C tstep: duree du pas de temps en seconde |
USE calendar |
27 |
C t_ops: frequence de l'operation pour IOIPSL |
USE histcom |
28 |
C t_wrt: frequence d'ecriture sur le fichier |
USE dimens_m |
29 |
C nq: nombre de traceurs |
USE paramet_m |
30 |
C |
USE comconst |
31 |
C Sortie: |
USE comvert |
32 |
C fileid: ID du fichier netcdf cree |
USE logic |
33 |
C filevid:ID du fichier netcdf pour la grille v |
USE comgeom |
34 |
C |
USE serre |
35 |
C L. Fairhead, LMD, 03/99 |
USE temps, ONLY : annee_ref, day_ref, itau_dyn |
36 |
C |
USE ener |
37 |
C ===================================================================== |
USE nr_util, ONLY : pi |
38 |
C |
|
39 |
C Declarations |
IMPLICIT NONE |
40 |
use dimens_m |
|
41 |
use paramet_m |
! Arguments |
42 |
use comconst |
INTEGER itau |
43 |
use comvert |
REAL, INTENT (IN) :: tstep |
44 |
use logic |
REAL t_ops, t_wrt |
45 |
use comgeom |
INTEGER fileid, filevid, filedid |
46 |
use serre |
INTEGER nq, ndex(1) |
47 |
use temps, only: annee_ref, day_ref, itau_dyn |
REAL nivd(1) |
48 |
use ener |
|
49 |
implicit none |
! Variables locales |
50 |
|
REAL zjulian |
51 |
C Arguments |
CHARACTER*3 str |
52 |
C |
CHARACTER*10 ctrac |
53 |
character*(*) infile |
INTEGER iq |
54 |
integer*4 itau |
REAL rlong(iip1, jjp1), rlat(iip1, jjp1) |
55 |
real tstep, t_ops, t_wrt |
INTEGER uhoriid, vhoriid, thoriid, zvertiid, dhoriid, dvertiid |
56 |
integer fileid, filevid,filedid |
INTEGER ii, jj |
57 |
integer nq,ndex(1) |
INTEGER zan, idayref |
58 |
real nivd(1) |
LOGICAL ok_sync |
59 |
|
|
60 |
C Variables locales |
!--------------------------------------------------------- |
61 |
C |
|
62 |
integer tau0 |
! Initialisations |
63 |
real zjulian |
str = 'q ' |
64 |
character*3 str |
ctrac = 'traceur ' |
65 |
character*10 ctrac |
ok_sync = .TRUE. |
66 |
integer iq |
|
67 |
real rlong(iip1,jjp1), rlat(iip1,jjp1),rl(1,1) |
! Appel a histbeg: creation du fichier netcdf et initialisations diverses |
68 |
integer uhoriid, vhoriid, thoriid, zvertiid,dhoriid,dvertiid |
|
69 |
integer ii,jj |
zan = annee_ref |
70 |
integer zan, idayref |
idayref = day_ref |
71 |
logical ok_sync |
CALL ymds2ju(zan, 1, idayref, 0.0, zjulian) |
72 |
C |
|
73 |
C Initialisations |
DO jj = 1, jjp1 |
74 |
C |
DO ii = 1, iip1 |
75 |
pi = 4. * atan (1.) |
rlong(ii, jj) = rlonu(ii)*180./pi |
76 |
str='q ' |
rlat(ii, jj) = rlatu(jj)*180./pi |
77 |
ctrac = 'traceur ' |
END DO |
78 |
ok_sync = .true. |
END DO |
79 |
C |
|
80 |
C Appel a histbeg: creation du fichier netcdf et initialisations diverses |
CALL histbeg_totreg('fluxstoke', rlong(:, 1), rlat(1, :), 1, iip1, 1, jjp1, & |
81 |
C |
itau_dyn, zjulian, tstep, uhoriid, fileid) |
82 |
|
|
83 |
zan = annee_ref |
! Creation du fichier histoire pour la grille en V (oblige pour l'instant, |
84 |
idayref = day_ref |
! IOIPSL ne permet pas de grilles avec des nombres de point differents dans |
85 |
CALL ymds2ju(zan, 1, idayref, 0.0, zjulian) |
! un meme fichier) |
86 |
tau0 = itau_dyn |
|
87 |
|
DO jj = 1, jjm |
88 |
do jj = 1, jjp1 |
DO ii = 1, iip1 |
89 |
do ii = 1, iip1 |
rlong(ii, jj) = rlonv(ii)*180./pi |
90 |
rlong(ii,jj) = rlonu(ii) * 180. / pi |
rlat(ii, jj) = rlatv(jj)*180./pi |
91 |
rlat(ii,jj) = rlatu(jj) * 180. / pi |
END DO |
92 |
enddo |
END DO |
93 |
enddo |
|
94 |
|
CALL histbeg_totreg('fluxstokev.nc', rlong(:, 1), rlat(1, :jjm), 1, iip1, & |
95 |
call histbeg_totreg(infile, iip1, rlong(:,1), jjp1, rlat(1,:), |
1, jjm, itau_dyn, zjulian, tstep, vhoriid, filevid) |
96 |
. 1, iip1, 1, jjp1, |
|
97 |
. tau0, zjulian, tstep, uhoriid, fileid) |
CALL histbeg_totreg('defstoke.nc', (/1./), (/1./), 1, 1, 1, 1, itau_dyn, & |
98 |
C |
zjulian, tstep, dhoriid, filedid) |
99 |
C Creation du fichier histoire pour la grille en V (oblige pour l'instant, |
|
100 |
C IOIPSL ne permet pas de grilles avec des nombres de point differents dans |
! Appel a histhori pour rajouter les autres grilles horizontales |
101 |
C un meme fichier) |
|
102 |
|
DO jj = 1, jjp1 |
103 |
|
DO ii = 1, iip1 |
104 |
do jj = 1, jjm |
rlong(ii, jj) = rlonv(ii)*180./pi |
105 |
do ii = 1, iip1 |
rlat(ii, jj) = rlatu(jj)*180./pi |
106 |
rlong(ii,jj) = rlonv(ii) * 180. / pi |
END DO |
107 |
rlat(ii,jj) = rlatv(jj) * 180. / pi |
END DO |
108 |
enddo |
|
109 |
enddo |
CALL histhori_regular(fileid, iip1, rlong, jjp1, rlat, 'scalar', & |
110 |
|
'Grille points scalaires', thoriid) |
111 |
call histbeg_totreg('fluxstokev.nc', iip1, rlong(:,1), jjm, |
|
112 |
. rlat(1,:),1, iip1, 1, jjm, |
! Appel a histvert pour la grille verticale |
113 |
. tau0, zjulian, tstep, vhoriid, filevid) |
|
114 |
|
CALL histvert(fileid, 'sig_s', 'Niveaux sigma', 'sigma_level', llm, & |
115 |
rl(1,1) = 1. |
nivsigs, zvertiid) |
116 |
call histbeg_regular('defstoke.nc', 1, rl, 1, rl, |
! Pour le fichier V |
117 |
. 1, 1, 1, 1, |
CALL histvert(filevid, 'sig_s', 'Niveaux sigma', 'sigma_level', llm, & |
118 |
. tau0, zjulian, tstep, dhoriid, filedid) |
nivsigs, zvertiid) |
119 |
|
! pour le fichier def |
120 |
C |
nivd(1) = 1 |
121 |
C Appel a histhori pour rajouter les autres grilles horizontales |
CALL histvert(filedid, 'sig_s', 'Niveaux sigma', 'sigma_level', 1, nivd, & |
122 |
C |
dvertiid) |
123 |
do jj = 1, jjp1 |
|
124 |
do ii = 1, iip1 |
! Appels a histdef pour la definition des variables a sauvegarder |
125 |
rlong(ii,jj) = rlonv(ii) * 180. / pi |
CALL histdef(fileid, 'phis', 'Surface geop. height', '-', iip1, jjp1, & |
126 |
rlat(ii,jj) = rlatu(jj) * 180. / pi |
thoriid, 1, 1, 1, -99, 'once', t_ops, t_wrt) |
127 |
enddo |
CALL histdef(fileid, 'aire', 'Grid area', '-', iip1, jjp1, thoriid, 1, 1, & |
128 |
enddo |
1, -99, 'once', t_ops, t_wrt) |
129 |
|
CALL histdef(filedid, 'dtvr', 'tps dyn', 's', 1, 1, dhoriid, 1, 1, 1, -99, & |
130 |
call histhori(fileid, iip1, rlong, jjp1, rlat, 'scalar', |
'once', t_ops, t_wrt) |
131 |
. 'Grille points scalaires', thoriid) |
CALL histdef(filedid, 'istdyn', 'tps stock', 's', 1, 1, dhoriid, 1, 1, 1, & |
132 |
|
-99, 'once', t_ops, t_wrt) |
133 |
C |
CALL histdef(filedid, 'istphy', 'tps stock phy', 's', 1, 1, dhoriid, 1, 1, & |
134 |
C Appel a histvert pour la grille verticale |
1, -99, 'once', t_ops, t_wrt) |
135 |
C |
CALL histdef(fileid, 'masse', 'Masse', 'kg', iip1, jjp1, thoriid, llm, 1, & |
136 |
call histvert(fileid, 'sig_s', 'Niveaux sigma', |
llm, zvertiid, 'inst(X)', t_ops, t_wrt) |
137 |
. 'sigma_level', |
CALL histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s', iip1, jjp1, & |
138 |
. llm, nivsigs, zvertiid) |
uhoriid, llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) |
139 |
C Pour le fichier V |
CALL histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s', iip1, jjm, & |
140 |
call histvert(filevid, 'sig_s', 'Niveaux sigma', |
vhoriid, llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) |
141 |
. 'sigma_level', |
CALL histdef(fileid, 'w', 'flx de masse vert', 'kg m/s', iip1, jjp1, & |
142 |
. llm, nivsigs, zvertiid) |
thoriid, llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) |
143 |
c pour le fichier def |
CALL histdef(fileid, 'teta', 'temperature potentielle', '-', iip1, jjp1, & |
144 |
nivd(1) = 1 |
thoriid, llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) |
145 |
call histvert(filedid, 'sig_s', 'Niveaux sigma', |
CALL histdef(fileid, 'phi', 'geopotentiel instantane', '-', iip1, jjp1, & |
146 |
. 'sigma_level', |
thoriid, llm, 1, llm, zvertiid, 'inst(X)', t_ops, t_wrt) |
147 |
. 1, nivd, dvertiid) |
|
148 |
|
CALL histend(fileid) |
149 |
C |
CALL histend(filevid) |
150 |
C Appels a histdef pour la definition des variables a sauvegarder |
CALL histend(filedid) |
151 |
|
IF (ok_sync) THEN |
152 |
CALL histdef(fileid, "phis", "Surface geop. height", "-", |
CALL histsync(fileid) |
153 |
. iip1,jjp1,thoriid, 1,1,1, -99, 32, |
CALL histsync(filevid) |
154 |
. "once", t_ops, t_wrt) |
CALL histsync(filedid) |
155 |
|
END IF |
156 |
CALL histdef(fileid, "aire", "Grid area", "-", |
|
157 |
. iip1,jjp1,thoriid, 1,1,1, -99, 32, |
END SUBROUTINE initfluxsto |
|
. "once", t_ops, t_wrt) |
|
|
|
|
|
CALL histdef(filedid, "dtvr", "tps dyn", "s", |
|
|
. 1,1,dhoriid, 1,1,1, -99, 32, |
|
|
. "once", t_ops, t_wrt) |
|
|
|
|
|
CALL histdef(filedid, "istdyn", "tps stock", "s", |
|
|
. 1,1,dhoriid, 1,1,1, -99, 32, |
|
|
. "once", t_ops, t_wrt) |
|
|
|
|
|
CALL histdef(filedid, "istphy", "tps stock phy", "s", |
|
|
. 1,1,dhoriid, 1,1,1, -99, 32, |
|
|
. "once", t_ops, t_wrt) |
|
|
|
|
|
|
|
|
C |
|
|
C Masse |
|
|
C |
|
|
call histdef(fileid, 'masse', 'Masse', 'kg', |
|
|
. iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|
|
. 32, 'inst(X)', t_ops, t_wrt) |
|
|
C |
|
|
C Pbaru |
|
|
C |
|
|
call histdef(fileid, 'pbaru', 'flx de masse zonal', 'kg m/s', |
|
|
. iip1, jjp1, uhoriid, llm, 1, llm, zvertiid, |
|
|
. 32, 'inst(X)', t_ops, t_wrt) |
|
|
|
|
|
C |
|
|
C Pbarv |
|
|
C |
|
|
call histdef(filevid, 'pbarv', 'flx de masse mer', 'kg m/s', |
|
|
. iip1, jjm, vhoriid, llm, 1, llm, zvertiid, |
|
|
. 32, 'inst(X)', t_ops, t_wrt) |
|
|
C |
|
|
C w |
|
|
C |
|
|
call histdef(fileid, 'w', 'flx de masse vert', 'kg m/s', |
|
|
. iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|
|
. 32, 'inst(X)', t_ops, t_wrt) |
|
|
|
|
|
C |
|
|
C Temperature potentielle |
|
|
C |
|
|
call histdef(fileid, 'teta', 'temperature potentielle', '-', |
|
|
. iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|
|
. 32, 'inst(X)', t_ops, t_wrt) |
|
|
C |
|
|
|
|
|
C |
|
|
C Geopotentiel |
|
|
C |
|
|
call histdef(fileid, 'phi', 'geopotentiel instantane', '-', |
|
|
. iip1, jjp1, thoriid, llm, 1, llm, zvertiid, |
|
|
. 32, 'inst(X)', t_ops, t_wrt) |
|
|
C |
|
|
C Fin |
|
|
C |
|
|
call histend(fileid) |
|
|
call histend(filevid) |
|
|
call histend(filedid) |
|
|
if (ok_sync) then |
|
|
call histsync(fileid) |
|
|
call histsync(filevid) |
|
|
call histsync(filedid) |
|
|
endif |
|
|
|
|
|
return |
|
|
end |
|