| 1 |
C $Header$ |
C $Header$ |
| 2 |
C $Name$ |
C $Name$ |
| 3 |
|
|
| 4 |
#include "COST_OPTIONS.h" |
#ifdef ALLOW_COST |
| 5 |
|
# include "COST_OPTIONS.h" |
| 6 |
|
#endif |
| 7 |
#include "STREAMICE_OPTIONS.h" |
#include "STREAMICE_OPTIONS.h" |
| 8 |
|
|
| 9 |
|
|
| 29 |
# include "STREAMICE.h" |
# include "STREAMICE.h" |
| 30 |
#endif |
#endif |
| 31 |
|
|
| 32 |
#include "cost.h" |
#ifdef ALLOW_COST |
| 33 |
|
# include "cost.h" |
| 34 |
|
#endif |
| 35 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
| 36 |
|
# include "tamc.h" |
| 37 |
|
#endif |
| 38 |
|
|
| 39 |
C == Routine arguments == |
C == Routine arguments == |
| 40 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
| 59 |
jthi = mybyhi(mythid) |
jthi = mybyhi(mythid) |
| 60 |
itlo = mybxlo(mythid) |
itlo = mybxlo(mythid) |
| 61 |
ithi = mybxhi(mythid) |
ithi = mybxhi(mythid) |
| 62 |
|
|
| 63 |
WRITE(suff,'(I10.10)') myIter |
WRITE(suff,'(I10.10)') myIter |
| 64 |
|
suff = suff(1:ILNBLNK(suff))//'.bin' |
| 65 |
|
|
| 66 |
CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff//'.data.', ' ', |
CALL READ_FLD_XY_RS( 'land_ice_surf.'//suff, ' ', |
| 67 |
& S_obs, 0, myThid ) |
& S_obs, 0, myThid ) |
| 68 |
|
|
| 69 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
| 70 |
! k=1 |
! k=1 |
| 71 |
|
|
| 72 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
| 73 |
|
CADJ STORE surf_el_streamice = comlev1, key = ikey_dynamics, |
| 74 |
|
CADJ & kind = isbyte |
| 75 |
|
CADJ STORE H_streamice_prev = comlev1, key = ikey_dynamics, |
| 76 |
|
CADJ & kind = isbyte |
| 77 |
|
CADJ STORE H_streamice = comlev1, key = ikey_dynamics, |
| 78 |
|
CADJ & kind = isbyte |
| 79 |
|
#endif |
| 80 |
|
|
| 81 |
C-- Calculate cost function on tile of this instance |
C-- Calculate cost function on tile of this instance |
| 82 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
| 83 |
do bi = itlo,ithi |
do bi = itlo,ithi |
| 84 |
do j=1,sNy |
do j=1,sNy |
| 85 |
do i=1,sNx |
do i=1,sNx |
| 86 |
|
|
| 87 |
cost_func1_streamice (bi,bj) = |
|
| 88 |
& cost_func1_streamice (bi,bj) + |
! S_obs(i,j,bi,bj) = 0.0 |
| 89 |
& 0.5 * (S_obs(i,j,bi,bj)- |
if (streamice_cost_mask(i,j,bi,bj).eq.1.0) THEN |
| 90 |
surf_el_streamice(i,j,bi,bj))**2 |
cost_func1_streamice (bi,bj) = |
| 91 |
|
& cost_func1_streamice (bi,bj) + |
| 92 |
|
& streamice_wgt_surf * (S_obs(i,j,bi,bj)- |
| 93 |
|
& surf_el_streamice(i,j,bi,bj))**2 / Nx / Ny + |
| 94 |
|
& streamice_wgt_drift * (H_streamice(i,j,bi,bj)- |
| 95 |
|
& H_streamice_prev(i,j,bi,bj))**2 / Nx / Ny |
| 96 |
|
endif |
| 97 |
|
|
| 98 |
|
|
| 99 |
end do |
end do |
| 100 |
end do |
end do |
| 105 |
|
|
| 106 |
RETURN |
RETURN |
| 107 |
END |
END |
|
|
|
| 108 |
|
|