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