Back to home page

MITgcm

 
 

    


File indexing completed on 2022-08-15 05:10:06 UTC

view on githubraw file Latest commit cf705a6c on 2022-08-14 22:40:32 UTC
0e09621e3e Patr*0001 #include "COST_OPTIONS.h"
bac5dcac5b Jean*0002 c#ifdef ALLOW_CTRL
                0003 c# include "CTRL_OPTIONS.h"
                0004 c#endif
0e09621e3e Patr*0005 
cf705a6c8e Mart*0006 CBOP
                0007 C     !ROUTINE: COST_TEMP
                0008 C     !INTERFACE:
0e09621e3e Patr*0009       SUBROUTINE COST_TEMP( myThid )
                0010 C     *==========================================================*
                0011 C     | SUBROUTINE COST_TEMP
                0012 C     | o the subroutine computes the sum of the squared errors
                0013 C     |   relatively to the Levitus climatology
                0014 C     *==========================================================*
cf705a6c8e Mart*0015 C
                0016 C     \ev
                0017 C     !USES:
0e09621e3e Patr*0018        IMPLICIT NONE
                0019 C     == Global variables ===
                0020 #include "SIZE.h"
                0021 #include "EEPARAMS.h"
                0022 #include "PARAMS.h"
                0023 #include "GRID.h"
                0024 #include "cost.h"
cf705a6c8e Mart*0025 #ifdef ALLOW_OPENAD
                0026 # include "FFIELDS.h"
                0027 #else
                0028 # include "cost_local.h"
                0029 #endif
0e09621e3e Patr*0030 
cf705a6c8e Mart*0031 C     !INPUT/OUTPUT PARAMETERS:
0e09621e3e Patr*0032 C     myThid - Thread number for this instance of the routine.
                0033       INTEGER myThid
                0034 
                0035 #ifdef ALLOW_COST_TEMP
cf705a6c8e Mart*0036 C     !LOCAL VARIABLES:
0e09621e3e Patr*0037       INTEGER i, j, k
                0038       INTEGER bi, bj
                0039       INTEGER Nk
                0040       _RL locfc,tmp
                0041       _RL thetalev(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
cf705a6c8e Mart*0042 CEOP
0e09621e3e Patr*0043 
                0044       Nk = 2
                0045 C Read annual mean Levitus temperature
                0046 
                0047       CALL READ_FLD_XYZ_RL('lev_t_an.bin',' ',thetalev,0,myThid)
                0048 
                0049 C  Total number of wet temperature point
                0050       tmp  = 0. _d 0
                0051       DO bj=myByLo(myThid),myByHi(myThid)
                0052        DO bi=myBxLo(myThid),myBxHi(myThid)
                0053          DO k=1, Nk
                0054           DO j=1,sNy
                0055            DO i=1,sNx
                0056              tmp = tmp + maskC(i,j,k,bi,bj)
                0057            ENDDO
                0058           ENDDO
                0059          ENDDO
                0060        ENDDO
                0061       ENDDO
                0062       _GLOBAL_SUM_RL( tmp , myThid )
                0063       IF ( tmp.GT.0. ) tmp = 1. _d 0 / tmp
                0064 
                0065       DO bj=myByLo(myThid),myByHi(myThid)
                0066        DO bi=myBxLo(myThid),myBxHi(myThid)
                0067 
                0068          locfc = 0. _d 0
                0069          DO k=1,Nk
                0070            DO j=1,sNy
                0071             DO i=1,sNx
                0072               locfc = locfc + tmp*maskC(i,j,k,bi,bj)*
                0073      &         wtheta(k,bi,bj)*
                0074      &         ( cMeanTheta(i,j,k,bi,bj) - thetalev(i,j,k,bi,bj) )**2
                0075             ENDDO
                0076            ENDDO
                0077          ENDDO
                0078 
                0079          objf_temp_tut(bi,bj) = locfc
                0080 c        print*,'objf_temp_tut =',locfc,startTime,endTime,tmp
                0081 
                0082        ENDDO
                0083       ENDDO
bac5dcac5b Jean*0084 
                0085 #endif /* ALLOW_COST_TEMP */
0e09621e3e Patr*0086       RETURN
                0087       END