1 |
cswdcost -- add sunroutine --- |
2 |
#include "DIC_OPTIONS.h" |
3 |
#include "GCHEM_OPTIONS.h" |
4 |
|
5 |
|
6 |
CStartOfInterFace |
7 |
SUBROUTINE DIC_COST ( |
8 |
I myTime,myIter,myThid) |
9 |
|
10 |
C /==========================================================\ |
11 |
C | SUBROUTINE DIC_COST i | |
12 |
C |==========================================================| |
13 |
IMPLICIT NONE |
14 |
|
15 |
C == GLobal variables == |
16 |
#include "SIZE.h" |
17 |
#include "DYNVARS.h" |
18 |
#include "EEPARAMS.h" |
19 |
#include "PARAMS.h" |
20 |
#include "GRID.h" |
21 |
#include "PTRACERS.h" |
22 |
#include "GCHEM.h" |
23 |
#include "DIC_ABIOTIC.h" |
24 |
#ifdef DIC_BIOTIC |
25 |
#include "DIC_BIOTIC.h" |
26 |
#include "DIC_DIAGS.h" |
27 |
#include "DIC_COST.h" |
28 |
#endif |
29 |
#ifdef ALLOW_SEAICE |
30 |
#include "ICE.h" |
31 |
#endif |
32 |
|
33 |
C == Routine arguments == |
34 |
INTEGER myIter |
35 |
_RL myTime |
36 |
INTEGER myThid |
37 |
|
38 |
#ifdef ALLOW_DIC_COST |
39 |
|
40 |
C == Local variables == |
41 |
LOGICAL DIFFERENT_MULTIPLE |
42 |
EXTERNAL DIFFERENT_MULTIPLE |
43 |
INTEGER i, j, bi, bj, k, it |
44 |
c |
45 |
_RL po4cost, o2cost, sumvol |
46 |
_RL po4costm, o2costm, sumvolm |
47 |
c |
48 |
c calculate costfunction |
49 |
|
50 |
_BEGIN_MASTER(myThid) |
51 |
|
52 |
sumvol= 0. _d 0 |
53 |
po4cost= 0. _d 0 |
54 |
o2cost=0.d0 |
55 |
cswdmonth-add-- |
56 |
sumvolm=0.d0 |
57 |
po4costm=0.d0 |
58 |
o2costm=0.d0 |
59 |
cswdmonth -- end add -- |
60 |
|
61 |
DO bj=myByLo(myThid),myByHi(myThid) |
62 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
63 |
DO i=1,sNx |
64 |
DO j=1,sNy |
65 |
do k=1,nR |
66 |
sumvol=sumvol+ |
67 |
& rA(i,j,bi,bj)*drF(k)*maskC(i,j,k,bi,bj) |
68 |
po4cost=po4cost+ |
69 |
& (po4ann(i,j,k,bi,bj)-po4obs(i,j,k,bi,bj))**2 |
70 |
& /po4var(k) |
71 |
& *rA(i,j,bi,bj)*drF(k)*maskC(i,j,k,bi,bj) |
72 |
o2cost=o2cost+ |
73 |
& (o2ann(i,j,k,bi,bj)-o2obs(i,j,k,bi,bj))**2 |
74 |
& /o2var(k) |
75 |
& *rA(i,j,bi,bj)*drF(k)*maskC(i,j,k,bi,bj) |
76 |
enddo |
77 |
cswdmonth-add-- |
78 |
do k=1,4 |
79 |
sumvolm=sumvolm+ |
80 |
& rA(i,j,bi,bj)*drF(k)*maskC(i,j,k,bi,bj) |
81 |
enddo |
82 |
do it=1,12 |
83 |
po4costm=po4costm+ |
84 |
& (po4lev1(i,j,it,bi,bj)-po4obsl1(i,j,it,bi,bj))**2 |
85 |
& /po4varm(it,1) |
86 |
& *rA(i,j,bi,bj)*drF(1)*maskC(i,j,1,bi,bj) + |
87 |
& (po4lev2(i,j,it,bi,bj)-po4obsl2(i,j,it,bi,bj))**2 |
88 |
& /po4varm(it,2) |
89 |
& *rA(i,j,bi,bj)*drF(2)*maskC(i,j,2,bi,bj) + |
90 |
& (po4lev3(i,j,it,bi,bj)-po4obsl3(i,j,it,bi,bj))**2 |
91 |
& /po4varm(it,3) |
92 |
& *rA(i,j,bi,bj)*drF(3)*maskC(i,j,3,bi,bj) |
93 |
cQQ & (po4lev4(i,j,it,bi,bj)-po4obsl4(i,j,it,bi,bj))**2 |
94 |
cQQ & /po4varm(it,4) |
95 |
cQQ & *rA(i,j,bi,bj)*drF(4)*maskC(i,j,4,bi,bj) |
96 |
o2costm=o2costm+ |
97 |
& (o2lev1(i,j,it,bi,bj)-o2obsl1(i,j,it,bi,bj))**2 |
98 |
& /o2varm(it,1) |
99 |
& *rA(i,j,bi,bj)*drF(1)*maskC(i,j,1,bi,bj) + |
100 |
& (o2lev2(i,j,it,bi,bj)-o2obsl2(i,j,it,bi,bj))**2 |
101 |
& /o2varm(it,2) |
102 |
& *rA(i,j,bi,bj)*drF(2)*maskC(i,j,2,bi,bj) + |
103 |
& (o2lev3(i,j,it,bi,bj)-o2obsl3(i,j,it,bi,bj))**2 |
104 |
& /o2varm(it,3) |
105 |
& *rA(i,j,bi,bj)*drF(3)*maskC(i,j,3,bi,bj) |
106 |
cQQ & (O2lev4(i,j,it,bi,bj)-o2obsl4(i,j,it,bi,bj))**2 |
107 |
cQQ & /o2varm(it,4) |
108 |
cQQ & *rA(i,j,bi,bj)*drF(4)*maskC(i,j,4,bi,bj) |
109 |
|
110 |
enddo |
111 |
cswdmonth -end- |
112 |
ENDDO |
113 |
ENDDO |
114 |
ENDDO |
115 |
ENDDO |
116 |
po4cost=po4cost/sumvol |
117 |
o2cost=o2cost/sumvol |
118 |
cswdmonth-add |
119 |
po4costm=po4costm/sumvolm/12.d0 |
120 |
o2costm=o2costm/sumvolm/12.d0 |
121 |
cswdmonth-end |
122 |
totcost=po4cost+o2cost+po4costm+o2costm |
123 |
|
124 |
print*,'COST ',totcost, po4cost, o2cost,po4costm,o2costm |
125 |
|
126 |
_END_MASTER(myThid) |
127 |
c |
128 |
#endif |
129 |
RETURN |
130 |
END |
131 |
cswd -- end added subroutine -- |