1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_accumulate_mean.F,v 1.7 2011/05/24 22:11:29 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "COST_OPTIONS.h" |
5 |
|
6 |
subroutine cost_accumulate_mean( myThid ) |
7 |
C *==========================================================* |
8 |
C | subroutine cost_accumulate_mean | |
9 |
C | o accumulate mean state for cost evalualtion | |
10 |
C *==========================================================* |
11 |
C | | |
12 |
C *==========================================================* |
13 |
IMPLICIT NONE |
14 |
|
15 |
C == Global variables === |
16 |
#include "SIZE.h" |
17 |
#include "EEPARAMS.h" |
18 |
#include "PARAMS.h" |
19 |
#include "DYNVARS.h" |
20 |
#include "GRID.h" |
21 |
|
22 |
#include "cost.h" |
23 |
|
24 |
C == Routine arguments == |
25 |
C myThid - Thread number for this instance of the routine. |
26 |
integer bi, bj |
27 |
integer myThid |
28 |
|
29 |
#ifdef ALLOW_COST |
30 |
C == Local variables |
31 |
_RL thetaRef |
32 |
|
33 |
integer i, j, k |
34 |
integer ig, jg |
35 |
integer itlo,ithi |
36 |
integer jtlo,jthi |
37 |
|
38 |
jtlo = mybylo(mythid) |
39 |
jthi = mybyhi(mythid) |
40 |
itlo = mybxlo(mythid) |
41 |
ithi = mybxhi(mythid) |
42 |
|
43 |
C-- Calculate cost function on tile of this instance |
44 |
do bj = jtlo,jthi |
45 |
do bi = itlo,ithi |
46 |
do k = 1, Nr |
47 |
do j=1,sNy |
48 |
do i=1,sNx |
49 |
cMeanTheta(i,j,k,bi,bj) = cMeanTheta(i,j,k,bi,bj) |
50 |
& + theta(i,j,k,bi,bj) |
51 |
& /lastinterval*deltaTClock |
52 |
cMeanUVel(i,j,k,bi,bj) = cMeanUVel(i,j,k,bi,bj) |
53 |
& + uVel(i,j,k,bi,bj) |
54 |
& /lastinterval*deltaTClock |
55 |
cMeanVVel(i,j,k,bi,bj) = cMeanVVel(i,j,k,bi,bj) |
56 |
& + vVel(i,j,k,bi,bj) |
57 |
& /lastinterval*deltaTClock |
58 |
|
59 |
cMeanThetaUVel(i,j,k,bi,bj) = |
60 |
& cMeanThetaUVel(i,j,k,bi,bj) |
61 |
& + (theta(i,j,k,bi,bj)+theta(i-1,j,k,bi,bj)) |
62 |
& /2.*uvel(i,j,k,bi,bj) |
63 |
& *maskW(i,j,k,bi,bj)*maskC(i,j,k,bi,bj) |
64 |
& /lastinterval*deltaTClock |
65 |
cMeanThetaVVel(i,j,k,bi,bj) = |
66 |
& cMeanThetaVVel(i,j,k,bi,bj) |
67 |
& + (theta(i,j,k,bi,bj)+theta(i,j-1,k,bi,bj)) |
68 |
& /2.*vvel(i,j,k,bi,bj) |
69 |
& *maskS(i,j,k,bi,bj)*maskC(i,j,k,bi,bj) |
70 |
& /lastinterval*deltaTClock |
71 |
end do |
72 |
end do |
73 |
end do |
74 |
end do |
75 |
end do |
76 |
|
77 |
#endif |
78 |
|
79 |
RETURN |
80 |
END |