Back to home page

MITgcm

 
 

    


File indexing completed on 2022-11-18 06:09:40 UTC

view on githubraw file Latest commit f9d7cbfb on 2022-11-18 00:09:08 UTC
0c3d35c9cd Gael*0001 #include "SMOOTH_OPTIONS.h"
                0002 
9f5240b52a Jean*0003       SUBROUTINE SMOOTH_READPARMS( myThid )
0c3d35c9cd Gael*0004 
                0005 C     *==========================================================*
9f5240b52a Jean*0006 C     | SUBROUTINE SMOOTH_READPARMS
0c3d35c9cd Gael*0007 C     | o Routine that reads the pkg/smooth namelist from data.smooth
                0008 C     *==========================================================*
                0009 
9f5240b52a Jean*0010       IMPLICIT NONE
0c3d35c9cd Gael*0011 
9f5240b52a Jean*0012 C     == global variables ==
0c3d35c9cd Gael*0013 #include "EEPARAMS.h"
                0014 #include "SIZE.h"
                0015 #include "GRID.h"
                0016 #include "PARAMS.h"
                0017 #include "SMOOTH.h"
                0018 
9f5240b52a Jean*0019 C     == routine arguments ==
                0020       INTEGER myThid
0c3d35c9cd Gael*0021 
9f5240b52a Jean*0022 C     == local variables ==
                0023 C     msgBuf     :: Informational/error message buffer
                0024 C     iUnit      :: Work variable for IO unit number
0c3d35c9cd Gael*0025       CHARACTER*(MAX_LEN_MBUF) msgBuf
9f5240b52a Jean*0026       INTEGER iUnit
                0027       INTEGER smoothOpNb
0c3d35c9cd Gael*0028 
f9d7cbfb72 Ou W*0029       CHARACTER*(MAX_LEN_FNAM) namBuf
                0030       INTEGER IL
                0031 #ifdef HAVE_SYSTEM
                0032       INTEGER pIL
                0033 #endif
                0034 
                0035 c     == functions ==
                0036       INTEGER  ILNBLNK
                0037       EXTERNAL ILNBLNK
                0038 
9f5240b52a Jean*0039 C     == end of interface ==
0c3d35c9cd Gael*0040 
9f5240b52a Jean*0041 C--   Read the namelist input.
                0042       NAMELIST /smooth_nml/
0c3d35c9cd Gael*0043      &                   smooth2Dnbt,
                0044      &                   smooth2Dtype,
                0045      &                   smooth2Dsize,
                0046      &                   smooth2D_Lx0,
                0047      &                   smooth2D_Ly0,
                0048      &                   smooth2Dfilter,
7b8b86ab99 Timo*0049      &                   smooth2DmaskName,
0c3d35c9cd Gael*0050      &                   smooth3Dnbt,
                0051      &                   smooth3DtypeH,
                0052      &                   smooth3DsizeH,
                0053      &                   smooth3DtypeZ,
                0054      &                   smooth3DsizeZ,
                0055      &                   smooth3D_Lx0,
                0056      &                   smooth3D_Ly0,
                0057      &                   smooth3D_Lz0,
7b8b86ab99 Timo*0058      &                   smooth3Dfilter,
f9d7cbfb72 Ou W*0059      &                   smooth3DmaskName,
                0060      &                   smoothDir
0c3d35c9cd Gael*0061 
587d15c8e3 Jean*0062 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0063 
                0064       IF ( .NOT.useSMOOTH ) THEN
                0065 C-    pkg SMOOTH is not used
                0066         _BEGIN_MASTER(myThid)
                0067 C-    Track pkg activation status:
                0068 C     print a (weak) warning if data.smooth is found
                0069          CALL PACKAGES_UNUSED_MSG( 'useSMOOTH', ' ', ' ' )
                0070         _END_MASTER(myThid)
                0071         RETURN
                0072       ENDIF
0c3d35c9cd Gael*0073 
                0074       _BEGIN_MASTER( myThid )
                0075 
9f5240b52a Jean*0076 C--   Set default values.
0c3d35c9cd Gael*0077       DO smoothOpNb=1,smoothOpNbMax
bd24731a66 Gael*0078         smooth2Dnbt(smoothOpNb)=0
                0079         smooth2D_Lx0(smoothOpNb)=0. _d 0
                0080         smooth2D_Ly0(smoothOpNb)=0. _d 0
                0081         smooth2Dtype(smoothOpNb)=0
                0082         smooth2Dsize(smoothOpNb)=0
                0083         smooth2Dfilter(smoothOpNb)=0
7b8b86ab99 Timo*0084         smooth2DmaskName(smoothOpNb)(1:5) = 'maskC'
bd24731a66 Gael*0085 
                0086         smooth3Dnbt(smoothOpNb)=0
                0087         smooth3D_Lx0(smoothOpNb)=0. _d 0
                0088         smooth3D_Ly0(smoothOpNb)=0. _d 0
                0089         smooth3D_Lz0(smoothOpNb)=0. _d 0
                0090         smooth3DtypeH(smoothOpNb)=0
                0091         smooth3DsizeH(smoothOpNb)=0
                0092         smooth3DtypeZ(smoothOpNb)=0
                0093         smooth3DsizeZ(smoothOpNb)=0
                0094         smooth3Dfilter(smoothOpNb)=0
7b8b86ab99 Timo*0095         smooth3DmaskName(smoothOpNb)(1:5) = 'maskC'
0c3d35c9cd Gael*0096       ENDDO
f9d7cbfb72 Ou W*0097       smoothDir = ' '
0c3d35c9cd Gael*0098 
bd24731a66 Gael*0099 C--   Read settings from model parameter file "data.smooth".
                0100       WRITE(msgBuf,'(A)') 'SMOOTH_READPARMS: opening data.smooth'
                0101       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0102      &                    SQUEEZE_RIGHT, myThid )
0c3d35c9cd Gael*0103 
bd24731a66 Gael*0104       CALL OPEN_COPY_DATA_FILE(
0c3d35c9cd Gael*0105      I                          'data.smooth', 'SMOOTH_READPARMS',
                0106      O                          iUnit,
                0107      I                          myThid )
                0108 
bd24731a66 Gael*0109       READ(  iUnit, nml = smooth_nml )
0c3d35c9cd Gael*0110 
bd24731a66 Gael*0111       WRITE(msgBuf,'(2A)') 'SMOOTH_READPARMS: ',
0c3d35c9cd Gael*0112      &       'finished reading data.smooth'
bd24731a66 Gael*0113       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0114      &                    SQUEEZE_RIGHT, myThid )
0c3d35c9cd Gael*0115 
7a77863887 Mart*0116 #ifdef SINGLE_DISK_IO
                0117       CLOSE(iUnit)
                0118 #else
                0119       CLOSE(iUnit,STATUS='DELETE')
                0120 #endif /* SINGLE_DISK_IO */
bd24731a66 Gael*0121 
                0122 C--   Print pkg/smooth settings to standard output:
                0123       WRITE(msgBuf,'(A)')
                0124      &'// ======================================================='
                0125       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0126      &                    SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0127       WRITE(msgBuf,'(A)') '// pkg/smooth configuration'
                0128       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0129      &                    SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0130       WRITE(msgBuf,'(A)')
                0131      &'// ======================================================='
                0132       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0133      &                    SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0134 
f9d7cbfb72 Ou W*0135       IF ( smoothDir .NE. ' ' ) THEN
                0136        IL = ILNBLNK( smoothDir )
                0137 C      append "/", if necessary
                0138        IF ( IL.LT.MAX_LEN_FNAM .AND. smoothDir(IL:IL).NE.'/' ) THEN
                0139         namBuf(1:IL) = smoothDir(1:IL)
                0140         WRITE(smoothDir(1:IL+1),'(2A)') namBuf(1:IL),'/'
                0141        ENDIF
                0142 #ifdef HAVE_SYSTEM
                0143 C      create directory
                0144        IL = ILNBLNK( smoothDir ) -1
                0145        WRITE(namBuf,'(2A)') ' mkdir -p ', smoothDir(1:IL)
                0146        pIL = 1 + ILNBLNK( namBuf )
                0147        WRITE(standardMessageUnit,'(3A)')
                0148      &  '==> SYSTEM CALL (from SMOOTH_READPARMS): >',
                0149      &                                 namBuf(1:pIL), '<'
                0150        CALL SYSTEM( namBuf(1:pIL) )
                0151 #else
                0152        WRITE(msgBuf,'(2A)') '** WARNING ** SMOOTH_READPARMS: ',
                0153      &       'cannot call mkdir -> please create smoothDir manually'
                0154        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0155      &                     SQUEEZE_RIGHT, myThid )
                0156 #endif
                0157       ENDIF
                0158 
bd24731a66 Gael*0159       DO smoothOpNb=1,smoothOpNbMax
                0160         IF (smooth2Dtype(smoothOpNb).NE.0) THEN
9f5240b52a Jean*0161           WRITE(msgBuf,'(A,I2,I6,2F6.0,A)') 'smooth 2D parameters: ',
bd24731a66 Gael*0162      &       smoothOpNb,smooth2Dnbt(smoothOpNb),
7b8b86ab99 Timo*0163      &       smooth2D_Lx0(smoothOpNb),smooth2D_Ly0(smoothOpNb),
                0164      &       smooth2DmaskName(smoothOpNb)
bd24731a66 Gael*0165           CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0166      &                        SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0167         ENDIF
                0168       ENDDO
                0169 
                0170       DO smoothOpNb=1,smoothOpNbMax
                0171         IF ((smooth3DtypeZ(smoothOpNb).NE.0).OR.
                0172      &      (smooth3DtypeH(smoothOpNb).NE.0)) then
9f5240b52a Jean*0173           WRITE(msgBuf,'(A,I2,I6,3F6.0,A)') 'smooth 3D parameters: ',
bd24731a66 Gael*0174      &       smoothOpNb,smooth3Dnbt(smoothOpNb),
                0175      &       smooth3D_Lx0(smoothOpNb),smooth3D_Ly0(smoothOpNb),
7b8b86ab99 Timo*0176      &       smooth3D_Lz0(smoothOpNb),
                0177      &       smooth3DmaskName(smoothOpNb)
bd24731a66 Gael*0178           CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0179      &                        SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0180         ENDIF
                0181       ENDDO
                0182 
                0183       WRITE(msgBuf,'(A)')
                0184      &'// ======================================================='
                0185       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0186      &                    SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0187       WRITE(msgBuf,'(A)') '// End of pkg/smooth config. summary'
                0188       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0189      &                    SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0190       WRITE(msgBuf,'(A)')
                0191      &'// ======================================================='
                0192       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0193      &                    SQUEEZE_RIGHT, myThid )
bd24731a66 Gael*0194       WRITE(msgBuf,'(A)') ' '
                0195       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
9f5240b52a Jean*0196      &                    SQUEEZE_RIGHT, myThid )
0c3d35c9cd Gael*0197 
587d15c8e3 Jean*0198       _END_MASTER( myThid )
0c3d35c9cd Gael*0199 
bd24731a66 Gael*0200 C--   Everyone else must wait for the parameters to be loaded
0c3d35c9cd Gael*0201       _BARRIER
                0202 
587d15c8e3 Jean*0203       RETURN
                0204       END