| 1 |
C $Header$ |
C $Header$ |
| 2 |
C $Name$ |
C $Name$ |
| 3 |
|
|
| 4 |
|
#include "STREAMICE_OPTIONS.h" |
| 5 |
#ifdef ALLOW_COST |
#ifdef ALLOW_COST |
| 6 |
# include "COST_OPTIONS.h" |
# include "COST_OPTIONS.h" |
| 7 |
#endif |
#endif |
|
#include "STREAMICE_OPTIONS.h" |
|
|
|
|
| 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 === |
| 30 |
|
|
| 31 |
#ifdef ALLOW_COST |
#ifdef ALLOW_COST |
| 32 |
# include "cost.h" |
# include "cost.h" |
| 33 |
#endif |
#endif |
| 34 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
| 35 |
# include "tamc.h" |
# include "tamc.h" |
| 36 |
#endif |
#endif |
| 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 |
| 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 |
|
|
suff = suff(1:ILNBLNK(suff))//'.bin' |
|
| 56 |
|
|
| 57 |
CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff, ' ', |
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 |
|
|
| 82 |
do j=1,sNy |
do j=1,sNy |
| 83 |
do i=1,sNx |
do i=1,sNx |
| 84 |
|
|
|
|
|
| 85 |
! S_obs(i,j,bi,bj) = 0.0 |
! S_obs(i,j,bi,bj) = 0.0 |
| 86 |
|
if (streamice_cost_mask(i,j,bi,bj).eq.1.0) THEN |
| 87 |
cost_func1_streamice (bi,bj) = |
cost_func1_streamice (bi,bj) = |
| 88 |
& cost_func1_streamice (bi,bj) + |
& cost_func1_streamice (bi,bj) + |
| 89 |
& streamice_wgt_surf * (S_obs(i,j,bi,bj)- |
& streamice_wgt_surf * (S_obs(i,j,bi,bj)- |
| 90 |
& surf_el_streamice(i,j,bi,bj))**2 / Nx / Ny + |
& surf_el_streamice(i,j,bi,bj))**2 / Nx / Ny + |
| 91 |
& streamice_wgt_drift * (H_streamice(i,j,bi,bj)- |
& streamice_wgt_drift * (H_streamice(i,j,bi,bj)- |
| 92 |
& H_streamice_prev(i,j,bi,bj))**2 / Nx / Ny |
& H_streamice_prev(i,j,bi,bj))**2 / Nx / Ny |
| 93 |
|
endif |
| 94 |
|
|
| 95 |
end do |
end do |
| 96 |
end do |
end do |
| 101 |
|
|
| 102 |
RETURN |
RETURN |
| 103 |
END |
END |
|
|
|