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