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 10199 for branches/UKMO/dev_r5518_DMP_TOOLS/NEMOGCM/TOOLS/DMP_TOOLS/src/coast_dist.F90 – NEMO

Ignore:
Timestamp:
2018-10-17T11:13:02+02:00 (6 years 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.

File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.