Back to home page

MITgcm

 
 

    


File indexing completed on 2023-09-21 05:10:49 UTC

view on githubraw file Latest commit 96b00645 on 2023-09-20 15:15:14 UTC
96b006450c dngo*0001 #include "STREAMICE_OPTIONS.h"
                0002 c#ifdef ALLOW_AUTODIFF
                0003 c# include "AUTODIFF_OPTIONS.h"
                0004 c#endif
                0005 #ifdef ALLOW_COST
                0006 # include "COST_OPTIONS.h"
                0007 #endif
                0008 
                0009       subroutine streamice_cost_vel_accum ( myIter, myThid )
                0010 C     *==========================================================*
                0011 C     | subroutine streamice_cost_vel_accum                      |
                0012 C     | o this routine calculates the velocity misfit contri-    |
                0013 C     |   bution to the per-timestep STREAMICE cost              |
                0014 C     *==========================================================*
                0015 C     |                                                          |
                0016 C     | Notes                                                    |
                0017 C     | =====                                                    |
                0018 C     *==========================================================*
                0019       IMPLICIT NONE
                0020 
                0021 C     == Global variables ===
                0022 #include "SIZE.h"
                0023 #include "EEPARAMS.h"
                0024 #include "PARAMS.h"
                0025 #include "DYNVARS.h"
                0026 #include "GRID.h"
                0027 #ifdef ALLOW_STREAMICE
                0028 # include "STREAMICE.h"
                0029 #endif
                0030 
                0031 #ifdef ALLOW_COST
                0032 # include "cost.h"
                0033 #endif
                0034 c#ifdef ALLOW_AUTODIFF_TAMC
                0035 c# include "tamc.h"
                0036 c#endif
                0037 
                0038 C     == Routine arguments ==
                0039 C     myThid - Thread number for this instance of the routine.
                0040       integer myIter, myThid
                0041 
                0042 #ifdef ALLOW_STREAMICE_TC_COST
                0043 C     == Local variables
                0044       _RL HAF
                0045       integer i, j, k, bi, bj
                0046       integer ig, jg
                0047       integer itlo,ithi
                0048       integer jtlo,jthi
                0049       integer il
                0050       INTEGER  ILNBLNK
                0051       EXTERNAL ILNBLNK
                0052       CHARACTER*(MAX_LEN_FNAM) uvelfilename
                0053       CHARACTER*(MAX_LEN_FNAM) vvelfilename
                0054       CHARACTER*(MAX_LEN_FNAM) errvelfilename
                0055       CHARACTER*(10) myIterStr
                0056       _RL uvelobs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0057       _RL vvelobs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0058       _RL errvelobs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0059       _RL i_numcells, vel_err, uobs, vobs, verr
                0060 
                0061       WRITE(myIterStr,'(I10.10)') myIter
                0062 
                0063       uvelfilename=STREAMICEvelOptimTCBasename(1:
                0064      & ILNBLNK(STREAMICEvelOptimTCBasename))//myIterStr//"u.bin"
                0065       vvelfilename=STREAMICEvelOptimTCBasename(1:
                0066      & ILNBLNK(STREAMICEvelOptimTCBasename))//myIterStr//"v.bin"
                0067       errvelfilename=STREAMICEvelOptimTCBasename(1:
                0068      & ILNBLNK(STREAMICEvelOptimTCBasename))//myIterStr//"err.bin"
                0069       CALL READ_FLD_XY_RL( uvelfilename, ' ', uvelobs,
                0070      &      0, myThid )
                0071       CALL READ_FLD_XY_RL( vvelfilename, ' ', vvelobs,
                0072      &      0, myThid )
                0073       CALL READ_FLD_XY_RL( errvelfilename, ' ', errvelobs,
                0074      &      0, myThid )
                0075 
                0076 c#ifdef ALLOW_AUTODIFF_TAMC
                0077 cCADJ STORE surf_el_streamice  = comlev1, key = ikey_dynamics,
                0078 cCADJ &     kind = isbyte
                0079 cCADJ STORE H_streamice_prev  = comlev1, key = ikey_dynamics,
                0080 cCADJ &     kind = isbyte
                0081 cCADJ STORE H_streamice  = comlev1, key = ikey_dynamics,
                0082 cCADJ &     kind = isbyte
                0083 c#endif
                0084 
                0085       i_numcells = 1.0/(Nx*Ny)
                0086 
                0087 C--   Calculate cost function on tile of this instance
                0088       DO bj=myByLo(myThid),myByHi(myThid)
                0089         DO bi=myBxLo(myThid),myBxHi(myThid)
                0090           do j=1,sNy
                0091             do i=1,sNx
                0092 
                0093              uobs = uvelobs(i,j,bi,bj)
                0094              vobs = vvelobs(i,j,bi,bj)
                0095              verr = errvelobs(i,j,bi,bj)
                0096 
                0097              if (uobs.gt.-999990. .and. vobs.gt.-999990. .and.
                0098      &           verr.gt.-999990.) then
                0099 
                0100               vel_err = streamice_wgt_vel * i_numcells * (
                0101      &         (streamice_u_surf(i,j,bi,bj)-uobs)**2
                0102      &        +(streamice_v_surf(i,j,bi,bj)-vobs)**2)
                0103      &        /(1. + verr**2)
                0104 
                0105               cost_func1_streamice (bi,bj) =
                0106      &        cost_func1_streamice (bi,bj) +
                0107      &              vel_err
                0108               cost_vel_streamice (bi,bj) =
                0109      &        cost_vel_streamice (bi,bj) +
                0110      &              vel_err
                0111 
                0112              end if
                0113 
                0114             end do
                0115           end do
                0116         end do
                0117       end do
                0118 
                0119 #endif
                0120 
                0121       RETURN
                0122       END