/[MITgcm]/MITgcm_contrib/dgoldberg/streamice/streamice_cost_surf_accum.F
ViewVC logotype

Diff of /MITgcm_contrib/dgoldberg/streamice/streamice_cost_surf_accum.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by heimbach, Fri Sep 28 02:55:40 2012 UTC revision 1.11 by dgoldberg, Wed Aug 27 19:29:13 2014 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
 #include "COST_OPTIONS.h"  
4  #include "STREAMICE_OPTIONS.h"  #include "STREAMICE_OPTIONS.h"
5    #ifdef ALLOW_COST
6    # include "COST_OPTIONS.h"
7    #endif
8    
9        subroutine streamice_cost_surf_accum ( myThid, myIter )        subroutine streamice_cost_surf_accum ( myThid, myIter )
10  C     /==========================================================\  C     *==========================================================*
11  C     | subroutine cost_test                                     |  C     | subroutine cost_test                                     |
12  C     | o this routine computes the cost function for the tiles  |  C     | o this routine computes the cost function for the tiles  |
13  C     |   of this processor                                      |  C     |   of this processor                                      |
14  C     |==========================================================|  C     *==========================================================*
15  C     |                                                          |  C     |                                                          |
16  C     | Notes                                                    |  C     | Notes                                                    |
17  C     | =====                                                    |  C     | =====                                                    |
18  C     \==========================================================/  C     *==========================================================*
19        IMPLICIT NONE        IMPLICIT NONE
20    
21  C     == Global variables ===  C     == Global variables ===
# Line 27  C     == Global variables === Line 28  C     == Global variables ===
28  # include "STREAMICE.h"  # include "STREAMICE.h"
29  #endif  #endif
30    
31  #include "cost.h"  #ifdef ALLOW_COST
32    # include "cost.h"
33    #endif
34    #ifdef ALLOW_AUTODIFF_TAMC
35    # include "tamc.h"
36    #endif
37    
38  C     == Routine arguments ==  C     == Routine arguments ==
39  C     myThid - Thread number for this instance of the routine.  C     myThid - Thread number for this instance of the routine.
40        integer myThid, myIter        integer myThid, myIter
41    
   
42  #ifdef ALLOW_COST_TEST  #ifdef ALLOW_COST_TEST
43  C     == Local variables  C     == Local variables
44        _RL thetaRef, HAF        _RL thetaRef, HAF
# Line 42  C     == Local variables Line 47  C     == Local variables
47        integer ig, jg        integer ig, jg
48        integer itlo,ithi        integer itlo,ithi
49        integer jtlo,jthi        integer jtlo,jthi
50          integer il
51        INTEGER  ILNBLNK        INTEGER  ILNBLNK
52        EXTERNAL ILNBLNK        EXTERNAL ILNBLNK
53        CHARACTER*(MAX_LEN_FNAM) suff        CHARACTER*(MAX_LEN_FNAM) suff
54        CHARACTER*(MAX_LEN_FNAM) STREAMICEsurfOptimFile        CHARACTER*(MAX_LEN_FNAM) STREAMICEsurfOptimFile
55        _RL S_obs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL S_obs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
         
       jtlo = mybylo(mythid)  
       jthi = mybyhi(mythid)  
       itlo = mybxlo(mythid)  
       ithi = mybxhi(mythid)  
     
       WRITE(suff,'(I10.10)') myIter  
56    
57        CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff//'.data.', ' ',        jtlo = mybylo(myThid)
58          jthi = mybyhi(myThid)
59          itlo = mybxlo(myThid)
60          ithi = mybxhi(myThid)
61    
62          WRITE(suff,'(a,I10.10,a)') 'land_ice_surf.',myIter, '.bin'
63    
64          CALL READ_FLD_XY_RL( suff, ' ',
65       &      S_obs, 0, myThid )       &      S_obs, 0, myThid )
66          
67  C--   Calculate mask for tracer cells  (0 => land, 1 => water)  C--   Calculate mask for tracer cells  (0 => land, 1 => water)
68  !       k=1  !       k=1
69    
70    #ifdef ALLOW_AUTODIFF_TAMC
71    CADJ STORE surf_el_streamice  = comlev1, key = ikey_dynamics,
72    CADJ &     kind = isbyte
73    CADJ STORE H_streamice_prev  = comlev1, key = ikey_dynamics,
74    CADJ &     kind = isbyte
75    CADJ STORE H_streamice  = comlev1, key = ikey_dynamics,
76    CADJ &     kind = isbyte
77    #endif
78    
79  C--   Calculate cost function on tile of this instance  C--   Calculate cost function on tile of this instance
80        do bj = jtlo,jthi        do bj = jtlo,jthi
81          do bi = itlo,ithi          do bi = itlo,ithi
82            do j=1,sNy            do j=1,sNy
83              do i=1,sNx              do i=1,sNx
84    
85               cost_func1_streamice (bi,bj) =  !             S_obs(i,j,bi,bj) = 0.0
86       &       cost_func1_streamice (bi,bj) +               if (streamice_cost_mask(i,j,bi,bj).eq.1.0) THEN
87       &       0.5 * (S_obs(i,j,bi,bj)-                cost_func1_streamice (bi,bj) =
88                       surf_el_streamice(i,j,bi,bj))**2       &        cost_func1_streamice (bi,bj) +
89         &        streamice_wgt_surf * (S_obs(i,j,bi,bj)-
90         &               surf_el_streamice(i,j,bi,bj))**2 / Nx / Ny +
91         &        streamice_wgt_drift * (H_streamice(i,j,bi,bj)-
92         &               H_streamice_prev(i,j,bi,bj))**2 / Nx / Ny
93                 endif
94    
95              end do              end do
96            end do            end do
# Line 81  C--   Calculate cost function on tile of Line 101  C--   Calculate cost function on tile of
101    
102        RETURN        RETURN
103        END        END
                                             

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.22