1 |
|
|
|
2 |
|
|
! $Id: moy_undefSTD.F90 3435 2019-01-22 15:21:59Z fairhead $ |
3 |
|
|
|
4 |
|
288 |
SUBROUTINE moy_undefstd(itap, itapm1) |
5 |
|
|
USE netcdf |
6 |
|
|
USE dimphy |
7 |
|
|
#ifdef CPP_IOIPSL |
8 |
|
|
USE phys_state_var_mod |
9 |
|
|
#endif |
10 |
|
|
#ifdef CPP_XIOS |
11 |
|
|
USE wxios, ONLY: missing_val |
12 |
|
|
#endif |
13 |
|
|
|
14 |
|
|
USE phys_cal_mod, ONLY: mth_len |
15 |
|
|
IMPLICIT NONE |
16 |
|
|
include "clesphys.h" |
17 |
|
|
#ifndef CPP_XIOS |
18 |
|
|
REAL :: missing_val |
19 |
|
|
#endif |
20 |
|
|
|
21 |
|
|
! ==================================================================== |
22 |
|
|
|
23 |
|
|
! I. Musat : 09.2004 |
24 |
|
|
|
25 |
|
|
! Moyenne - a des frequences differentes - des valeurs bien definies |
26 |
|
|
! (.NE.missing_val) des variables interpolees a un niveau de |
27 |
|
|
! pression. |
28 |
|
|
! 1) les variables de type "day" (nout=1) ou "mth" (nout=2) sont sommees |
29 |
|
|
! tous les pas de temps de la physique |
30 |
|
|
|
31 |
|
|
! 2) les variables de type "NMC" (nout=3) sont calculees a partir |
32 |
|
|
! des valeurs instantannees toutes les 6 heures |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
! NB: mettre "inst(X)" dans le write_hist*NMC.h ! |
36 |
|
|
! ==================================================================== |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
! variables Input |
40 |
|
|
! INTEGER nlevSTD, klevSTD, itap |
41 |
|
|
! PARAMETER(klevSTD=17) |
42 |
|
|
INTEGER itap, itapm1 |
43 |
|
|
|
44 |
|
|
! variables locales |
45 |
|
|
! INTEGER i, k, nout, n |
46 |
|
|
! PARAMETER(nout=3) !nout=1 day/nout=2 mth/nout=3 NMC |
47 |
|
|
INTEGER i, k, n |
48 |
|
|
! REAL dtime, freq_outNMC(nout), freq_moyNMC(nout) |
49 |
|
|
! REAL freq_outNMC(nout), freq_calNMC(nout) |
50 |
|
|
REAL freq_moynmc(nout) |
51 |
|
|
|
52 |
|
|
! variables Output |
53 |
|
|
! REAL tnondef(klon,klevSTD,nout) |
54 |
|
|
! REAL tsumSTD(klon,klevSTD,nout) |
55 |
|
|
|
56 |
|
|
REAL un_jour |
57 |
|
|
PARAMETER (un_jour=86400.) |
58 |
|
|
! REAL missing_val |
59 |
|
|
|
60 |
|
|
! missing_val = nf90_fill_real |
61 |
|
|
#ifndef CPP_XIOS |
62 |
|
|
missing_val=missing_val_nf90 |
63 |
|
|
#endif |
64 |
|
|
|
65 |
✓✓ |
1152 |
DO n = 1, nout |
66 |
✗✓ |
864 |
IF (freq_outnmc(n)<0) THEN |
67 |
|
|
freq_moynmc(n) = (mth_len*un_jour)/freq_calnmc(n) |
68 |
|
|
! print*,'moy_undefSTD n freq_out freq_moy =', |
69 |
|
|
! $n,freq_moyNMC(n) |
70 |
|
|
ELSE |
71 |
|
864 |
freq_moynmc(n) = freq_outnmc(n)/freq_calnmc(n) |
72 |
|
|
END IF |
73 |
|
|
|
74 |
|
|
! calcul 1 fois pas mois, 1 fois par jour ou toutes les 6h |
75 |
|
|
|
76 |
✓✓✗✓ ✓✓✓✓
|
864 |
IF (n==1 .AND. itap==itapm1 .OR. n>1 .AND. mod(itap,nint(freq_outnmc(n)/ & |
77 |
|
288 |
phys_tstep))==0) THEN |
78 |
|
|
|
79 |
|
|
! print*,'moy_undefSTD n itap itapm1',n,itap,itapm1 |
80 |
|
|
|
81 |
✓✓ |
486 |
DO k = 1, nlevstd |
82 |
✓✓ |
457569 |
DO i = 1, klon |
83 |
✓✓ |
456705 |
IF (tnondef(i,k,n)/=(freq_moynmc(n))) THEN |
84 |
|
|
tsumstd(i, k, n) = tsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
85 |
|
435546 |
)) |
86 |
|
|
usumstd(i, k, n) = usumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
87 |
|
435546 |
)) |
88 |
|
|
vsumstd(i, k, n) = vsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
89 |
|
435546 |
)) |
90 |
|
|
wsumstd(i, k, n) = wsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
91 |
|
435546 |
)) |
92 |
|
|
phisumstd(i, k, n) = phisumstd(i, k, n)/ & |
93 |
|
435546 |
(freq_moynmc(n)-tnondef(i,k,n)) |
94 |
|
|
qsumstd(i, k, n) = qsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
95 |
|
435546 |
)) |
96 |
|
|
rhsumstd(i, k, n) = rhsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
97 |
|
435546 |
,n)) |
98 |
|
|
uvsumstd(i, k, n) = uvsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
99 |
|
435546 |
,n)) |
100 |
|
|
vqsumstd(i, k, n) = vqsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
101 |
|
435546 |
,n)) |
102 |
|
|
vtsumstd(i, k, n) = vtsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
103 |
|
435546 |
,n)) |
104 |
|
|
wqsumstd(i, k, n) = wqsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
105 |
|
435546 |
,n)) |
106 |
|
|
vphisumstd(i, k, n) = vphisumstd(i, k, n)/ & |
107 |
|
435546 |
(freq_moynmc(n)-tnondef(i,k,n)) |
108 |
|
|
wtsumstd(i, k, n) = wtsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
109 |
|
435546 |
,n)) |
110 |
|
|
u2sumstd(i, k, n) = u2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
111 |
|
435546 |
,n)) |
112 |
|
|
v2sumstd(i, k, n) = v2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
113 |
|
435546 |
,n)) |
114 |
|
|
t2sumstd(i, k, n) = t2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
115 |
|
435546 |
,n)) |
116 |
|
|
o3sumstd(i, k, n) = o3sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
117 |
|
435546 |
,n)) |
118 |
|
|
o3daysumstd(i, k, n) = o3daysumstd(i, k, n)/ & |
119 |
|
435546 |
(freq_moynmc(n)-tnondef(i,k,n)) |
120 |
|
|
ELSE |
121 |
|
20700 |
tsumstd(i, k, n) = missing_val |
122 |
|
20700 |
usumstd(i, k, n) = missing_val |
123 |
|
20700 |
vsumstd(i, k, n) = missing_val |
124 |
|
20700 |
wsumstd(i, k, n) = missing_val |
125 |
|
20700 |
phisumstd(i, k, n) = missing_val |
126 |
|
20700 |
qsumstd(i, k, n) = missing_val |
127 |
|
20700 |
rhsumstd(i, k, n) = missing_val |
128 |
|
20700 |
uvsumstd(i, k, n) = missing_val |
129 |
|
20700 |
vqsumstd(i, k, n) = missing_val |
130 |
|
20700 |
vtsumstd(i, k, n) = missing_val |
131 |
|
20700 |
wqsumstd(i, k, n) = missing_val |
132 |
|
20700 |
vphisumstd(i, k, n) = missing_val |
133 |
|
20700 |
wtsumstd(i, k, n) = missing_val |
134 |
|
20700 |
u2sumstd(i, k, n) = missing_val |
135 |
|
20700 |
v2sumstd(i, k, n) = missing_val |
136 |
|
20700 |
t2sumstd(i, k, n) = missing_val |
137 |
|
20700 |
o3sumstd(i, k, n) = missing_val |
138 |
|
20700 |
o3daysumstd(i, k, n) = missing_val |
139 |
|
|
END IF !tnondef(i,k,n).NE.(freq_moyNMC(n)) |
140 |
|
|
END DO !i |
141 |
|
|
END DO !k |
142 |
|
|
END IF !MOD(itap,NINT(freq_outNMC(n)/phys_tstep)).EQ.0 |
143 |
|
|
|
144 |
|
|
END DO !n |
145 |
|
|
|
146 |
|
288 |
RETURN |
147 |
|
|
END SUBROUTINE moy_undefstd |