[524] | 1 | ! |
---|
[1279] | 2 | ! $Id: inidissip.F90 1490 2011-02-18 10:29:11Z abarral $ |
---|
[524] | 3 | ! |
---|
[1489] | 4 | SUBROUTINE inidissip ( lstardis,nitergdiv,nitergrot,niterh , & |
---|
| 5 | tetagdiv,tetagrot,tetatemp ) |
---|
| 6 | !======================================================================= |
---|
| 7 | ! initialisation de la dissipation horizontale |
---|
| 8 | !======================================================================= |
---|
| 9 | !----------------------------------------------------------------------- |
---|
| 10 | ! declarations: |
---|
| 11 | ! ------------- |
---|
[524] | 12 | |
---|
[1490] | 13 | USE control_mod, only : idissip,iperiod |
---|
[1403] | 14 | |
---|
[1489] | 15 | IMPLICIT NONE |
---|
| 16 | include "dimensions.h" |
---|
| 17 | include "paramet.h" |
---|
| 18 | include "comdissipn.h" |
---|
| 19 | include "comconst.h" |
---|
| 20 | include "comvert.h" |
---|
| 21 | include "logic.h" |
---|
[1490] | 22 | include "iniprint.h" |
---|
[524] | 23 | |
---|
[1490] | 24 | LOGICAL,INTENT(in) :: lstardis |
---|
| 25 | INTEGER,INTENT(in) :: nitergdiv,nitergrot,niterh |
---|
| 26 | REAL,INTENT(in) :: tetagdiv,tetagrot,tetatemp |
---|
| 27 | |
---|
| 28 | ! Local variables: |
---|
[1489] | 29 | REAL fact,zvert(llm),zz |
---|
| 30 | REAL zh(ip1jmp1),zu(ip1jmp1),zv(ip1jm),deltap(ip1jmp1,llm) |
---|
| 31 | REAL ullm,vllm,umin,vmin,zhmin,zhmax |
---|
| 32 | REAL zllm,z1llm |
---|
[524] | 33 | |
---|
[1489] | 34 | INTEGER l,ij,idum,ii |
---|
| 35 | REAL tetamin |
---|
| 36 | REAL pseudoz |
---|
[1490] | 37 | character (len=80) :: abort_message |
---|
[524] | 38 | |
---|
[1489] | 39 | REAL ran1 |
---|
[524] | 40 | |
---|
| 41 | |
---|
[1489] | 42 | !----------------------------------------------------------------------- |
---|
| 43 | ! |
---|
| 44 | ! calcul des valeurs propres des operateurs par methode iterrative: |
---|
| 45 | ! ----------------------------------------------------------------- |
---|
[524] | 46 | |
---|
[1489] | 47 | crot = -1. |
---|
| 48 | cdivu = -1. |
---|
| 49 | cdivh = -1. |
---|
[524] | 50 | |
---|
[1489] | 51 | ! calcul de la valeur propre de divgrad: |
---|
| 52 | ! -------------------------------------- |
---|
| 53 | idum = 0 |
---|
| 54 | DO l = 1, llm |
---|
| 55 | DO ij = 1, ip1jmp1 |
---|
[524] | 56 | deltap(ij,l) = 1. |
---|
[1489] | 57 | ENDDO |
---|
| 58 | ENDDO |
---|
[524] | 59 | |
---|
[1489] | 60 | idum = -1 |
---|
| 61 | zh(1) = RAN1(idum)-.5 |
---|
| 62 | idum = 0 |
---|
| 63 | DO ij = 2, ip1jmp1 |
---|
| 64 | zh(ij) = RAN1(idum) -.5 |
---|
| 65 | ENDDO |
---|
[524] | 66 | |
---|
[1489] | 67 | CALL filtreg (zh,jjp1,1,2,1,.TRUE.,1) |
---|
[524] | 68 | |
---|
[1489] | 69 | CALL minmax(iip1*jjp1,zh,zhmin,zhmax ) |
---|
[524] | 70 | |
---|
[1489] | 71 | IF ( zhmin .GE. zhmax ) THEN |
---|
[1490] | 72 | write(lunout,*)' Inidissip zh min max ',zhmin,zhmax |
---|
| 73 | abort_message='probleme generateur alleatoire dans inidissip' |
---|
| 74 | call abort_gcm('inidissip',abort_message,1) |
---|
[1489] | 75 | ENDIF |
---|
[524] | 76 | |
---|
[1489] | 77 | zllm = ABS( zhmax ) |
---|
| 78 | DO l = 1,50 |
---|
| 79 | IF(lstardis) THEN |
---|
| 80 | CALL divgrad2(1,zh,deltap,niterh,zh) |
---|
| 81 | ELSE |
---|
| 82 | CALL divgrad (1,zh,niterh,zh) |
---|
| 83 | ENDIF |
---|
[524] | 84 | |
---|
[1489] | 85 | CALL minmax(iip1*jjp1,zh,zhmin,zhmax ) |
---|
[524] | 86 | |
---|
[1489] | 87 | zllm = ABS( zhmax ) |
---|
| 88 | z1llm = 1./zllm |
---|
| 89 | DO ij = 1,ip1jmp1 |
---|
| 90 | zh(ij) = zh(ij)* z1llm |
---|
| 91 | ENDDO |
---|
| 92 | ENDDO |
---|
[524] | 93 | |
---|
[1489] | 94 | IF(lstardis) THEN |
---|
| 95 | cdivh = 1./ zllm |
---|
| 96 | ELSE |
---|
| 97 | cdivh = zllm ** ( -1./niterh ) |
---|
| 98 | ENDIF |
---|
[524] | 99 | |
---|
[1489] | 100 | ! calcul des valeurs propres de gradiv (ii =1) et nxgrarot(ii=2) |
---|
| 101 | ! ----------------------------------------------------------------- |
---|
[1490] | 102 | write(lunout,*)'inidissip: calcul des valeurs propres' |
---|
[524] | 103 | |
---|
[1489] | 104 | DO ii = 1, 2 |
---|
| 105 | ! |
---|
| 106 | DO ij = 1, ip1jmp1 |
---|
| 107 | zu(ij) = RAN1(idum) -.5 |
---|
| 108 | ENDDO |
---|
| 109 | CALL filtreg (zu,jjp1,1,2,1,.TRUE.,1) |
---|
| 110 | DO ij = 1, ip1jm |
---|
| 111 | zv(ij) = RAN1(idum) -.5 |
---|
| 112 | ENDDO |
---|
| 113 | CALL filtreg (zv,jjm,1,2,1,.FALSE.,1) |
---|
[524] | 114 | |
---|
[1489] | 115 | CALL minmax(iip1*jjp1,zu,umin,ullm ) |
---|
| 116 | CALL minmax(iip1*jjm, zv,vmin,vllm ) |
---|
[524] | 117 | |
---|
[1489] | 118 | ullm = ABS ( ullm ) |
---|
| 119 | vllm = ABS ( vllm ) |
---|
[524] | 120 | |
---|
[1489] | 121 | DO l = 1, 50 |
---|
| 122 | IF(ii.EQ.1) THEN |
---|
| 123 | !cccc CALL covcont( 1,zu,zv,zu,zv ) |
---|
| 124 | IF(lstardis) THEN |
---|
| 125 | CALL gradiv2( 1,zu,zv,nitergdiv,zu,zv ) |
---|
| 126 | ELSE |
---|
| 127 | CALL gradiv ( 1,zu,zv,nitergdiv,zu,zv ) |
---|
| 128 | ENDIF |
---|
| 129 | ELSE |
---|
| 130 | IF(lstardis) THEN |
---|
| 131 | CALL nxgraro2( 1,zu,zv,nitergrot,zu,zv ) |
---|
| 132 | ELSE |
---|
| 133 | CALL nxgrarot( 1,zu,zv,nitergrot,zu,zv ) |
---|
| 134 | ENDIF |
---|
| 135 | ENDIF |
---|
[524] | 136 | |
---|
[1489] | 137 | CALL minmax(iip1*jjp1,zu,umin,ullm ) |
---|
| 138 | CALL minmax(iip1*jjm, zv,vmin,vllm ) |
---|
[524] | 139 | |
---|
[1489] | 140 | ullm = ABS ( ullm ) |
---|
| 141 | vllm = ABS ( vllm ) |
---|
[524] | 142 | |
---|
[1489] | 143 | zllm = MAX( ullm,vllm ) |
---|
| 144 | z1llm = 1./ zllm |
---|
| 145 | DO ij = 1, ip1jmp1 |
---|
| 146 | zu(ij) = zu(ij)* z1llm |
---|
| 147 | ENDDO |
---|
| 148 | DO ij = 1, ip1jm |
---|
| 149 | zv(ij) = zv(ij)* z1llm |
---|
| 150 | ENDDO |
---|
| 151 | end DO |
---|
[524] | 152 | |
---|
[1489] | 153 | IF ( ii.EQ.1 ) THEN |
---|
| 154 | IF(lstardis) THEN |
---|
| 155 | cdivu = 1./zllm |
---|
| 156 | ELSE |
---|
| 157 | cdivu = zllm **( -1./nitergdiv ) |
---|
| 158 | ENDIF |
---|
| 159 | ELSE |
---|
| 160 | IF(lstardis) THEN |
---|
| 161 | crot = 1./ zllm |
---|
| 162 | ELSE |
---|
| 163 | crot = zllm **( -1./nitergrot ) |
---|
| 164 | ENDIF |
---|
| 165 | ENDIF |
---|
[524] | 166 | |
---|
[1489] | 167 | end DO |
---|
[524] | 168 | |
---|
[1489] | 169 | ! petit test pour les operateurs non star: |
---|
| 170 | ! ---------------------------------------- |
---|
[524] | 171 | |
---|
[1489] | 172 | ! IF(.NOT.lstardis) THEN |
---|
| 173 | fact = rad*24./REAL(jjm) |
---|
| 174 | fact = fact*fact |
---|
[1490] | 175 | write(lunout,*)'inidissip: coef u ', fact/cdivu, 1./cdivu |
---|
| 176 | write(lunout,*)'inidissip: coef r ', fact/crot , 1./crot |
---|
| 177 | write(lunout,*)'inidissip: coef h ', fact/cdivh, 1./cdivh |
---|
[1489] | 178 | ! ENDIF |
---|
[524] | 179 | |
---|
[1489] | 180 | !----------------------------------------------------------------------- |
---|
| 181 | ! variation verticale du coefficient de dissipation: |
---|
| 182 | ! -------------------------------------------------- |
---|
[524] | 183 | |
---|
[1489] | 184 | if (ok_strato .and. llm==39) then |
---|
| 185 | do l=1,llm |
---|
| 186 | pseudoz=8.*log(preff/presnivs(l)) |
---|
| 187 | zvert(l)=1+ & |
---|
| 188 | (tanh((pseudoz-dissip_zref)/dissip_deltaz)+1.)/2. & |
---|
| 189 | *(dissip_factz-1.) |
---|
| 190 | enddo |
---|
| 191 | else |
---|
| 192 | DO l=1,llm |
---|
| 193 | zvert(l)=1. |
---|
| 194 | ENDDO |
---|
| 195 | fact=2. |
---|
| 196 | DO l = 1, llm |
---|
| 197 | zz = 1. - preff/presnivs(l) |
---|
| 198 | zvert(l)= fact -( fact-1.)/( 1.+zz*zz ) |
---|
| 199 | ENDDO |
---|
| 200 | endif |
---|
[524] | 201 | |
---|
| 202 | |
---|
[1490] | 203 | write(lunout,*)'inidissip: Constantes de temps de la diffusion horizontale' |
---|
[524] | 204 | |
---|
[1489] | 205 | tetamin = 1.e+6 |
---|
[524] | 206 | |
---|
[1489] | 207 | DO l=1,llm |
---|
| 208 | tetaudiv(l) = zvert(l)/tetagdiv |
---|
| 209 | tetaurot(l) = zvert(l)/tetagrot |
---|
| 210 | tetah(l) = zvert(l)/tetatemp |
---|
[524] | 211 | |
---|
[1489] | 212 | IF( tetamin.GT. (1./tetaudiv(l)) ) tetamin = 1./ tetaudiv(l) |
---|
| 213 | IF( tetamin.GT. (1./tetaurot(l)) ) tetamin = 1./ tetaurot(l) |
---|
| 214 | IF( tetamin.GT. (1./ tetah(l)) ) tetamin = 1./ tetah(l) |
---|
| 215 | ENDDO |
---|
[524] | 216 | |
---|
[1490] | 217 | write(lunout,*)'inidissip: tetamin dtvr iperiod ',tetamin,dtvr,iperiod |
---|
[1489] | 218 | idissip = INT( tetamin/( 2.*dtvr*iperiod) ) * iperiod |
---|
[1490] | 219 | write(lunout,*)'inidissip: tetamin idissip ',tetamin,idissip |
---|
[1489] | 220 | idissip = MAX(iperiod,idissip) |
---|
| 221 | dtdiss = idissip * dtvr |
---|
[1490] | 222 | write(lunout,*)'inidissip: idissip dtdiss ',idissip,dtdiss |
---|
[524] | 223 | |
---|
[1489] | 224 | DO l = 1,llm |
---|
[1490] | 225 | write(lunout,*)zvert(l),dtdiss*tetaudiv(l),dtdiss*tetaurot(l), & |
---|
[1489] | 226 | dtdiss*tetah(l) |
---|
| 227 | ENDDO |
---|
[524] | 228 | |
---|
[1489] | 229 | END SUBROUTINE inidissip |
---|