Back to home page

MITgcm

 
 

    


File indexing completed on 2023-11-05 05:10:01 UTC

view on githubraw file Latest commit 65754df4 on 2023-11-04 17:55:24 UTC
b35bd3101a Jean*0001 #include "ADMTLM_OPTIONS.h"
ee5ca1ad15 Patr*0002 
                0003       subroutine admtlm_metric( myThid )
                0004 C     /==========================================================\
                0005 C     | subroutine admtlm_metric                                 |
                0006 C     | o This routine assigns final T,S to cost function        |
                0007 C     \==========================================================/
                0008        implicit none
                0009 
                0010 C     == Global variables ===
                0011 #include "SIZE.h"
                0012 #include "EEPARAMS.h"
                0013 #include "PARAMS.h"
                0014 #include "GRID.h"
                0015 #include "DYNVARS.h"
8f0b59c61c Patr*0016 #ifdef ALLOW_ADMTLM
                0017 # include "cost.h"
                0018 # include "g_cost.h"
65754df434 Mart*0019 # include "OPTIMCYCLE.h"
8f0b59c61c Patr*0020 #endif
ee5ca1ad15 Patr*0021 
                0022 C     ======== Routine arguments ======================
                0023 C     myThid - Thread number for this instance of the routine.
                0024       integer myThid
                0025 
                0026 #ifdef ALLOW_ADMTLM
                0027 C     ========= Local variables =========================
                0028       integer i, j, k
                0029       integer bi, bj
                0030       _RL myMetric
8f0b59c61c Patr*0031       _RL stdDevSST
                0032       _RL stdDevSSS
e4939baa16 Patr*0033       _RL stdDevtheta
                0034       _RL stdDevsalt
                0035       _RL stdDevuvel
                0036       _RL stdDevvvel
                0037       _RL stdDevetan
ee5ca1ad15 Patr*0038 
8f0b59c61c Patr*0039       myMetric  = 0. _d 0
                0040       stdDevSST = 0.52 _d 0
                0041       stdDevSSS = 0.134 _d 0
e4939baa16 Patr*0042       stdDevtheta = 1.
                0043       stdDevsalt  = 1.
                0044       stdDevuvel  = 1.
                0045       stdDevvvel  = 1.
                0046       stdDevetan  = 1.
ee5ca1ad15 Patr*0047 
                0048       DO bj=myByLo(myThid),myByHi(myThid)
                0049        DO bi=myBxLo(myThid),myBxHi(myThid)
8f0b59c61c Patr*0050         DO j=1,sNy
                0051          DO i=1,sNx
e4939baa16 Patr*0052           DO k=1,Nr
                0053            myMetric = myMetric
                0054      &      + g_objf_state_final(i,j,bi,bj,k+0*Nr)**2/stdDevtheta**2
                0055      &      + g_objf_state_final(i,j,bi,bj,k+1*Nr)**2/stdDevsalt**2
                0056      &      + g_objf_state_final(i,j,bi,bj,k+2*Nr)**2/stdDevuvel**2
                0057      &      + g_objf_state_final(i,j,bi,bj,k+3*Nr)**2/stdDevvvel**2
ee5ca1ad15 Patr*0058           END DO
e4939baa16 Patr*0059            myMetric = myMetric
                0060      &      + g_objf_state_final(i,j,bi,bj,1+4*Nr)**2/stdDevetan**2
                0061          END DO
8f0b59c61c Patr*0062         END DO
ee5ca1ad15 Patr*0063        END DO
                0064       END DO
                0065 
12ffad7671 Jean*0066       _GLOBAL_SUM_RL( myMetric , myThid )
e4939baa16 Patr*0067       myMetric = myMetric/(nx*ny*(4*Nr+1))
ee5ca1ad15 Patr*0068 
8f0b59c61c Patr*0069 cph(
                0070       DO bj=myByLo(myThid),myByHi(myThid)
                0071        DO bi=myBxLo(myThid),myBxHi(myThid)
                0072         DO j=1,sNy
                0073          DO i=1,sNx
305d315bb8 Jean*0074 c            print '(a,2I4,2(x,F15.9))', 'ph-metric T ', i, j,
e4939baa16 Patr*0075 c     &           g_objf_state_final(i,j,bi,bj,1),
                0076 c     &           g_objf_state_final(i,j,bi,bj,1)**2 / stdDevSST**2
305d315bb8 Jean*0077 c            print '(a,2I4,2(x,F15.9))', 'ph-metric S ', i, j,
e4939baa16 Patr*0078 c     &           g_objf_state_final(i,j,bi,bj,2),
                0079 c     &           g_objf_state_final(i,j,bi,bj,2)**2 / stdDevSSS**2
8f0b59c61c Patr*0080           END DO
                0081         END DO
                0082        END DO
                0083       END DO
                0084 
a5276edbc9 Patr*0085       print *, 'ph-admtlm myMetric = ', optimcycle, myMetric
8f0b59c61c Patr*0086 
                0087 cph)
ee5ca1ad15 Patr*0088 
                0089 #endif
305d315bb8 Jean*0090 
ee5ca1ad15 Patr*0091       end