1 | ! |
---|
2 | ! $Id: inidissip.f90 5285 2024-10-28 13:33:29Z ymeurdesoif $ |
---|
3 | ! |
---|
4 | SUBROUTINE inidissip ( lstardis,nitergdiv,nitergrot,niterh , & |
---|
5 | tetagdiv,tetagrot,tetatemp, vert_prof_dissip) |
---|
6 | !======================================================================= |
---|
7 | ! initialisation de la dissipation horizontale |
---|
8 | !======================================================================= |
---|
9 | !----------------------------------------------------------------------- |
---|
10 | ! declarations: |
---|
11 | ! ------------- |
---|
12 | |
---|
13 | USE iniprint_mod_h |
---|
14 | USE comdissipn_mod_h |
---|
15 | USE control_mod, only : dissip_period,iperiod |
---|
16 | USE comconst_mod, ONLY: dissip_deltaz, dissip_factz, dissip_zref, & |
---|
17 | dtdiss, dtvr, rad |
---|
18 | USE comvert_mod, ONLY: preff, presnivs |
---|
19 | |
---|
20 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
21 | USE paramet_mod_h |
---|
22 | IMPLICIT NONE |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | LOGICAL,INTENT(in) :: lstardis |
---|
27 | INTEGER,INTENT(in) :: nitergdiv,nitergrot,niterh |
---|
28 | REAL,INTENT(in) :: tetagdiv,tetagrot,tetatemp |
---|
29 | |
---|
30 | integer, INTENT(in):: vert_prof_dissip |
---|
31 | ! Vertical profile of horizontal dissipation |
---|
32 | ! Allowed values: |
---|
33 | ! 0: rational fraction, function of pressure |
---|
34 | ! 1: tanh of altitude |
---|
35 | |
---|
36 | ! Local variables: |
---|
37 | REAL fact,zvert(llm),zz |
---|
38 | REAL zh(ip1jmp1),zu(ip1jmp1), gx(ip1jmp1), divgra(ip1jmp1) |
---|
39 | real zv(ip1jm), gy(ip1jm), deltap(ip1jmp1,llm) |
---|
40 | REAL ullm,vllm,umin,vmin,zhmin,zhmax |
---|
41 | REAL zllm |
---|
42 | |
---|
43 | INTEGER l,ij,idum,ii |
---|
44 | REAL tetamin |
---|
45 | REAL pseudoz |
---|
46 | character (len=80) :: abort_message |
---|
47 | |
---|
48 | REAL ran1 |
---|
49 | |
---|
50 | |
---|
51 | !----------------------------------------------------------------------- |
---|
52 | ! |
---|
53 | ! calcul des valeurs propres des operateurs par methode iterrative: |
---|
54 | ! ----------------------------------------------------------------- |
---|
55 | |
---|
56 | crot = -1. |
---|
57 | cdivu = -1. |
---|
58 | cdivh = -1. |
---|
59 | |
---|
60 | ! calcul de la valeur propre de divgrad: |
---|
61 | ! -------------------------------------- |
---|
62 | idum = 0 |
---|
63 | DO l = 1, llm |
---|
64 | DO ij = 1, ip1jmp1 |
---|
65 | deltap(ij,l) = 1. |
---|
66 | ENDDO |
---|
67 | ENDDO |
---|
68 | |
---|
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 |
---|
75 | |
---|
76 | CALL filtreg (zh,jjp1,1,2,1,.TRUE.,1) |
---|
77 | |
---|
78 | CALL minmax(iip1*jjp1,zh,zhmin,zhmax ) |
---|
79 | |
---|
80 | IF ( zhmin .GE. zhmax ) THEN |
---|
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) |
---|
84 | ENDIF |
---|
85 | |
---|
86 | zllm = ABS( zhmax ) |
---|
87 | DO l = 1,50 |
---|
88 | IF(lstardis) THEN |
---|
89 | CALL divgrad2(1,zh,deltap,niterh,divgra) |
---|
90 | ELSE |
---|
91 | CALL divgrad (1,zh,niterh,divgra) |
---|
92 | ENDIF |
---|
93 | |
---|
94 | zllm = ABS(maxval(divgra)) |
---|
95 | zh = divgra / zllm |
---|
96 | ENDDO |
---|
97 | |
---|
98 | IF(lstardis) THEN |
---|
99 | cdivh = 1./ zllm |
---|
100 | ELSE |
---|
101 | cdivh = zllm ** ( -1./niterh ) |
---|
102 | ENDIF |
---|
103 | |
---|
104 | ! calcul des valeurs propres de gradiv (ii =1) et nxgrarot(ii=2) |
---|
105 | ! ----------------------------------------------------------------- |
---|
106 | write(lunout,*)'inidissip: calcul des valeurs propres' |
---|
107 | |
---|
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) |
---|
118 | |
---|
119 | CALL minmax(iip1*jjp1,zu,umin,ullm ) |
---|
120 | CALL minmax(iip1*jjm, zv,vmin,vllm ) |
---|
121 | |
---|
122 | ullm = ABS ( ullm ) |
---|
123 | vllm = ABS ( vllm ) |
---|
124 | |
---|
125 | DO l = 1, 50 |
---|
126 | IF(ii.EQ.1) THEN |
---|
127 | !cccc CALL covcont( 1,zu,zv,zu,zv ) |
---|
128 | IF(lstardis) THEN |
---|
129 | CALL gradiv2( 1,zu,zv,nitergdiv,gx,gy ) |
---|
130 | ELSE |
---|
131 | CALL gradiv ( 1,zu,zv,nitergdiv,gx,gy ) |
---|
132 | ENDIF |
---|
133 | ELSE |
---|
134 | IF(lstardis) THEN |
---|
135 | CALL nxgraro2( 1,zu,zv,nitergrot,gx,gy ) |
---|
136 | ELSE |
---|
137 | CALL nxgrarot( 1,zu,zv,nitergrot,gx,gy ) |
---|
138 | ENDIF |
---|
139 | ENDIF |
---|
140 | |
---|
141 | zllm = max(abs(maxval(gx)), abs(maxval(gy))) |
---|
142 | zu = gx / zllm |
---|
143 | zv = gy / zllm |
---|
144 | end DO |
---|
145 | |
---|
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 |
---|
159 | |
---|
160 | end DO |
---|
161 | |
---|
162 | ! petit test pour les operateurs non star: |
---|
163 | ! ---------------------------------------- |
---|
164 | |
---|
165 | ! IF(.NOT.lstardis) THEN |
---|
166 | fact = rad*24./REAL(jjm) |
---|
167 | fact = fact*fact |
---|
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 |
---|
171 | ! ENDIF |
---|
172 | |
---|
173 | !----------------------------------------------------------------------- |
---|
174 | ! variation verticale du coefficient de dissipation: |
---|
175 | ! -------------------------------------------------- |
---|
176 | |
---|
177 | if (vert_prof_dissip == 1) then |
---|
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 |
---|
194 | |
---|
195 | |
---|
196 | write(lunout,*)'inidissip: Constantes de temps de la diffusion horizontale' |
---|
197 | |
---|
198 | tetamin = 1.e+6 |
---|
199 | |
---|
200 | DO l=1,llm |
---|
201 | tetaudiv(l) = zvert(l)/tetagdiv |
---|
202 | tetaurot(l) = zvert(l)/tetagrot |
---|
203 | tetah(l) = zvert(l)/tetatemp |
---|
204 | |
---|
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 |
---|
209 | |
---|
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 |
---|
216 | |
---|
217 | dtdiss = dissip_period * dtvr |
---|
218 | write(lunout,*)'inidissip: dissip_period=',dissip_period,' dtdiss=',dtdiss,' dtvr=',dtvr |
---|
219 | |
---|
220 | DO l = 1,llm |
---|
221 | write(lunout,*)zvert(l),dtdiss*tetaudiv(l),dtdiss*tetaurot(l), & |
---|
222 | dtdiss*tetah(l) |
---|
223 | ENDDO |
---|
224 | |
---|
225 | END SUBROUTINE inidissip |
---|