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 5794 – NEMO

Changeset 5794


Ignore:
Timestamp:
2015-10-14T12:22:34+02:00 (9 years ago)
Author:
timgraham
Message:

Minor bug fixes and added namelist file

Location:
branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/scoord_gen.F90

    r5769 r5794  
    4141      !!          s_tanh  (Madec et al 1996) 
    4242      !!                a cosh/tanh function that gives stretched coordinates         
     43      !! 
     44      !! ** History: 2015: Tim Graham - Code created based on online zdf_sco routine 
     45      !! 
    4346      !! 
    4447      !!---------------------------------------------------------------------- 
     
    201204      ! Envelope bathymetry saved in hbatt 
    202205      hbatt(:,:) = zenv(:,:)  
    203       ! TODO - get this section to work 
    204206      IF( ln_eq_taper) THEN 
    205207        CALL READ_GPHIT() 
    206208        IF( MINVAL( gphit(:,:) ) * MAXVAL( gphit(:,:) ) <= 0. ) THEN 
    207           CALL ctl_warn( ' s-coordinates are tapered in vicinity of the Equator' ) 
     209          WRITE(*,*) 's-coordinates are tapered in vicinity of the Equator'  
    208210          DO jj = 1, jpj 
    209211             DO ji = 1, jpi 
     
    212214             END DO 
    213215          END DO 
     216        ENDIF 
    214217      ENDIF 
    215218      ! 
     
    298301      ENDIF 
    299302 
    300       CALL check_nf90( nf90_put_var(ncout, var_ids(11), mbathy) ) 
     303!Write all 2D variables to output file 
     304      CALL write_netcdf_2d_vars() 
    301305      CALL check_nf90( nf90_close(ncout) ) 
    302306 
     
    403407 
    404408         z_gsigt3m1 = z_gsigt3 
    405          z_gsiw3m1 = z_gsiw3 
     409         z_gsi3w3m1 = z_gsi3w3 
    406410  
    407411         where (e3t_0   (:,:).eq.0.0)  e3t_0(:,:) = 1.0 
     
    413417         where (e3vw_0  (:,:).eq.0.0)  e3vw_0(:,:) = 1.0 
    414418         
    415          CALL write_netcdf_vars(jk) 
     419         CALL write_netcdf_3d_vars(jk) 
    416420         DO jj = 1, jpj 
    417421            DO ji = 1, jpi 
     
    507511             IF( jk .EQ. 1) THEN 
    508512                z_esigw3(ji,jj  ) = 2.0 * (z_gsigt3(ji,jj ) - z_gsigw3(ji,jj )) 
    509                 z_gsi3w3(ji,jj) = 0.5 * z_esigw3(ji,jj) 
     513                z_gsi3w3(ji,jj) = 0.5 * z_esigw3(ji,jj)  
    510514             ELSE 
    511515                z_esigw3(ji,jj) = z_gsigt3(ji,jj) - z_gsigt3m1(ji,jj) 
     
    552556         ! Keep some arrays for next level 
    553557         z_gsigt3m1 = z_gsigt3 
    554          z_gsiw3m1 = z_gsiw3 
     558         z_gsi3w3m1 = z_gsi3w3 
    555559  
    556560         where (e3t_0   (:,:).eq.0.0)  e3t_0(:,:) = 1.0 
     
    562566         where (e3vw_0  (:,:).eq.0.0)  e3vw_0(:,:) = 1.0 
    563567          
    564          CALL write_netcdf_vars(jk) 
     568         CALL write_netcdf_3d_vars(jk) 
    565569 
    566570         DO jj = 1, jpj 
     
    622626      DO jk = 2, jpk 
    623627         z_gsi3w(jk) = z_gsi3w(jk-1) + z_esigw(jk) 
    624       END DO 
    625 !!gm: depuw, depvw can be suppressed (modif in ldfslp) and depw=dep3w can be set (save 3 3D arrays) 
    626       DO jk = 1, jpk 
    627628      END DO 
    628629!!gm: e3uw, e3vw can be suppressed  (modif in dynzdf, dynzdf_iso, zdfbfr) (save 2 3D arrays) 
     
    655656         where (e3vw_0  (:,:).eq.0.0)  e3vw_0(:,:) = 1.0 
    656657  
    657          CALL write_netcdf_vars(jk) 
     658         CALL write_netcdf_3d_vars(jk) 
    658659      ENDDO ! End of loop over jk 
    659660 
  • branches/2015/dev_r5187_UKMO13_simplification/NEMOGCM/TOOLS/SCOORD_GEN/src/utils.F90

    r5769 r5794  
    2323   !! s-coordinate and hybrid z-s-coordinate 
    2424   !! =----------------======--------------- 
    25    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   gsigt, gsigw       !: model level depth coefficient at t-, w-levels (analytic) 
    26    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   gsi3w              !: model level depth coefficient at w-level (sum of gsigw) 
    27    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::   esigt, esigw       !: vertical scale factor coef. at t-, w-levels 
    28  
    2925   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hbatv , hbatf      !: ocean depth at the vertical of  v--f 
    3026   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hbatt , hbatu      !:                                 t--u points (m) 
     
    6056 
    6157   NAMELIST/namzgr_sco/rn_jpk, ln_s_sh94, ln_s_sf12, ln_sigcrit, ln_eq_taper, &  
    62                         cn_coord_hgr, rn_sbot_min, rn_sbot_max, rn_hc, rn_rmax,rn_theta, & 
    63                         rn_thetb, rn_bb, rn_alpha, rn_efold, rn_zs, rn_zb_a, rn_zb_b 
     58                  &      cn_coord_hgr, rn_sbot_min, rn_sbot_max, rn_hc, rn_rmax,rn_theta, & 
     59                  &      rn_thetb, rn_bb, rn_alpha, rn_efold, rn_zs, rn_zb_a, rn_zb_b 
    6460 
    6561  ! IDs for output netcdf file 
    6662  INTEGER :: id_x, id_y, id_z 
    6763  INTEGER :: ncout 
    68   INTEGER, DIMENSION(11) :: var_ids  !Array to contain all variable IDs 
     64  INTEGER, DIMENSION(20) :: var_ids  !Array to contain all variable IDs 
    6965 
    7066   CONTAINS 
     
    8177      ALLOCATE( gdep3w_0(jpi,jpj) , e3v_0(jpi,jpj) , e3f_0(jpi,jpj) ,                         & 
    8278         &      gdept_0(jpi,jpj) , e3t_0(jpi,jpj) , e3u_0 (jpi,jpj) ,                         & 
    83          &      gdepw_0(jpi,jpj) , e3w_0(jpi,jpj) , e3vw_0(jpi,jpj) ,  
     79         &      gdepw_0(jpi,jpj) , e3w_0(jpi,jpj) , e3vw_0(jpi,jpj) ,                         & 
    8480         &      gphit(jpi,jpj)   , e3uw_0(jpi,jpj) , STAT=ierr(2) ) 
    8581         ! 
     
    130126     CALL check_nf90( nf90_close(ncin), 'Error closing horizontal coordinate file' ) 
    131127 
    132    END SUBROUTINE read_gphit() 
     128   END SUBROUTINE read_gphit 
    133129 
    134130   SUBROUTINE dimlen( ncid, dimname, len ) 
     
    172168     CALL check_nf90( nf90_def_var(ncout, 'e3uw_0', nf90_double, (/id_x, id_y,id_z/), var_ids(9)) ) 
    173169     CALL check_nf90( nf90_def_var(ncout, 'e3vw_0', nf90_double, (/id_x, id_y,id_z/), var_ids(10)) ) 
     170     ! 2D fields 
    174171     CALL check_nf90( nf90_def_var(ncout, 'mbathy', nf90_double, (/id_x, id_y/), var_ids(11)) ) 
    175      CALL check_nf90( nf90_def_var(ncout, 'hbatt', nf90_double, (/id_x, id_y,id_z/), var_ids(12)) ) 
    176      CALL check_nf90( nf90_def_var(ncout, 'hbatu', nf90_double, (/id_x, id_y,id_z/), var_ids(13)) ) 
    177      CALL check_nf90( nf90_def_var(ncout, 'hbatv', nf90_double, (/id_x, id_y,id_z/), var_ids(14)) ) 
    178      CALL check_nf90( nf90_def_var(ncout, 'hbatf', nf90_double, (/id_x, id_y,id_z/), var_ids(15)) ) 
    179      CALL check_nf90( nf90_def_var(ncout, 'gsigt', nf90_double, (/id_x, id_y,id_z/), var_ids(16)) ) 
    180      CALL check_nf90( nf90_def_var(ncout, 'gsigw', nf90_double, (/id_x, id_y,id_z/), var_ids(17)) ) 
    181      CALL check_nf90( nf90_def_var(ncout, 'gsi3w', nf90_double, (/id_x, id_y,id_z/), var_ids(18)) ) 
    182      CALL check_nf90( nf90_def_var(ncout, 'esigt', nf90_double, (/id_x, id_y,id_z/), var_ids(19)) ) 
    183      CALL check_nf90( nf90_def_var(ncout, 'esigw', nf90_double, (/id_x, id_y,id_z/), var_ids(20)) ) 
     172     CALL check_nf90( nf90_def_var(ncout, 'hbatt', nf90_double, (/id_x, id_y/), var_ids(12)) ) 
     173     CALL check_nf90( nf90_def_var(ncout, 'hbatu', nf90_double, (/id_x, id_y/), var_ids(13)) ) 
     174     CALL check_nf90( nf90_def_var(ncout, 'hbatv', nf90_double, (/id_x, id_y/), var_ids(14)) ) 
     175     CALL check_nf90( nf90_def_var(ncout, 'hbatf', nf90_double, (/id_x, id_y/), var_ids(15)) ) 
    184176 
    185177      
     
    191183   END SUBROUTINE make_coord_file 
    192184 
    193    SUBROUTINE write_netcdf_vars(kk) 
     185   SUBROUTINE write_netcdf_2d_vars() 
     186 
     187     CALL check_nf90( nf90_put_var(ncout, var_ids(11), mbathy, (/ 1,1 /), (/ jpi, jpj /) ) ) 
     188     CALL check_nf90( nf90_put_var(ncout, var_ids(12), hbatt, (/ 1,1 /), (/ jpi, jpj /) ) ) 
     189     CALL check_nf90( nf90_put_var(ncout, var_ids(13), hbatu, (/ 1,1 /), (/ jpi, jpj /) ) ) 
     190     CALL check_nf90( nf90_put_var(ncout, var_ids(14), hbatv, (/ 1,1 /), (/ jpi, jpj /) ) ) 
     191     CALL check_nf90( nf90_put_var(ncout, var_ids(15), hbatf, (/ 1,1 /), (/ jpi, jpj /) ) ) 
     192 
     193   END SUBROUTINE write_netcdf_2d_vars 
     194 
     195   SUBROUTINE write_netcdf_3d_vars(kk) 
    194196   ! Write  variables to the netcdf file at level kk 
    195197     INTEGER, INTENT(in) :: kk 
     
    205207     CALL check_nf90( nf90_put_var(ncout, var_ids(9), e3uw_0, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    206208     CALL check_nf90( nf90_put_var(ncout, var_ids(10), e3vw_0, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    207      CALL check_nf90( nf90_put_var(ncout, var_ids(12), hbatt, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    208      CALL check_nf90( nf90_put_var(ncout, var_ids(13), hbatu, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    209      CALL check_nf90( nf90_put_var(ncout, var_ids(14), hbatv, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    210      CALL check_nf90( nf90_put_var(ncout, var_ids(15), hbatf, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    211      CALL check_nf90( nf90_put_var(ncout, var_ids(16), gsigt, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    212      CALL check_nf90( nf90_put_var(ncout, var_ids(17), gsigw, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    213      CALL check_nf90( nf90_put_var(ncout, var_ids(18), gsi3w, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    214      CALL check_nf90( nf90_put_var(ncout, var_ids(19), esigt, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    215      CALL check_nf90( nf90_put_var(ncout, var_ids(20), esi3w, (/ 1,1,kk /), (/ jpi, jpj,1 /) ) ) 
    216  
    217    END SUBROUTINE write_netcdf_vars 
     209 
     210   END SUBROUTINE write_netcdf_3d_vars 
    218211 
    219212   SUBROUTINE check_nf90( istat, message ) 
Note: See TracChangeset for help on using the changeset viewer.