Changeset 1575 for trunk/LMDZ.COMMON/libf/misc
- Timestamp:
- Jul 13, 2016, 4:29:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/misc/wxios.F90
r1549 r1575 1 ! $Id : wxios.F90$1 ! $Id$ 2 2 #ifdef CPP_XIOS 3 3 MODULE wxios … … 33 33 SUBROUTINE reformadate(odate, ndate) 34 34 CHARACTER(len=*), INTENT(IN) :: odate 35 #ifdef XIOS1 35 36 CHARACTER(len=100), INTENT(OUT) :: ndate 37 #else 38 TYPE(xios_duration) :: ndate 39 #endif 36 40 37 41 INTEGER :: i = 0 … … 48 52 i = INDEX(odate, "day") 49 53 IF (i > 0) THEN 54 #ifdef XIOS1 50 55 ndate = odate(1:i-1)//"d" 56 #else 57 read(odate(1:i-1),*) ndate%day 58 #endif 51 59 END IF 52 60 53 61 i = INDEX(odate, "hr") 54 62 IF (i > 0) THEN 63 #ifdef XIOS1 55 64 ndate = odate(1:i-1)//"h" 65 #else 66 read(odate(1:i-1),*) ndate%hour 67 #endif 56 68 END IF 57 69 58 70 i = INDEX(odate, "mth") 59 71 IF (i > 0) THEN 72 #ifdef XIOS1 60 73 ndate = odate(1:i-1)//"mo" 74 #else 75 read(odate(1:i-1),*) ndate%month 76 #endif 61 77 END IF 62 78 … … 99 115 100 116 SUBROUTINE wxios_init(xios_ctx_name, locom, outcom, type_ocean) 101 IMPLICIT NONE102 I NCLUDE 'iniprint.h'117 USE print_control_mod, ONLY : prt_level, lunout 118 IMPLICIT NONE 103 119 104 120 CHARACTER(len=*), INTENT(IN) :: xios_ctx_name … … 140 156 141 157 SUBROUTINE wxios_context_init() 142 IMPLICIT NONE 143 INCLUDE 'iniprint.h' 158 USE print_control_mod, ONLY : prt_level, lunout 159 ! USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY 160 IMPLICIT NONE 144 161 145 162 TYPE(xios_context) :: xios_ctx 146 163 164 !$OMP MASTER 147 165 !Initialisation du contexte: 148 166 CALL xios_context_initialize(g_ctx_name, g_comm) … … 157 175 !Une première analyse des héritages: 158 176 CALL xios_solve_inheritance() 177 !$OMP END MASTER 159 178 END SUBROUTINE wxios_context_init 160 179 … … 164 183 165 184 SUBROUTINE wxios_set_cal(pasdetemps, calendrier, annee, mois, jour, heure, ini_an, ini_mois, ini_jour, ini_heure) 166 IMPLICIT NONE167 I NCLUDE 'iniprint.h'185 USE print_control_mod, ONLY : prt_level, lunout 186 IMPLICIT NONE 168 187 169 188 !Paramètres: … … 178 197 179 198 !Variables pour xios: 199 #ifdef XIOS1 180 200 TYPE(xios_time) :: mdtime 201 #else 202 TYPE(xios_duration) :: mdtime 203 #endif 181 204 !REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0 182 205 206 #ifdef XIOS1 183 207 mdtime = xios_time(0, 0, 0, 0, 0, pasdetemps) 208 #else 209 mdtime%second=pasdetemps 210 #endif 184 211 185 212 !Réglage du calendrier: 213 #ifdef XIOS1 186 214 SELECT CASE (calendrier) 187 215 CASE('earth_360d') … … 198 226 CALL abort_gcm('Gcm:Xios',abort_message,1) 199 227 END SELECT 228 #else 229 SELECT CASE (calendrier) 230 CASE('earth_360d') 231 CALL xios_define_calendar("D360") 232 IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 360 jours/an' 233 CASE('earth_365d') 234 CALL xios_define_calendar("NoLeap") 235 IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier terrestre a 365 jours/an' 236 CASE('gregorian') 237 CALL xios_define_calendar("Gregorian") 238 IF (prt_level >= 10) WRITE(lunout,*) 'wxios_set_cal: Calendrier gregorien' 239 CASE DEFAULT 240 abort_message = 'wxios_set_cal: Mauvais choix de calendrier' 241 CALL abort_gcm('Gcm:Xios',abort_message,1) 242 END SELECT 243 #endif 200 244 201 245 !Formatage de la date d'origine: 202 WRITE(date, "(i4.4,'-',i2.2,'-',i2.2,' ',i2.2,':00:00')") annee, mois, jour, int(heure) 246 WRITE(date, "(i4.4,'-',i2.2,'-',i2.2,' ',i2.2,':00:00')") annee, mois, jour, int(heure) 203 247 204 248 IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Time origin: ", date 205 249 #ifdef XIOS1 206 250 CALL xios_set_context_attr_hdl(g_ctx, time_origin = date) 251 #else 252 CALL xios_set_time_origin(xios_date(annee,mois,jour,int(heure),0,0)) 253 #endif 207 254 208 255 !Formatage de la date de debut: … … 212 259 IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Start date: ", date 213 260 261 #ifdef XIOS1 214 262 CALL xios_set_context_attr_hdl(g_ctx, start_date = date) 263 #else 264 CALL xios_set_start_date(xios_date(ini_an,ini_mois,ini_jour,int(ini_heure),0,0)) 265 #endif 215 266 216 267 !Et enfin,le pas de temps: … … 221 272 SUBROUTINE wxios_set_timestep(ts) 222 273 REAL, INTENT(IN) :: ts 274 #ifdef XIOS1 223 275 TYPE(xios_time) :: mdtime 224 276 225 277 mdtime = xios_time(0, 0, 0, 0, 0, ts) 278 #else 279 TYPE(xios_duration) :: mdtime 280 281 mdtime%timestep = ts 282 #endif 226 283 227 284 CALL xios_set_timestep(mdtime) … … 237 294 238 295 239 IMPLICIT NONE240 I NCLUDE 'iniprint.h'296 USE print_control_mod, ONLY : prt_level, lunout 297 IMPLICIT NONE 241 298 242 299 CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier … … 277 334 278 335 !On parametrise le domaine: 336 #ifdef XIOS1 279 337 CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin, ni=ni) 280 338 CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin, nj=nj, data_dim=2) 281 339 CALL xios_set_domain_attr_hdl(dom, lonvalue=io_lon(ibegin:iend), latvalue=io_lat(jbegin:jend)) 282 340 #else 341 CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin-1, ni=ni, type="rectilinear") 342 CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin-1, nj=nj, data_dim=2) 343 CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(ibegin:iend), latvalue_1d=io_lat(jbegin:jend)) 344 #endif 283 345 IF (.NOT.is_sequential) THEN 284 346 mask(:,:)=.TRUE. … … 291 353 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,nj)=",mask(:,nj) 292 354 ENDIF 355 #ifdef XIOS1 293 356 CALL xios_set_domain_attr_hdl(dom, mask=mask) 357 #else 358 CALL xios_set_domain_attr_hdl(dom, mask_2d=mask) 359 #endif 294 360 END IF 295 361 … … 307 373 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 308 374 SUBROUTINE wxios_add_vaxis(axis_id, axis_size, axis_value) 309 IMPLICIT NONE310 I NCLUDE 'iniprint.h'375 USE print_control_mod, ONLY : prt_level, lunout 376 IMPLICIT NONE 311 377 312 378 CHARACTER (len=*), INTENT(IN) :: axis_id … … 335 401 336 402 ! Ehouarn: New way to declare axis, without axis_group: 403 #ifdef XIOS1 337 404 CALL xios_set_axis_attr(trim(axis_id),size=axis_size,value=axis_value) 338 405 #else 406 CALL xios_set_axis_attr(trim(axis_id),n_glo=axis_size,value=axis_value) 407 #endif 339 408 !Vérification: 340 409 IF (xios_is_valid_axis(TRIM(ADJUSTL(axis_id)))) THEN … … 351 420 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 352 421 SUBROUTINE wxios_add_file(fname, ffreq, flvl) 353 IMPLICIT NONE354 I NCLUDE 'iniprint.h'422 USE print_control_mod, ONLY : prt_level, lunout 423 IMPLICIT NONE 355 424 356 425 CHARACTER(len=*), INTENT(IN) :: fname … … 360 429 TYPE(xios_file) :: x_file 361 430 TYPE(xios_filegroup) :: x_fg 431 #ifdef XIOS1 362 432 CHARACTER(len=100) :: nffreq 433 #else 434 TYPE(xios_duration) :: nffreq 435 #endif 363 436 364 437 !On regarde si le fichier n'est pas défini par XML: … … 372 445 373 446 !On configure: 447 #ifdef XIOS1 374 448 CALL xios_set_file_attr_hdl(x_file, name="X"//fname,& 375 449 output_freq=TRIM(ADJUSTL(nffreq)), output_level=flvl, enabled=.TRUE.) 376 450 #else 451 CALL xios_set_file_attr_hdl(x_file, name="X"//fname,& 452 output_freq=nffreq, output_level=flvl, enabled=.TRUE.) 453 #endif 454 377 455 IF (xios_is_valid_file("X"//fname)) THEN 378 456 IF (prt_level >= 10) THEN 379 457 WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname 458 #ifdef XIOS1 380 459 WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl 460 #else 461 WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl 462 #endif 381 463 ENDIF 382 464 ELSE 383 465 WRITE(lunout,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname) 466 #ifdef XIOS1 384 467 WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl 468 #else 469 WRITE(lunout,*) "wxios_add_file: output_freq=",nffreq,"; output_lvl=",flvl 470 #endif 385 471 END IF 386 472 ELSE … … 435 521 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 436 522 SUBROUTINE wxios_add_field_to_file(fieldname, fdim, fid, fname, fieldlongname, fieldunit, field_level, op, nam_axvert) 437 IMPLICIT NONE438 I NCLUDE 'iniprint.h'523 USE print_control_mod, ONLY : prt_level, lunout 524 IMPLICIT NONE 439 525 440 526 CHARACTER(len=*), INTENT(IN) :: fieldname … … 452 538 TYPE(xios_field) :: field 453 539 TYPE(xios_fieldgroup) :: fieldgroup 540 #ifndef XIOS1 541 TYPE(xios_duration) :: freq_op 542 #endif 454 543 LOGICAL :: bool=.FALSE. 455 544 INTEGER :: lvl =0 … … 510 599 511 600 !L'operation, sa frequence: 601 #ifdef XIOS1 512 602 CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op="1ts", prec=4) 603 #else 604 freq_op%timestep=1 605 CALL xios_set_field_attr_hdl(field, field_ref=fieldname, operation=TRIM(ADJUSTL(operation)), freq_op=freq_op, prec=4) 606 #endif 513 607 514 608
Note: See TracChangeset
for help on using the changeset viewer.