Changeset 10199


Ignore:
Timestamp:
2018-10-17T11:13:02+02:00 (20 months ago)
Author:
jenniewaters
Message:

Alllow a distance to coast file to be read in. Also modify code to prevent multiple calculations of the surface distance to coast.

Location:
branches/UKMO/dev_r5518_DMP_TOOLS/NEMOGCM/TOOLS/DMP_TOOLS
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_DMP_TOOLS/NEMOGCM/TOOLS/DMP_TOOLS/src/coast_dist.F90

    r4739 r10199  
    99   CONTAINS 
    1010 
    11    SUBROUTINE coast_dist_weight( presto )  
     11   SUBROUTINE coast_dist_weight( presto, ln_read , klev )  
    1212      !!---------------------------------------------------------------------- 
    1313      !!                 *** ROUTINE coast_dist_weight *** 
     
    2020      IMPLICIT NONE 
    2121      REAL(wp), DIMENSION(jpi,jpj), INTENT( inout ) :: presto 
     22      LOGICAL, INTENT( in )                         :: ln_read 
     23      INTEGER, INTENT( in )                         :: klev 
    2224      REAL(wp), DIMENSION(jpi,jpj) :: zdct 
    2325      REAL(wp) :: zinfl = 1000.e3_wp  ! Distance of influence of coast line (could be 
    2426                                  ! a namelist setting) 
    2527      INTEGER :: jj, ji           ! dummy loop indices 
    26        
    27  
    28       CALL cofdis( zdct ) 
     28      INTEGER :: ncin, tdist_id 
     29 
     30      IF ( ln_read ) THEN 
     31 
     32         CALL check_nf90( nf90_open('dist_coast_uvtf.nc', NF90_NOWRITE, ncin), 'Error opening dist to coast file' ) 
     33         CALL check_nf90( nf90_inq_varid( ncin, 'tdist', tdist_id ), 'Cannot get variable ID for tmask') 
     34         CALL check_nf90( nf90_get_var( ncin, tdist_id, zdct, (/ 1,1,klev /), (/ jpi, jpj,1 /) ) ) 
     35         CALL check_nf90( nf90_close(ncin) )  
     36 
     37      ELSE 
     38 
     39         IF (klev == 1 ) THEN ! Since only a the surface distance to coast is used, only calculate once. 
     40            CALL cofdis( zdct ) 
     41         ENDIF 
     42 
     43      ENDIF 
     44 
    2945      DO jj = 1, jpj 
    3046         DO ji = 1, jpi 
  • branches/UKMO/dev_r5518_DMP_TOOLS/NEMOGCM/TOOLS/DMP_TOOLS/src/make_dmp_file.F90

    r4745 r10199  
    9494           IF (ln_coast) THEN 
    9595              ! Reduce damping in vicinity of coastlines 
    96               CALL coast_dist_weight(resto) 
     96              CALL coast_dist_weight(resto, ln_readdistcoast, jk) 
    9797           ENDIF 
    9898        ENDIF 
  • branches/UKMO/dev_r5518_DMP_TOOLS/NEMOGCM/TOOLS/DMP_TOOLS/src/utils.F90

    r4739 r10199  
    4646  LOGICAL :: ln_zero_top_layer = .false. 
    4747  LOGICAL :: ln_custom = .false. 
     48  LOGICAL :: ln_readdistcoast = .false. 
    4849 
    4950  NAMELIST/nam_dmp_create/cp_cfg, cp_cfz, jp_cfg, lzoom, ln_full_field, & 
    5051                          ln_med_red_seas, ln_old_31_lev_code, ln_coast, & 
    5152                          ln_zero_top_layer, ln_custom, & 
    52                           pn_surf, pn_bot, pn_dep, nn_hdmp, jperio 
     53                          pn_surf, pn_bot, pn_dep, nn_hdmp, jperio, ln_readdistcoast 
    5354 
    5455  CONTAINS  
     
    7273     CALL check_nf90( nf90_inq_varid( ncin, 'vmask', vmask_id ), 'Cannot get variable ID for vmask') 
    7374     CALL check_nf90( nf90_inq_varid( ncin, 'fmask', fmask_id ), 'Cannot get variable ID for fmask') 
    74      CALL check_nf90( nf90_inq_varid( ncin, 'gdept_0', gdept_id ), 'Cannot get variable ID for gdept_0') 
     75     CALL check_nf90( nf90_inq_varid( ncin, 'gdept', gdept_id ), 'Cannot get variable ID for gdept_0') 
    7576     CALL check_nf90( nf90_inq_varid( ncin, 'gphit', gphit_id ), 'Cannot get variable ID for gphit') 
    7677     CALL check_nf90( nf90_inq_varid( ncin, 'gphiu', gphiu_id ), 'Cannot get variable ID for gphiu') 
Note: See TracChangeset for help on using the changeset viewer.