[524] | 1 | ! |
---|
[1403] | 2 | ! $Id: initphysto.f90 5268 2024-10-23 17:02:39Z evignon $ |
---|
[524] | 3 | ! |
---|
[1447] | 4 | SUBROUTINE initphysto(infile,tstep,t_ops,t_wrt,fileid) |
---|
| 5 | |
---|
| 6 | USE dimphy |
---|
| 7 | USE mod_phys_lmdz_para |
---|
| 8 | USE IOIPSL |
---|
| 9 | USE iophy |
---|
[1785] | 10 | USE indice_sol_mod |
---|
[2343] | 11 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev |
---|
| 12 | USE time_phylmdz_mod, ONLY: day_ref, annee_ref |
---|
[1447] | 13 | |
---|
| 14 | IMPLICIT NONE |
---|
[1403] | 15 | |
---|
[1447] | 16 | ! |
---|
| 17 | ! Routine d'initialisation des ecritures des fichiers histoires LMDZ |
---|
| 18 | ! au format IOIPSL |
---|
| 19 | ! |
---|
| 20 | ! Appels succesifs des routines: histbeg |
---|
| 21 | ! histhori |
---|
| 22 | ! histver |
---|
| 23 | ! histdef |
---|
| 24 | ! histend |
---|
| 25 | ! |
---|
| 26 | ! Entree: |
---|
| 27 | ! |
---|
| 28 | ! infile: nom du fichier histoire a creer |
---|
| 29 | ! day0,anne0: date de reference |
---|
| 30 | ! tstep: duree du pas de temps en seconde |
---|
| 31 | ! t_ops: frequence de l'operation pour IOIPSL |
---|
| 32 | ! t_wrt: frequence d'ecriture sur le fichier |
---|
| 33 | ! |
---|
| 34 | ! Sortie: |
---|
| 35 | ! fileid: ID du fichier netcdf cree |
---|
| 36 | ! |
---|
| 37 | ! L. Fairhead, LMD, 03/99 |
---|
| 38 | ! |
---|
| 39 | ! ===================================================================== |
---|
[524] | 40 | |
---|
[1447] | 41 | ! Arguments |
---|
| 42 | CHARACTER(len=*), INTENT(IN) :: infile |
---|
| 43 | REAL, INTENT(IN) :: tstep |
---|
| 44 | REAL, INTENT(IN) :: t_ops |
---|
| 45 | REAL, INTENT(IN) :: t_wrt |
---|
| 46 | INTEGER, INTENT(OUT) :: fileid |
---|
[524] | 47 | |
---|
[1447] | 48 | ! Variables locales |
---|
| 49 | INTEGER nhoriid, i |
---|
| 50 | INTEGER l,k |
---|
[2343] | 51 | REAL nivsigs(nbp_lev) |
---|
[1447] | 52 | INTEGER tau0 |
---|
| 53 | REAL zjulian |
---|
| 54 | INTEGER iq |
---|
| 55 | INTEGER uhoriid, vhoriid, thoriid, zvertiid |
---|
| 56 | INTEGER ii,jj |
---|
| 57 | INTEGER zan, idayref |
---|
| 58 | LOGICAL ok_sync |
---|
[2343] | 59 | REAL zx_lon(nbp_lon,nbp_lat), zx_lat(nbp_lon,nbp_lat) |
---|
[1447] | 60 | CHARACTER(len=12) :: nvar |
---|
[524] | 61 | |
---|
[1447] | 62 | ! Initialisations |
---|
| 63 | ! |
---|
| 64 | ok_sync= .TRUE. |
---|
| 65 | ! |
---|
| 66 | ! Appel a histbeg: creation du fichier netcdf et initialisations diverses |
---|
| 67 | ! |
---|
[524] | 68 | |
---|
[1447] | 69 | zan = annee_ref |
---|
| 70 | idayref = day_ref |
---|
| 71 | CALL ymds2ju(zan, 1, idayref, 0.0, zjulian) |
---|
| 72 | tau0 = 0 |
---|
| 73 | |
---|
| 74 | CALL histbeg_phy(infile,tau0, zjulian, tstep, & |
---|
| 75 | nhoriid, fileid) |
---|
[524] | 76 | |
---|
[1447] | 77 | !$OMP MASTER |
---|
| 78 | ! Appel a histvert pour la grille verticale |
---|
| 79 | ! |
---|
[2343] | 80 | DO l=1,nbp_lev |
---|
[1447] | 81 | nivsigs(l)=REAL(l) |
---|
| 82 | ENDDO |
---|
| 83 | |
---|
| 84 | CALL histvert(fileid, 'sig_s', 'Niveaux sigma', & |
---|
| 85 | 'sigma_level', & |
---|
[2343] | 86 | nbp_lev, nivsigs, zvertiid) |
---|
[1447] | 87 | ! |
---|
| 88 | ! Appels a histdef pour la definition des variables a sauvegarder |
---|
| 89 | ! |
---|
| 90 | CALL histdef(fileid, "phis", "Surface geop. height", "-", & |
---|
[2343] | 91 | nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, & |
---|
[1447] | 92 | "once", t_ops, t_wrt) |
---|
| 93 | |
---|
| 94 | CALL histdef(fileid, "aire", "Grid area", "-", & |
---|
[2343] | 95 | nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, & |
---|
[1447] | 96 | "once", t_ops, t_wrt) |
---|
[524] | 97 | |
---|
[1447] | 98 | CALL histdef(fileid, "longitudes", "longitudes", "-", & |
---|
[2343] | 99 | nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, & |
---|
[1447] | 100 | "once", t_ops, t_wrt) |
---|
[524] | 101 | |
---|
[1447] | 102 | CALL histdef(fileid, "latitudes", "latitudes", "-", & |
---|
[2343] | 103 | nbp_lon,jj_nb,nhoriid, 1,1,1, -99, 32, & |
---|
[1447] | 104 | "once", t_ops, t_wrt) |
---|
| 105 | ! T |
---|
[2343] | 106 | CALL histdef(fileid, 't', 'Temperature', 'K', nbp_lon, jj_nb, nhoriid, & |
---|
| 107 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 108 | ! mfu |
---|
[2343] | 109 | CALL histdef(fileid, 'mfu', 'flx m. pan. mt', 'kg m/s',nbp_lon, jj_nb, nhoriid, & |
---|
| 110 | nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 111 | ! mfd |
---|
[2343] | 112 | CALL histdef(fileid, 'mfd', 'flx m. pan. des', 'kg m/s',nbp_lon, jj_nb, nhoriid, & |
---|
| 113 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 114 | ! en_u |
---|
[2343] | 115 | CALL histdef(fileid, 'en_u', 'flx ent pan mt', 'kg m/s', nbp_lon, jj_nb, nhoriid, & |
---|
| 116 | nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 117 | ! de_u |
---|
[2343] | 118 | CALL histdef(fileid, 'de_u', 'flx det pan mt', 'kg m/s',nbp_lon, jj_nb, nhoriid, & |
---|
| 119 | nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 120 | ! en_d |
---|
[2343] | 121 | CALL histdef(fileid, 'en_d', 'flx ent pan dt', 'kg m/s', nbp_lon, jj_nb, nhoriid, & |
---|
| 122 | nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 123 | ! de_d |
---|
[2343] | 124 | CALL histdef(fileid, 'de_d', 'flx det pan dt', 'kg m/s', nbp_lon, jj_nb, nhoriid, & |
---|
| 125 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 126 | ! coefh |
---|
[2343] | 127 | CALL histdef(fileid, "coefh", " ", " ", nbp_lon, jj_nb, nhoriid, & |
---|
| 128 | nbp_lev, 1, nbp_lev, zvertiid,32, "inst(X)", t_ops, t_wrt) |
---|
[1447] | 129 | ! fm_th |
---|
[2343] | 130 | CALL histdef(fileid, "fm_th", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
| 131 | nbp_lev, 1, nbp_lev, zvertiid,32, "inst(X)", t_ops, t_wrt) |
---|
[1447] | 132 | ! en_th |
---|
[2343] | 133 | CALL histdef(fileid, "en_th", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
| 134 | nbp_lev, 1, nbp_lev, zvertiid,32, "inst(X)", t_ops, t_wrt) |
---|
[1447] | 135 | ! frac_impa |
---|
[2343] | 136 | CALL histdef(fileid, 'frac_impa', ' ', ' ',nbp_lon, jj_nb, nhoriid, & |
---|
| 137 | nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 138 | ! frac_nucl |
---|
[2343] | 139 | CALL histdef(fileid, 'frac_nucl', ' ', ' ',nbp_lon, jj_nb, nhoriid, & |
---|
| 140 | nbp_lev, 1, nbp_lev, zvertiid,32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 141 | ! pyu1 |
---|
[2343] | 142 | CALL histdef(fileid, "pyu1", " ", " ", nbp_lon,jj_nb,nhoriid, & |
---|
[1447] | 143 | 1,1,1, -99, 32, "inst(X)", t_ops, t_wrt) |
---|
| 144 | ! pyv1 |
---|
[2343] | 145 | CALL histdef(fileid, "pyv1", " ", " ", nbp_lon,jj_nb,nhoriid, & |
---|
[1447] | 146 | 1,1,1, -99, 32,"inst(X)", t_ops, t_wrt) |
---|
| 147 | ! ftsol1 |
---|
[2343] | 148 | CALL histdef(fileid, "ftsol1", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 149 | 1, 1,1, -99,32, "inst(X)", t_ops, t_wrt) |
---|
| 150 | ! ftsol2 |
---|
[2343] | 151 | CALL histdef(fileid, "ftsol2", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 152 | 1, 1,1, -99,32, "inst(X)", t_ops, t_wrt) |
---|
| 153 | ! ftsol3 |
---|
[2343] | 154 | CALL histdef(fileid, "ftsol3", " ", " ", nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 155 | 1, 1,1, -99,32, "inst(X)", t_ops, t_wrt) |
---|
| 156 | ! ftsol4 |
---|
[2343] | 157 | CALL histdef(fileid, "ftsol4", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 158 | 1, 1,1, -99, 32, "inst(X)", t_ops, t_wrt) |
---|
| 159 | ! psrf1 |
---|
[2343] | 160 | CALL histdef(fileid, "psrf1", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 161 | 1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt) |
---|
| 162 | ! psrf2 |
---|
[2343] | 163 | CALL histdef(fileid, "psrf2", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 164 | 1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt) |
---|
| 165 | ! psrf3 |
---|
[2343] | 166 | CALL histdef(fileid, "psrf3", " ", " ",nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 167 | 1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt) |
---|
| 168 | ! psrf4 |
---|
[2343] | 169 | CALL histdef(fileid, "psrf4", " ", " ", nbp_lon, jj_nb, nhoriid, & |
---|
[1447] | 170 | 1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt) |
---|
| 171 | ! sh |
---|
[2343] | 172 | CALL histdef(fileid, 'sh', '', '', nbp_lon, jj_nb, nhoriid, & |
---|
| 173 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 174 | ! da |
---|
[2343] | 175 | CALL histdef(fileid, 'da', '', '', nbp_lon, jj_nb, nhoriid, & |
---|
| 176 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 177 | ! mp |
---|
[2343] | 178 | CALL histdef(fileid, 'mp', '', '', nbp_lon, jj_nb, nhoriid, & |
---|
| 179 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 180 | ! upwd |
---|
[2343] | 181 | CALL histdef(fileid, 'upwd', '', '', nbp_lon, jj_nb, nhoriid, & |
---|
| 182 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 183 | ! dnwd |
---|
[2343] | 184 | CALL histdef(fileid, 'dnwd', '', '', nbp_lon, jj_nb, nhoriid, & |
---|
| 185 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[524] | 186 | |
---|
[1447] | 187 | ! phi |
---|
[2343] | 188 | DO k=1,nbp_lev |
---|
[1447] | 189 | IF (k<10) THEN |
---|
| 190 | WRITE(nvar,'(i1)') k |
---|
| 191 | ELSE IF (k<100) THEN |
---|
| 192 | WRITE(nvar,'(i2)') k |
---|
| 193 | ELSE |
---|
| 194 | WRITE(nvar,'(i3)') k |
---|
| 195 | END IF |
---|
| 196 | nvar='phi_lev'//trim(nvar) |
---|
| 197 | |
---|
[2343] | 198 | CALL histdef(fileid, nvar, '', '', nbp_lon, jj_nb, nhoriid, & |
---|
| 199 | nbp_lev, 1, nbp_lev, zvertiid, 32, 'inst(X)', t_ops, t_wrt) |
---|
[1447] | 200 | END DO |
---|
[766] | 201 | |
---|
[1447] | 202 | CALL histend(fileid) |
---|
| 203 | IF (ok_sync) CALL histsync |
---|
| 204 | !$OMP END MASTER |
---|
[524] | 205 | |
---|
[1447] | 206 | END SUBROUTINE initphysto |
---|