1 | |
---|
2 | ! $Id: friction_p.F 1299 2010-01-20 14:27:21Z fairhead $ |
---|
3 | |
---|
4 | !======================================================================= |
---|
5 | SUBROUTINE friction_loc(ucov,vcov,pdt) |
---|
6 | USE parallel_lmdz |
---|
7 | USE control_mod |
---|
8 | USE IOIPSL |
---|
9 | USE comconst_mod, ONLY: pi |
---|
10 | IMPLICIT NONE |
---|
11 | |
---|
12 | !======================================================================= |
---|
13 | |
---|
14 | ! Friction for the Newtonian case: |
---|
15 | ! -------------------------------- |
---|
16 | ! 2 possibilities (depending on flag 'friction_type' |
---|
17 | ! friction_type=0 : A friction that is only applied to the lowermost |
---|
18 | ! atmospheric layer |
---|
19 | ! friction_type=1 : Friction applied on all atmospheric layer (but |
---|
20 | ! (default) with stronger magnitude near the surface; see |
---|
21 | ! iniacademic.F) |
---|
22 | !======================================================================= |
---|
23 | |
---|
24 | include "dimensions.h" |
---|
25 | include "paramet.h" |
---|
26 | include "comgeom2.h" |
---|
27 | include "iniprint.h" |
---|
28 | include "academic.h" |
---|
29 | |
---|
30 | ! arguments: |
---|
31 | REAL,INTENT(inout) :: ucov( iip1,jjb_u:jje_u,llm ) |
---|
32 | REAL,INTENT(inout) :: vcov( iip1,jjb_v:jje_v,llm ) |
---|
33 | REAL,INTENT(in) :: pdt ! time step |
---|
34 | |
---|
35 | ! local variables: |
---|
36 | |
---|
37 | REAL :: modv(iip1,jjb_u:jje_u),zco,zsi |
---|
38 | REAL :: vpn,vps,upoln,upols,vpols,vpoln |
---|
39 | REAL :: u2(iip1,jjb_u:jje_u),v2(iip1,jjb_v:jje_v) |
---|
40 | INTEGER :: i,j,l |
---|
41 | REAL,PARAMETER :: cfric=1.e-5 |
---|
42 | LOGICAL,SAVE :: firstcall=.TRUE. |
---|
43 | INTEGER,SAVE :: friction_type=1 |
---|
44 | CHARACTER(len=20) :: modname="friction_p" |
---|
45 | CHARACTER(len=80) :: abort_message |
---|
46 | !$OMP THREADPRIVATE(firstcall,friction_type) |
---|
47 | integer :: jjb,jje |
---|
48 | |
---|
49 | !$OMP SINGLE |
---|
50 | IF (firstcall) THEN |
---|
51 | ! set friction type |
---|
52 | CALL getin("friction_type",friction_type) |
---|
53 | if ((friction_type<0).or.(friction_type>1)) then |
---|
54 | abort_message="wrong friction type" |
---|
55 | write(lunout,*)'Friction: wrong friction type',friction_type |
---|
56 | CALL abort_gcm(modname,abort_message,42) |
---|
57 | endif |
---|
58 | firstcall=.FALSE. |
---|
59 | ENDIF |
---|
60 | !$OMP END SINGLE COPYPRIVATE(friction_type,firstcall) |
---|
61 | |
---|
62 | if (friction_type==0) then ! friction on first layer only |
---|
63 | !$OMP SINGLE |
---|
64 | ! calcul des composantes au carre du vent naturel |
---|
65 | jjb=jj_begin |
---|
66 | jje=jj_end+1 |
---|
67 | if (pole_sud) jje=jj_end |
---|
68 | |
---|
69 | do j=jjb,jje |
---|
70 | do i=1,iip1 |
---|
71 | u2(i,j)=ucov(i,j,1)*ucov(i,j,1)*unscu2(i,j) |
---|
72 | enddo |
---|
73 | enddo |
---|
74 | |
---|
75 | jjb=jj_begin-1 |
---|
76 | jje=jj_end+1 |
---|
77 | if (pole_nord) jjb=jj_begin |
---|
78 | if (pole_sud) jje=jj_end-1 |
---|
79 | |
---|
80 | do j=jjb,jje |
---|
81 | do i=1,iip1 |
---|
82 | v2(i,j)=vcov(i,j,1)*vcov(i,j,1)*unscv2(i,j) |
---|
83 | enddo |
---|
84 | enddo |
---|
85 | |
---|
86 | ! calcul du module de V en dehors des poles |
---|
87 | jjb=jj_begin |
---|
88 | jje=jj_end+1 |
---|
89 | if (pole_nord) jjb=jj_begin+1 |
---|
90 | if (pole_sud) jje=jj_end-1 |
---|
91 | |
---|
92 | do j=jjb,jje |
---|
93 | do i=2,iip1 |
---|
94 | modv(i,j)=sqrt(0.5*(u2(i-1,j)+u2(i,j)+v2(i,j-1)+v2(i,j))) |
---|
95 | enddo |
---|
96 | modv(1,j)=modv(iip1,j) |
---|
97 | enddo |
---|
98 | |
---|
99 | ! les deux composantes du vent au pole sont obtenues comme |
---|
100 | ! premiers modes de fourier de v pres du pole |
---|
101 | if (pole_nord) then |
---|
102 | |
---|
103 | upoln=0. |
---|
104 | vpoln=0. |
---|
105 | |
---|
106 | do i=2,iip1 |
---|
107 | zco=cos(rlonv(i))*(rlonu(i)-rlonu(i-1)) |
---|
108 | zsi=sin(rlonv(i))*(rlonu(i)-rlonu(i-1)) |
---|
109 | vpn=vcov(i,1,1)/cv(i,1) |
---|
110 | upoln=upoln+zco*vpn |
---|
111 | vpoln=vpoln+zsi*vpn |
---|
112 | enddo |
---|
113 | vpn=sqrt(upoln*upoln+vpoln*vpoln)/pi |
---|
114 | do i=1,iip1 |
---|
115 | ! modv(i,1)=vpn |
---|
116 | modv(i,1)=modv(i,2) |
---|
117 | enddo |
---|
118 | |
---|
119 | endif |
---|
120 | |
---|
121 | if (pole_sud) then |
---|
122 | |
---|
123 | upols=0. |
---|
124 | vpols=0. |
---|
125 | do i=2,iip1 |
---|
126 | zco=cos(rlonv(i))*(rlonu(i)-rlonu(i-1)) |
---|
127 | zsi=sin(rlonv(i))*(rlonu(i)-rlonu(i-1)) |
---|
128 | vps=vcov(i,jjm,1)/cv(i,jjm) |
---|
129 | upols=upols+zco*vps |
---|
130 | vpols=vpols+zsi*vps |
---|
131 | enddo |
---|
132 | vps=sqrt(upols*upols+vpols*vpols)/pi |
---|
133 | do i=1,iip1 |
---|
134 | ! modv(i,jjp1)=vps |
---|
135 | modv(i,jjp1)=modv(i,jjm) |
---|
136 | enddo |
---|
137 | |
---|
138 | endif |
---|
139 | |
---|
140 | ! calcul du frottement au sol. |
---|
141 | |
---|
142 | jjb=jj_begin |
---|
143 | jje=jj_end |
---|
144 | if (pole_nord) jjb=jj_begin+1 |
---|
145 | if (pole_sud) jje=jj_end-1 |
---|
146 | |
---|
147 | do j=jjb,jje |
---|
148 | do i=1,iim |
---|
149 | ucov(i,j,1)=ucov(i,j,1) & |
---|
150 | -cfric*pdt*0.5*(modv(i+1,j)+modv(i,j))*ucov(i,j,1) |
---|
151 | enddo |
---|
152 | ucov(iip1,j,1)=ucov(1,j,1) |
---|
153 | enddo |
---|
154 | |
---|
155 | jjb=jj_begin |
---|
156 | jje=jj_end |
---|
157 | if (pole_sud) jje=jj_end-1 |
---|
158 | |
---|
159 | do j=jjb,jje |
---|
160 | do i=1,iip1 |
---|
161 | vcov(i,j,1)=vcov(i,j,1) & |
---|
162 | -cfric*pdt*0.5*(modv(i,j+1)+modv(i,j))*vcov(i,j,1) |
---|
163 | enddo |
---|
164 | vcov(iip1,j,1)=vcov(1,j,1) |
---|
165 | enddo |
---|
166 | !$OMP END SINGLE |
---|
167 | endif ! of if (friction_type.eq.0) |
---|
168 | |
---|
169 | if (friction_type==1) then |
---|
170 | ! for ucov() |
---|
171 | jjb=jj_begin |
---|
172 | jje=jj_end |
---|
173 | if (pole_nord) jjb=jj_begin+1 |
---|
174 | if (pole_sud) jje=jj_end-1 |
---|
175 | |
---|
176 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
177 | do l=1,llm |
---|
178 | ucov(1:iip1,jjb:jje,l)=ucov(1:iip1,jjb:jje,l)* & |
---|
179 | (1.-pdt*kfrict(l)) |
---|
180 | enddo |
---|
181 | !$OMP END DO NOWAIT |
---|
182 | |
---|
183 | ! for vcoc() |
---|
184 | jjb=jj_begin |
---|
185 | jje=jj_end |
---|
186 | if (pole_sud) jje=jj_end-1 |
---|
187 | |
---|
188 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
189 | do l=1,llm |
---|
190 | vcov(1:iip1,jjb:jje,l)=vcov(1:iip1,jjb:jje,l)* & |
---|
191 | (1.-pdt*kfrict(l)) |
---|
192 | enddo |
---|
193 | !$OMP END DO |
---|
194 | endif ! of if (friction_type.eq.1) |
---|
195 | |
---|
196 | |
---|
197 | END SUBROUTINE friction_loc |
---|
198 | |
---|