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
5ed655852f Jean*0001 #include "COST_OPTIONS.h"
1248b51214 Jean*0002
0003
0004
f1ca098265 Davi*0005
11c3150c71 Mart*0006
0007
0008
18d499ba09 Jean*0009 SUBROUTINE COST_TEMP( myThid )
0010
0011
0012
0013
0014
11c3150c71 Mart*0015
0016
0017
18d499ba09 Jean*0018 IMPLICIT NONE
f1ca098265 Davi*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
f1ca098265 Davi*0030
11c3150c71 Mart*0031
f1ca098265 Davi*0032
18d499ba09 Jean*0033 INTEGER myThid
f1ca098265 Davi*0034
0035 #ifdef ALLOW_COST_TEMP
11c3150c71 Mart*0036
18d499ba09 Jean*0037 INTEGER i, j, k
0038 INTEGER bi, bj
0039 INTEGER Nk
f1ca098265 Davi*0040 _RL locfc,tmp
0041 _RL thetalev(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
11c3150c71 Mart*0042
18d499ba09 Jean*0043
cc6c185e3a Davi*0044 Nk = 2
f1ca098265 Davi*0045
18d499ba09 Jean*0046
cc6c185e3a Davi*0047 CALL READ_FLD_XYZ_RL('lev_t_an.bin',' ',thetalev,0,myThid)
18d499ba09 Jean*0048
f1ca098265 Davi*0049
0050 tmp = 0. _d 0
0051 DO bj=myByLo(myThid),myByHi(myThid)
18d499ba09 Jean*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
f1ca098265 Davi*0059 ENDDO
18d499ba09 Jean*0060 ENDDO
f1ca098265 Davi*0061 ENDDO
12ffad7671 Jean*0062 _GLOBAL_SUM_RL( tmp , myThid )
18d499ba09 Jean*0063 IF ( tmp.GT.0. ) tmp = 1. _d 0 / tmp
0064
f1ca098265 Davi*0065 DO bj=myByLo(myThid),myByHi(myThid)
18d499ba09 Jean*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)*
f1ca098265 Davi*0074 & ( cMeanTheta(i,j,k,bi,bj) - thetalev(i,j,k,bi,bj) )**2
18d499ba09 Jean*0075 ENDDO
0076 ENDDO
f1ca098265 Davi*0077 ENDDO
18d499ba09 Jean*0078
0079 objf_temp_tut(bi,bj) = locfc
0080
0081
0082 ENDDO
f1ca098265 Davi*0083 ENDDO
1248b51214 Jean*0084
0085 #endif /* ALLOW_COST_TEMP */
18d499ba09 Jean*0086 RETURN
0087 END