New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 15540 for NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/SBC/fldread.F90 – NEMO

Ignore:
Timestamp:
2021-11-26T12:27:56+01:00 (3 years ago)
Author:
sparonuz
Message:

Mixed precision version, tested up to 30 years on ORCA2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/SBC/fldread.F90

    r14644 r15540  
    4949   TYPE, PUBLIC ::   FLD_N      !: Namelist field informations 
    5050      CHARACTER(len = 256) ::   clname      ! generic name of the NetCDF flux file 
    51       REAL(wp)             ::   freqh       ! frequency of each flux file 
     51      REAL(dp)             ::   freqh       ! frequency of each flux file 
    5252      CHARACTER(len = 34)  ::   clvar       ! generic name of the variable in the NetCDF flux file 
    5353      LOGICAL              ::   ln_tint     ! time interpolation or not (T/F) 
     
    6565      CHARACTER(len = 256)            ::   clrootname   ! generic name of the NetCDF file 
    6666      CHARACTER(len = 256)            ::   clname       ! current name of the NetCDF file 
    67       REAL(wp)                        ::   freqh        ! frequency of each flux file 
     67      REAL(dp)                        ::   freqh        ! frequency of each flux file 
    6868      CHARACTER(len = 34)             ::   clvar        ! generic name of the variable in the NetCDF flux file 
    6969      LOGICAL                         ::   ln_tint      ! time interpolation or not (T/F) 
     
    7171      CHARACTER(len = 8)              ::   clftyp       ! type of data file 'daily', 'monthly' or yearly' 
    7272      CHARACTER(len = 1)              ::   cltype       ! nature of grid-points: T, U, V... 
    73       REAL(wp)                        ::   zsgn         ! -1. the sign change across the north fold, =  1. otherwise 
     73      REAL(dp)                        ::   zsgn         ! -1. the sign change across the north fold, =  1. otherwise 
    7474      INTEGER                         ::   num          ! iom id of the jpfld files to be read 
    7575      INTEGER , DIMENSION(2,2)        ::   nrec         ! before/after record (1: index, 2: second since Jan. 1st 00h of yr nit000) 
     
    7777      INTEGER                         ::   naa          ! index of after  values 
    7878      INTEGER , ALLOCATABLE, DIMENSION(:) ::   nrecsec   !  
    79       REAL(wp), POINTER, DIMENSION(:,:,:  ) ::   fnow   ! input fields interpolated to now time step 
    80       REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   fdta   ! 2 consecutive record of input fields 
     79      REAL(dp), POINTER, DIMENSION(:,:,:  ) ::   fnow   ! input fields interpolated to now time step 
     80      REAL(dp), POINTER, DIMENSION(:,:,:,:) ::   fdta   ! 2 consecutive record of input fields 
    8181      CHARACTER(len = 256)            ::   wgtname      ! current name of the NetCDF weight file acting as a key 
    8282      !                                                 ! into the WGTLIST structure 
     
    115115      INTEGER,  DIMENSION(:,:,:), POINTER     ::   data_jpi     ! array of source integers 
    116116      INTEGER,  DIMENSION(:,:,:), POINTER     ::   data_jpj     ! array of source integers 
    117       REAL(wp), DIMENSION(:,:,:), POINTER     ::   data_wgt     ! array of weights on model grid 
    118       REAL(wp), DIMENSION(:,:,:), POINTER     ::   fly_dta      ! array of values on input grid 
    119       REAL(wp), DIMENSION(:,:,:), POINTER     ::   col          ! temporary array for reading in columns 
     117      REAL(dp), DIMENSION(:,:,:), POINTER     ::   data_wgt     ! array of weights on model grid 
     118      REAL(dp), DIMENSION(:,:,:), POINTER     ::   fly_dta      ! array of values on input grid 
     119      REAL(dp), DIMENSION(:,:,:), POINTER     ::   col          ! temporary array for reading in columns 
    120120   END TYPE WGT 
    121121 
     
    124124   INTEGER                            ::   nxt_wgt = 1  ! point to next available space in ref_wgts array 
    125125   INTEGER                            ::   nflag = 0 
    126    REAL(wp), PARAMETER                ::   undeff_lsm = -999.00_wp 
     126   REAL(dp), PARAMETER                ::   undeff_lsm = -999.00_wp 
    127127 
    128128!$AGRIF_END_DO_NOT_TREAT 
     
    130130   !! * Substitutions 
    131131#  include "do_loop_substitute.h90" 
     132#  include "single_precision_substitute.h90" 
    132133#  include "domzgr_substitute.h90" 
    133134   !!---------------------------------------------------------------------- 
     
    357358      INTEGER ::   idmspc   ! number of spatial dimensions 
    358359      LOGICAL ::   lmoor    ! C1D case: point data 
    359       REAL(wp), DIMENSION(:,:,:), POINTER ::   dta_alias   ! short cut 
     360      REAL(dp), DIMENSION(:,:,:), POINTER ::   dta_alias   ! short cut 
    360361      !!--------------------------------------------------------------------- 
    361362      iaa = sdjf%naa 
     
    372373         CALL wgt_list( sdjf, iw ) 
    373374         CALL fld_interp( sdjf%num, sdjf%clvar, iw, ipk, dta_alias(:,:,:), sdjf%nrec(1,iaa), sdjf%lsmname ) 
    374          CALL lbc_lnk( 'fldread', dta_alias(:,:,:), sdjf%cltype, sdjf%zsgn, kfillmode = jpfillcopy ) 
     375         CALL lbc_lnk( 'fldread', dta_alias(:,:,:), sdjf%cltype, CASTSP(sdjf%zsgn), kfillmode = jpfillcopy ) 
    375376      ELSE                                          ! default case 
    376377         ! C1D case: If product of spatial dimensions == ipk, then x,y are of 
     
    386387         ELSE 
    387388            CALL iom_get( sdjf%num,  jpdom_global, sdjf%clvar, dta_alias(:,:,:), sdjf%nrec(1,iaa),   & 
    388                &          sdjf%cltype, sdjf%zsgn, kfill = jpfillcopy ) 
     389               &          sdjf%cltype, CASTSP(sdjf%zsgn), kfill = jpfillcopy ) 
    389390         ENDIF 
    390391      ENDIF 
     
    404405      INTEGER                   , INTENT(in   ) ::   knum         ! stream number 
    405406      CHARACTER(LEN=*)          , INTENT(in   ) ::   cdvar        ! variable name 
    406       REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pdta         ! bdy output field on model grid 
     407      REAL(dp), DIMENSION(:,:,:), INTENT(  out) ::   pdta         ! bdy output field on model grid 
    407408      INTEGER                   , INTENT(in   ) ::   krec         ! record number to read (ie time slice) 
    408409      INTEGER , DIMENSION(:)    , INTENT(in   ) ::   kmap         ! global-to-local bdy mapping indices 
     
    421422      INTEGER                                   ::   indims       ! number of dimensions of the variable 
    422423      INTEGER, DIMENSION(4)                     ::   idimsz       ! size of variable dimensions  
    423       REAL(wp)                                  ::   zfv          ! fillvalue  
    424       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zz_read      ! work space for global boundary data 
    425       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zdta_read    ! work space local data requiring vertical interpolation 
    426       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zdta_read_z  ! work space local data requiring vertical interpolation 
    427       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zdta_read_dz ! work space local data requiring vertical interpolation 
     424      REAL(dp)                                  ::   zfv          ! fillvalue  
     425      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zz_read      ! work space for global boundary data 
     426      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zdta_read    ! work space local data requiring vertical interpolation 
     427      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zdta_read_z  ! work space local data requiring vertical interpolation 
     428      REAL(dp), ALLOCATABLE, DIMENSION(:,:,:)   ::   zdta_read_dz ! work space local data requiring vertical interpolation 
    428429      CHARACTER(LEN=1),DIMENSION(3)             ::   cltype 
    429430      LOGICAL                                   ::   lluld        ! is the variable using the unlimited dimension 
     
    506507      !! ** Purpose :  inner core of fld_map 
    507508      !!---------------------------------------------------------------------- 
    508       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read    ! global boundary data 
     509      REAL(dp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read    ! global boundary data 
    509510      INTEGER,  DIMENSION(:    ), INTENT(in   ) ::   kmap         ! global-to-local bdy mapping indices 
    510       REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pdta_bdy     ! bdy output field on model grid 
     511      REAL(dp), DIMENSION(:,:,:), INTENT(  out) ::   pdta_bdy     ! bdy output field on model grid 
    511512      !! 
    512513      INTEGER,  DIMENSION(3) ::   idim_read,  idim_bdy            ! arrays dimensions 
     
    550551      USE bdy_oce, ONLY:  idx_bdy         ! indexing for map <-> ij transformation 
    551552 
    552       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read       ! data read in bdy file 
    553       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read_z     ! depth of the data read in bdy file 
    554       REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read_dz    ! thickness of the levels in bdy file 
    555       REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   pdta            ! output field on model grid (2 dimensional) 
    556       REAL(wp)                  , INTENT(in   ) ::   pfv             ! fillvalue of the data read in bdy file 
     553      REAL(dp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read       ! data read in bdy file 
     554      REAL(dp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read_z     ! depth of the data read in bdy file 
     555      REAL(dp), DIMENSION(:,:,:), INTENT(in   ) ::   pdta_read_dz    ! thickness of the levels in bdy file 
     556      REAL(dp), DIMENSION(:,:,:), INTENT(  out) ::   pdta            ! output field on model grid (2 dimensional) 
     557      REAL(dp)                  , INTENT(in   ) ::   pfv             ! fillvalue of the data read in bdy file 
    557558      LOGICAL                   , INTENT(in   ) ::   ldtotvel        ! true if toal ( = barotrop + barocline) velocity 
    558559      INTEGER                   , INTENT(in   ) ::   kgrd            ! grid type (t, u, v) 
     
    564565      INTEGER                  ::   ipkmax              ! number of vertical levels in boundary data file where no mask 
    565566      INTEGER                  ::   jb, ji, jj, jk, jkb ! loop counters 
    566       REAL(wp)                 ::   zcoef, zi           !  
    567       REAL(wp)                 ::   ztrans, ztrans_new  ! transports 
    568       REAL(wp), DIMENSION(jpk) ::   zdepth, zdhalf      ! level and half-level depth 
     567      REAL(dp)                 ::   zcoef, zi           !  
     568      REAL(dp)                 ::   ztrans, ztrans_new  ! transports 
     569      REAL(dp), DIMENSION(jpk) ::   zdepth, zdhalf      ! level and half-level depth 
    569570      !!--------------------------------------------------------------------- 
    570571      
     
    706707      INTEGER ::   iv              ! indice of V component 
    707708      CHARACTER (LEN=100)          ::   clcomp       ! dummy weight name 
    708       REAL(wp), DIMENSION(jpi,jpj) ::   utmp, vtmp   ! temporary arrays for vector rotation 
    709       REAL(wp), DIMENSION(:,:,:), POINTER ::   dta_u, dta_v    ! short cut 
     709      REAL(dp), DIMENSION(jpi,jpj) ::   utmp, vtmp   ! temporary arrays for vector rotation 
     710      REAL(dp), DIMENSION(:,:,:), POINTER ::   dta_u, dta_v    ! short cut 
    710711      !!--------------------------------------------------------------------- 
    711712      ! 
     
    11061107      INTEGER , DIMENSION(4) ::   ddims 
    11071108      INTEGER                ::   isrc 
    1108       REAL(wp), DIMENSION(jpi,jpj) ::   data_tmp 
     1109      REAL(dp), DIMENSION(jpi,jpj) ::   data_tmp 
    11091110      !!---------------------------------------------------------------------- 
    11101111      ! 
     
    12271228      INTEGER,                   INTENT(in   ) :: jpi1_lsm,jpi2_lsm,jpj1_lsm,jpj2_lsm  ! temporary indices 
    12281229      INTEGER, DIMENSION(3),     INTENT(in   ) :: rec1_lsm,recn_lsm                    ! temporary arrays for start and length 
    1229       REAL(wp),DIMENSION (:,:,:),INTENT(inout) :: zfieldo                              ! input/output array for seaoverland application 
     1230      REAL(dp),DIMENSION (:,:,:),INTENT(inout) :: zfieldo                              ! input/output array for seaoverland application 
    12301231      CHARACTER (len=100),       INTENT(in   ) :: clmaskfile                           ! land/sea mask file name 
    12311232      ! 
    12321233      INTEGER :: inum,jni,jnj,jnz,jc   ! local indices 
    1233       REAL(wp),DIMENSION (:,:,:),ALLOCATABLE :: zslmec1             ! local array for land point detection 
    1234       REAL(wp),DIMENSION (:,:),  ALLOCATABLE :: zfieldn   ! array of forcing field with undeff for land points 
    1235       REAL(wp),DIMENSION (:,:),  ALLOCATABLE :: zfield    ! array of forcing field 
     1234      REAL(dp),DIMENSION (:,:,:),ALLOCATABLE :: zslmec1             ! local array for land point detection 
     1235      REAL(dp),DIMENSION (:,:),  ALLOCATABLE :: zfieldn   ! array of forcing field with undeff for land points 
     1236      REAL(dp),DIMENSION (:,:),  ALLOCATABLE :: zfield    ! array of forcing field 
    12361237      !!--------------------------------------------------------------------- 
    12371238      ! 
     
    12901291      !!----------------------------------------------------------------------  
    12911292      INTEGER                          , INTENT(in   ) :: ileni,ilenj   ! lengths  
    1292       REAL(wp), DIMENSION (ileni,ilenj), INTENT(in   ) :: zfieldn       ! array of forcing field with undeff for land points 
    1293       REAL(wp), DIMENSION (ileni,ilenj), INTENT(  out) :: zfield        ! array of forcing field 
    1294       ! 
    1295       REAL(wp) , DIMENSION (ileni,ilenj)   :: zmat1, zmat2, zmat3, zmat4  ! local arrays  
    1296       REAL(wp) , DIMENSION (ileni,ilenj)   :: zmat5, zmat6, zmat7, zmat8  !   -     -  
    1297       REAL(wp) , DIMENSION (ileni,ilenj)   :: zlsm2d                      !   -     -  
    1298       REAL(wp) , DIMENSION (ileni,ilenj,8) :: zlsm3d                      !   -     - 
     1293      REAL(dp), DIMENSION (ileni,ilenj), INTENT(in   ) :: zfieldn       ! array of forcing field with undeff for land points 
     1294      REAL(dp), DIMENSION (ileni,ilenj), INTENT(  out) :: zfield        ! array of forcing field 
     1295      ! 
     1296      REAL(dp) , DIMENSION (ileni,ilenj)   :: zmat1, zmat2, zmat3, zmat4  ! local arrays  
     1297      REAL(dp) , DIMENSION (ileni,ilenj)   :: zmat5, zmat6, zmat7, zmat8  !   -     -  
     1298      REAL(dp) , DIMENSION (ileni,ilenj)   :: zlsm2d                      !   -     -  
     1299      REAL(dp) , DIMENSION (ileni,ilenj,8) :: zlsm3d                      !   -     - 
    12991300      LOGICAL  , DIMENSION (ileni,ilenj,8) :: ll_msknan3d                 ! logical mask for undeff detection 
    13001301      LOGICAL  , DIMENSION (ileni,ilenj)   :: ll_msknan2d                 ! logical mask for undeff detection 
     
    13301331      INTEGER                   , INTENT(in   ) ::   kw      ! weights number 
    13311332      INTEGER                   , INTENT(in   ) ::   kk      ! vertical dimension of kk 
    1332       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   dta     ! output field on model grid 
     1333      REAL(dp), DIMENSION(:,:,:), INTENT(inout) ::   dta     ! output field on model grid 
    13331334      INTEGER                   , INTENT(in   ) ::   nrec    ! record number to read (ie time slice) 
    13341335      CHARACTER(LEN=*)          , INTENT(in   ) ::   lsmfile ! land sea mask file name 
     
    13471348      INTEGER ::   jpi1_lsm,jpi2_lsm,jpj1_lsm,jpj2_lsm   ! temporary indices 
    13481349      INTEGER ::   itmpi,itmpj,itmpz                     ! lengths 
    1349       REAL(wp),DIMENSION(:,:,:), ALLOCATABLE ::   ztmp_fly_dta                 ! local array of values on input grid      
     1350      REAL(dp),DIMENSION(:,:,:), ALLOCATABLE ::   ztmp_fly_dta                 ! local array of values on input grid      
    13501351      !!---------------------------------------------------------------------- 
    13511352      ipk = SIZE(dta, 3) 
Note: See TracChangeset for help on using the changeset viewer.