[879] | 1 | ! |
---|
[1897] | 2 | ! $Id: iophy.F90 3266 2018-03-14 18:02:21Z acozic $ |
---|
[879] | 3 | ! |
---|
[1807] | 4 | MODULE iophy |
---|
| 5 | |
---|
[1797] | 6 | ! abd REAL,private,allocatable,DIMENSION(:),save :: io_lat |
---|
| 7 | ! abd REAL,private,allocatable,DIMENSION(:),save :: io_lon |
---|
[1791] | 8 | REAL,ALLOCATABLE,DIMENSION(:),SAVE :: io_lat |
---|
| 9 | REAL,ALLOCATABLE,DIMENSION(:),SAVE :: io_lon |
---|
| 10 | INTEGER, SAVE :: phys_domain_id |
---|
| 11 | INTEGER, SAVE :: npstn |
---|
| 12 | INTEGER, ALLOCATABLE, DIMENSION(:), SAVE :: nptabij |
---|
| 13 | INTEGER, SAVE :: itau_iophy |
---|
[3238] | 14 | LOGICAL :: check_dim = .false. |
---|
[1791] | 15 | |
---|
| 16 | !$OMP THREADPRIVATE(itau_iophy) |
---|
[1852] | 17 | |
---|
| 18 | #ifdef CPP_XIOS |
---|
[629] | 19 | INTERFACE histwrite_phy |
---|
[2660] | 20 | !#ifdef CPP_XIOSnew |
---|
[2645] | 21 | MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old,histwrite2d_xios,histwrite3d_xios,histwrite0d_xios |
---|
[2660] | 22 | !#else |
---|
| 23 | ! MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old,histwrite2d_xios,histwrite3d_xios |
---|
| 24 | !#endif |
---|
| 25 | |
---|
[1852] | 26 | END INTERFACE |
---|
| 27 | #else |
---|
| 28 | INTERFACE histwrite_phy |
---|
[1791] | 29 | MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old |
---|
[1001] | 30 | END INTERFACE |
---|
[1852] | 31 | #endif |
---|
[629] | 32 | |
---|
[1539] | 33 | INTERFACE histbeg_phy_all |
---|
[1825] | 34 | MODULE PROCEDURE histbeg_phy,histbeg_phyxios,histbeg_phy_points |
---|
[1539] | 35 | END INTERFACE |
---|
[1001] | 36 | |
---|
[1539] | 37 | |
---|
[1797] | 38 | CONTAINS |
---|
[629] | 39 | |
---|
[1797] | 40 | ! ug Routine pour définir itau_iophy depuis phys_output_write_mod: |
---|
| 41 | SUBROUTINE set_itau_iophy(ito) |
---|
[3266] | 42 | IMPLICIT NONE |
---|
| 43 | INTEGER, INTENT(IN) :: ito |
---|
| 44 | itau_iophy = ito |
---|
[1797] | 45 | END SUBROUTINE |
---|
| 46 | |
---|
| 47 | SUBROUTINE init_iophy_new(rlat,rlon) |
---|
[3266] | 48 | |
---|
| 49 | USE dimphy, ONLY: klon |
---|
| 50 | USE mod_phys_lmdz_para, ONLY: gather, bcast, & |
---|
| 51 | jj_nb, jj_begin, jj_end, ii_begin, ii_end, & |
---|
| 52 | mpi_size, mpi_rank, klon_mpi, & |
---|
[2429] | 53 | is_sequential, is_south_pole_dyn |
---|
[3266] | 54 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo |
---|
| 55 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1897] | 56 | #ifdef CPP_IOIPSL |
---|
[3266] | 57 | USE ioipsl, ONLY: flio_dom_set |
---|
[1897] | 58 | #endif |
---|
| 59 | #ifdef CPP_XIOS |
---|
[3266] | 60 | USE wxios, ONLY: wxios_domain_param |
---|
[1897] | 61 | #endif |
---|
[3266] | 62 | IMPLICIT NONE |
---|
[1797] | 63 | REAL,DIMENSION(klon),INTENT(IN) :: rlon |
---|
| 64 | REAL,DIMENSION(klon),INTENT(IN) :: rlat |
---|
[1001] | 65 | |
---|
[1797] | 66 | REAL,DIMENSION(klon_glo) :: rlat_glo |
---|
| 67 | REAL,DIMENSION(klon_glo) :: rlon_glo |
---|
[1001] | 68 | |
---|
| 69 | INTEGER,DIMENSION(2) :: ddid |
---|
| 70 | INTEGER,DIMENSION(2) :: dsg |
---|
| 71 | INTEGER,DIMENSION(2) :: dsl |
---|
| 72 | INTEGER,DIMENSION(2) :: dpf |
---|
| 73 | INTEGER,DIMENSION(2) :: dpl |
---|
| 74 | INTEGER,DIMENSION(2) :: dhs |
---|
| 75 | INTEGER,DIMENSION(2) :: dhe |
---|
| 76 | INTEGER :: i |
---|
[1852] | 77 | INTEGER :: data_ibegin, data_iend |
---|
[1001] | 78 | |
---|
| 79 | CALL gather(rlat,rlat_glo) |
---|
| 80 | CALL bcast(rlat_glo) |
---|
| 81 | CALL gather(rlon,rlon_glo) |
---|
| 82 | CALL bcast(rlon_glo) |
---|
| 83 | |
---|
| 84 | !$OMP MASTER |
---|
[2350] | 85 | ALLOCATE(io_lat(nbp_lat)) |
---|
| 86 | IF (klon_glo == 1) THEN |
---|
| 87 | io_lat(1)=rlat_glo(1) |
---|
| 88 | ELSE |
---|
| 89 | io_lat(1)=rlat_glo(1) |
---|
| 90 | io_lat(nbp_lat)=rlat_glo(klon_glo) |
---|
[2344] | 91 | DO i=2,nbp_lat-1 |
---|
| 92 | io_lat(i)=rlat_glo(2+(i-2)*nbp_lon) |
---|
[1001] | 93 | ENDDO |
---|
| 94 | ENDIF |
---|
| 95 | |
---|
[2344] | 96 | ALLOCATE(io_lon(nbp_lon)) |
---|
| 97 | IF (klon_glo == 1) THEN |
---|
| 98 | io_lon(1)=rlon_glo(1) |
---|
| 99 | ELSE |
---|
| 100 | io_lon(1:nbp_lon)=rlon_glo(2:nbp_lon+1) |
---|
| 101 | ENDIF |
---|
| 102 | |
---|
[1852] | 103 | !! (I) dtnb : total number of domains |
---|
| 104 | !! (I) dnb : domain number |
---|
| 105 | !! (I) did(:) : distributed dimensions identifiers |
---|
| 106 | !! (up to 5 dimensions are supported) |
---|
| 107 | !! (I) dsg(:) : total number of points for each dimension |
---|
| 108 | !! (I) dsl(:) : local number of points for each dimension |
---|
| 109 | !! (I) dpf(:) : position of first local point for each dimension |
---|
| 110 | !! (I) dpl(:) : position of last local point for each dimension |
---|
| 111 | !! (I) dhs(:) : start halo size for each dimension |
---|
| 112 | !! (I) dhe(:) : end halo size for each dimension |
---|
| 113 | !! (C) cdnm : Model domain definition name. |
---|
| 114 | !! The names actually supported are : |
---|
| 115 | !! "BOX", "APPLE", "ORANGE". |
---|
| 116 | !! These names are case insensitive. |
---|
[1001] | 117 | |
---|
| 118 | ddid=(/ 1,2 /) |
---|
[2344] | 119 | dsg=(/ nbp_lon, nbp_lat /) |
---|
| 120 | dsl=(/ nbp_lon, jj_nb /) |
---|
[1001] | 121 | dpf=(/ 1,jj_begin /) |
---|
[2344] | 122 | dpl=(/ nbp_lon, jj_end /) |
---|
[1001] | 123 | dhs=(/ ii_begin-1,0 /) |
---|
[1797] | 124 | IF (mpi_rank==mpi_size-1) THEN |
---|
[1001] | 125 | dhe=(/0,0/) |
---|
[1797] | 126 | ELSE |
---|
[2344] | 127 | dhe=(/ nbp_lon-ii_end,0 /) |
---|
[1797] | 128 | ENDIF |
---|
[1852] | 129 | |
---|
[2097] | 130 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1797] | 131 | CALL flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, & |
---|
[1001] | 132 | 'APPLE',phys_domain_id) |
---|
[1852] | 133 | #endif |
---|
[1825] | 134 | #ifdef CPP_XIOS |
---|
[1897] | 135 | ! Set values for the mask: |
---|
[1852] | 136 | IF (mpi_rank == 0) THEN |
---|
| 137 | data_ibegin = 0 |
---|
| 138 | ELSE |
---|
| 139 | data_ibegin = ii_begin - 1 |
---|
[2854] | 140 | ENDIF |
---|
[1852] | 141 | |
---|
| 142 | IF (mpi_rank == mpi_size-1) THEN |
---|
| 143 | data_iend = nbp_lon |
---|
| 144 | ELSE |
---|
| 145 | data_iend = ii_end + 1 |
---|
[2854] | 146 | ENDIF |
---|
[1852] | 147 | |
---|
[2854] | 148 | IF (prt_level>=10) THEN |
---|
[1897] | 149 | write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end |
---|
| 150 | write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat |
---|
| 151 | write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend |
---|
| 152 | write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend |
---|
[2429] | 153 | write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn |
---|
[2854] | 154 | ENDIF |
---|
[1852] | 155 | |
---|
[1897] | 156 | ! Initialize the XIOS domain coreesponding to this process: |
---|
[1852] | 157 | CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, & |
---|
| 158 | 1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end, & |
---|
| 159 | klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend, & |
---|
[2429] | 160 | io_lat, io_lon,is_south_pole_dyn,mpi_rank) |
---|
[1825] | 161 | #endif |
---|
[1001] | 162 | !$OMP END MASTER |
---|
| 163 | |
---|
[1797] | 164 | END SUBROUTINE init_iophy_new |
---|
[1001] | 165 | |
---|
[3266] | 166 | |
---|
[1797] | 167 | SUBROUTINE init_iophy(lat,lon) |
---|
[3266] | 168 | |
---|
| 169 | USE mod_phys_lmdz_para, ONLY: jj_begin, jj_end, ii_begin, ii_end, jj_nb, & |
---|
| 170 | mpi_size, mpi_rank |
---|
| 171 | USE ioipsl, ONLY: flio_dom_set |
---|
| 172 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
| 173 | |
---|
| 174 | IMPLICIT NONE |
---|
| 175 | |
---|
[2344] | 176 | REAL,DIMENSION(nbp_lon),INTENT(IN) :: lon |
---|
| 177 | REAL,DIMENSION(nbp_lat),INTENT(IN) :: lat |
---|
[766] | 178 | |
---|
| 179 | INTEGER,DIMENSION(2) :: ddid |
---|
| 180 | INTEGER,DIMENSION(2) :: dsg |
---|
| 181 | INTEGER,DIMENSION(2) :: dsl |
---|
| 182 | INTEGER,DIMENSION(2) :: dpf |
---|
| 183 | INTEGER,DIMENSION(2) :: dpl |
---|
| 184 | INTEGER,DIMENSION(2) :: dhs |
---|
| 185 | INTEGER,DIMENSION(2) :: dhe |
---|
| 186 | |
---|
| 187 | !$OMP MASTER |
---|
[2854] | 188 | ALLOCATE(io_lat(nbp_lat)) |
---|
[629] | 189 | io_lat(:)=lat(:) |
---|
[2854] | 190 | ALLOCATE(io_lon(nbp_lon)) |
---|
[629] | 191 | io_lon(:)=lon(:) |
---|
[1331] | 192 | |
---|
[766] | 193 | ddid=(/ 1,2 /) |
---|
[2344] | 194 | dsg=(/ nbp_lon, nbp_lat /) |
---|
| 195 | dsl=(/ nbp_lon, jj_nb /) |
---|
[776] | 196 | dpf=(/ 1,jj_begin /) |
---|
[2344] | 197 | dpl=(/ nbp_lon, jj_end /) |
---|
[776] | 198 | dhs=(/ ii_begin-1,0 /) |
---|
[2854] | 199 | IF (mpi_rank==mpi_size-1) THEN |
---|
[766] | 200 | dhe=(/0,0/) |
---|
[2854] | 201 | ELSE |
---|
[2344] | 202 | dhe=(/ nbp_lon-ii_end,0 /) |
---|
[2854] | 203 | ENDIF |
---|
[766] | 204 | |
---|
[2097] | 205 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[776] | 206 | call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, & |
---|
[766] | 207 | 'APPLE',phys_domain_id) |
---|
[1852] | 208 | #endif |
---|
[766] | 209 | !$OMP END MASTER |
---|
| 210 | |
---|
[2854] | 211 | END SUBROUTINE init_iophy |
---|
[1825] | 212 | |
---|
| 213 | SUBROUTINE histbeg_phyxios(name,itau0,zjulian,dtime,ffreq,lev,nhori,nid_day) |
---|
[1897] | 214 | ! USE dimphy |
---|
[2854] | 215 | USE mod_phys_lmdz_para, ONLY: is_sequential, is_using_mpi, is_mpi_root, & |
---|
[1897] | 216 | jj_begin, jj_end, jj_nb |
---|
[2344] | 217 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[2854] | 218 | USE ioipsl, ONLY: histbeg |
---|
[1897] | 219 | #ifdef CPP_XIOS |
---|
[2854] | 220 | USE wxios, ONLY: wxios_add_file |
---|
[1897] | 221 | #endif |
---|
[1825] | 222 | IMPLICIT NONE |
---|
[3266] | 223 | INCLUDE 'clesphys.h' |
---|
[1825] | 224 | |
---|
[3266] | 225 | CHARACTER*(*), INTENT(IN) :: name |
---|
| 226 | INTEGER, INTENT(IN) :: itau0 |
---|
| 227 | REAL,INTENT(IN) :: zjulian |
---|
| 228 | REAL,INTENT(IN) :: dtime |
---|
| 229 | CHARACTER(LEN=*), INTENT(IN) :: ffreq |
---|
| 230 | INTEGER,INTENT(IN) :: lev |
---|
| 231 | INTEGER,INTENT(OUT) :: nhori |
---|
| 232 | INTEGER,INTENT(OUT) :: nid_day |
---|
[1825] | 233 | |
---|
| 234 | !$OMP MASTER |
---|
[3266] | 235 | IF (is_sequential) THEN |
---|
| 236 | CALL histbeg(name,nbp_lon,io_lon, jj_nb,io_lat(jj_begin:jj_end), & |
---|
| 237 | 1,nbp_lon,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day) |
---|
| 238 | ELSE |
---|
| 239 | CALL histbeg(name,nbp_lon,io_lon, jj_nb,io_lat(jj_begin:jj_end), & |
---|
| 240 | 1,nbp_lon,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day,phys_domain_id) |
---|
| 241 | ENDIF |
---|
[1825] | 242 | |
---|
| 243 | #ifdef CPP_XIOS |
---|
[3266] | 244 | ! ug OMP en chantier... |
---|
| 245 | IF((.NOT. is_using_mpi) .OR. is_mpi_root) THEN |
---|
| 246 | ! ug Création du fichier |
---|
| 247 | IF (.not. ok_all_xml) THEN |
---|
| 248 | CALL wxios_add_file(name, ffreq, lev) |
---|
[2854] | 249 | ENDIF |
---|
[3266] | 250 | ENDIF |
---|
[1825] | 251 | #endif |
---|
| 252 | !$OMP END MASTER |
---|
[629] | 253 | |
---|
[1825] | 254 | END SUBROUTINE histbeg_phyxios |
---|
| 255 | |
---|
[1797] | 256 | SUBROUTINE histbeg_phy(name,itau0,zjulian,dtime,nhori,nid_day) |
---|
[1897] | 257 | |
---|
[2854] | 258 | USE mod_phys_lmdz_para, ONLY: jj_begin, jj_end, jj_nb, is_sequential |
---|
[2344] | 259 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[2854] | 260 | USE ioipsl, ONLY: histbeg |
---|
[1897] | 261 | |
---|
[1797] | 262 | IMPLICIT NONE |
---|
[629] | 263 | |
---|
[2854] | 264 | CHARACTER*(*), INTENT(IN) :: name |
---|
| 265 | INTEGER, INTENT(IN) :: itau0 |
---|
[1797] | 266 | REAL,INTENT(IN) :: zjulian |
---|
| 267 | REAL,INTENT(IN) :: dtime |
---|
[2854] | 268 | INTEGER,INTENT(OUT) :: nhori |
---|
| 269 | INTEGER,INTENT(OUT) :: nid_day |
---|
[766] | 270 | |
---|
| 271 | !$OMP MASTER |
---|
[2097] | 272 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[2854] | 273 | IF (is_sequential) THEN |
---|
[3266] | 274 | CALL histbeg(name,nbp_lon,io_lon, jj_nb,io_lat(jj_begin:jj_end), & |
---|
[2344] | 275 | 1,nbp_lon,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day) |
---|
[2854] | 276 | ELSE |
---|
[3266] | 277 | CALL histbeg(name,nbp_lon,io_lon, jj_nb,io_lat(jj_begin:jj_end), & |
---|
[2344] | 278 | 1,nbp_lon,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day,phys_domain_id) |
---|
[2854] | 279 | ENDIF |
---|
[1852] | 280 | #endif |
---|
[766] | 281 | !$OMP END MASTER |
---|
[629] | 282 | |
---|
[1797] | 283 | END SUBROUTINE histbeg_phy |
---|
[1539] | 284 | |
---|
[1825] | 285 | |
---|
[1797] | 286 | SUBROUTINE histbeg_phy_points(rlon,rlat,pim,tabij,ipt,jpt, & |
---|
[1539] | 287 | plon,plat,plon_bounds,plat_bounds, & |
---|
| 288 | nname,itau0,zjulian,dtime,nnhori,nnid_day) |
---|
[2854] | 289 | USE dimphy, ONLY: klon |
---|
| 290 | USE mod_phys_lmdz_para, ONLY: gather, bcast, & |
---|
[1897] | 291 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
| 292 | mpi_rank |
---|
[2854] | 293 | USE mod_grid_phy_lmdz, ONLY: klon_glo, nbp_lon, nbp_lat |
---|
| 294 | USE ioipsl, ONLY: histbeg |
---|
[1897] | 295 | |
---|
[1797] | 296 | IMPLICIT NONE |
---|
[1539] | 297 | |
---|
[1797] | 298 | REAL,DIMENSION(klon),INTENT(IN) :: rlon |
---|
| 299 | REAL,DIMENSION(klon),INTENT(IN) :: rlat |
---|
[2854] | 300 | INTEGER, INTENT(IN) :: itau0 |
---|
[1797] | 301 | REAL,INTENT(IN) :: zjulian |
---|
| 302 | REAL,INTENT(IN) :: dtime |
---|
[2854] | 303 | INTEGER, INTENT(IN) :: pim |
---|
| 304 | INTEGER, intent(out) :: nnhori |
---|
| 305 | CHARACTER(len=20), INTENT(IN) :: nname |
---|
| 306 | INTEGER, INTENT(OUT) :: nnid_day |
---|
| 307 | INTEGER :: i |
---|
[1797] | 308 | REAL,DIMENSION(klon_glo) :: rlat_glo |
---|
| 309 | REAL,DIMENSION(klon_glo) :: rlon_glo |
---|
| 310 | INTEGER, DIMENSION(pim), INTENT(IN) :: tabij |
---|
| 311 | REAL,DIMENSION(pim), INTENT(IN) :: plat, plon |
---|
| 312 | INTEGER,DIMENSION(pim), INTENT(IN) :: ipt, jpt |
---|
| 313 | REAL,DIMENSION(pim,2), intent(out) :: plat_bounds, plon_bounds |
---|
[1539] | 314 | |
---|
| 315 | INTEGER, SAVE :: tabprocbeg, tabprocend |
---|
| 316 | !$OMP THREADPRIVATE(tabprocbeg, tabprocend) |
---|
| 317 | INTEGER :: ip |
---|
| 318 | INTEGER, PARAMETER :: nip=1 |
---|
| 319 | INTEGER :: npproc |
---|
[1797] | 320 | REAL, allocatable, DIMENSION(:) :: npplat, npplon |
---|
| 321 | REAL, allocatable, DIMENSION(:,:) :: npplat_bounds, npplon_bounds |
---|
[2344] | 322 | REAL, DIMENSION(nbp_lon,nbp_lat) :: zx_lon, zx_lat |
---|
[1539] | 323 | |
---|
| 324 | CALL gather(rlat,rlat_glo) |
---|
| 325 | CALL bcast(rlat_glo) |
---|
| 326 | CALL gather(rlon,rlon_glo) |
---|
| 327 | CALL bcast(rlon_glo) |
---|
| 328 | |
---|
| 329 | !$OMP MASTER |
---|
| 330 | DO i=1,pim |
---|
| 331 | |
---|
| 332 | ! print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i) |
---|
| 333 | |
---|
| 334 | plon_bounds(i,1)=rlon_glo(tabij(i)-1) |
---|
| 335 | plon_bounds(i,2)=rlon_glo(tabij(i)+1) |
---|
[2854] | 336 | IF (plon_bounds(i,2).LE.0..AND.plon_bounds(i,1).GE.0.) THEN |
---|
| 337 | IF (rlon_glo(tabij(i)).GE.0.) THEN |
---|
[1539] | 338 | plon_bounds(i,2)=-1*plon_bounds(i,2) |
---|
[2854] | 339 | ENDIF |
---|
| 340 | ENDIF |
---|
| 341 | IF (plon_bounds(i,2).GE.0..AND.plon_bounds(i,1).LE.0.) THEN |
---|
| 342 | IF (rlon_glo(tabij(i)).LE.0.) THEN |
---|
[1539] | 343 | plon_bounds(i,2)=-1*plon_bounds(i,2) |
---|
[2854] | 344 | ENDIF |
---|
| 345 | ENDIF |
---|
[1539] | 346 | ! |
---|
[2344] | 347 | IF ( tabij(i).LE.nbp_lon) THEN |
---|
[1539] | 348 | plat_bounds(i,1)=rlat_glo(tabij(i)) |
---|
| 349 | ELSE |
---|
[2344] | 350 | plat_bounds(i,1)=rlat_glo(tabij(i)-nbp_lon) |
---|
[1539] | 351 | ENDIF |
---|
[2344] | 352 | plat_bounds(i,2)=rlat_glo(tabij(i)+nbp_lon) |
---|
[1539] | 353 | ! |
---|
| 354 | ! print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon_glo(tabij(i)),plon_bounds(i,2) |
---|
| 355 | ! print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat_glo(tabij(i)),plat_bounds(i,2) |
---|
| 356 | ! |
---|
| 357 | ENDDO |
---|
| 358 | if (is_sequential) then |
---|
| 359 | |
---|
| 360 | npstn=pim |
---|
| 361 | IF(.NOT. ALLOCATED(nptabij)) THEN |
---|
| 362 | ALLOCATE(nptabij(pim)) |
---|
| 363 | ENDIF |
---|
| 364 | DO i=1,pim |
---|
| 365 | nptabij(i)=tabij(i) |
---|
| 366 | ENDDO |
---|
| 367 | |
---|
[2344] | 368 | CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlon_glo,zx_lon) |
---|
[2854] | 369 | IF ((nbp_lon*nbp_lat).GT.1) THEN |
---|
[2344] | 370 | DO i = 1, nbp_lon |
---|
[1539] | 371 | zx_lon(i,1) = rlon_glo(i+1) |
---|
[2344] | 372 | zx_lon(i,nbp_lat) = rlon_glo(i+1) |
---|
[1539] | 373 | ENDDO |
---|
[2854] | 374 | ENDIF |
---|
[2344] | 375 | CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,rlat_glo,zx_lat) |
---|
[1539] | 376 | |
---|
| 377 | DO i=1,pim |
---|
| 378 | ! print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i) |
---|
| 379 | |
---|
| 380 | plon_bounds(i,1)=zx_lon(ipt(i)-1,jpt(i)) |
---|
| 381 | plon_bounds(i,2)=zx_lon(ipt(i)+1,jpt(i)) |
---|
| 382 | |
---|
[2854] | 383 | IF (ipt(i).EQ.1) THEN |
---|
[2344] | 384 | plon_bounds(i,1)=zx_lon(nbp_lon,jpt(i)) |
---|
[1539] | 385 | plon_bounds(i,2)=360.+zx_lon(ipt(i)+1,jpt(i)) |
---|
[2854] | 386 | ENDIF |
---|
[1539] | 387 | |
---|
[2854] | 388 | IF (ipt(i).EQ.nbp_lon) THEN |
---|
[1539] | 389 | plon_bounds(i,2)=360.+zx_lon(1,jpt(i)) |
---|
[2854] | 390 | ENDIF |
---|
[1539] | 391 | |
---|
| 392 | plat_bounds(i,1)=zx_lat(ipt(i),jpt(i)-1) |
---|
| 393 | plat_bounds(i,2)=zx_lat(ipt(i),jpt(i)+1) |
---|
| 394 | |
---|
[2854] | 395 | IF (jpt(i).EQ.1) THEN |
---|
[1539] | 396 | plat_bounds(i,1)=zx_lat(ipt(i),1)+0.001 |
---|
| 397 | plat_bounds(i,2)=zx_lat(ipt(i),1)-0.001 |
---|
[2854] | 398 | ENDIF |
---|
[1539] | 399 | |
---|
[2854] | 400 | IF (jpt(i).EQ.nbp_lat) THEN |
---|
[2344] | 401 | plat_bounds(i,1)=zx_lat(ipt(i),nbp_lat)+0.001 |
---|
| 402 | plat_bounds(i,2)=zx_lat(ipt(i),nbp_lat)-0.001 |
---|
[2854] | 403 | ENDIF |
---|
[1539] | 404 | ! |
---|
| 405 | ! print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon(tabij(i)),plon_bounds(i,2) |
---|
| 406 | ! print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat(tabij(i)),plat_bounds(i,2) |
---|
| 407 | ! |
---|
| 408 | ENDDO |
---|
[1897] | 409 | |
---|
[2097] | 410 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[3266] | 411 | CALL histbeg(nname,pim,plon,plon_bounds, & |
---|
[1539] | 412 | plat,plat_bounds, & |
---|
| 413 | itau0, zjulian, dtime, nnhori, nnid_day) |
---|
[1852] | 414 | #endif |
---|
[2854] | 415 | ELSE |
---|
[1539] | 416 | npproc=0 |
---|
| 417 | DO ip=1, pim |
---|
| 418 | tabprocbeg=klon_mpi_begin |
---|
| 419 | tabprocend=klon_mpi_end |
---|
| 420 | IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN |
---|
| 421 | npproc=npproc+1 |
---|
| 422 | npstn=npproc |
---|
| 423 | ENDIF |
---|
| 424 | ENDDO |
---|
| 425 | ! print*,'CFMIP_iophy mpi_rank npstn',mpi_rank,npstn |
---|
| 426 | IF(.NOT. ALLOCATED(nptabij)) THEN |
---|
| 427 | ALLOCATE(nptabij(npstn)) |
---|
| 428 | ALLOCATE(npplon(npstn), npplat(npstn)) |
---|
| 429 | ALLOCATE(npplon_bounds(npstn,2), npplat_bounds(npstn,2)) |
---|
| 430 | ENDIF |
---|
| 431 | npproc=0 |
---|
| 432 | DO ip=1, pim |
---|
| 433 | IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN |
---|
| 434 | npproc=npproc+1 |
---|
| 435 | nptabij(npproc)=tabij(ip) |
---|
| 436 | ! print*,'mpi_rank npproc ip plon plat tabij=',mpi_rank,npproc,ip, & |
---|
| 437 | ! plon(ip),plat(ip),tabij(ip) |
---|
| 438 | npplon(npproc)=plon(ip) |
---|
| 439 | npplat(npproc)=plat(ip) |
---|
| 440 | npplon_bounds(npproc,1)=plon_bounds(ip,1) |
---|
| 441 | npplon_bounds(npproc,2)=plon_bounds(ip,2) |
---|
| 442 | npplat_bounds(npproc,1)=plat_bounds(ip,1) |
---|
| 443 | npplat_bounds(npproc,2)=plat_bounds(ip,2) |
---|
| 444 | !!! |
---|
| 445 | !!! print qui sert a reordonner les points stations selon l'ordre CFMIP |
---|
| 446 | !!! ne pas enlever |
---|
| 447 | print*,'iophy_mpi rank ip lon lat',mpi_rank,ip,plon(ip),plat(ip) |
---|
| 448 | !!! |
---|
| 449 | ENDIF |
---|
| 450 | ENDDO |
---|
[2097] | 451 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[3266] | 452 | CALL histbeg(nname,npstn,npplon,npplon_bounds, & |
---|
[1539] | 453 | npplat,npplat_bounds, & |
---|
| 454 | itau0,zjulian,dtime,nnhori,nnid_day,phys_domain_id) |
---|
[1852] | 455 | #endif |
---|
[2854] | 456 | ENDIF |
---|
[1539] | 457 | !$OMP END MASTER |
---|
| 458 | |
---|
[2854] | 459 | END SUBROUTINE histbeg_phy_points |
---|
[1807] | 460 | |
---|
| 461 | |
---|
| 462 | SUBROUTINE histdef2d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar) |
---|
| 463 | |
---|
[2854] | 464 | USE ioipsl, ONLY: histdef |
---|
[3238] | 465 | USE mod_phys_lmdz_para, ONLY: jj_nb, is_master |
---|
[2854] | 466 | USE phys_output_var_mod, ONLY: type_ecri, zoutm, zdtime_moy, lev_files, & |
---|
[2989] | 467 | nid_files, nhorim, swaero_diag, dryaod_diag, nfiles, & |
---|
| 468 | ok_4xCO2atm |
---|
[2344] | 469 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[2854] | 470 | USE aero_mod, ONLY : naero_tot, name_aero_tau |
---|
[3238] | 471 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[2854] | 472 | |
---|
[1807] | 473 | IMPLICIT NONE |
---|
| 474 | |
---|
| 475 | INCLUDE "clesphys.h" |
---|
| 476 | |
---|
| 477 | INTEGER :: iff |
---|
[2854] | 478 | INTEGER :: naero |
---|
[1807] | 479 | LOGICAL :: lpoint |
---|
| 480 | INTEGER, DIMENSION(nfiles) :: flag_var |
---|
[2854] | 481 | CHARACTER(LEN=20) :: nomvar |
---|
[1807] | 482 | CHARACTER(LEN=*) :: titrevar |
---|
| 483 | CHARACTER(LEN=*) :: unitvar |
---|
| 484 | |
---|
| 485 | REAL zstophym |
---|
| 486 | |
---|
| 487 | IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN |
---|
| 488 | zstophym=zoutm(iff) |
---|
| 489 | ELSE |
---|
| 490 | zstophym=zdtime_moy |
---|
| 491 | ENDIF |
---|
[3238] | 492 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histdef2d_old for ', nomvar |
---|
[1807] | 493 | ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def |
---|
| 494 | CALL conf_physoutputs(nomvar,flag_var) |
---|
| 495 | |
---|
| 496 | IF(.NOT.lpoint) THEN |
---|
| 497 | IF ( flag_var(iff)<=lev_files(iff) ) THEN |
---|
| 498 | CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, & |
---|
[2344] | 499 | nbp_lon,jj_nb,nhorim(iff), 1,1,1, -99, 32, & |
---|
[1807] | 500 | type_ecri(iff), zstophym,zoutm(iff)) |
---|
| 501 | ENDIF |
---|
| 502 | ELSE |
---|
| 503 | IF ( flag_var(iff)<=lev_files(iff) ) THEN |
---|
| 504 | CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, & |
---|
| 505 | npstn,1,nhorim(iff), 1,1,1, -99, 32, & |
---|
| 506 | type_ecri(iff), zstophym,zoutm(iff)) |
---|
| 507 | ENDIF |
---|
| 508 | ENDIF |
---|
| 509 | |
---|
| 510 | ! Set swaero_diag=true if at least one of the concerned variables are defined |
---|
[2854] | 511 | IF (nomvar=='topswad' .OR. nomvar=='topswad0' .OR. nomvar=='solswad' .OR. nomvar=='solswad0' .OR. & |
---|
| 512 | nomvar=='toplwad' .OR. nomvar=='toplwad0' .OR. nomvar=='sollwad' .OR. nomvar=='sollwad0' .OR. & |
---|
| 513 | nomvar=='topswai' .OR. nomvar=='solswai' ) THEN |
---|
| 514 | IF ( flag_var(iff)<=lev_files(iff) ) swaero_diag=.TRUE. |
---|
| 515 | ENDIF |
---|
[1807] | 516 | |
---|
[2854] | 517 | ! Set dryaod_diag=true if at least one of the concerned variables are defined |
---|
[2856] | 518 | IF (nomvar=='dryod550aer') THEN |
---|
| 519 | IF ( flag_var(iff)<=lev_files(iff) ) dryaod_diag=.TRUE. |
---|
| 520 | ENDIF |
---|
[2854] | 521 | DO naero = 1, naero_tot-1 |
---|
| 522 | IF (nomvar=='dryod550_'//name_aero_tau(naero)) THEN |
---|
| 523 | IF ( flag_var(iff)<=lev_files(iff) ) dryaod_diag=.TRUE. |
---|
| 524 | ENDIF |
---|
| 525 | ENDDO |
---|
[1807] | 526 | |
---|
[2989] | 527 | ! Set ok_4xCO2atm=true if at least one of the concerned variables are |
---|
| 528 | ! defined |
---|
| 529 | IF (nomvar=='rsut4co2'.OR.nomvar=='rlut4co2'.OR.nomvar=='rsutcs4co2' & |
---|
| 530 | .OR. nomvar=='rlutcs4co2'.OR.nomvar=='rsu4co2'.OR.nomvar=='rsucs4co2' & |
---|
| 531 | .OR.nomvar=='rsu4co2'.OR.nomvar=='rsucs4co2'.OR.nomvar=='rsd4co2'.OR. & |
---|
| 532 | nomvar=='rsdcs4co2'.OR.nomvar=='rlu4co2'.OR.nomvar=='rlucs4co2'.OR.& |
---|
| 533 | nomvar=='rld4co2'.OR.nomvar=='rldcs4co2') THEN |
---|
| 534 | IF ( flag_var(iff)<=lev_files(iff) ) ok_4xCO2atm=.TRUE. |
---|
| 535 | ENDIF |
---|
[2854] | 536 | END SUBROUTINE histdef2d_old |
---|
[1807] | 537 | |
---|
| 538 | SUBROUTINE histdef3d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar) |
---|
| 539 | |
---|
[2854] | 540 | USE ioipsl, ONLY: histdef |
---|
| 541 | USE dimphy, ONLY: klev |
---|
[3238] | 542 | USE mod_phys_lmdz_para, ONLY: jj_nb, is_master |
---|
[2854] | 543 | USE phys_output_var_mod, ONLY: type_ecri, zoutm, lev_files, nid_files, & |
---|
[1897] | 544 | nhorim, zdtime_moy, levmin, levmax, & |
---|
| 545 | nvertm, nfiles |
---|
[2344] | 546 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[3238] | 547 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1807] | 548 | IMPLICIT NONE |
---|
| 549 | |
---|
| 550 | INCLUDE "clesphys.h" |
---|
| 551 | |
---|
| 552 | INTEGER :: iff |
---|
| 553 | LOGICAL :: lpoint |
---|
| 554 | INTEGER, DIMENSION(nfiles) :: flag_var |
---|
| 555 | CHARACTER(LEN=20) :: nomvar |
---|
| 556 | CHARACTER(LEN=*) :: titrevar |
---|
| 557 | CHARACTER(LEN=*) :: unitvar |
---|
| 558 | |
---|
| 559 | REAL zstophym |
---|
| 560 | |
---|
| 561 | ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def |
---|
| 562 | CALL conf_physoutputs(nomvar,flag_var) |
---|
| 563 | |
---|
[3238] | 564 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histdef3d_old for ', nomvar |
---|
| 565 | |
---|
[1807] | 566 | IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN |
---|
| 567 | zstophym=zoutm(iff) |
---|
| 568 | ELSE |
---|
| 569 | zstophym=zdtime_moy |
---|
| 570 | ENDIF |
---|
| 571 | |
---|
| 572 | IF(.NOT.lpoint) THEN |
---|
| 573 | IF ( flag_var(iff)<=lev_files(iff) ) THEN |
---|
| 574 | CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, & |
---|
[2344] | 575 | nbp_lon, jj_nb, nhorim(iff), klev, levmin(iff), & |
---|
[1807] | 576 | levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), & |
---|
| 577 | zstophym, zoutm(iff)) |
---|
| 578 | ENDIF |
---|
| 579 | ELSE |
---|
| 580 | IF ( flag_var(iff)<=lev_files(iff) ) THEN |
---|
| 581 | CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, & |
---|
| 582 | npstn,1,nhorim(iff), klev, levmin(iff), & |
---|
| 583 | levmax(iff)-levmin(iff)+1, nvertm(iff), 32, & |
---|
| 584 | type_ecri(iff), zstophym,zoutm(iff)) |
---|
| 585 | ENDIF |
---|
| 586 | ENDIF |
---|
| 587 | END SUBROUTINE histdef3d_old |
---|
| 588 | |
---|
| 589 | SUBROUTINE histdef2d (iff,var) |
---|
| 590 | |
---|
[2854] | 591 | USE ioipsl, ONLY: histdef |
---|
[3238] | 592 | USE mod_phys_lmdz_para, ONLY: jj_nb, is_master |
---|
[2854] | 593 | USE phys_output_var_mod, ONLY: ctrl_out, type_ecri_files, zoutm, zdtime_moy, & |
---|
[1897] | 594 | clef_stations, phys_out_filenames, lev_files, & |
---|
[3082] | 595 | nid_files, nhorim, swaerofree_diag, swaero_diag, dryaod_diag,& |
---|
[2989] | 596 | ok_4xCO2atm |
---|
[2319] | 597 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[2344] | 598 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[2854] | 599 | USE aero_mod, ONLY : naero_tot, name_aero_tau |
---|
[1897] | 600 | #ifdef CPP_XIOS |
---|
[2854] | 601 | USE wxios, ONLY: wxios_add_field_to_file |
---|
[1897] | 602 | #endif |
---|
[3238] | 603 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1807] | 604 | IMPLICIT NONE |
---|
| 605 | |
---|
| 606 | INCLUDE "clesphys.h" |
---|
| 607 | |
---|
| 608 | INTEGER :: iff |
---|
[2854] | 609 | INTEGER :: naero |
---|
[1807] | 610 | TYPE(ctrl_out) :: var |
---|
| 611 | |
---|
| 612 | REAL zstophym |
---|
| 613 | CHARACTER(LEN=20) :: typeecrit |
---|
| 614 | |
---|
[3238] | 615 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histdef2d for ', var%name |
---|
| 616 | |
---|
[1807] | 617 | ! ug On récupère le type écrit de la structure: |
---|
| 618 | ! Assez moche, à refaire si meilleure méthode... |
---|
| 619 | IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN |
---|
| 620 | typeecrit = 'once' |
---|
| 621 | ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN |
---|
| 622 | typeecrit = 't_min(X)' |
---|
| 623 | ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN |
---|
| 624 | typeecrit = 't_max(X)' |
---|
| 625 | ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN |
---|
| 626 | typeecrit = 'inst(X)' |
---|
| 627 | ELSE |
---|
| 628 | typeecrit = type_ecri_files(iff) |
---|
| 629 | ENDIF |
---|
| 630 | |
---|
| 631 | IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN |
---|
| 632 | zstophym=zoutm(iff) |
---|
| 633 | ELSE |
---|
| 634 | zstophym=zdtime_moy |
---|
| 635 | ENDIF |
---|
| 636 | |
---|
| 637 | ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def |
---|
| 638 | CALL conf_physoutputs(var%name, var%flag) |
---|
| 639 | |
---|
| 640 | IF(.NOT.clef_stations(iff)) THEN |
---|
[1852] | 641 | |
---|
[1825] | 642 | #ifdef CPP_XIOS |
---|
[2114] | 643 | IF (.not. ok_all_xml) THEN |
---|
| 644 | IF ( var%flag(iff)<=lev_files(iff) ) THEN |
---|
| 645 | CALL wxios_add_field_to_file(var%name, 2, iff, phys_out_filenames(iff), & |
---|
| 646 | var%description, var%unit, var%flag(iff), typeecrit) |
---|
| 647 | IF (prt_level >= 10) THEN |
---|
| 648 | WRITE(lunout,*) 'histdef2d: call wxios_add_field_to_file var%name iff: ', & |
---|
| 649 | trim(var%name),iff |
---|
| 650 | ENDIF |
---|
[2001] | 651 | ENDIF |
---|
| 652 | ENDIF |
---|
[1825] | 653 | #endif |
---|
[2097] | 654 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1825] | 655 | |
---|
[1807] | 656 | IF ( var%flag(iff)<=lev_files(iff) ) THEN |
---|
| 657 | CALL histdef (nid_files(iff), var%name, var%description, var%unit, & |
---|
[2344] | 658 | nbp_lon,jj_nb,nhorim(iff), 1,1,1, -99, 32, & |
---|
[1807] | 659 | typeecrit, zstophym,zoutm(iff)) |
---|
| 660 | ENDIF |
---|
| 661 | ELSE |
---|
| 662 | IF ( var%flag(iff)<=lev_files(iff)) THEN |
---|
| 663 | CALL histdef (nid_files(iff), var%name, var%description, var%unit, & |
---|
| 664 | npstn,1,nhorim(iff), 1,1,1, -99, 32, & |
---|
| 665 | typeecrit, zstophym,zoutm(iff)) |
---|
| 666 | ENDIF |
---|
[1852] | 667 | #endif |
---|
[1807] | 668 | ENDIF |
---|
| 669 | |
---|
[2854] | 670 | ! Set swaero_diag=true if at least one of the concerned variables are defined |
---|
[2529] | 671 | !--OB 30/05/2016 use wider set of variables |
---|
| 672 | IF ( var%name=='topswad' .OR. var%name=='topswad0' .OR. var%name=='solswad' .OR. var%name=='solswad0' .OR. & |
---|
| 673 | var%name=='topswai' .OR. var%name=='solswai' .OR. ( iflag_rrtm==1 .AND. ( & |
---|
| 674 | var%name=='toplwad' .OR. var%name=='toplwad0' .OR. var%name=='sollwad' .OR. var%name=='sollwad0' .OR. & |
---|
| 675 | var%name=='toplwai' .OR. var%name=='sollwai' ) ) ) THEN |
---|
[2854] | 676 | IF ( var%flag(iff)<=lev_files(iff) ) swaero_diag=.TRUE. |
---|
| 677 | ENDIF |
---|
| 678 | |
---|
[3082] | 679 | ! Set swaerofree_diag=true if at least one of the concerned variables are defined |
---|
[3106] | 680 | IF (var%name=='SWupTOAcleanclr' .OR. var%name=='SWupSFCcleanclr' .OR. var%name=='SWdnSFCcleanclr' .OR. & |
---|
[3107] | 681 | var%name=='LWupTOAcleanclr' .OR. var%name=='LWdnSFCcleanclr' ) THEN |
---|
[3082] | 682 | IF ( var%flag(iff)<=lev_files(iff) ) swaerofree_diag=.TRUE. |
---|
| 683 | ENDIF |
---|
| 684 | |
---|
[2854] | 685 | ! set dryaod_dry=true if at least one of the concerned variables are defined |
---|
| 686 | IF (var%name=='dryod550aer') THEN |
---|
| 687 | IF ( var%flag(iff)<=lev_files(iff) ) dryaod_diag=.TRUE. |
---|
| 688 | ENDIF |
---|
| 689 | ! |
---|
| 690 | DO naero = 1, naero_tot-1 |
---|
| 691 | IF (var%name=='dryod550_'//name_aero_tau(naero)) THEN |
---|
| 692 | IF ( var%flag(iff)<=lev_files(iff) ) dryaod_diag=.TRUE. |
---|
| 693 | ENDIF |
---|
| 694 | ENDDO |
---|
[2989] | 695 | ! Set ok_4xCO2atm=true if at least one of the concerned variables are |
---|
| 696 | ! defined |
---|
| 697 | IF (var%name=='rsut4co2'.OR.var%name=='rlut4co2'.OR.var%name=='rsutcs4co2' & |
---|
| 698 | .OR. var%name=='rlutcs4co2'.OR.var%name=='rsu4co2'.OR.var%name=='rsucs4co2' & |
---|
| 699 | .OR.var%name=='rsu4co2'.OR.var%name=='rsucs4co2'.OR.var%name=='rsd4co2'.OR. & |
---|
| 700 | var%name=='rsdcs4co2'.OR.var%name=='rlu4co2'.OR.var%name=='rlucs4co2'.OR.& |
---|
| 701 | var%name=='rld4co2'.OR.var%name=='rldcs4co2') THEN |
---|
| 702 | IF ( var%flag(iff)<=lev_files(iff) ) ok_4xCO2atm=.TRUE. |
---|
| 703 | ENDIF |
---|
[1807] | 704 | END SUBROUTINE histdef2d |
---|
[2001] | 705 | |
---|
[1807] | 706 | SUBROUTINE histdef3d (iff,var) |
---|
| 707 | |
---|
[2854] | 708 | USE ioipsl, ONLY: histdef |
---|
| 709 | USE dimphy, ONLY: klev |
---|
[3238] | 710 | USE mod_phys_lmdz_para, ONLY: jj_nb, is_master |
---|
[2854] | 711 | USE phys_output_var_mod, ONLY: ctrl_out, type_ecri_files, zoutm, zdtime_moy, & |
---|
[1897] | 712 | clef_stations, phys_out_filenames, lev_files, & |
---|
[3266] | 713 | nid_files, nhorim, swaerofree_diag, levmin, & |
---|
[1897] | 714 | levmax, nvertm |
---|
[2311] | 715 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[2344] | 716 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[1897] | 717 | #ifdef CPP_XIOS |
---|
[2854] | 718 | USE wxios, ONLY: wxios_add_field_to_file |
---|
[1897] | 719 | #endif |
---|
[3238] | 720 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1807] | 721 | IMPLICIT NONE |
---|
| 722 | |
---|
| 723 | INCLUDE "clesphys.h" |
---|
| 724 | |
---|
| 725 | INTEGER :: iff |
---|
| 726 | TYPE(ctrl_out) :: var |
---|
| 727 | |
---|
| 728 | REAL zstophym |
---|
| 729 | CHARACTER(LEN=20) :: typeecrit |
---|
| 730 | |
---|
[3238] | 731 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histdef3d for ', var%name |
---|
| 732 | |
---|
[1807] | 733 | ! ug On récupère le type écrit de la structure: |
---|
| 734 | ! Assez moche, à refaire si meilleure méthode... |
---|
| 735 | IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN |
---|
| 736 | typeecrit = 'once' |
---|
| 737 | ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN |
---|
| 738 | typeecrit = 't_min(X)' |
---|
| 739 | ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN |
---|
| 740 | typeecrit = 't_max(X)' |
---|
| 741 | ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN |
---|
| 742 | typeecrit = 'inst(X)' |
---|
| 743 | ELSE |
---|
| 744 | typeecrit = type_ecri_files(iff) |
---|
| 745 | ENDIF |
---|
| 746 | |
---|
| 747 | ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def |
---|
| 748 | CALL conf_physoutputs(var%name,var%flag) |
---|
| 749 | |
---|
| 750 | IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN |
---|
| 751 | zstophym=zoutm(iff) |
---|
| 752 | ELSE |
---|
| 753 | zstophym=zdtime_moy |
---|
| 754 | ENDIF |
---|
| 755 | |
---|
| 756 | IF(.NOT.clef_stations(iff)) THEN |
---|
[1852] | 757 | |
---|
[1825] | 758 | #ifdef CPP_XIOS |
---|
[2114] | 759 | IF (.not. ok_all_xml) THEN |
---|
| 760 | IF ( var%flag(iff)<=lev_files(iff) ) THEN |
---|
| 761 | CALL wxios_add_field_to_file(var%name, 3, iff, phys_out_filenames(iff), & |
---|
| 762 | var%description, var%unit, var%flag(iff), typeecrit) |
---|
| 763 | IF (prt_level >= 10) THEN |
---|
| 764 | WRITE(lunout,*) 'histdef3d: call wxios_add_field_to_file var%name iff: ', & |
---|
| 765 | trim(var%name),iff |
---|
| 766 | ENDIF |
---|
| 767 | ENDIF |
---|
| 768 | ENDIF |
---|
[1825] | 769 | #endif |
---|
[2097] | 770 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1825] | 771 | |
---|
[1807] | 772 | IF ( var%flag(iff)<=lev_files(iff) ) THEN |
---|
| 773 | CALL histdef (nid_files(iff), var%name, var%description, var%unit, & |
---|
[2344] | 774 | nbp_lon, jj_nb, nhorim(iff), klev, levmin(iff), & |
---|
[1807] | 775 | levmax(iff)-levmin(iff)+1, nvertm(iff), 32, typeecrit, & |
---|
| 776 | zstophym, zoutm(iff)) |
---|
| 777 | ENDIF |
---|
| 778 | ELSE |
---|
| 779 | IF ( var%flag(iff)<=lev_files(iff)) THEN |
---|
| 780 | CALL histdef (nid_files(iff), var%name, var%description, var%unit, & |
---|
| 781 | npstn,1,nhorim(iff), klev, levmin(iff), & |
---|
| 782 | levmax(iff)-levmin(iff)+1, nvertm(iff), 32, & |
---|
| 783 | typeecrit, zstophym,zoutm(iff)) |
---|
| 784 | ENDIF |
---|
[1852] | 785 | #endif |
---|
[1807] | 786 | ENDIF |
---|
[3082] | 787 | |
---|
| 788 | ! Set swaerofree_diag=true if at least one of the concerned variables are defined |
---|
| 789 | IF (var%name=='rsucsaf' .OR. var%name=='rsdcsaf') THEN |
---|
| 790 | IF ( var%flag(iff)<=lev_files(iff) ) swaerofree_diag=.TRUE. |
---|
| 791 | ENDIF |
---|
| 792 | |
---|
[1807] | 793 | END SUBROUTINE histdef3d |
---|
| 794 | |
---|
| 795 | SUBROUTINE conf_physoutputs(nam_var,flag_var) |
---|
| 796 | !!! Lecture des noms et niveau de sortie des variables dans output.def |
---|
| 797 | ! en utilisant les routines getin de IOIPSL |
---|
[2854] | 798 | USE ioipsl, ONLY: getin |
---|
| 799 | USE phys_output_var_mod, ONLY: nfiles |
---|
[2311] | 800 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1807] | 801 | IMPLICIT NONE |
---|
| 802 | |
---|
| 803 | CHARACTER(LEN=20) :: nam_var |
---|
| 804 | INTEGER, DIMENSION(nfiles) :: flag_var |
---|
| 805 | |
---|
| 806 | IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:) |
---|
| 807 | CALL getin('flag_'//nam_var,flag_var) |
---|
| 808 | CALL getin('name_'//nam_var,nam_var) |
---|
| 809 | IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:) |
---|
| 810 | |
---|
| 811 | END SUBROUTINE conf_physoutputs |
---|
| 812 | |
---|
[1539] | 813 | |
---|
[1791] | 814 | SUBROUTINE histwrite2d_phy_old(nid,lpoint,name,itau,field) |
---|
[3266] | 815 | |
---|
| 816 | USE dimphy, ONLY: klon |
---|
| 817 | USE mod_phys_lmdz_para, ONLY: Gather_omp, grid1Dto2D_mpi, & |
---|
| 818 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
| 819 | jj_nb, klon_mpi, is_master |
---|
| 820 | USE ioipsl, ONLY: histwrite |
---|
| 821 | USE print_control_mod, ONLY: prt_level,lunout |
---|
| 822 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
| 823 | |
---|
| 824 | IMPLICIT NONE |
---|
[629] | 825 | |
---|
[2854] | 826 | INTEGER,INTENT(IN) :: nid |
---|
| 827 | LOGICAL,INTENT(IN) :: lpoint |
---|
| 828 | CHARACTER*(*), INTENT(IN) :: name |
---|
| 829 | INTEGER, INTENT(IN) :: itau |
---|
[1797] | 830 | REAL,DIMENSION(:),INTENT(IN) :: field |
---|
| 831 | REAL,DIMENSION(klon_mpi) :: buffer_omp |
---|
| 832 | INTEGER, allocatable, DIMENSION(:) :: index2d |
---|
[2344] | 833 | REAL :: Field2d(nbp_lon,jj_nb) |
---|
[1331] | 834 | |
---|
[2854] | 835 | INTEGER :: ip |
---|
| 836 | REAL,ALLOCATABLE,DIMENSION(:) :: fieldok |
---|
[1539] | 837 | |
---|
[2311] | 838 | IF (size(field)/=klon) CALL abort_physic('iophy::histwrite2d','Field first DIMENSION not equal to klon',1) |
---|
[3238] | 839 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite2d_phy_old for ', name |
---|
| 840 | |
---|
[776] | 841 | CALL Gather_omp(field,buffer_omp) |
---|
[766] | 842 | !$OMP MASTER |
---|
[1331] | 843 | CALL grid1Dto2D_mpi(buffer_omp,Field2d) |
---|
[3266] | 844 | IF (.NOT.lpoint) THEN |
---|
[2344] | 845 | ALLOCATE(index2d(nbp_lon*jj_nb)) |
---|
| 846 | ALLOCATE(fieldok(nbp_lon*jj_nb)) |
---|
[1897] | 847 | IF (prt_level >= 10) write(lunout,*)'Sending ',name,' to IOIPSL' |
---|
[2344] | 848 | CALL histwrite(nid,name,itau,Field2d,nbp_lon*jj_nb,index2d) |
---|
[1897] | 849 | IF (prt_level >= 10) write(lunout,*)'Finished sending ',name,' to IOIPSL' |
---|
[2854] | 850 | ELSE |
---|
[1539] | 851 | ALLOCATE(fieldok(npstn)) |
---|
| 852 | ALLOCATE(index2d(npstn)) |
---|
| 853 | |
---|
[2854] | 854 | IF (is_sequential) THEN |
---|
[1539] | 855 | ! klon_mpi_begin=1 |
---|
| 856 | ! klon_mpi_end=klon |
---|
| 857 | DO ip=1, npstn |
---|
| 858 | fieldok(ip)=buffer_omp(nptabij(ip)) |
---|
| 859 | ENDDO |
---|
[2854] | 860 | ELSE |
---|
[1539] | 861 | DO ip=1, npstn |
---|
| 862 | ! print*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip) |
---|
| 863 | IF(nptabij(ip).GE.klon_mpi_begin.AND. & |
---|
| 864 | nptabij(ip).LE.klon_mpi_end) THEN |
---|
| 865 | fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1) |
---|
| 866 | ENDIF |
---|
| 867 | ENDDO |
---|
[2854] | 868 | ENDIF |
---|
[1897] | 869 | IF (prt_level >= 10) write(lunout,*)'Sending ',name,' to IOIPSL' |
---|
[1539] | 870 | CALL histwrite(nid,name,itau,fieldok,npstn,index2d) |
---|
[1897] | 871 | IF (prt_level >= 10) write(lunout,*)'Finished sending ',name,' to IOIPSL' |
---|
[1539] | 872 | ! |
---|
[2854] | 873 | ENDIF |
---|
| 874 | DEALLOCATE(index2d) |
---|
| 875 | DEALLOCATE(fieldok) |
---|
[1791] | 876 | !$OMP END MASTER |
---|
[1331] | 877 | |
---|
[1791] | 878 | |
---|
[2854] | 879 | END SUBROUTINE histwrite2d_phy_old |
---|
[1791] | 880 | |
---|
[1797] | 881 | SUBROUTINE histwrite3d_phy_old(nid,lpoint,name,itau,field) |
---|
[3266] | 882 | |
---|
| 883 | USE dimphy, ONLY: klon |
---|
| 884 | USE mod_phys_lmdz_para, ONLY: Gather_omp, grid1Dto2D_mpi, & |
---|
| 885 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
| 886 | jj_nb, klon_mpi, is_master |
---|
| 887 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
| 888 | USE ioipsl, ONLY: histwrite |
---|
| 889 | USE print_control_mod, ONLY: prt_level,lunout |
---|
| 890 | |
---|
| 891 | IMPLICIT NONE |
---|
[629] | 892 | |
---|
[2854] | 893 | INTEGER,INTENT(IN) :: nid |
---|
| 894 | LOGICAL,INTENT(IN) :: lpoint |
---|
| 895 | CHARACTER*(*), INTENT(IN) :: name |
---|
| 896 | INTEGER, INTENT(IN) :: itau |
---|
[1797] | 897 | REAL,DIMENSION(:,:),INTENT(IN) :: field ! --> field(klon,:) |
---|
| 898 | REAL,DIMENSION(klon_mpi,size(field,2)) :: buffer_omp |
---|
[2344] | 899 | REAL :: Field3d(nbp_lon,jj_nb,size(field,2)) |
---|
[1539] | 900 | INTEGER :: ip, n, nlev |
---|
[1797] | 901 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d |
---|
| 902 | REAL,allocatable, DIMENSION(:,:) :: fieldok |
---|
[1539] | 903 | |
---|
[3238] | 904 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite3d_phy_old for ', name |
---|
[1791] | 905 | |
---|
[2311] | 906 | IF (size(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1) |
---|
[1331] | 907 | nlev=size(field,2) |
---|
[1539] | 908 | |
---|
[776] | 909 | CALL Gather_omp(field,buffer_omp) |
---|
[766] | 910 | !$OMP MASTER |
---|
[1331] | 911 | CALL grid1Dto2D_mpi(buffer_omp,field3d) |
---|
[2854] | 912 | IF (.NOT.lpoint) THEN |
---|
[3266] | 913 | ALLOCATE(index3d(nbp_lon*jj_nb*nlev)) |
---|
| 914 | ALLOCATE(fieldok(nbp_lon*jj_nb,nlev)) |
---|
| 915 | IF (prt_level >= 10) write(lunout,*)'Sending ',name,' to IOIPSL' |
---|
| 916 | CALL histwrite(nid,name,itau,Field3d,nbp_lon*jj_nb*nlev,index3d) |
---|
| 917 | IF (prt_level >= 10) write(lunout,*)'Finished sending ',name,' to IOIPSL' |
---|
| 918 | ELSE |
---|
[1539] | 919 | nlev=size(field,2) |
---|
| 920 | ALLOCATE(index3d(npstn*nlev)) |
---|
| 921 | ALLOCATE(fieldok(npstn,nlev)) |
---|
| 922 | |
---|
[2854] | 923 | IF (is_sequential) THEN |
---|
[3266] | 924 | ! klon_mpi_begin=1 |
---|
| 925 | ! klon_mpi_end=klon |
---|
| 926 | DO n=1, nlev |
---|
| 927 | DO ip=1, npstn |
---|
| 928 | fieldok(ip,n)=buffer_omp(nptabij(ip),n) |
---|
| 929 | ENDDO |
---|
| 930 | ENDDO |
---|
[2854] | 931 | ELSE |
---|
[3266] | 932 | DO n=1, nlev |
---|
| 933 | DO ip=1, npstn |
---|
| 934 | IF(nptabij(ip).GE.klon_mpi_begin.AND. & |
---|
| 935 | nptabij(ip).LE.klon_mpi_end) THEN |
---|
| 936 | fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n) |
---|
| 937 | ENDIF |
---|
| 938 | ENDDO |
---|
| 939 | ENDDO |
---|
[2854] | 940 | ENDIF |
---|
[1897] | 941 | IF (prt_level >= 10) write(lunout,*)'Sending ',name,' to IOIPSL' |
---|
[1539] | 942 | CALL histwrite(nid,name,itau,fieldok,npstn*nlev,index3d) |
---|
[1897] | 943 | IF (prt_level >= 10) write(lunout,*)'Finished sending ',name,' to IOIPSL' |
---|
[2854] | 944 | ENDIF |
---|
[3266] | 945 | DEALLOCATE(index3d) |
---|
| 946 | DEALLOCATE(fieldok) |
---|
[766] | 947 | !$OMP END MASTER |
---|
[1791] | 948 | |
---|
[2854] | 949 | END SUBROUTINE histwrite3d_phy_old |
---|
[1791] | 950 | |
---|
| 951 | |
---|
| 952 | ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE |
---|
| 953 | SUBROUTINE histwrite2d_phy(var,field, STD_iff) |
---|
[3266] | 954 | |
---|
| 955 | USE mod_phys_lmdz_omp_transfert, ONLY: bcast_omp |
---|
[3003] | 956 | USE dimphy, ONLY: klon, klev |
---|
[2854] | 957 | USE mod_phys_lmdz_para, ONLY: gather_omp, grid1dto2d_mpi, & |
---|
[1897] | 958 | jj_nb, klon_mpi, klon_mpi_begin, & |
---|
[3238] | 959 | klon_mpi_end, is_sequential, is_master |
---|
[2854] | 960 | USE ioipsl, ONLY: histwrite |
---|
| 961 | USE phys_output_var_mod, ONLY: ctrl_out, clef_files, lev_files, & |
---|
[1897] | 962 | nfiles, vars_defined, clef_stations, & |
---|
[3266] | 963 | nid_files, swaerofree_diag, swaero_diag, dryaod_diag, ok_4xCO2atm |
---|
[2311] | 964 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[2344] | 965 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[1791] | 966 | #ifdef CPP_XIOS |
---|
[2854] | 967 | USE xios, ONLY: xios_send_field |
---|
[1791] | 968 | #endif |
---|
| 969 | |
---|
| 970 | IMPLICIT NONE |
---|
[3266] | 971 | INCLUDE 'clesphys.h' |
---|
[1791] | 972 | |
---|
[3266] | 973 | TYPE(ctrl_out), INTENT(IN) :: var |
---|
| 974 | REAL, DIMENSION(:), INTENT(IN) :: field |
---|
| 975 | INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS..... |
---|
[1791] | 976 | |
---|
[3266] | 977 | INTEGER :: iff, iff_beg, iff_end |
---|
| 978 | LOGICAL, SAVE :: firstx |
---|
[2001] | 979 | !$OMP THREADPRIVATE(firstx) |
---|
| 980 | |
---|
[3266] | 981 | REAL,DIMENSION(klon_mpi) :: buffer_omp |
---|
| 982 | INTEGER, allocatable, DIMENSION(:) :: index2d |
---|
| 983 | REAL :: Field2d(nbp_lon,jj_nb) |
---|
[1791] | 984 | |
---|
[3266] | 985 | INTEGER :: ip |
---|
| 986 | REAL, ALLOCATABLE, DIMENSION(:) :: fieldok |
---|
[1791] | 987 | |
---|
[3266] | 988 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite2d_phy for ',trim(var%name) |
---|
[3238] | 989 | |
---|
[3266] | 990 | IF (prt_level >= 10) THEN |
---|
| 991 | WRITE(lunout,*)'Begin histwrite2d_phy for ',trim(var%name) |
---|
| 992 | ENDIF |
---|
| 993 | |
---|
[1791] | 994 | ! ug RUSTINE POUR LES STD LEVS..... |
---|
[3266] | 995 | IF (PRESENT(STD_iff)) THEN |
---|
| 996 | iff_beg = STD_iff |
---|
| 997 | iff_end = STD_iff |
---|
| 998 | ELSE |
---|
| 999 | iff_beg = 1 |
---|
| 1000 | iff_end = nfiles |
---|
| 1001 | ENDIF |
---|
[1791] | 1002 | |
---|
[1807] | 1003 | ! On regarde si on est dans la phase de définition ou d'écriture: |
---|
[2854] | 1004 | IF (.NOT.vars_defined) THEN |
---|
[1821] | 1005 | !$OMP MASTER |
---|
[1807] | 1006 | !Si phase de définition.... on définit |
---|
[2114] | 1007 | IF (.not. ok_all_xml) THEN |
---|
[2854] | 1008 | IF (prt_level >= 10) THEN |
---|
| 1009 | WRITE (lunout,*)"histwrite2d_phy: .not.vars_defined ; time to define ", trim(var%name) |
---|
| 1010 | ENDIF |
---|
[1807] | 1011 | DO iff=iff_beg, iff_end |
---|
| 1012 | IF (clef_files(iff)) THEN |
---|
| 1013 | CALL histdef2d(iff, var) |
---|
| 1014 | ENDIF |
---|
| 1015 | ENDDO |
---|
[2114] | 1016 | ENDIF |
---|
[1821] | 1017 | !$OMP END MASTER |
---|
[3266] | 1018 | !--broadcasting the flags that have been changed in histdef2d on OMP masters |
---|
| 1019 | CALL bcast_omp(swaero_diag) |
---|
| 1020 | CALL bcast_omp(swaerofree_diag) |
---|
| 1021 | CALL bcast_omp(dryaod_diag) |
---|
| 1022 | CALL bcast_omp(ok_4xCO2atm) |
---|
| 1023 | |
---|
[1807] | 1024 | ELSE |
---|
| 1025 | |
---|
| 1026 | !Et sinon on.... écrit |
---|
[3003] | 1027 | IF (SIZE(field)/=klon .AND. SIZE(field)/=klev) CALL abort_physic('iophy::histwrite2d_phy','Field first DIMENSION not equal to klon/klev',1) |
---|
[2854] | 1028 | IF (prt_level >= 10) THEn |
---|
| 1029 | WRITE (lunout,*)"histwrite2d_phy: .not.vars_defined ; time to gather and write ", trim(var%name) |
---|
| 1030 | ENDIF |
---|
[1897] | 1031 | |
---|
[3003] | 1032 | |
---|
| 1033 | IF (SIZE(field) == klon) then |
---|
| 1034 | CALL Gather_omp(field,buffer_omp) |
---|
| 1035 | ELSE |
---|
| 1036 | buffer_omp(:)=0. |
---|
| 1037 | ENDIF |
---|
[1791] | 1038 | !$OMP MASTER |
---|
| 1039 | CALL grid1Dto2D_mpi(buffer_omp,Field2d) |
---|
[1897] | 1040 | |
---|
[1791] | 1041 | ! La boucle sur les fichiers: |
---|
[2001] | 1042 | firstx=.true. |
---|
[2114] | 1043 | |
---|
| 1044 | IF (ok_all_xml) THEN |
---|
| 1045 | #ifdef CPP_XIOS |
---|
[2854] | 1046 | IF (prt_level >= 10) THEN |
---|
| 1047 | write(lunout,*)'Dans iophy histwrite2D,var%name ', trim(var%name) |
---|
| 1048 | ENDIF |
---|
[3003] | 1049 | IF (SIZE(field) == klon) then |
---|
| 1050 | CALL xios_send_field(var%name, Field2d) |
---|
| 1051 | ELSE |
---|
| 1052 | CALL xios_send_field(var%name, field) |
---|
| 1053 | ENDIF |
---|
[2854] | 1054 | IF (prt_level >= 10) THEN |
---|
| 1055 | WRITE (lunout,*)'Dans iophy histwrite2D,var%name apres xios_send ', trim(var%name) |
---|
| 1056 | ENDIF |
---|
[2114] | 1057 | #else |
---|
[2311] | 1058 | CALL abort_physic ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1) |
---|
[2114] | 1059 | #endif |
---|
| 1060 | ELSE |
---|
| 1061 | DO iff=iff_beg, iff_end |
---|
[1791] | 1062 | IF (var%flag(iff) <= lev_files(iff) .AND. clef_files(iff)) THEN |
---|
[2001] | 1063 | |
---|
| 1064 | #ifdef CPP_XIOS |
---|
| 1065 | IF (firstx) THEN |
---|
[2854] | 1066 | IF (prt_level >= 10) THEN |
---|
| 1067 | WRITE (lunout,*)'Dans iophy histwrite2D,iff,var%name ', iff,trim(var%name) |
---|
| 1068 | WRITE (lunout,*)"histwrite2d_phy:.NOT.clef_stations(iff)and iff==iff_beg, call xios_send_field" |
---|
| 1069 | ENDIF |
---|
[3003] | 1070 | IF (SIZE(field) == klon) then |
---|
| 1071 | CALL xios_send_field(var%name, Field2d) |
---|
| 1072 | ELSE |
---|
| 1073 | CALL xios_send_field(var%name, field) |
---|
| 1074 | ENDIF |
---|
[2001] | 1075 | firstx=.false. |
---|
| 1076 | ENDIF |
---|
| 1077 | #endif |
---|
| 1078 | |
---|
[2854] | 1079 | IF (.NOT.clef_stations(iff)) THEN |
---|
[2344] | 1080 | ALLOCATE(index2d(nbp_lon*jj_nb)) |
---|
| 1081 | ALLOCATE(fieldok(nbp_lon*jj_nb)) |
---|
[2097] | 1082 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[2344] | 1083 | CALL histwrite(nid_files(iff),var%name,itau_iophy,Field2d,nbp_lon*jj_nb,index2d) |
---|
[1852] | 1084 | #endif |
---|
[2001] | 1085 | !#ifdef CPP_XIOS |
---|
| 1086 | ! IF (iff == iff_beg) THEN |
---|
| 1087 | ! if (prt_level >= 10) then |
---|
[2002] | 1088 | ! write(lunout,*)"histwrite2d_phy: .NOT.clef_stations(iff) and iff==iff_beg, call xios_send_field" |
---|
[2001] | 1089 | ! endif |
---|
[2002] | 1090 | ! CALL xios_send_field(var%name, Field2d) |
---|
[2001] | 1091 | ! ENDIF |
---|
| 1092 | !#endif |
---|
[1791] | 1093 | ELSE |
---|
| 1094 | ALLOCATE(fieldok(npstn)) |
---|
| 1095 | ALLOCATE(index2d(npstn)) |
---|
| 1096 | |
---|
| 1097 | IF (is_sequential) THEN |
---|
[1897] | 1098 | DO ip=1, npstn |
---|
| 1099 | fieldok(ip)=buffer_omp(nptabij(ip)) |
---|
| 1100 | ENDDO |
---|
| 1101 | ELSE |
---|
[1791] | 1102 | DO ip=1, npstn |
---|
[1897] | 1103 | write(lunout,*)'histwrite2d_phy is_sequential npstn ip namenptabij',npstn,ip,var%name,nptabij(ip) |
---|
[1791] | 1104 | IF(nptabij(ip).GE.klon_mpi_begin.AND. & |
---|
| 1105 | nptabij(ip).LE.klon_mpi_end) THEN |
---|
| 1106 | fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1) |
---|
| 1107 | ENDIF |
---|
| 1108 | ENDDO |
---|
[1897] | 1109 | ENDIF ! of IF (is_sequential) |
---|
[2097] | 1110 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[2854] | 1111 | IF (prt_level >= 10) THEn |
---|
[1897] | 1112 | write(lunout,*)"histwrite2d_phy: clef_stations(iff) and iff==iff_beg, call wxios_write_2D" |
---|
[2854] | 1113 | ENDIF |
---|
[1791] | 1114 | CALL histwrite(nid_files(iff),var%name,itau_iophy,fieldok,npstn,index2d) |
---|
[1852] | 1115 | #endif |
---|
[1897] | 1116 | ENDIF ! of IF(.NOT.clef_stations(iff)) |
---|
[1791] | 1117 | |
---|
[2854] | 1118 | DEALLOCATE(index2d) |
---|
| 1119 | DEALLOCATE(fieldok) |
---|
[1791] | 1120 | ENDIF !levfiles |
---|
[2114] | 1121 | ENDDO ! of DO iff=iff_beg, iff_end |
---|
| 1122 | ENDIF |
---|
[1791] | 1123 | !$OMP END MASTER |
---|
[1807] | 1124 | ENDIF ! vars_defined |
---|
[3266] | 1125 | |
---|
[1897] | 1126 | IF (prt_level >= 10) WRITE(lunout,*)'End histwrite2d_phy ',trim(var%name) |
---|
[3266] | 1127 | |
---|
[1791] | 1128 | END SUBROUTINE histwrite2d_phy |
---|
| 1129 | |
---|
| 1130 | |
---|
| 1131 | ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE |
---|
[1807] | 1132 | SUBROUTINE histwrite3d_phy(var, field, STD_iff) |
---|
[3266] | 1133 | |
---|
| 1134 | USE mod_phys_lmdz_omp_transfert, ONLY: bcast_omp |
---|
[2854] | 1135 | USE dimphy, ONLY: klon, klev |
---|
| 1136 | USE mod_phys_lmdz_para, ONLY: gather_omp, grid1dto2d_mpi, & |
---|
[1897] | 1137 | jj_nb, klon_mpi, klon_mpi_begin, & |
---|
[3238] | 1138 | klon_mpi_end, is_sequential, is_master |
---|
[2854] | 1139 | USE ioipsl, ONLY: histwrite |
---|
| 1140 | USE phys_output_var_mod, ONLY: ctrl_out, clef_files, lev_files, & |
---|
[1897] | 1141 | nfiles, vars_defined, clef_stations, & |
---|
[3266] | 1142 | nid_files, swaerofree_diag |
---|
[2344] | 1143 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[1791] | 1144 | #ifdef CPP_XIOS |
---|
[2854] | 1145 | USE xios, ONLY: xios_send_field |
---|
[1791] | 1146 | #endif |
---|
[2311] | 1147 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1791] | 1148 | |
---|
| 1149 | IMPLICIT NONE |
---|
[3266] | 1150 | INCLUDE 'clesphys.h' |
---|
[1791] | 1151 | |
---|
[3266] | 1152 | TYPE(ctrl_out), INTENT(IN) :: var |
---|
| 1153 | REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:) |
---|
| 1154 | INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS..... |
---|
[1807] | 1155 | |
---|
[3266] | 1156 | INTEGER :: iff, iff_beg, iff_end |
---|
| 1157 | LOGICAL, SAVE :: firstx |
---|
[2001] | 1158 | !$OMP THREADPRIVATE(firstx) |
---|
[3266] | 1159 | REAL,DIMENSION(klon_mpi,SIZE(field,2)) :: buffer_omp |
---|
| 1160 | REAL :: Field3d(nbp_lon,jj_nb,SIZE(field,2)) |
---|
| 1161 | INTEGER :: ip, n, nlev, nlevx |
---|
| 1162 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d |
---|
| 1163 | REAL,ALLOCATABLE, DIMENSION(:,:) :: fieldok |
---|
[1791] | 1164 | |
---|
[3238] | 1165 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite3d_phy for ', trim(var%name) |
---|
| 1166 | |
---|
[1897] | 1167 | IF (prt_level >= 10) write(lunout,*)'Begin histrwrite3d ',var%name |
---|
[1791] | 1168 | |
---|
[1828] | 1169 | ! ug RUSTINE POUR LES STD LEVS..... |
---|
| 1170 | IF (PRESENT(STD_iff)) THEN |
---|
| 1171 | iff_beg = STD_iff |
---|
| 1172 | iff_end = STD_iff |
---|
| 1173 | ELSE |
---|
| 1174 | iff_beg = 1 |
---|
| 1175 | iff_end = nfiles |
---|
[2854] | 1176 | ENDIF |
---|
[1828] | 1177 | |
---|
[1807] | 1178 | ! On regarde si on est dans la phase de définition ou d'écriture: |
---|
[3266] | 1179 | IF (.NOT.vars_defined) THEN |
---|
[1807] | 1180 | !Si phase de définition.... on définit |
---|
[1821] | 1181 | !$OMP MASTER |
---|
[1828] | 1182 | DO iff=iff_beg, iff_end |
---|
[1807] | 1183 | IF (clef_files(iff)) THEN |
---|
| 1184 | CALL histdef3d(iff, var) |
---|
| 1185 | ENDIF |
---|
| 1186 | ENDDO |
---|
[1821] | 1187 | !$OMP END MASTER |
---|
[3266] | 1188 | !--broadcasting the flag that have been changed in histdef3d on OMP masters |
---|
| 1189 | CALL bcast_omp(swaerofree_diag) |
---|
[1807] | 1190 | ELSE |
---|
| 1191 | !Et sinon on.... écrit |
---|
[3003] | 1192 | |
---|
| 1193 | IF (SIZE(field,1)/=klon .AND. SIZE(field,1)/=klev) CALL abort_physic('iophy::histwrite3d_xios','Field first DIMENSION not equal to klon/klev',1) |
---|
| 1194 | |
---|
[1807] | 1195 | nlev=SIZE(field,2) |
---|
[2854] | 1196 | IF (nlev.EQ.klev+1) THEN |
---|
[2001] | 1197 | nlevx=klev |
---|
[2854] | 1198 | ELSE |
---|
[2001] | 1199 | nlevx=nlev |
---|
[2854] | 1200 | ENDIF |
---|
[1791] | 1201 | |
---|
[3003] | 1202 | IF (SIZE(field,1) == klon) then |
---|
| 1203 | CALL Gather_omp(field,buffer_omp) |
---|
| 1204 | ELSE |
---|
| 1205 | buffer_omp(:,:)=0. |
---|
| 1206 | ENDIF |
---|
[1791] | 1207 | !$OMP MASTER |
---|
| 1208 | CALL grid1Dto2D_mpi(buffer_omp,field3d) |
---|
| 1209 | |
---|
| 1210 | ! BOUCLE SUR LES FICHIERS |
---|
[3266] | 1211 | firstx=.true. |
---|
[2114] | 1212 | |
---|
[3266] | 1213 | IF (ok_all_xml) THEN |
---|
[2114] | 1214 | #ifdef CPP_XIOS |
---|
[3266] | 1215 | IF (prt_level >= 10) THEN |
---|
| 1216 | write(lunout,*)'Dans iophy histwrite3D,var%name ',trim(var%name) |
---|
| 1217 | ENDIF |
---|
| 1218 | IF (SIZE(field,1) == klon) then |
---|
[3003] | 1219 | CALL xios_send_field(var%name, Field3d(:,:,1:nlevx)) |
---|
[3266] | 1220 | ELSE |
---|
[3003] | 1221 | CALL xios_send_field(var%name, field) |
---|
[3266] | 1222 | ENDIF |
---|
[2114] | 1223 | #else |
---|
[2311] | 1224 | CALL abort_physic ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1) |
---|
[2114] | 1225 | #endif |
---|
[3266] | 1226 | ELSE |
---|
[2114] | 1227 | |
---|
[3266] | 1228 | DO iff=iff_beg, iff_end |
---|
| 1229 | IF (var%flag(iff) <= lev_files(iff) .AND. clef_files(iff)) THEN |
---|
[2001] | 1230 | #ifdef CPP_XIOS |
---|
| 1231 | IF (firstx) THEN |
---|
[2854] | 1232 | IF (prt_level >= 10) THEn |
---|
| 1233 | WRITE (lunout,*)'Dans iophy, histwrite3D iff nlev klev firstx', & |
---|
[2001] | 1234 | iff,nlev,klev, firstx |
---|
[2854] | 1235 | WRITE (lunout,*)'histwrite3d_phy: call xios_send_field for ', & |
---|
[2001] | 1236 | trim(var%name), ' with iim jjm nlevx = ', & |
---|
[2344] | 1237 | nbp_lon,jj_nb,nlevx |
---|
[2854] | 1238 | ENDIF |
---|
[3003] | 1239 | IF (SIZE(field,1) == klon) then |
---|
| 1240 | CALL xios_send_field(var%name, Field3d(:,:,1:nlevx)) |
---|
| 1241 | ELSE |
---|
| 1242 | CALL xios_send_field(var%name, field) |
---|
| 1243 | ENDIF |
---|
| 1244 | firstx=.false. |
---|
[2001] | 1245 | ENDIF |
---|
| 1246 | #endif |
---|
[3266] | 1247 | IF (.NOT.clef_stations(iff)) THEN |
---|
[2344] | 1248 | ALLOCATE(index3d(nbp_lon*jj_nb*nlev)) |
---|
| 1249 | ALLOCATE(fieldok(nbp_lon*jj_nb,nlev)) |
---|
[1852] | 1250 | |
---|
[2097] | 1251 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[2344] | 1252 | CALL histwrite(nid_files(iff),var%name,itau_iophy,Field3d,nbp_lon*jj_nb*nlev,index3d) |
---|
[1852] | 1253 | #endif |
---|
[1825] | 1254 | |
---|
[2001] | 1255 | !#ifdef CPP_XIOS |
---|
| 1256 | ! IF (iff == 1) THEN |
---|
[2002] | 1257 | ! CALL xios_send_field(var%name, Field3d(:,:,1:klev)) |
---|
[2001] | 1258 | ! ENDIF |
---|
| 1259 | !#endif |
---|
| 1260 | ! |
---|
[3266] | 1261 | ELSE |
---|
[1791] | 1262 | nlev=size(field,2) |
---|
| 1263 | ALLOCATE(index3d(npstn*nlev)) |
---|
| 1264 | ALLOCATE(fieldok(npstn,nlev)) |
---|
| 1265 | |
---|
| 1266 | IF (is_sequential) THEN |
---|
| 1267 | DO n=1, nlev |
---|
| 1268 | DO ip=1, npstn |
---|
| 1269 | fieldok(ip,n)=buffer_omp(nptabij(ip),n) |
---|
| 1270 | ENDDO |
---|
| 1271 | ENDDO |
---|
| 1272 | ELSE |
---|
| 1273 | DO n=1, nlev |
---|
| 1274 | DO ip=1, npstn |
---|
| 1275 | IF(nptabij(ip).GE.klon_mpi_begin.AND. & |
---|
| 1276 | nptabij(ip).LE.klon_mpi_end) THEN |
---|
| 1277 | fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n) |
---|
| 1278 | ENDIF |
---|
| 1279 | ENDDO |
---|
| 1280 | ENDDO |
---|
| 1281 | ENDIF |
---|
[2097] | 1282 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[1791] | 1283 | CALL histwrite(nid_files(iff),var%name,itau_iophy,fieldok,npstn*nlev,index3d) |
---|
[1852] | 1284 | #endif |
---|
[3266] | 1285 | ENDIF |
---|
| 1286 | DEALLOCATE(index3d) |
---|
| 1287 | DEALLOCATE(fieldok) |
---|
| 1288 | ENDIF |
---|
[1791] | 1289 | ENDDO |
---|
[3266] | 1290 | ENDIF |
---|
[1791] | 1291 | !$OMP END MASTER |
---|
[1807] | 1292 | ENDIF ! vars_defined |
---|
[3266] | 1293 | |
---|
[1897] | 1294 | IF (prt_level >= 10) write(lunout,*)'End histrwrite3d ',var%name |
---|
[3266] | 1295 | |
---|
[1791] | 1296 | END SUBROUTINE histwrite3d_phy |
---|
| 1297 | |
---|
[1852] | 1298 | |
---|
| 1299 | ! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV |
---|
| 1300 | #ifdef CPP_XIOS |
---|
| 1301 | SUBROUTINE histwrite2d_xios(field_name,field) |
---|
[3266] | 1302 | |
---|
[3003] | 1303 | USE dimphy, ONLY: klon, klev |
---|
[2854] | 1304 | USE mod_phys_lmdz_para, ONLY: gather_omp, grid1Dto2D_mpi, & |
---|
[1897] | 1305 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
[3238] | 1306 | jj_nb, klon_mpi, is_master |
---|
[2344] | 1307 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[2854] | 1308 | USE xios, ONLY: xios_send_field |
---|
[2311] | 1309 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1852] | 1310 | |
---|
| 1311 | IMPLICIT NONE |
---|
| 1312 | |
---|
[3266] | 1313 | CHARACTER(LEN=*), INTENT(IN) :: field_name |
---|
| 1314 | REAL, DIMENSION(:), INTENT(IN) :: field |
---|
[1852] | 1315 | |
---|
[3266] | 1316 | REAL,DIMENSION(klon_mpi) :: buffer_omp |
---|
| 1317 | INTEGER, allocatable, DIMENSION(:) :: index2d |
---|
| 1318 | REAL :: Field2d(nbp_lon,jj_nb) |
---|
[1852] | 1319 | |
---|
[3266] | 1320 | INTEGER :: ip |
---|
| 1321 | REAL, ALLOCATABLE, DIMENSION(:) :: fieldok |
---|
[1852] | 1322 | |
---|
[3266] | 1323 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite2d_xios for ', field_name |
---|
[3238] | 1324 | |
---|
[3266] | 1325 | IF (prt_level >= 10) WRITE(lunout,*)'Begin histrwrite2d_xios ',field_name |
---|
[1852] | 1326 | |
---|
[3266] | 1327 | !Et sinon on.... écrit |
---|
| 1328 | IF (SIZE(field)/=klon .AND. SIZE(field)/=klev) CALL abort_physic('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon/klev',1) |
---|
[1852] | 1329 | |
---|
[3266] | 1330 | IF (SIZE(field) == klev) then |
---|
[1852] | 1331 | !$OMP MASTER |
---|
[3003] | 1332 | CALL xios_send_field(field_name,field) |
---|
| 1333 | !$OMP END MASTER |
---|
[3266] | 1334 | ELSE |
---|
[3003] | 1335 | CALL Gather_omp(field,buffer_omp) |
---|
| 1336 | !$OMP MASTER |
---|
| 1337 | CALL grid1Dto2D_mpi(buffer_omp,Field2d) |
---|
[1852] | 1338 | |
---|
| 1339 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 1340 | !ATTENTION, STATIONS PAS GEREES ! |
---|
| 1341 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 1342 | !IF(.NOT.clef_stations(iff)) THEN |
---|
[3003] | 1343 | IF (.TRUE.) THEN |
---|
| 1344 | ALLOCATE(index2d(nbp_lon*jj_nb)) |
---|
| 1345 | ALLOCATE(fieldok(nbp_lon*jj_nb)) |
---|
| 1346 | |
---|
| 1347 | |
---|
| 1348 | CALL xios_send_field(field_name, Field2d) |
---|
| 1349 | |
---|
| 1350 | ELSE |
---|
| 1351 | ALLOCATE(fieldok(npstn)) |
---|
| 1352 | ALLOCATE(index2d(npstn)) |
---|
| 1353 | |
---|
| 1354 | IF (is_sequential) THEN |
---|
| 1355 | DO ip=1, npstn |
---|
| 1356 | fieldok(ip)=buffer_omp(nptabij(ip)) |
---|
| 1357 | ENDDO |
---|
| 1358 | ELSE |
---|
| 1359 | DO ip=1, npstn |
---|
| 1360 | PRINT*,'histwrite2d_xios is_sequential npstn ip namenptabij',npstn,ip,field_name,nptabij(ip) |
---|
| 1361 | IF(nptabij(ip).GE.klon_mpi_begin.AND. & |
---|
| 1362 | nptabij(ip).LE.klon_mpi_end) THEN |
---|
| 1363 | fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1) |
---|
| 1364 | ENDIF |
---|
| 1365 | ENDDO |
---|
| 1366 | ENDIF |
---|
| 1367 | |
---|
[1852] | 1368 | ENDIF |
---|
| 1369 | |
---|
[3003] | 1370 | DEALLOCATE(index2d) |
---|
| 1371 | DEALLOCATE(fieldok) |
---|
[1852] | 1372 | !$OMP END MASTER |
---|
[3266] | 1373 | ENDIF |
---|
[1852] | 1374 | |
---|
[1897] | 1375 | IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite2d_xios ',field_name |
---|
[1852] | 1376 | END SUBROUTINE histwrite2d_xios |
---|
| 1377 | |
---|
| 1378 | |
---|
| 1379 | ! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE |
---|
| 1380 | SUBROUTINE histwrite3d_xios(field_name, field) |
---|
[3266] | 1381 | |
---|
[2854] | 1382 | USE dimphy, ONLY: klon, klev |
---|
| 1383 | USE mod_phys_lmdz_para, ONLY: gather_omp, grid1Dto2D_mpi, & |
---|
[1897] | 1384 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
[3238] | 1385 | jj_nb, klon_mpi, is_master |
---|
[2854] | 1386 | USE xios, ONLY: xios_send_field |
---|
[2344] | 1387 | USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat |
---|
[2311] | 1388 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[1852] | 1389 | |
---|
| 1390 | IMPLICIT NONE |
---|
| 1391 | |
---|
[3266] | 1392 | CHARACTER(LEN=*), INTENT(IN) :: field_name |
---|
| 1393 | REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:) |
---|
[1852] | 1394 | |
---|
[3266] | 1395 | REAL,DIMENSION(klon_mpi,SIZE(field,2)) :: buffer_omp |
---|
| 1396 | REAL :: Field3d(nbp_lon,jj_nb,SIZE(field,2)) |
---|
| 1397 | INTEGER :: ip, n, nlev |
---|
| 1398 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d |
---|
| 1399 | REAL,ALLOCATABLE, DIMENSION(:,:) :: fieldok |
---|
[1852] | 1400 | |
---|
[3266] | 1401 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite3d_xios for ', field_name |
---|
[1852] | 1402 | |
---|
[3266] | 1403 | IF (prt_level >= 10) write(lunout,*)'Begin histrwrite3d_xios ',field_name |
---|
[3238] | 1404 | |
---|
[3266] | 1405 | !Et on.... écrit |
---|
| 1406 | IF (SIZE(field,1)/=klon .AND. SIZE(field,1)/=klev) CALL abort_physic('iophy::histwrite3d_xios','Field first DIMENSION not equal to klon/klev',1) |
---|
[3003] | 1407 | |
---|
[3266] | 1408 | IF (SIZE(field,1) == klev) then |
---|
[3003] | 1409 | !$OMP MASTER |
---|
| 1410 | CALL xios_send_field(field_name,field) |
---|
| 1411 | !$OMP END MASTER |
---|
[3266] | 1412 | ELSE |
---|
[3003] | 1413 | nlev=SIZE(field,2) |
---|
[1852] | 1414 | |
---|
| 1415 | |
---|
[3003] | 1416 | CALL Gather_omp(field,buffer_omp) |
---|
[1852] | 1417 | !$OMP MASTER |
---|
[3003] | 1418 | CALL grid1Dto2D_mpi(buffer_omp,field3d) |
---|
[1852] | 1419 | |
---|
| 1420 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 1421 | !ATTENTION, STATIONS PAS GEREES ! |
---|
| 1422 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 1423 | !IF (.NOT.clef_stations(iff)) THEN |
---|
[3003] | 1424 | IF(.TRUE.)THEN |
---|
| 1425 | ALLOCATE(index3d(nbp_lon*jj_nb*nlev)) |
---|
| 1426 | ALLOCATE(fieldok(nbp_lon*jj_nb,nlev)) |
---|
| 1427 | CALL xios_send_field(field_name, Field3d(:,:,1:nlev)) |
---|
| 1428 | |
---|
| 1429 | ELSE |
---|
| 1430 | nlev=size(field,2) |
---|
| 1431 | ALLOCATE(index3d(npstn*nlev)) |
---|
| 1432 | ALLOCATE(fieldok(npstn,nlev)) |
---|
| 1433 | |
---|
| 1434 | IF (is_sequential) THEN |
---|
| 1435 | DO n=1, nlev |
---|
| 1436 | DO ip=1, npstn |
---|
| 1437 | fieldok(ip,n)=buffer_omp(nptabij(ip),n) |
---|
| 1438 | ENDDO |
---|
[1852] | 1439 | ENDDO |
---|
[3003] | 1440 | ELSE |
---|
| 1441 | DO n=1, nlev |
---|
| 1442 | DO ip=1, npstn |
---|
| 1443 | IF(nptabij(ip).GE.klon_mpi_begin.AND. & |
---|
| 1444 | nptabij(ip).LE.klon_mpi_end) THEN |
---|
| 1445 | fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n) |
---|
| 1446 | ENDIF |
---|
| 1447 | ENDDO |
---|
[1852] | 1448 | ENDDO |
---|
[3003] | 1449 | ENDIF |
---|
| 1450 | ENDIF |
---|
| 1451 | DEALLOCATE(index3d) |
---|
| 1452 | DEALLOCATE(fieldok) |
---|
[1852] | 1453 | !$OMP END MASTER |
---|
[3266] | 1454 | ENDIF |
---|
[1852] | 1455 | |
---|
[1897] | 1456 | IF (prt_level >= 10) write(lunout,*)'End histrwrite3d_xios ',field_name |
---|
[3266] | 1457 | |
---|
[1852] | 1458 | END SUBROUTINE histwrite3d_xios |
---|
[2645] | 1459 | |
---|
[2660] | 1460 | #ifdef CPP_XIOS |
---|
[2645] | 1461 | SUBROUTINE histwrite0d_xios(field_name, field) |
---|
[2854] | 1462 | USE xios, ONLY: xios_send_field |
---|
[3238] | 1463 | USE mod_phys_lmdz_para, ONLY: is_master |
---|
| 1464 | USE print_control_mod, ONLY: prt_level,lunout |
---|
[2645] | 1465 | IMPLICIT NONE |
---|
| 1466 | |
---|
[3266] | 1467 | CHARACTER(LEN=*), INTENT(IN) :: field_name |
---|
| 1468 | REAL, INTENT(IN) :: field ! --> scalar |
---|
[2645] | 1469 | |
---|
[3266] | 1470 | IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite0d_xios for ', field_name |
---|
[3238] | 1471 | |
---|
[2645] | 1472 | !$OMP MASTER |
---|
[3266] | 1473 | CALL xios_send_field(field_name, field) |
---|
[2645] | 1474 | !$OMP END MASTER |
---|
| 1475 | |
---|
| 1476 | END SUBROUTINE histwrite0d_xios |
---|
[1852] | 1477 | #endif |
---|
[2660] | 1478 | |
---|
| 1479 | #endif |
---|
[3266] | 1480 | END MODULE iophy |
---|