1 | ! |
---|
2 | ! $Id: friction.f90 5292 2024-10-28 15:58:32Z fhourdin $ |
---|
3 | ! |
---|
4 | !======================================================================= |
---|
5 | SUBROUTINE friction(ucov,vcov,pdt) |
---|
6 | USE iniprint_mod_h |
---|
7 | USE comgeom2_mod_h |
---|
8 | USE control_mod |
---|
9 | USE IOIPSL |
---|
10 | USE comconst_mod, ONLY: pi |
---|
11 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
12 | USE paramet_mod_h |
---|
13 | USE academic_mod_h, ONLY: kfrict |
---|
14 | IMPLICIT NONE |
---|
15 | |
---|
16 | !======================================================================= |
---|
17 | ! |
---|
18 | ! Friction for the Newtonian case: |
---|
19 | ! -------------------------------- |
---|
20 | ! 2 possibilities (depending on flag 'friction_type' |
---|
21 | ! friction_type=0 : A friction that is only applied to the lowermost |
---|
22 | ! atmospheric layer |
---|
23 | ! friction_type=1 : Friction applied on all atmospheric layer (but |
---|
24 | ! (default) with stronger magnitude near the surface; see |
---|
25 | ! iniacademic.F) |
---|
26 | !======================================================================= |
---|
27 | |
---|
28 | ! arguments: |
---|
29 | REAL,INTENT(out) :: ucov( iip1,jjp1,llm ) |
---|
30 | REAL,INTENT(out) :: vcov( iip1,jjm,llm ) |
---|
31 | REAL,INTENT(in) :: pdt ! time step |
---|
32 | |
---|
33 | ! local variables: |
---|
34 | |
---|
35 | REAL :: modv(iip1,jjp1),zco,zsi |
---|
36 | REAL :: vpn,vps,upoln,upols,vpols,vpoln |
---|
37 | REAL :: u2(iip1,jjp1),v2(iip1,jjm) |
---|
38 | INTEGER :: i,j,l |
---|
39 | REAL,PARAMETER :: cfric=1.e-5 |
---|
40 | LOGICAL,SAVE :: firstcall=.true. |
---|
41 | INTEGER,SAVE :: friction_type=1 |
---|
42 | CHARACTER(len=20) :: modname="friction" |
---|
43 | CHARACTER(len=80) :: abort_message |
---|
44 | |
---|
45 | IF (firstcall) THEN |
---|
46 | ! ! set friction type |
---|
47 | call getin("friction_type",friction_type) |
---|
48 | if ((friction_type.lt.0).or.(friction_type.gt.1)) then |
---|
49 | abort_message="wrong friction type" |
---|
50 | write(lunout,*)'Friction: wrong friction type',friction_type |
---|
51 | call abort_gcm(modname,abort_message,42) |
---|
52 | endif |
---|
53 | firstcall=.false. |
---|
54 | ENDIF |
---|
55 | |
---|
56 | if (friction_type.eq.0) then |
---|
57 | ! calcul des composantes au carre du vent naturel |
---|
58 | do j=1,jjp1 |
---|
59 | do i=1,iip1 |
---|
60 | u2(i,j)=ucov(i,j,1)*ucov(i,j,1)*unscu2(i,j) |
---|
61 | enddo |
---|
62 | enddo |
---|
63 | do j=1,jjm |
---|
64 | do i=1,iip1 |
---|
65 | v2(i,j)=vcov(i,j,1)*vcov(i,j,1)*unscv2(i,j) |
---|
66 | enddo |
---|
67 | enddo |
---|
68 | |
---|
69 | ! calcul du module de V en dehors des poles |
---|
70 | do j=2,jjm |
---|
71 | do i=2,iip1 |
---|
72 | modv(i,j)=sqrt(0.5*(u2(i-1,j)+u2(i,j)+v2(i,j-1)+v2(i,j))) |
---|
73 | enddo |
---|
74 | modv(1,j)=modv(iip1,j) |
---|
75 | enddo |
---|
76 | |
---|
77 | ! les deux composantes du vent au pole sont obtenues comme |
---|
78 | ! premiers modes de fourier de v pres du pole |
---|
79 | upoln=0. |
---|
80 | vpoln=0. |
---|
81 | upols=0. |
---|
82 | vpols=0. |
---|
83 | do i=2,iip1 |
---|
84 | zco=cos(rlonv(i))*(rlonu(i)-rlonu(i-1)) |
---|
85 | zsi=sin(rlonv(i))*(rlonu(i)-rlonu(i-1)) |
---|
86 | vpn=vcov(i,1,1)/cv(i,1) |
---|
87 | vps=vcov(i,jjm,1)/cv(i,jjm) |
---|
88 | upoln=upoln+zco*vpn |
---|
89 | vpoln=vpoln+zsi*vpn |
---|
90 | upols=upols+zco*vps |
---|
91 | vpols=vpols+zsi*vps |
---|
92 | enddo |
---|
93 | vpn=sqrt(upoln*upoln+vpoln*vpoln)/pi |
---|
94 | vps=sqrt(upols*upols+vpols*vpols)/pi |
---|
95 | do i=1,iip1 |
---|
96 | ! modv(i,1)=vpn |
---|
97 | ! modv(i,jjp1)=vps |
---|
98 | modv(i,1)=modv(i,2) |
---|
99 | modv(i,jjp1)=modv(i,jjm) |
---|
100 | enddo |
---|
101 | |
---|
102 | ! calcul du frottement au sol. |
---|
103 | do j=2,jjm |
---|
104 | do i=1,iim |
---|
105 | ucov(i,j,1)=ucov(i,j,1) & |
---|
106 | -cfric*pdt*0.5*(modv(i+1,j)+modv(i,j))*ucov(i,j,1) |
---|
107 | enddo |
---|
108 | ucov(iip1,j,1)=ucov(1,j,1) |
---|
109 | enddo |
---|
110 | do j=1,jjm |
---|
111 | do i=1,iip1 |
---|
112 | vcov(i,j,1)=vcov(i,j,1) & |
---|
113 | -cfric*pdt*0.5*(modv(i,j+1)+modv(i,j))*vcov(i,j,1) |
---|
114 | enddo |
---|
115 | vcov(iip1,j,1)=vcov(1,j,1) |
---|
116 | enddo |
---|
117 | endif ! of if (friction_type.eq.0) |
---|
118 | |
---|
119 | if (friction_type.eq.1) then |
---|
120 | do l=1,llm |
---|
121 | ucov(:,:,l)=ucov(:,:,l)*(1.-pdt*kfrict(l)) |
---|
122 | vcov(:,:,l)=vcov(:,:,l)*(1.-pdt*kfrict(l)) |
---|
123 | enddo |
---|
124 | endif |
---|
125 | |
---|
126 | RETURN |
---|
127 | END SUBROUTINE friction |
---|
128 | |
---|