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