[3331] | 1 | MODULE paramLMDZ_phy_mod |
---|
| 2 | |
---|
| 3 | ! Olivier 13/07/2016 |
---|
| 4 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 5 | |
---|
| 6 | CONTAINS |
---|
| 7 | |
---|
| 8 | SUBROUTINE ini_paramLMDZ_phy(dtime,nid_ctesGCM) |
---|
| 9 | |
---|
| 10 | USE iophy |
---|
| 11 | USE dimphy |
---|
| 12 | USE ioipsl, only: histbeg, histvert, histdef, histend, ymds2ju |
---|
| 13 | USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root |
---|
| 14 | USE geometry_mod, ONLY: longitude_deg, latitude_deg |
---|
| 15 | USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo |
---|
| 16 | USE time_phylmdz_mod, ONLY: annee_ref, day_ref, itau_phy, pdtphys |
---|
| 17 | USE mod_phys_lmdz_transfert_para, ONLY: gather, bcast |
---|
| 18 | |
---|
| 19 | IMPLICIT NONE |
---|
| 20 | |
---|
| 21 | include "clesphys.h" |
---|
| 22 | include "YOMCST.h" |
---|
| 23 | |
---|
| 24 | REAL, INTENT(OUT) :: dtime |
---|
| 25 | INTEGER, INTENT(OUT) :: nid_ctesGCM |
---|
| 26 | |
---|
| 27 | REAL,DIMENSION(klon_glo) :: rlat_glo |
---|
| 28 | REAL,DIMENSION(klon_glo) :: rlon_glo |
---|
| 29 | INTEGER i, idayref, ISW, itau_w |
---|
| 30 | REAL zstophy, zout |
---|
| 31 | REAL zx_lon(nbp_lon,nbp_lat) |
---|
| 32 | REAL zx_lat(nbp_lon,nbp_lat) |
---|
| 33 | |
---|
| 34 | CHARACTER*1 ch1 |
---|
| 35 | INTEGER nhori |
---|
| 36 | INTEGER, PARAMETER :: np=1 |
---|
| 37 | |
---|
| 38 | REAL zjulian |
---|
| 39 | SAVE zjulian |
---|
| 40 | !$OMP THREADPRIVATE(zjulian) |
---|
| 41 | |
---|
| 42 | !IM Implemente en modes sequentiel et parallele |
---|
| 43 | |
---|
| 44 | CALL gather(latitude_deg,rlat_glo) |
---|
| 45 | CALL bcast(rlat_glo) |
---|
| 46 | CALL gather(longitude_deg,rlon_glo) |
---|
| 47 | CALL bcast(rlon_glo) |
---|
| 48 | |
---|
| 49 | !$OMP MASTER |
---|
| 50 | IF (is_mpi_root) THEN |
---|
| 51 | ! |
---|
| 52 | ! zstophy = pdtphys |
---|
| 53 | ! zout = -1 |
---|
| 54 | !--OB modified for daily output |
---|
| 55 | zstophy = 86400. |
---|
| 56 | zout = 86400. |
---|
| 57 | ! |
---|
| 58 | idayref = day_ref |
---|
| 59 | CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian) |
---|
| 60 | ! |
---|
| 61 | CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlon_glo,zx_lon) |
---|
| 62 | IF (nbp_lon.GT.1) THEN |
---|
| 63 | DO i = 1, nbp_lon |
---|
| 64 | zx_lon(i,1) = rlon_glo(i+1) |
---|
| 65 | zx_lon(i,nbp_lat) = rlon_glo(i+1) |
---|
| 66 | ENDDO |
---|
| 67 | ENDIF |
---|
| 68 | ! |
---|
| 69 | CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlat_glo,zx_lat) |
---|
| 70 | ! |
---|
| 71 | CALL histbeg("paramLMDZ_phy.nc", & |
---|
| 72 | np,zx_lon(np:np,1), np,zx_lat(1,np:np), & |
---|
| 73 | 1,1,1,1, & |
---|
| 74 | itau_phy, zjulian, dtime, & |
---|
| 75 | nhori, nid_ctesGCM) |
---|
| 76 | ! |
---|
| 77 | CALL histdef(nid_ctesGCM, "R_ecc", & |
---|
| 78 | "Excentricite","-", & |
---|
| 79 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 80 | "ave(X)", zstophy,zout) |
---|
| 81 | ! |
---|
| 82 | CALL histdef(nid_ctesGCM, "R_peri", & |
---|
| 83 | "Equinoxe","-", & |
---|
| 84 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 85 | "ave(X)", zstophy,zout) |
---|
| 86 | ! |
---|
| 87 | CALL histdef(nid_ctesGCM, "R_incl", & |
---|
| 88 | "Inclinaison","deg", & |
---|
| 89 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 90 | "ave(X)", zstophy,zout) |
---|
| 91 | ! |
---|
| 92 | CALL histdef(nid_ctesGCM, "solaire", & |
---|
| 93 | "Constante solaire","W/m2", & |
---|
| 94 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 95 | "ave(X)", zstophy,zout) |
---|
| 96 | ! |
---|
| 97 | #ifdef CPP_RRTM |
---|
| 98 | IF (iflag_rrtm.EQ.1) THEN |
---|
| 99 | DO ISW=1, NSW |
---|
| 100 | WRITE(ch1,'(i1)') ISW |
---|
| 101 | CALL histdef(nid_ctesGCM, "rsun"//ch1, & |
---|
| 102 | "Fraction constante solaire bande "//ch1,"W/m2", & |
---|
| 103 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 104 | "ave(X)", zstophy,zout) |
---|
| 105 | ENDDO |
---|
| 106 | ENDIF |
---|
| 107 | #endif |
---|
| 108 | ! |
---|
| 109 | CALL histdef(nid_ctesGCM, "co2_ppm", & |
---|
| 110 | "Concentration du CO2", "ppm", & |
---|
| 111 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 112 | "ave(X)", zstophy,zout) |
---|
| 113 | ! |
---|
| 114 | CALL histdef(nid_ctesGCM, "CH4_ppb", & |
---|
| 115 | "Concentration du CH4", "ppb", & |
---|
| 116 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 117 | "ave(X)", zstophy,zout) |
---|
| 118 | ! |
---|
| 119 | CALL histdef(nid_ctesGCM, "N2O_ppb", & |
---|
| 120 | "Concentration du N2O", "ppb", & |
---|
| 121 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 122 | "ave(X)", zstophy,zout) |
---|
| 123 | ! |
---|
| 124 | CALL histdef(nid_ctesGCM, "CFC11_ppt", & |
---|
| 125 | "Concentration du CFC11", "ppt", & |
---|
| 126 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 127 | "ave(X)", zstophy,zout) |
---|
| 128 | ! |
---|
| 129 | CALL histdef(nid_ctesGCM, "CFC12_ppt", & |
---|
| 130 | "Concentration du CFC12", "ppt", & |
---|
| 131 | 1,1,nhori, 1,1,1, -99, 32, & |
---|
| 132 | "ave(X)", zstophy,zout) |
---|
| 133 | ! |
---|
| 134 | CALL histend(nid_ctesGCM) |
---|
| 135 | |
---|
| 136 | ENDIF !(is_mpi_root) |
---|
| 137 | !$OMP END MASTER |
---|
| 138 | |
---|
| 139 | END SUBROUTINE ini_paramLMDZ_phy |
---|
| 140 | |
---|
| 141 | !================================================================= |
---|
| 142 | |
---|
| 143 | SUBROUTINE write_paramLMDZ_phy(itap,nid_ctesGCM,ok_sync) |
---|
| 144 | |
---|
| 145 | USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root |
---|
| 146 | USE time_phylmdz_mod, ONLY: day_step_phy, annee_ref, itau_phy, start_time |
---|
| 147 | USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo |
---|
| 148 | |
---|
| 149 | USE iophy |
---|
| 150 | USE ioipsl, ONLY: histwrite, histsync |
---|
| 151 | |
---|
| 152 | #ifdef CPP_RRTM |
---|
| 153 | USE YOESW, ONLY : RSUN |
---|
| 154 | #endif |
---|
| 155 | |
---|
| 156 | IMPLICIT NONE |
---|
| 157 | |
---|
| 158 | include "clesphys.h" |
---|
| 159 | include "YOMCST.h" |
---|
| 160 | |
---|
| 161 | INTEGER, INTENT(IN) :: itap, nid_ctesGCM |
---|
| 162 | LOGICAL, INTENT(IN) :: ok_sync |
---|
| 163 | |
---|
| 164 | INTEGER itau_w, ISW |
---|
| 165 | INTEGER ndex2d(nbp_lon*nbp_lat) |
---|
| 166 | REAL :: zx_tmp_0d(1,1) |
---|
| 167 | INTEGER, PARAMETER :: np=1 |
---|
| 168 | |
---|
| 169 | CHARACTER*1 ch1 |
---|
| 170 | |
---|
| 171 | !$OMP MASTER |
---|
| 172 | IF (is_mpi_root) THEN |
---|
| 173 | ! |
---|
| 174 | ndex2d = 0 |
---|
| 175 | itau_w = itau_phy + itap + int(start_time * day_step_phy) |
---|
| 176 | ! |
---|
| 177 | ! Variables globales |
---|
| 178 | ! |
---|
| 179 | zx_tmp_0d=R_ecc |
---|
| 180 | CALL histwrite(nid_ctesGCM,"R_ecc",itau_w, & |
---|
| 181 | zx_tmp_0d,np,ndex2d) |
---|
| 182 | ! |
---|
| 183 | zx_tmp_0d=R_peri |
---|
| 184 | CALL histwrite(nid_ctesGCM,"R_peri",itau_w, & |
---|
| 185 | zx_tmp_0d,np,ndex2d) |
---|
| 186 | ! |
---|
| 187 | zx_tmp_0d=R_incl |
---|
| 188 | CALL histwrite(nid_ctesGCM,"R_incl",itau_w, & |
---|
| 189 | zx_tmp_0d,np,ndex2d) |
---|
| 190 | ! |
---|
| 191 | zx_tmp_0d=solaire |
---|
| 192 | CALL histwrite(nid_ctesGCM,"solaire",itau_w, & |
---|
| 193 | zx_tmp_0d,np,ndex2d) |
---|
| 194 | ! |
---|
| 195 | #ifdef CPP_RRTM |
---|
| 196 | IF (iflag_rrtm.EQ.1) THEN |
---|
| 197 | DO ISW=1, NSW |
---|
| 198 | WRITE(ch1,'(i1)') ISW |
---|
| 199 | zx_tmp_0d=RSUN(ISW) |
---|
| 200 | CALL histwrite(nid_ctesGCM,"rsun"//ch1,itau_w, & |
---|
| 201 | zx_tmp_0d,np,ndex2d) |
---|
| 202 | ENDDO |
---|
| 203 | ENDIF |
---|
| 204 | #endif |
---|
| 205 | ! |
---|
| 206 | zx_tmp_0d=co2_ppm |
---|
| 207 | CALL histwrite(nid_ctesGCM,"co2_ppm",itau_w, & |
---|
| 208 | zx_tmp_0d,np,ndex2d) |
---|
| 209 | ! |
---|
| 210 | zx_tmp_0d=CH4_ppb |
---|
| 211 | CALL histwrite(nid_ctesGCM,"CH4_ppb",itau_w, & |
---|
| 212 | zx_tmp_0d,np,ndex2d) |
---|
| 213 | ! |
---|
| 214 | zx_tmp_0d=N2O_ppb |
---|
| 215 | CALL histwrite(nid_ctesGCM,"N2O_ppb",itau_w, & |
---|
| 216 | zx_tmp_0d,np,ndex2d) |
---|
| 217 | ! |
---|
| 218 | zx_tmp_0d=CFC11_ppt |
---|
| 219 | CALL histwrite(nid_ctesGCM,"CFC11_ppt",itau_w, & |
---|
| 220 | zx_tmp_0d,np,ndex2d) |
---|
| 221 | ! |
---|
| 222 | zx_tmp_0d=CFC12_ppt |
---|
| 223 | CALL histwrite(nid_ctesGCM,"CFC12_ppt",itau_w, & |
---|
| 224 | zx_tmp_0d,np,ndex2d) |
---|
| 225 | ! |
---|
| 226 | !================================================================= |
---|
| 227 | ! |
---|
| 228 | IF (ok_sync) THEN |
---|
| 229 | call histsync(nid_ctesGCM) |
---|
| 230 | ENDIF |
---|
| 231 | |
---|
| 232 | ENDIF !(is_mpi_root) then |
---|
| 233 | !$OMP END MASTER |
---|
| 234 | |
---|
| 235 | END SUBROUTINE write_paramLMDZ_phy |
---|
| 236 | |
---|
| 237 | END MODULE paramLMDZ_phy_mod |
---|