[2097] | 1 | ! $Id: iophy.F90 5135 2024-07-26 17:20:23Z aborella $ |
---|
[5099] | 2 | |
---|
[1883] | 3 | module iophy |
---|
[5111] | 4 | |
---|
[5117] | 5 | ! abd REAL,PRIVATE,ALLOCATABLE,DIMENSION(:),save :: io_lat |
---|
| 6 | ! abd REAL,PRIVATE,ALLOCATABLE,DIMENSION(:),save :: io_lon |
---|
| 7 | REAL, ALLOCATABLE, DIMENSION(:), save :: io_lat |
---|
| 8 | REAL, ALLOCATABLE, DIMENSION(:), save :: io_lon |
---|
[1883] | 9 | INTEGER, save :: phys_domain_id |
---|
| 10 | INTEGER, save :: npstn |
---|
[5117] | 11 | INTEGER, ALLOCATABLE, DIMENSION(:), save :: nptabij |
---|
[1883] | 12 | |
---|
[5111] | 13 | |
---|
| 14 | ! interfaces for both IOIPSL and XIOS |
---|
[1883] | 15 | INTERFACE histwrite_phy |
---|
[5111] | 16 | MODULE PROCEDURE histwrite2d_phy, histwrite3d_phy, histwrite2d_xios, histwrite3d_xios |
---|
[1883] | 17 | END INTERFACE |
---|
| 18 | |
---|
[5111] | 19 | ! interfaces for both IOIPSL and XIOS |
---|
[1883] | 20 | INTERFACE histbeg_phy_all |
---|
| 21 | MODULE PROCEDURE histbeg_phy, histbeg_phyxios |
---|
| 22 | END INTERFACE |
---|
| 23 | |
---|
[5119] | 24 | CONTAINS |
---|
[1883] | 25 | |
---|
[5111] | 26 | SUBROUTINE init_iophy_new(rlat, rlon) |
---|
[5116] | 27 | USE dimphy, ONLY: klon |
---|
| 28 | USE lmdz_phys_para, ONLY: gather, bcast, & |
---|
[5111] | 29 | jj_nb, jj_begin, jj_end, ii_begin, ii_end, & |
---|
| 30 | mpi_size, mpi_rank, klon_mpi, & |
---|
| 31 | is_sequential, is_south_pole_dyn |
---|
[5116] | 32 | USE lmdz_grid_phy, ONLY: nbp_lon, nbp_lat, klon_glo |
---|
[5112] | 33 | USE lmdz_print_control, ONLY: lunout, prt_level |
---|
[5111] | 34 | USE lmdz_grid_phy, ONLY: nbp_lon, nbp_lat |
---|
[5116] | 35 | USE ioipsl, ONLY: flio_dom_set |
---|
[5117] | 36 | USE lmdz_wxios, ONLY: wxios_domain_param, using_xios |
---|
[5113] | 37 | IMPLICIT NONE |
---|
[5117] | 38 | REAL, DIMENSION(klon), INTENT(IN) :: rlon |
---|
| 39 | REAL, DIMENSION(klon), INTENT(IN) :: rlat |
---|
[1883] | 40 | |
---|
[5117] | 41 | REAL, DIMENSION(klon_glo) :: rlat_glo |
---|
| 42 | REAL, DIMENSION(klon_glo) :: rlon_glo |
---|
[1883] | 43 | |
---|
[5111] | 44 | INTEGER, DIMENSION(2) :: ddid |
---|
| 45 | INTEGER, DIMENSION(2) :: dsg |
---|
| 46 | INTEGER, DIMENSION(2) :: dsl |
---|
| 47 | INTEGER, DIMENSION(2) :: dpf |
---|
| 48 | INTEGER, DIMENSION(2) :: dpl |
---|
| 49 | INTEGER, DIMENSION(2) :: dhs |
---|
| 50 | INTEGER, DIMENSION(2) :: dhe |
---|
| 51 | INTEGER :: i |
---|
[5116] | 52 | INTEGER :: data_ibegin, data_iend |
---|
[5111] | 53 | |
---|
| 54 | CALL gather(rlat, rlat_glo) |
---|
[1883] | 55 | CALL bcast(rlat_glo) |
---|
[5111] | 56 | CALL gather(rlon, rlon_glo) |
---|
[1883] | 57 | CALL bcast(rlon_glo) |
---|
[5111] | 58 | |
---|
| 59 | !$OMP MASTER |
---|
[2326] | 60 | ALLOCATE(io_lat(nbp_lat)) |
---|
[5111] | 61 | io_lat(1) = rlat_glo(1) |
---|
| 62 | io_lat(nbp_lat) = rlat_glo(klon_glo) |
---|
[5116] | 63 | IF ((nbp_lon * nbp_lat) > 1) THEN |
---|
[5111] | 64 | DO i = 2, nbp_lat - 1 |
---|
| 65 | io_lat(i) = rlat_glo(2 + (i - 2) * nbp_lon) |
---|
[1883] | 66 | ENDDO |
---|
| 67 | ENDIF |
---|
| 68 | |
---|
[2326] | 69 | ALLOCATE(io_lon(nbp_lon)) |
---|
[5111] | 70 | IF ((nbp_lon * nbp_lat) > 1) THEN |
---|
| 71 | io_lon(:) = rlon_glo(2:nbp_lon + 1) |
---|
[2326] | 72 | ELSE |
---|
[5111] | 73 | io_lon(1) = rlon_glo(1) |
---|
[2326] | 74 | ENDIF |
---|
[5111] | 75 | !! (I) dtnb : total number of domains |
---|
| 76 | !! (I) dnb : domain number |
---|
| 77 | !! (I) did(:) : distributed dimensions identifiers |
---|
| 78 | !! (up to 5 dimensions are supported) |
---|
| 79 | !! (I) dsg(:) : total number of points for each dimension |
---|
| 80 | !! (I) dsl(:) : local number of points for each dimension |
---|
| 81 | !! (I) dpf(:) : position of first local point for each dimension |
---|
| 82 | !! (I) dpl(:) : position of last local point for each dimension |
---|
| 83 | !! (I) dhs(:) : start halo size for each dimension |
---|
| 84 | !! (I) dhe(:) : end halo size for each dimension |
---|
| 85 | !! (C) cdnm : Model domain definition name. |
---|
| 86 | !! The names actually supported are : |
---|
| 87 | !! "BOX", "APPLE", "ORANGE". |
---|
| 88 | !! These names are case insensitive. |
---|
| 89 | ddid = (/ 1, 2 /) |
---|
| 90 | dsg = (/ nbp_lon, nbp_lat /) |
---|
| 91 | dsl = (/ nbp_lon, jj_nb /) |
---|
| 92 | dpf = (/ 1, jj_begin /) |
---|
| 93 | dpl = (/ nbp_lon, jj_end /) |
---|
| 94 | dhs = (/ ii_begin - 1, 0 /) |
---|
[5117] | 95 | IF (mpi_rank==mpi_size - 1) THEN |
---|
[5111] | 96 | dhe = (/0, 0/) |
---|
[1883] | 97 | else |
---|
[5111] | 98 | dhe = (/ nbp_lon - ii_end, 0 /) |
---|
[1883] | 99 | endif |
---|
[5111] | 100 | |
---|
[2097] | 101 | #ifndef CPP_IOIPSL_NO_OUTPUT |
---|
[5111] | 102 | CALL flio_dom_set(mpi_size, mpi_rank, ddid, dsg, dsl, dpf, dpl, dhs, dhe, & |
---|
| 103 | 'APPLE', phys_domain_id) |
---|
[1883] | 104 | #endif |
---|
[4619] | 105 | IF (using_xios) THEN |
---|
| 106 | ! Set values for the mask: |
---|
| 107 | IF (mpi_rank == 0) THEN |
---|
[5111] | 108 | data_ibegin = 0 |
---|
| 109 | ELSE |
---|
| 110 | data_ibegin = ii_begin - 1 |
---|
[4619] | 111 | END IF |
---|
[1883] | 112 | |
---|
[5111] | 113 | IF (mpi_rank == mpi_size - 1) THEN |
---|
| 114 | data_iend = nbp_lon |
---|
[4619] | 115 | ELSE |
---|
[5111] | 116 | data_iend = ii_end + 1 |
---|
[4619] | 117 | END IF |
---|
[1883] | 118 | |
---|
[5117] | 119 | IF (prt_level>=10) THEN |
---|
[5116] | 120 | 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 |
---|
| 121 | WRITE(lunout, *) "init_iophy_new: mpirank=", mpi_rank, " nbp_lon=", nbp_lon, " nbp_lat=", nbp_lat |
---|
| 122 | WRITE(lunout, *) "init_iophy_new: mpirank=", mpi_rank, " data_ibegin=", data_ibegin, " data_iend=", data_iend |
---|
| 123 | WRITE(lunout, *) "init_iophy_new: mpirank=", mpi_rank, " data_ibegin=", data_ibegin, " data_iend=", data_iend |
---|
| 124 | WRITE(lunout, *) "init_iophy_new: mpirank=", mpi_rank, " is_south_pole=", is_south_pole_dyn |
---|
[4619] | 125 | endif |
---|
[1883] | 126 | |
---|
[4619] | 127 | ! Initialize the XIOS domain coreesponding to this process: |
---|
[5111] | 128 | CALL wxios_domain_param("dom_glo") |
---|
| 129 | ! CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, & |
---|
| 130 | ! 1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end, & |
---|
| 131 | ! klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend, & |
---|
| 132 | ! io_lat, io_lon,is_south_pole_dyn,mpi_rank) |
---|
[4619] | 133 | ENDIF |
---|
[5111] | 134 | !$OMP END MASTER |
---|
| 135 | |
---|
[1883] | 136 | END SUBROUTINE init_iophy_new |
---|
[5111] | 137 | |
---|
| 138 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 139 | |
---|
| 140 | SUBROUTINE histbeg_phy(name, itau0, zjulian, dtime, nhori, nid_day) |
---|
[5116] | 141 | USE lmdz_phys_para, ONLY: is_sequential, jj_begin, jj_end, jj_nb |
---|
[5117] | 142 | USE ioipsl, ONLY: histbeg |
---|
[5112] | 143 | USE lmdz_print_control, ONLY: prt_level, lunout |
---|
[5111] | 144 | USE lmdz_grid_phy, ONLY: nbp_lon |
---|
[5113] | 145 | IMPLICIT NONE |
---|
[5111] | 146 | |
---|
[5135] | 147 | CHARACTER*(*), INTENT(IN) :: name |
---|
[5117] | 148 | INTEGER, INTENT(IN) :: itau0 |
---|
| 149 | REAL, INTENT(IN) :: zjulian |
---|
| 150 | REAL, INTENT(IN) :: dtime |
---|
| 151 | INTEGER, INTENT(OUT) :: nhori |
---|
| 152 | INTEGER, INTENT(OUT) :: nid_day |
---|
[1883] | 153 | |
---|
[5111] | 154 | !$OMP MASTER |
---|
[5117] | 155 | IF (is_sequential) THEN |
---|
[5111] | 156 | CALL histbeg(name, nbp_lon, io_lon, jj_nb, io_lat(jj_begin:jj_end), & |
---|
| 157 | 1, nbp_lon, 1, jj_nb, itau0, zjulian, dtime, nhori, nid_day) |
---|
[1883] | 158 | else |
---|
[5111] | 159 | CALL histbeg(name, nbp_lon, io_lon, jj_nb, io_lat(jj_begin:jj_end), & |
---|
| 160 | 1, nbp_lon, 1, jj_nb, itau0, zjulian, dtime, nhori, nid_day, phys_domain_id) |
---|
[1883] | 161 | endif |
---|
[5111] | 162 | !$OMP END MASTER |
---|
| 163 | |
---|
[5103] | 164 | END SUBROUTINE histbeg_phy |
---|
[1883] | 165 | |
---|
[5111] | 166 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1883] | 167 | |
---|
| 168 | |
---|
[5111] | 169 | ! SUBROUTINE histbeg_phyxios(name,itau0,zjulian,dtime,ffreq,lev,nhori,nid_day) |
---|
| 170 | SUBROUTINE histbeg_phyxios(name, ffreq, lev) |
---|
[5116] | 171 | USE lmdz_phys_para, ONLY: is_using_mpi, is_mpi_root |
---|
[5117] | 172 | USE lmdz_wxios, ONLY: wxios_add_file |
---|
[5111] | 173 | IMPLICIT NONE |
---|
| 174 | |
---|
[5135] | 175 | CHARACTER*(*), INTENT(IN) :: name |
---|
[5117] | 176 | ! INTEGER, INTENT(IN) :: itau0 |
---|
[5111] | 177 | ! REAL,INTENT(IN) :: zjulian |
---|
| 178 | ! REAL,INTENT(IN) :: dtime |
---|
| 179 | character(LEN = *), INTENT(IN) :: ffreq |
---|
| 180 | INTEGER, INTENT(IN) :: lev |
---|
[5117] | 181 | ! INTEGER,INTENT(OUT) :: nhori |
---|
| 182 | ! INTEGER,INTENT(OUT) :: nid_day |
---|
[1883] | 183 | |
---|
[5111] | 184 | !$OMP MASTER |
---|
[1883] | 185 | |
---|
| 186 | ! ug OMP en chantier... |
---|
| 187 | IF((.NOT. is_using_mpi) .OR. is_mpi_root) THEN |
---|
[5111] | 188 | ! ug Création du fichier |
---|
| 189 | CALL wxios_add_file(name, ffreq, lev) |
---|
[1883] | 190 | END IF |
---|
| 191 | |
---|
[5111] | 192 | !$OMP END MASTER |
---|
| 193 | |
---|
[1883] | 194 | END SUBROUTINE histbeg_phyxios |
---|
| 195 | |
---|
| 196 | |
---|
[5111] | 197 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 198 | |
---|
| 199 | SUBROUTINE histwrite2d_phy(nid, lpoint, name, itau, field) |
---|
[5116] | 200 | USE dimphy, ONLY: klon |
---|
| 201 | USE lmdz_phys_para, ONLY: Gather_omp, grid1Dto2D_mpi, & |
---|
[5111] | 202 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
| 203 | jj_nb, klon_mpi |
---|
[5116] | 204 | USE ioipsl, ONLY: histwrite |
---|
[5111] | 205 | USE lmdz_grid_phy, ONLY: nbp_lon |
---|
| 206 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
[5113] | 207 | IMPLICIT NONE |
---|
[5111] | 208 | |
---|
[5117] | 209 | INTEGER, INTENT(IN) :: nid |
---|
| 210 | logical, INTENT(IN) :: lpoint |
---|
[5135] | 211 | CHARACTER*(*), INTENT(IN) :: name |
---|
[5117] | 212 | INTEGER, INTENT(IN) :: itau |
---|
| 213 | REAL, DIMENSION(:), INTENT(IN) :: field |
---|
| 214 | REAL, DIMENSION(klon_mpi) :: buffer_omp |
---|
| 215 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index2d |
---|
[5111] | 216 | REAL :: Field2d(nbp_lon, jj_nb) |
---|
[1883] | 217 | |
---|
[5116] | 218 | INTEGER :: ip |
---|
[5117] | 219 | REAL, ALLOCATABLE, DIMENSION(:) :: fieldok |
---|
[1883] | 220 | |
---|
[5111] | 221 | IF (size(field)/=klon) CALL abort_physic('iophy::histwrite2d', 'Field first dimension not equal to klon', 1) |
---|
| 222 | |
---|
| 223 | CALL Gather_omp(field, buffer_omp) |
---|
| 224 | !$OMP MASTER |
---|
| 225 | CALL grid1Dto2D_mpi(buffer_omp, Field2d) |
---|
[5116] | 226 | IF(.NOT.lpoint) THEN |
---|
[5111] | 227 | ALLOCATE(index2d(nbp_lon * jj_nb)) |
---|
| 228 | ALLOCATE(fieldok(nbp_lon * jj_nb)) |
---|
| 229 | CALL histwrite(nid, name, itau, Field2d, nbp_lon * jj_nb, index2d) |
---|
[1883] | 230 | else |
---|
[5111] | 231 | ALLOCATE(fieldok(npstn)) |
---|
| 232 | ALLOCATE(index2d(npstn)) |
---|
[1883] | 233 | |
---|
[5116] | 234 | IF(is_sequential) THEN |
---|
[5111] | 235 | ! klon_mpi_begin=1 |
---|
| 236 | ! klon_mpi_end=klon |
---|
| 237 | DO ip = 1, npstn |
---|
| 238 | fieldok(ip) = buffer_omp(nptabij(ip)) |
---|
| 239 | ENDDO |
---|
| 240 | else |
---|
| 241 | DO ip = 1, npstn |
---|
| 242 | ! PRINT*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip) |
---|
| 243 | IF(nptabij(ip)>=klon_mpi_begin.AND. & |
---|
| 244 | nptabij(ip)<=klon_mpi_end) THEN |
---|
| 245 | fieldok(ip) = buffer_omp(nptabij(ip) - klon_mpi_begin + 1) |
---|
| 246 | ENDIF |
---|
| 247 | ENDDO |
---|
| 248 | endif |
---|
| 249 | CALL histwrite(nid, name, itau, fieldok, npstn, index2d) |
---|
[5099] | 250 | |
---|
[1883] | 251 | endif |
---|
| 252 | deallocate(index2d) |
---|
| 253 | deallocate(fieldok) |
---|
[5111] | 254 | !$OMP END MASTER |
---|
[5103] | 255 | END SUBROUTINE histwrite2d_phy |
---|
[1883] | 256 | |
---|
[5111] | 257 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1883] | 258 | |
---|
[5111] | 259 | SUBROUTINE histwrite3d_phy(nid, lpoint, name, itau, field) |
---|
[5116] | 260 | USE dimphy, ONLY: klon |
---|
| 261 | USE lmdz_phys_para, ONLY: Gather_omp, grid1Dto2D_mpi, & |
---|
[5111] | 262 | is_sequential, klon_mpi_begin, klon_mpi_end, & |
---|
| 263 | jj_nb, klon_mpi |
---|
[5116] | 264 | USE ioipsl, ONLY: histwrite |
---|
[5111] | 265 | USE lmdz_grid_phy, ONLY: nbp_lon |
---|
| 266 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
[5113] | 267 | IMPLICIT NONE |
---|
[5111] | 268 | |
---|
[5117] | 269 | INTEGER, INTENT(IN) :: nid |
---|
| 270 | logical, INTENT(IN) :: lpoint |
---|
[5135] | 271 | CHARACTER*(*), INTENT(IN) :: name |
---|
[5117] | 272 | INTEGER, INTENT(IN) :: itau |
---|
| 273 | REAL, DIMENSION(:, :), INTENT(IN) :: field ! --> field(klon,:) |
---|
| 274 | REAL, DIMENSION(klon_mpi, size(field, 2)) :: buffer_omp |
---|
[5111] | 275 | REAL :: Field3d(nbp_lon, jj_nb, size(field, 2)) |
---|
[1883] | 276 | INTEGER :: ip, n, nlev |
---|
[5117] | 277 | INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d |
---|
| 278 | REAL, ALLOCATABLE, DIMENSION(:, :) :: fieldok |
---|
[1883] | 279 | |
---|
[5111] | 280 | IF (size(field, 1)/=klon) CALL abort_physic('iophy::histwrite3d', 'Field first dimension not equal to klon', 1) |
---|
| 281 | nlev = size(field, 2) |
---|
[1883] | 282 | |
---|
[5111] | 283 | CALL Gather_omp(field, buffer_omp) |
---|
| 284 | !$OMP MASTER |
---|
| 285 | CALL grid1Dto2D_mpi(buffer_omp, field3d) |
---|
[5116] | 286 | IF(.NOT.lpoint) THEN |
---|
[5111] | 287 | ALLOCATE(index3d(nbp_lon * jj_nb * nlev)) |
---|
| 288 | ALLOCATE(fieldok(nbp_lon * jj_nb, nlev)) |
---|
| 289 | CALL histwrite(nid, name, itau, Field3d, nbp_lon * jj_nb * nlev, index3d) |
---|
[1883] | 290 | else |
---|
[5111] | 291 | nlev = size(field, 2) |
---|
| 292 | ALLOCATE(index3d(npstn * nlev)) |
---|
| 293 | ALLOCATE(fieldok(npstn, nlev)) |
---|
[1883] | 294 | |
---|
[5116] | 295 | IF(is_sequential) THEN |
---|
[5111] | 296 | ! klon_mpi_begin=1 |
---|
| 297 | ! klon_mpi_end=klon |
---|
| 298 | DO n = 1, nlev |
---|
| 299 | DO ip = 1, npstn |
---|
| 300 | fieldok(ip, n) = buffer_omp(nptabij(ip), n) |
---|
| 301 | ENDDO |
---|
| 302 | ENDDO |
---|
[1883] | 303 | else |
---|
[5111] | 304 | DO n = 1, nlev |
---|
| 305 | DO ip = 1, npstn |
---|
| 306 | IF(nptabij(ip)>=klon_mpi_begin.AND. & |
---|
| 307 | nptabij(ip)<=klon_mpi_end) THEN |
---|
| 308 | fieldok(ip, n) = buffer_omp(nptabij(ip) - klon_mpi_begin + 1, n) |
---|
| 309 | ENDIF |
---|
| 310 | ENDDO |
---|
| 311 | ENDDO |
---|
[1883] | 312 | endif |
---|
[5111] | 313 | CALL histwrite(nid, name, itau, fieldok, npstn * nlev, index3d) |
---|
| 314 | endif |
---|
| 315 | deallocate(index3d) |
---|
| 316 | deallocate(fieldok) |
---|
| 317 | !$OMP END MASTER |
---|
[5103] | 318 | END SUBROUTINE histwrite3d_phy |
---|
[1883] | 319 | |
---|
[5111] | 320 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1883] | 321 | |
---|
[5111] | 322 | ! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV |
---|
[4619] | 323 | |
---|
[5111] | 324 | SUBROUTINE histwrite2d_xios(field_name, field) |
---|
[5116] | 325 | USE dimphy, ONLY: klon |
---|
| 326 | USE lmdz_phys_para, ONLY: gather_omp, grid1Dto2D_mpi, & |
---|
[5111] | 327 | jj_nb, klon_mpi |
---|
[5116] | 328 | USE lmdz_xios, ONLY: xios_send_field |
---|
[5112] | 329 | USE lmdz_print_control, ONLY: prt_level, lunout |
---|
[5111] | 330 | USE lmdz_grid_phy, ONLY: nbp_lon |
---|
| 331 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
| 332 | IMPLICIT NONE |
---|
[1883] | 333 | |
---|
[5111] | 334 | CHARACTER(LEN = *), INTENT(IN) :: field_name |
---|
[1883] | 335 | REAL, DIMENSION(:), INTENT(IN) :: field |
---|
| 336 | |
---|
[5111] | 337 | REAL, DIMENSION(klon_mpi) :: buffer_omp |
---|
| 338 | REAL :: Field2d(nbp_lon, jj_nb) |
---|
[1883] | 339 | |
---|
[5111] | 340 | IF (prt_level >= 10) WRITE(lunout, *)'Begin histrwrite2d_xios ', trim(field_name) |
---|
| 341 | |
---|
| 342 | IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_xios', 'Field first DIMENSION not equal to klon', 1) |
---|
| 343 | |
---|
| 344 | CALL Gather_omp(field, buffer_omp) |
---|
| 345 | !$OMP MASTER |
---|
| 346 | CALL grid1Dto2D_mpi(buffer_omp, Field2d) |
---|
| 347 | |
---|
[2002] | 348 | CALL xios_send_field(field_name, Field2d) |
---|
[5111] | 349 | !$OMP END MASTER |
---|
[1883] | 350 | |
---|
[5111] | 351 | IF (prt_level >= 10) WRITE(lunout, *)'End histrwrite2d_xios ', trim(field_name) |
---|
[1883] | 352 | END SUBROUTINE histwrite2d_xios |
---|
| 353 | |
---|
[5111] | 354 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1883] | 355 | |
---|
[5111] | 356 | ! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV |
---|
[4619] | 357 | |
---|
[1883] | 358 | SUBROUTINE histwrite3d_xios(field_name, field) |
---|
[5116] | 359 | USE dimphy, ONLY: klon, klev |
---|
| 360 | USE lmdz_phys_para, ONLY: gather_omp, grid1Dto2D_mpi, & |
---|
[5111] | 361 | jj_nb, klon_mpi |
---|
[5116] | 362 | USE lmdz_xios, ONLY: xios_send_field |
---|
[5112] | 363 | USE lmdz_print_control, ONLY: prt_level, lunout |
---|
[5111] | 364 | USE lmdz_grid_phy, ONLY: nbp_lon |
---|
| 365 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
| 366 | IMPLICIT NONE |
---|
[1883] | 367 | |
---|
[5111] | 368 | CHARACTER(LEN = *), INTENT(IN) :: field_name |
---|
| 369 | REAL, DIMENSION(:, :), INTENT(IN) :: field ! --> field(klon,:) |
---|
[1883] | 370 | |
---|
[5111] | 371 | REAL, DIMENSION(klon_mpi, SIZE(field, 2)) :: buffer_omp |
---|
| 372 | REAL :: Field3d(nbp_lon, jj_nb, SIZE(field, 2)) |
---|
[1883] | 373 | INTEGER :: ip, n, nlev |
---|
| 374 | |
---|
[5116] | 375 | IF (prt_level >= 10) WRITE(lunout, *)'Begin histrwrite3d_xios ', trim(field_name) |
---|
[1883] | 376 | |
---|
| 377 | !Et on.... écrit |
---|
[5111] | 378 | IF (SIZE(field, 1)/=klon) CALL abort_physic('iophy::histwrite3d', 'Field first DIMENSION not equal to klon', 1) |
---|
| 379 | nlev = SIZE(field, 2) |
---|
[1883] | 380 | |
---|
[5111] | 381 | CALL Gather_omp(field, buffer_omp) |
---|
| 382 | !$OMP MASTER |
---|
| 383 | CALL grid1Dto2D_mpi(buffer_omp, field3d) |
---|
[1883] | 384 | |
---|
[5111] | 385 | CALL xios_send_field(field_name, Field3d(:, :, 1:nlev)) |
---|
| 386 | !$OMP END MASTER |
---|
[1883] | 387 | |
---|
[5116] | 388 | IF (prt_level >= 10) WRITE(lunout, *)'End histrwrite3d_xios ', trim(field_name) |
---|
[1883] | 389 | END SUBROUTINE histwrite3d_xios |
---|
| 390 | |
---|
[5119] | 391 | END MODULE iophy |
---|