- Timestamp:
- Mar 26, 2018, 5:25:49 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/readchlorophyll.F90
r2391 r3298 2 2 ! $Id$ 3 3 ! 4 !--This routine is to be tested with MPI / OMP parallelism 5 !--OB 26/03/2018 4 6 5 subroutinereadchlorophyll(debut)7 SUBROUTINE readchlorophyll(debut) 6 8 7 use netcdf95, only: nf95_close, nf95_gw_var, nf95_inq_dimid, & 8 nf95_inq_varid, nf95_open 9 use netcdf, only: nf90_get_var, nf90_noerr, nf90_nowrite 10 11 USE phys_cal_mod, ONLY : mth_cur 12 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, & 13 grid2dto1d_glo 14 USE mod_phys_lmdz_mpi_data, ONLY : is_mpi_root 9 USE netcdf95, ONLY: nf95_close, nf95_gw_var, nf95_inq_dimid, nf95_inq_varid, nf95_open 10 USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_nowrite 11 USE phys_cal_mod, ONLY: mth_cur 12 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid2dto1d_glo 13 USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root 14 USE mod_phys_lmdz_omp_data, ONLY: is_omp_root 15 15 USE mod_phys_lmdz_para, ONLY: scatter 16 16 USE phys_state_var_mod, ONLY: chl_con 17 17 18 implicit none18 IMPLICIT NONE 19 19 20 include"YOMCST.h"20 INCLUDE "YOMCST.h" 21 21 22 22 ! Variable input 23 logicaldebut23 LOGICAL debut 24 24 25 25 ! Variables locales 26 integern_lat ! number of latitudes in the input data27 integern_lon ! number of longitudes in the input data28 integern_lev ! number of levels in the input data29 integern_month ! number of months in the input data30 real, pointer:: latitude(:)31 real, pointer:: longitude(:)32 real, pointer:: time(:)33 integeri, k34 integer, save:: mth_pre26 INTEGER n_lat ! number of latitudes in the input data 27 INTEGER n_lon ! number of longitudes in the input data 28 INTEGER n_lev ! number of levels in the input data 29 INTEGER n_month ! number of months in the input data 30 REAL, POINTER :: latitude(:) 31 REAL, POINTER :: longitude(:) 32 REAL, POINTER :: time(:) 33 INTEGER i, k 34 INTEGER, SAVE :: mth_pre 35 35 !$OMP THREADPRIVATE(mth_pre) 36 36 37 37 ! Champs reconstitues 38 real, allocatable:: chlorocon(:, :, :)39 real, allocatable:: chlorocon_mois(:, :)40 real, allocatable:: chlorocon_mois_glo(:)38 REAL, ALLOCATABLE :: chlorocon(:, :, :) 39 REAL, ALLOCATABLE :: chlorocon_mois(:, :) 40 REAL, ALLOCATABLE :: chlorocon_mois_glo(:) 41 41 42 42 ! For NetCDF: 43 integer ncid_in ! IDs for input files 44 integer varid, ncerr 45 43 INTEGER ncid_in ! IDs for input files 44 INTEGER varid, ncerr 46 45 47 46 !-------------------------------------------------------- 48 49 47 50 48 !--only read file if beginning of run or start of new month 51 49 IF (debut.OR.mth_cur.NE.mth_pre) THEN 52 50 53 IF (is_mpi_root) THEN 54 51 IF (is_mpi_root.AND.is_omp_root) THEN 55 52 56 53 CALL nf95_open("chlorophyll.nc", nf90_nowrite, ncid_in) … … 64 61 STOP 65 62 ENDIF 66 67 63 68 64 CALL nf95_inq_varid(ncid_in, "lat", varid) … … 104 100 CALL grid2dTo1d_glo(chlorocon_mois,chlorocon_mois_glo) 105 101 106 107 print*,"chrolophyll current month",mth_cur 108 do i=1,klon_glo 102 print *,"chrolophyll current month",mth_cur 103 DO i=1,klon_glo 109 104 ! if(isnan(chlorocon_mois_glo(i)))then ! isnan() is not in the Fortran standard... 110 105 ! Another way to check for NaN: 111 if(chlorocon_mois_glo(i).ne.chlorocon_mois_glo(i)) then 112 chlorocon_mois_glo(i)=0. 113 endif 114 !print*,"high chl con",i,chlorocon_mois_glo(i) 115 enddo 106 IF (chlorocon_mois_glo(i).NE.chlorocon_mois_glo(i)) chlorocon_mois_glo(i)=0. 107 ENDDO 116 108 117 109 ! DEALLOCATE(chlorocon) … … 119 111 ! DEALLOCATE(chlorocon_mois_glo) 120 112 121 ENDIF !--is_mpi_root 113 ENDIF !--is_mpi_root and is_omp_root 122 114 123 115 !--scatter on all proc … … 129 121 ENDIF !--debut ou nouveau mois 130 122 131 end subroutinereadchlorophyll123 END SUBROUTINE readchlorophyll
Note: See TracChangeset
for help on using the changeset viewer.