File indexing completed on 2025-08-05 05:09:15 UTC
view on githubraw file Latest commit 13ce79fe on 2025-08-04 21:05:34 UTC
13ce79fe94 Ivan*0001 #include "PROFILES_OPTIONS.h"
0002 #include "AD_CONFIG.h"
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 SUBROUTINE PROFILES_NF_ERROR( message, STATUS, bi, bj, myThid )
0015
0016
0017
0018
0019
0020 IMPLICIT NONE
0021
0022 #ifdef ALLOW_PROFILES
0023 # include "SIZE.h"
0024 # include "EEPARAMS.h"
0025 # include "PARAMS.h"
0026 # include "netcdf.inc"
0027 #endif
0028
0029
0030
0031
0032
0033
0034 CHARACTER*(*) message
0035 INTEGER STATUS, bi, bj, myThid
0036
0037
0038
0039
0040
0041 INTEGER ILNBLNK
0042 EXTERNAL ILNBLNK
0043
0044
0045 #ifdef ALLOW_PROFILES
0046 INTEGER IL
0047 CHARACTER*(MAX_LEN_MBUF) msgBuf
0048
0049 IF (debugLevel .GE. debLevA .AND. STATUS .NE. NF_NOERR) THEN
0050 IL = ILNBLNK(message)
0051 IF ( IL .GT. 0 ) THEN
0052 WRITE(msgBuf,'(A,A,2I3,1X,A)')
0053 & 'NF_MESSAGE: PROFILES_', message(1:IL),
0054 & bi, bj, NF_STRERROR(STATUS)
0055 ELSE
0056 WRITE(msgBuf,'(A,2I3,1X,A)') 'NF_MESSAGE: PROFILES ',
0057 & bi, bj, NF_STRERROR(STATUS)
0058 ENDIF
0059 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0060 & SQUEEZE_RIGHT,myThid )
0061 ENDIF
0062 #endif /* ALLOW_PROFILES */
0063
0064 RETURN
0065 END
0066
0067
0068
0069
0070
0071
0072 SUBROUTINE PROFILES_NC_CLOSE( myThid )
0073
0074
0075
0076
0077
0078 IMPLICIT NONE
0079
0080 #ifdef ALLOW_PROFILES
0081 # include "SIZE.h"
0082 # include "EEPARAMS.h"
0083 # include "PROFILES_SIZE.h"
0084 # include "profiles.h"
0085 # include "netcdf.inc"
0086 #endif
0087
0088
0089
0090 INTEGER myThid
0091
0092
0093
0094
0095
0096 INTEGER ILNBLNK
0097 EXTERNAL ILNBLNK
0098
0099
0100 #ifdef ALLOW_PROFILES
0101
0102 INTEGER bi, bj
0103 INTEGER IL, numFile
0104 INTEGER STATUS
0105 CHARACTER*(MAX_LEN_MBUF) msgBuf
0106
0107 _BEGIN_MASTER( myThid )
0108
0109 IF (profilesDoNcOutput) THEN
0110
0111
0112
0113
0114 DO bj = 1, nSy
0115 DO bi = 1, nSx
0116 DO numFile = 1, NFILESPROFMAX
0117 IL = ILNBLNK( profilesfiles(numFile) )
0118
0119 IF (IL.NE.0) THEN
0120 WRITE(msgBuf,'(A,A,5(1X,I8))')
0121 & 'S/R PROFILES_NC_CLOSE:',
0122 & ' Closing '//profilesfiles(numFile)(1:IL), numFile,
0123 & fiddata(numFile,bi,bj),fidforward(numFile,bi,bj),
0124 & fidadjoint(numFile,bi,bj),fidtangent(numFile,bi,bj)
0125 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0126 & SQUEEZE_RIGHT,myThid )
0127
0128 IF ( fiddata(numFile,bi,bj) .GT. 0 ) THEN
0129 STATUS = NF_CLOSE( fiddata(numFile,bi,bj) )
0130 WRITE(msgBuf,'(A,I3,I8)')
0131 & 'NC_CLOSE: NF_CLOSE data unit',
0132 & numFile, fiddata(numFile,bi,bj)
0133 CALL PROFILES_NF_ERROR( msgBuf, STATUS,
0134 & bi, bj, myThid )
0135 ENDIF
0136
0137
0138 IF ( fidforward(numFile,bi,bj) .GT. 0 ) THEN
0139 STATUS = NF_CLOSE( fidforward(numFile,bi,bj) )
0140 WRITE(msgBuf,'(A,I3,I8)')
0141 & 'NC_CLOSE: NF_CLOSE fwd unit',
0142 & numFile, fidforward(numFile,bi,bj)
0143 CALL PROFILES_NF_ERROR( msgBuf, STATUS,
0144 & bi, bj, myThid )
0145 ENDIF
0146 #ifdef ALLOW_ADJOINT_RUN
0147
0148 IF ( fidadjoint(numFile,bi,bj) .GT. 0 ) THEN
0149 STATUS = NF_CLOSE( fidadjoint(numFile,bi,bj) )
0150 WRITE(msgBuf,'(A,I3,I8)')
0151 & 'NC_CLOSE: NF_CLOSE adj unit',
0152 & numFile, fidadjoint(numFile,bi,bj)
0153 CALL PROFILES_NF_ERROR( msgBuf, STATUS,
0154 & bi, bj, myThid )
0155 ENDIF
0156 #endif
0157 #ifdef ALLOW_TANGENTLINEAR_RUN
0158
0159 IF ( fidtangent(numFile,bi,bj) .GT. 0 ) THEN
0160 STATUS = NF_CLOSE( fidtangent(numFile,bi,bj) )
0161 WRITE(msgBuf,'(A,I3,I8)')
0162 & 'NC_CLOSE: NF_CLOSE tlm unit',
0163 & numFile, fidtangent(numFile,bi,bj)
0164 CALL PROFILES_NF_ERROR( msgBuf, STATUS,
0165 & bi, bj, myThid )
0166 ENDIF
0167 #endif
0168 ENDIF
0169
0170 ENDDO
0171 ENDDO
0172 ENDDO
0173 ENDIF
0174
0175 _END_MASTER( myThid )
0176 #endif /* ALLOW_PROFILES */
0177
0178 RETURN
0179 END