[1992] | 1 | |
---|
[1403] | 2 | ! $Id: moy_undefSTD.F90 3065 2017-11-10 13:25:09Z dcugnet $ |
---|
[1992] | 3 | |
---|
| 4 | SUBROUTINE moy_undefstd(itap, itapm1) |
---|
| 5 | USE netcdf |
---|
| 6 | USE dimphy |
---|
[2271] | 7 | #ifdef CPP_IOIPSL |
---|
[1992] | 8 | USE phys_state_var_mod |
---|
[2271] | 9 | #endif |
---|
[2313] | 10 | #ifdef CPP_XIOS |
---|
| 11 | USE wxios, ONLY: missing_val |
---|
| 12 | #endif |
---|
| 13 | |
---|
[1992] | 14 | USE phys_cal_mod, ONLY: mth_len |
---|
| 15 | IMPLICIT NONE |
---|
| 16 | include "clesphys.h" |
---|
[2313] | 17 | #ifndef CPP_XIOS |
---|
[2271] | 18 | REAL :: missing_val |
---|
| 19 | #endif |
---|
[1992] | 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.) |
---|
[2271] | 58 | ! REAL missing_val |
---|
[1992] | 59 | |
---|
[2271] | 60 | ! missing_val = nf90_fill_real |
---|
| 61 | #ifndef CPP_XIOS |
---|
| 62 | missing_val=missing_val_nf90 |
---|
| 63 | #endif |
---|
[1992] | 64 | |
---|
| 65 | DO n = 1, nout |
---|
| 66 | 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 | 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 | |
---|
[2380] | 76 | IF (n==1 .AND. itap==itapm1 .OR. n>1 .AND. mod(itap,nint(freq_outnmc(n)/ & |
---|
[3065] | 77 | phys_tstep))==0) THEN |
---|
[1992] | 78 | |
---|
| 79 | ! print*,'moy_undefSTD n itap itapm1',n,itap,itapm1 |
---|
| 80 | |
---|
| 81 | DO k = 1, nlevstd |
---|
| 82 | DO i = 1, klon |
---|
| 83 | 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 | )) |
---|
| 86 | usumstd(i, k, n) = usumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
---|
| 87 | )) |
---|
| 88 | vsumstd(i, k, n) = vsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
---|
| 89 | )) |
---|
| 90 | wsumstd(i, k, n) = wsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
---|
| 91 | )) |
---|
| 92 | phisumstd(i, k, n) = phisumstd(i, k, n)/ & |
---|
| 93 | (freq_moynmc(n)-tnondef(i,k,n)) |
---|
| 94 | qsumstd(i, k, n) = qsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k,n & |
---|
| 95 | )) |
---|
| 96 | rhsumstd(i, k, n) = rhsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 97 | ,n)) |
---|
| 98 | uvsumstd(i, k, n) = uvsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 99 | ,n)) |
---|
| 100 | vqsumstd(i, k, n) = vqsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 101 | ,n)) |
---|
| 102 | vtsumstd(i, k, n) = vtsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 103 | ,n)) |
---|
| 104 | wqsumstd(i, k, n) = wqsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 105 | ,n)) |
---|
| 106 | vphisumstd(i, k, n) = vphisumstd(i, k, n)/ & |
---|
| 107 | (freq_moynmc(n)-tnondef(i,k,n)) |
---|
| 108 | wtsumstd(i, k, n) = wtsumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 109 | ,n)) |
---|
| 110 | u2sumstd(i, k, n) = u2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 111 | ,n)) |
---|
| 112 | v2sumstd(i, k, n) = v2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 113 | ,n)) |
---|
| 114 | t2sumstd(i, k, n) = t2sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 115 | ,n)) |
---|
| 116 | o3sumstd(i, k, n) = o3sumstd(i, k, n)/(freq_moynmc(n)-tnondef(i,k & |
---|
| 117 | ,n)) |
---|
| 118 | o3daysumstd(i, k, n) = o3daysumstd(i, k, n)/ & |
---|
| 119 | (freq_moynmc(n)-tnondef(i,k,n)) |
---|
[1352] | 120 | ELSE |
---|
[1992] | 121 | tsumstd(i, k, n) = missing_val |
---|
| 122 | usumstd(i, k, n) = missing_val |
---|
| 123 | vsumstd(i, k, n) = missing_val |
---|
| 124 | wsumstd(i, k, n) = missing_val |
---|
| 125 | phisumstd(i, k, n) = missing_val |
---|
| 126 | qsumstd(i, k, n) = missing_val |
---|
| 127 | rhsumstd(i, k, n) = missing_val |
---|
| 128 | uvsumstd(i, k, n) = missing_val |
---|
| 129 | vqsumstd(i, k, n) = missing_val |
---|
| 130 | vtsumstd(i, k, n) = missing_val |
---|
| 131 | wqsumstd(i, k, n) = missing_val |
---|
| 132 | vphisumstd(i, k, n) = missing_val |
---|
| 133 | wtsumstd(i, k, n) = missing_val |
---|
| 134 | u2sumstd(i, k, n) = missing_val |
---|
| 135 | v2sumstd(i, k, n) = missing_val |
---|
| 136 | t2sumstd(i, k, n) = missing_val |
---|
| 137 | o3sumstd(i, k, n) = missing_val |
---|
| 138 | 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 |
---|
[3065] | 142 | END IF !MOD(itap,NINT(freq_outNMC(n)/phys_tstep)).EQ.0 |
---|
[1992] | 143 | |
---|
| 144 | END DO !n |
---|
| 145 | |
---|
| 146 | RETURN |
---|
| 147 | END SUBROUTINE moy_undefstd |
---|