C $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/dgoldberg/streamice/streamice_cost_surf_accum.F,v 1.7 2012/10/04 15:42:48 dgoldberg Exp $ C $Name: $ #include "COST_OPTIONS.h" #include "STREAMICE_OPTIONS.h" subroutine streamice_cost_surf_accum ( myThid, myIter ) C /==========================================================\ C | subroutine cost_test | C | o this routine computes the cost function for the tiles | C | of this processor | C |==========================================================| C | | C | Notes | C | ===== | C \==========================================================/ IMPLICIT NONE C == Global variables === #include "SIZE.h" #include "EEPARAMS.h" #include "PARAMS.h" #include "DYNVARS.h" #include "GRID.h" #ifdef ALLOW_STREAMICE # include "STREAMICE.h" #endif #include "cost.h" #ifdef ALLOW_AUTODIFF_TAMC # include "tamc.h" #endif C == Routine arguments == C myThid - Thread number for this instance of the routine. integer myThid, myIter #ifdef ALLOW_COST_TEST C == Local variables _RL thetaRef, HAF integer i, j, k, bi, bj integer ig, jg integer itlo,ithi integer jtlo,jthi INTEGER ILNBLNK EXTERNAL ILNBLNK CHARACTER*(MAX_LEN_FNAM) suff CHARACTER*(MAX_LEN_FNAM) STREAMICEsurfOptimFile _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 suff = suff(1:ILNBLNK(suff))//'.data' CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff, ' ', & S_obs, 0, myThid ) C-- Calculate mask for tracer cells (0 => land, 1 => water) ! k=1 #ifdef ALLOW_AUTODIFF_TAMC CADJ STORE surf_el_streamice = comlev1, key = ikey_dynamics, CADJ & kind = isbyte CADJ STORE H_streamice_prev = comlev1, key = ikey_dynamics, CADJ & kind = isbyte CADJ STORE H_streamice = comlev1, key = ikey_dynamics, CADJ & kind = isbyte #endif C-- Calculate cost function on tile of this instance do bj = jtlo,jthi do bi = itlo,ithi do j=1,sNy do i=1,sNx ! S_obs(i,j,bi,bj) = 0.0 cost_func1_streamice (bi,bj) = & cost_func1_streamice (bi,bj) + & 0.5 * (S_obs(i,j,bi,bj)- & surf_el_streamice(i,j,bi,bj))**2 + & 0.5 * (H_streamice(i,j,bi,bj)- & H_streamice_prev(i,j,bi,bj))**2 end do end do end do end do #endif RETURN END