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
0003
0004
0e09621e3e Patr*0005
cf705a6c8e Mart*0006
0007
0008
0e09621e3e Patr*0009 SUBROUTINE COST_TEMP( myThid )
0010
0011
0012
0013
0014
cf705a6c8e Mart*0015
0016
0017
0e09621e3e Patr*0018 IMPLICIT NONE
0019
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
0e09621e3e Patr*0032
0033 INTEGER myThid
0034
0035 #ifdef ALLOW_COST_TEMP
cf705a6c8e Mart*0036
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
0e09621e3e Patr*0043
0044 Nk = 2
0045
0046
0047 CALL READ_FLD_XYZ_RL('lev_t_an.bin',' ',thetalev,0,myThid)
0048
0049
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
0081
0082 ENDDO
0083 ENDDO
bac5dcac5b Jean*0084
0085 #endif /* ALLOW_COST_TEMP */
0e09621e3e Patr*0086 RETURN
0087 END