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 15141 for NEMO/trunk/src/OCE/DIA/diawri.F90 – NEMO

Ignore:
Timestamp:
2021-07-23T16:20:12+02:00 (3 years ago)
Author:
smasson
Message:

trunk: avoid implicit loops in diawri

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/DIA/diawri.F90

    r15136 r15141  
    583583      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
    584584      ! 
    585       REAL(wp), DIMENSION(jpi,jpj)   :: zw2d       ! 2D workspace 
    586       REAL(wp), DIMENSION(jpi,jpj,jpk) :: zw3d, ze3t, zgdept       ! 3D workspace 
     585      REAL(wp), DIMENSION(jpi,jpj    ) :: z2d     ! 2D workspace 
     586      REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3d     ! 3D workspace 
    587587      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zw3d_abl   ! ABL 3D workspace 
    588588      !!---------------------------------------------------------------------- 
     
    624624      it = kt 
    625625      itmod = kt - nit000 + 1 
    626  
    627       ! store e3t for subsitute 
    628       DO jk = 1, jpk 
    629          ze3t  (:,:,jk) =  e3t  (:,:,jk,Kmm) 
    630          zgdept(:,:,jk) =  gdept(:,:,jk,Kmm) 
    631       END DO 
    632  
    633626 
    634627      ! 1. Define NETCDF files and fields at beginning of first time step 
     
    944937 
    945938      IF( .NOT.ln_linssh ) THEN 
    946          CALL histwrite( nid_T, "votemper", it, ts(:,:,:,jp_tem,Kmm) * ze3t(:,:,:) , ndim_T , ndex_T  )   ! heat content 
    947          CALL histwrite( nid_T, "vosaline", it, ts(:,:,:,jp_sal,Kmm) * ze3t(:,:,:) , ndim_T , ndex_T  )   ! salt content 
    948          CALL histwrite( nid_T, "sosstsst", it, ts(:,:,1,jp_tem,Kmm) * ze3t(:,:,1) , ndim_hT, ndex_hT )   ! sea surface heat content 
    949          CALL histwrite( nid_T, "sosaline", it, ts(:,:,1,jp_sal,Kmm) * ze3t(:,:,1) , ndim_hT, ndex_hT )   ! sea surface salinity content 
     939         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     940            z3d(ji,jj,jk) = ts(ji,jj,jk,jp_tem,Kmm) * e3t(ji,jj,jk,Kmm) 
     941         END_3D 
     942         CALL histwrite( nid_T, "votemper", it, z3d, ndim_T , ndex_T  )   ! heat content 
     943         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     944            z3d(ji,jj,jk) = ts(ji,jj,jk,jp_sal,Kmm) * e3t(ji,jj,jk,Kmm) 
     945         END_3D 
     946         CALL histwrite( nid_T, "vosaline", it, z3d, ndim_T , ndex_T  )   ! salt content 
     947         DO_2D( 0, 0, 0, 0 ) 
     948            z2d(ji,jj   ) = ts(ji,jj, 1,jp_tem,Kmm) * e3t(ji,jj, 1,Kmm) 
     949         END_2D 
     950         CALL histwrite( nid_T, "sosstsst", it, z2d, ndim_hT, ndex_hT )   ! sea surface heat content 
     951         DO_2D( 0, 0, 0, 0 ) 
     952            z2d(ji,jj   ) = ts(ji,jj, 1,jp_sal,Kmm) * e3t(ji,jj, 1,Kmm) 
     953         END_2D 
     954         CALL histwrite( nid_T, "sosaline", it, z2d, ndim_hT, ndex_hT )   ! sea surface salinity content 
    950955      ELSE 
    951956         CALL histwrite( nid_T, "votemper", it, ts(:,:,:,jp_tem,Kmm) , ndim_T , ndex_T  )   ! temperature 
     
    955960      ENDIF 
    956961      IF( .NOT.ln_linssh ) THEN 
    957          zw3d(:,:,:) = ( ( ze3t(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
    958          CALL histwrite( nid_T, "vovvle3t", it, ze3t (:,:,:)     , ndim_T , ndex_T  )   ! level thickness 
    959          CALL histwrite( nid_T, "vovvldep", it, zgdept , ndim_T , ndex_T  )   ! t-point depth  
    960          CALL histwrite( nid_T, "vovvldef", it, zw3d             , ndim_T , ndex_T  )   ! level thickness deformation 
    961       ENDIF 
    962       CALL histwrite( nid_T, "sossheig", it, ssh(:,:,Kmm)          , ndim_hT, ndex_hT )   ! sea surface height 
    963       CALL histwrite( nid_T, "sowaflup", it, ( emp-rnf )   , ndim_hT, ndex_hT )   ! upward water flux 
     962         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     963           z3d(ji,jj,jk) = e3t(ji,jj,jk,Kmm)     ! 3D workspace for qco substitution 
     964         END_3D 
     965         CALL histwrite( nid_T, "vovvle3t", it, z3d        , ndim_T , ndex_T  )   ! level thickness 
     966         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     967           z3d(ji,jj,jk) = gdept(ji,jj,jk,Kmm)   ! 3D workspace for qco substitution 
     968         END_3D 
     969         CALL histwrite( nid_T, "vovvldep", it, z3d        , ndim_T , ndex_T  )   ! t-point depth  
     970         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     971            z3d(ji,jj,jk) = ( ( e3t(ji,jj,jk,Kmm) - e3t_0(ji,jj,jk) ) / e3t_0(ji,jj,jk) * 100._wp * tmask(ji,jj,jk) ) ** 2 
     972         END_3D          
     973         CALL histwrite( nid_T, "vovvldef", it, z3d        , ndim_T , ndex_T  )   ! level thickness deformation 
     974      ENDIF 
     975      CALL histwrite( nid_T, "sossheig", it, ssh(:,:,Kmm)  , ndim_hT, ndex_hT )   ! sea surface height 
     976      DO_2D( 0, 0, 0, 0 ) 
     977         z2d(ji,jj) = emp(ji,jj) - rnf(ji,jj) 
     978      END_2D 
     979      CALL histwrite( nid_T, "sowaflup", it, z2d           , ndim_hT, ndex_hT )   ! upward water flux 
    964980      CALL histwrite( nid_T, "sorunoff", it, rnf           , ndim_hT, ndex_hT )   ! river runoffs 
    965981      CALL histwrite( nid_T, "sosfldow", it, sfx           , ndim_hT, ndex_hT )   ! downward salt flux  
     
    967983                                                                                  ! in linear free surface case) 
    968984      IF( ln_linssh ) THEN 
    969          zw2d(:,:) = emp (:,:) * ts(:,:,1,jp_tem,Kmm) 
    970          CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sst 
    971          zw2d(:,:) = emp (:,:) * ts(:,:,1,jp_sal,Kmm) 
    972          CALL histwrite( nid_T, "sosss_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sss 
    973       ENDIF 
    974       CALL histwrite( nid_T, "sohefldo", it, qns + qsr     , ndim_hT, ndex_hT )   ! total heat flux 
     985         DO_2D( 0, 0, 0, 0 ) 
     986            z2d(ji,jj) = emp (ji,jj) * ts(ji,jj,1,jp_tem,Kmm) 
     987         END_2D 
     988         CALL histwrite( nid_T, "sosst_cd", it, z2d, ndim_hT, ndex_hT )          ! c/d term on sst 
     989         DO_2D( 0, 0, 0, 0 ) 
     990            z2d(ji,jj) = emp (ji,jj) * ts(ji,jj,1,jp_sal,Kmm) 
     991         END_2D 
     992         CALL histwrite( nid_T, "sosss_cd", it, z2d, ndim_hT, ndex_hT )          ! c/d term on sss 
     993      ENDIF 
     994      DO_2D( 0, 0, 0, 0 ) 
     995         z2d(ji,jj) = qsr(ji,jj) + qns(ji,jj) 
     996      END_2D 
     997      CALL histwrite( nid_T, "sohefldo", it, z2d           , ndim_hT, ndex_hT )   ! total heat flux 
    975998      CALL histwrite( nid_T, "soshfldo", it, qsr           , ndim_hT, ndex_hT )   ! solar heat flux 
    976999      IF( ALLOCATED(hmld) ) THEN   ! zdf_mxl not called by SWE 
     
    10301053         CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping 
    10311054         CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping 
    1032          zw2d(:,:) = erp(:,:) * ts(:,:,1,jp_sal,Kmm) * tmask(:,:,1) 
    1033          CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping 
     1055         DO_2D( 0, 0, 0, 0 ) 
     1056            z2d(ji,jj) = erp(ji,jj) * ts(ji,jj,1,jp_sal,Kmm) * tmask(ji,jj,1) 
     1057         END_2D 
     1058         CALL histwrite( nid_T, "sosafldp", it, z2d           , ndim_hT, ndex_hT )   ! salt flux damping 
    10341059      ENDIF 
    10351060!      zw2d(:,:) = FLOAT( nmln(:,:) ) * tmask(:,:,1) 
     
    10431068#endif 
    10441069 
    1045       CALL histwrite( nid_U, "vozocrtx", it, uu(:,:,:,Kmm)            , ndim_U , ndex_U )    ! i-current 
     1070      CALL histwrite( nid_U, "vozocrtx", it, uu(:,:,:,Kmm) , ndim_U , ndex_U )    ! i-current 
    10461071      CALL histwrite( nid_U, "sozotaux", it, utau          , ndim_hU, ndex_hU )   ! i-wind stress 
    10471072 
    1048       CALL histwrite( nid_V, "vomecrty", it, vv(:,:,:,Kmm)            , ndim_V , ndex_V  )   ! j-current 
     1073      CALL histwrite( nid_V, "vomecrty", it, vv(:,:,:,Kmm) , ndim_V , ndex_V  )   ! j-current 
    10491074      CALL histwrite( nid_V, "sometauy", it, vtau          , ndim_hV, ndex_hV )   ! j-wind stress 
    10501075 
    10511076      IF( ln_zad_Aimp ) THEN 
    1052          CALL histwrite( nid_W, "vovecrtz", it, ww + wi     , ndim_T, ndex_T )    ! vert. current 
     1077         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     1078           z3d(ji,jj,jk) = ww(ji,jj,jk) + wi(ji,jj,jk) 
     1079         END_3D          
     1080         CALL histwrite( nid_W, "vovecrtz", it, z3d         , ndim_T, ndex_T )    ! vert. current 
    10531081      ELSE 
    10541082         CALL histwrite( nid_W, "vovecrtz", it, ww          , ndim_T, ndex_T )    ! vert. current 
     
    10971125      CHARACTER (len=* ), INTENT( in ) ::   cdfile_name      ! name of the file created 
    10981126      !! 
    1099       INTEGER :: inum, jk 
    1100       REAL(wp), DIMENSION(jpi,jpj,jpk) :: ze3t, zgdept       ! 3D workspace for qco substitution 
     1127      INTEGER ::   ji, jj, jk       ! dummy loop indices 
     1128      INTEGER ::   inum 
     1129      REAL(wp), DIMENSION(jpi,jpj)     :: z2d       
     1130      REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3d       
    11011131      !!---------------------------------------------------------------------- 
    11021132      !  
     
    11081138      ENDIF  
    11091139      ! 
    1110       DO jk = 1, jpk 
    1111          ze3t(:,:,jk) =  e3t(:,:,jk,Kmm) 
    1112          zgdept(:,:,jk) =  gdept(:,:,jk,Kmm) 
    1113       END DO 
    1114       ! 
    11151140      CALL iom_open( TRIM(cdfile_name), inum, ldwrt = .TRUE. ) 
    11161141      ! 
    11171142      CALL iom_rstput( 0, 0, inum, 'votemper', ts(:,:,:,jp_tem,Kmm) )    ! now temperature 
    11181143      CALL iom_rstput( 0, 0, inum, 'vosaline', ts(:,:,:,jp_sal,Kmm) )    ! now salinity 
    1119       CALL iom_rstput( 0, 0, inum, 'sossheig', ssh(:,:,Kmm)              )    ! sea surface height 
    1120       CALL iom_rstput( 0, 0, inum, 'vozocrtx', uu(:,:,:,Kmm)                )    ! now i-velocity 
    1121       CALL iom_rstput( 0, 0, inum, 'vomecrty', vv(:,:,:,Kmm)                )    ! now j-velocity 
     1144      CALL iom_rstput( 0, 0, inum, 'sossheig', ssh(:,:,Kmm)         )    ! sea surface height 
     1145      CALL iom_rstput( 0, 0, inum, 'vozocrtx', uu(:,:,:,Kmm)        )    ! now i-velocity 
     1146      CALL iom_rstput( 0, 0, inum, 'vomecrty', vv(:,:,:,Kmm)        )    ! now j-velocity 
    11221147      IF( ln_zad_Aimp ) THEN 
    1123          CALL iom_rstput( 0, 0, inum, 'vovecrtz', ww + wi        )    ! now k-velocity 
     1148         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     1149           z3d(ji,jj,jk) = ww(ji,jj,jk) + wi(ji,jj,jk) 
     1150         END_3D 
     1151         CALL iom_rstput( 0, 0, inum, 'vovecrtz', z3d            )    ! now k-velocity 
    11241152      ELSE 
    11251153         CALL iom_rstput( 0, 0, inum, 'vovecrtz', ww             )    ! now k-velocity 
    11261154      ENDIF 
    1127       CALL iom_rstput( 0, 0, inum, 'risfdep', risfdep            )    ! now k-velocity 
     1155      CALL iom_rstput( 0, 0, inum, 'risfdep', risfdep            ) 
    11281156      CALL iom_rstput( 0, 0, inum, 'ht'     , ht(:,:)            )    ! now water column height 
    11291157      ! 
    11301158      IF ( ln_isf ) THEN 
    11311159         IF (ln_isfcav_mlt) THEN 
    1132             CALL iom_rstput( 0, 0, inum, 'fwfisf_cav', fwfisf_cav          )    ! now k-velocity 
    1133             CALL iom_rstput( 0, 0, inum, 'rhisf_cav_tbl', rhisf_tbl_cav    )    ! now k-velocity 
    1134             CALL iom_rstput( 0, 0, inum, 'rfrac_cav_tbl', rfrac_tbl_cav    )    ! now k-velocity 
    1135             CALL iom_rstput( 0, 0, inum, 'misfkb_cav', REAL(misfkb_cav,wp) )    ! now k-velocity 
    1136             CALL iom_rstput( 0, 0, inum, 'misfkt_cav', REAL(misfkt_cav,wp) )    ! now k-velocity 
     1160            CALL iom_rstput( 0, 0, inum, 'fwfisf_cav', fwfisf_cav          ) 
     1161            CALL iom_rstput( 0, 0, inum, 'rhisf_cav_tbl', rhisf_tbl_cav    ) 
     1162            CALL iom_rstput( 0, 0, inum, 'rfrac_cav_tbl', rfrac_tbl_cav    ) 
     1163            CALL iom_rstput( 0, 0, inum, 'misfkb_cav', REAL(misfkb_cav,wp) ) 
     1164            CALL iom_rstput( 0, 0, inum, 'misfkt_cav', REAL(misfkt_cav,wp) ) 
    11371165            CALL iom_rstput( 0, 0, inum, 'mskisf_cav', REAL(mskisf_cav,wp), ktype = jp_i1 ) 
    11381166         END IF 
    11391167         IF (ln_isfpar_mlt) THEN 
    1140             CALL iom_rstput( 0, 0, inum, 'isfmsk_par', REAL(mskisf_par,wp) )    ! now k-velocity 
    1141             CALL iom_rstput( 0, 0, inum, 'fwfisf_par', fwfisf_par          )    ! now k-velocity 
    1142             CALL iom_rstput( 0, 0, inum, 'rhisf_par_tbl', rhisf_tbl_par    )    ! now k-velocity 
    1143             CALL iom_rstput( 0, 0, inum, 'rfrac_par_tbl', rfrac_tbl_par    )    ! now k-velocity 
    1144             CALL iom_rstput( 0, 0, inum, 'misfkb_par', REAL(misfkb_par,wp) )    ! now k-velocity 
    1145             CALL iom_rstput( 0, 0, inum, 'misfkt_par', REAL(misfkt_par,wp) )    ! now k-velocity 
     1168            CALL iom_rstput( 0, 0, inum, 'isfmsk_par', REAL(mskisf_par,wp) ) 
     1169            CALL iom_rstput( 0, 0, inum, 'fwfisf_par', fwfisf_par          ) 
     1170            CALL iom_rstput( 0, 0, inum, 'rhisf_par_tbl', rhisf_tbl_par    ) 
     1171            CALL iom_rstput( 0, 0, inum, 'rfrac_par_tbl', rfrac_tbl_par    ) 
     1172            CALL iom_rstput( 0, 0, inum, 'misfkb_par', REAL(misfkb_par,wp) ) 
     1173            CALL iom_rstput( 0, 0, inum, 'misfkt_par', REAL(misfkt_par,wp) ) 
    11461174            CALL iom_rstput( 0, 0, inum, 'mskisf_par', REAL(mskisf_par,wp), ktype = jp_i1 ) 
    11471175         END IF 
     
    11561184         CALL iom_rstput( 0, 0, inum,  'ahmf', ahmf              )    ! ahmf at v-point 
    11571185      ENDIF 
    1158       CALL iom_rstput( 0, 0, inum, 'sowaflup', emp - rnf         )    ! freshwater budget 
    1159       CALL iom_rstput( 0, 0, inum, 'sohefldo', qsr + qns         )    ! total heat flux 
     1186      DO_2D( 0, 0, 0, 0 ) 
     1187         z2d(ji,jj) = emp(ji,jj) - rnf(ji,jj) 
     1188      END_2D 
     1189      CALL iom_rstput( 0, 0, inum, 'sowaflup', z2d               )    ! freshwater budget 
     1190      DO_2D( 0, 0, 0, 0 ) 
     1191         z2d(ji,jj) = qsr(ji,jj) + qns(ji,jj) 
     1192      END_2D 
     1193      CALL iom_rstput( 0, 0, inum, 'sohefldo', z2d               )    ! total heat flux 
    11601194      CALL iom_rstput( 0, 0, inum, 'soshfldo', qsr               )    ! solar heat flux 
    11611195      CALL iom_rstput( 0, 0, inum, 'soicecov', fr_i              )    ! ice fraction 
    11621196      CALL iom_rstput( 0, 0, inum, 'sozotaux', utau              )    ! i-wind stress 
    11631197      CALL iom_rstput( 0, 0, inum, 'sometauy', vtau              )    ! j-wind stress 
    1164       IF(  .NOT.ln_linssh  ) THEN              
    1165          CALL iom_rstput( 0, 0, inum, 'vovvldep', zgdept        )    !  T-cell depth  
    1166          CALL iom_rstput( 0, 0, inum, 'vovvle3t', ze3t          )    !  T-cell thickness   
     1198      IF(  .NOT.ln_linssh  ) THEN 
     1199         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     1200           z3d(ji,jj,jk) = gdept(ji,jj,jk,Kmm)   ! 3D workspace for qco substitution 
     1201         END_3D 
     1202         CALL iom_rstput( 0, 0, inum, 'vovvldep', z3d            )    !  T-cell depth  
     1203         DO_3D( 0, 0, 0, 0, 1, jpk ) 
     1204           z3d(ji,jj,jk) = e3t(ji,jj,jk,Kmm)     ! 3D workspace for qco substitution 
     1205         END_3D 
     1206         CALL iom_rstput( 0, 0, inum, 'vovvle3t', z3d            )    !  T-cell thickness   
    11671207      END IF 
    11681208      IF( ln_wave .AND. ln_sdw ) THEN 
Note: See TracChangeset for help on using the changeset viewer.