1 | ! |
---|
2 | ! $Id: inidissip.F90 1490 2011-02-18 10:29:11Z ymeurdesoif $ |
---|
3 | ! |
---|
4 | SUBROUTINE inidissip ( lstardis,nitergdiv,nitergrot,niterh , & |
---|
5 | tetagdiv,tetagrot,tetatemp ) |
---|
6 | !======================================================================= |
---|
7 | ! initialisation de la dissipation horizontale |
---|
8 | !======================================================================= |
---|
9 | !----------------------------------------------------------------------- |
---|
10 | ! declarations: |
---|
11 | ! ------------- |
---|
12 | |
---|
13 | USE control_mod, only : idissip,iperiod |
---|
14 | |
---|
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" |
---|
22 | include "iniprint.h" |
---|
23 | |
---|
24 | LOGICAL,INTENT(in) :: lstardis |
---|
25 | INTEGER,INTENT(in) :: nitergdiv,nitergrot,niterh |
---|
26 | REAL,INTENT(in) :: tetagdiv,tetagrot,tetatemp |
---|
27 | |
---|
28 | ! Local variables: |
---|
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 |
---|
33 | |
---|
34 | INTEGER l,ij,idum,ii |
---|
35 | REAL tetamin |
---|
36 | REAL pseudoz |
---|
37 | character (len=80) :: abort_message |
---|
38 | |
---|
39 | REAL ran1 |
---|
40 | |
---|
41 | |
---|
42 | !----------------------------------------------------------------------- |
---|
43 | ! |
---|
44 | ! calcul des valeurs propres des operateurs par methode iterrative: |
---|
45 | ! ----------------------------------------------------------------- |
---|
46 | |
---|
47 | crot = -1. |
---|
48 | cdivu = -1. |
---|
49 | cdivh = -1. |
---|
50 | |
---|
51 | ! calcul de la valeur propre de divgrad: |
---|
52 | ! -------------------------------------- |
---|
53 | idum = 0 |
---|
54 | DO l = 1, llm |
---|
55 | DO ij = 1, ip1jmp1 |
---|
56 | deltap(ij,l) = 1. |
---|
57 | ENDDO |
---|
58 | ENDDO |
---|
59 | |
---|
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 |
---|
66 | |
---|
67 | CALL filtreg (zh,jjp1,1,2,1,.TRUE.,1) |
---|
68 | |
---|
69 | CALL minmax(iip1*jjp1,zh,zhmin,zhmax ) |
---|
70 | |
---|
71 | IF ( zhmin .GE. zhmax ) THEN |
---|
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) |
---|
75 | ENDIF |
---|
76 | |
---|
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 |
---|
84 | |
---|
85 | CALL minmax(iip1*jjp1,zh,zhmin,zhmax ) |
---|
86 | |
---|
87 | zllm = ABS( zhmax ) |
---|
88 | z1llm = 1./zllm |
---|
89 | DO ij = 1,ip1jmp1 |
---|
90 | zh(ij) = zh(ij)* z1llm |
---|
91 | ENDDO |
---|
92 | ENDDO |
---|
93 | |
---|
94 | IF(lstardis) THEN |
---|
95 | cdivh = 1./ zllm |
---|
96 | ELSE |
---|
97 | cdivh = zllm ** ( -1./niterh ) |
---|
98 | ENDIF |
---|
99 | |
---|
100 | ! calcul des valeurs propres de gradiv (ii =1) et nxgrarot(ii=2) |
---|
101 | ! ----------------------------------------------------------------- |
---|
102 | write(lunout,*)'inidissip: calcul des valeurs propres' |
---|
103 | |
---|
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) |
---|
114 | |
---|
115 | CALL minmax(iip1*jjp1,zu,umin,ullm ) |
---|
116 | CALL minmax(iip1*jjm, zv,vmin,vllm ) |
---|
117 | |
---|
118 | ullm = ABS ( ullm ) |
---|
119 | vllm = ABS ( vllm ) |
---|
120 | |
---|
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 |
---|
136 | |
---|
137 | CALL minmax(iip1*jjp1,zu,umin,ullm ) |
---|
138 | CALL minmax(iip1*jjm, zv,vmin,vllm ) |
---|
139 | |
---|
140 | ullm = ABS ( ullm ) |
---|
141 | vllm = ABS ( vllm ) |
---|
142 | |
---|
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 |
---|
152 | |
---|
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 |
---|
166 | |
---|
167 | end DO |
---|
168 | |
---|
169 | ! petit test pour les operateurs non star: |
---|
170 | ! ---------------------------------------- |
---|
171 | |
---|
172 | ! IF(.NOT.lstardis) THEN |
---|
173 | fact = rad*24./REAL(jjm) |
---|
174 | fact = fact*fact |
---|
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 |
---|
178 | ! ENDIF |
---|
179 | |
---|
180 | !----------------------------------------------------------------------- |
---|
181 | ! variation verticale du coefficient de dissipation: |
---|
182 | ! -------------------------------------------------- |
---|
183 | |
---|
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 |
---|
201 | |
---|
202 | |
---|
203 | write(lunout,*)'inidissip: Constantes de temps de la diffusion horizontale' |
---|
204 | |
---|
205 | tetamin = 1.e+6 |
---|
206 | |
---|
207 | DO l=1,llm |
---|
208 | tetaudiv(l) = zvert(l)/tetagdiv |
---|
209 | tetaurot(l) = zvert(l)/tetagrot |
---|
210 | tetah(l) = zvert(l)/tetatemp |
---|
211 | |
---|
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 |
---|
216 | |
---|
217 | write(lunout,*)'inidissip: tetamin dtvr iperiod ',tetamin,dtvr,iperiod |
---|
218 | idissip = INT( tetamin/( 2.*dtvr*iperiod) ) * iperiod |
---|
219 | write(lunout,*)'inidissip: tetamin idissip ',tetamin,idissip |
---|
220 | idissip = MAX(iperiod,idissip) |
---|
221 | dtdiss = idissip * dtvr |
---|
222 | write(lunout,*)'inidissip: idissip dtdiss ',idissip,dtdiss |
---|
223 | |
---|
224 | DO l = 1,llm |
---|
225 | write(lunout,*)zvert(l),dtdiss*tetaudiv(l),dtdiss*tetaurot(l), & |
---|
226 | dtdiss*tetah(l) |
---|
227 | ENDDO |
---|
228 | |
---|
229 | END SUBROUTINE inidissip |
---|