source: LMDZ6/branches/Amaury_dev/libf/dyn3d/friction.F90 @ 5115

Last change on this file since 5115 was 5113, checked in by abarral, 4 months ago

Rename modules in misc from *_mod > lmdz_*
Put cbrt.f90, ch*.f90, pch*.f90 in new lmdz_libmath_pch.f90

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1! $Id: friction.F90 5113 2024-07-24 11:17:08Z abarral $
2
3!=======================================================================
4SUBROUTINE friction(ucov, vcov, pdt)
5
6  USE control_mod
7  USE IOIPSL
8  USE comconst_mod, ONLY: pi
9  IMPLICIT NONE
10
11  !=======================================================================
12
13  !   Friction for the Newtonian case:
14  !   --------------------------------
15  !    2 possibilities (depending on flag 'friction_type'
16  ! friction_type=0 : A friction that is only applied to the lowermost
17  !                   atmospheric layer
18  ! friction_type=1 : Friction applied on all atmospheric layer (but
19  !   (default)       with stronger magnitude near the surface; see
20  !                   iniacademic.F)
21  !=======================================================================
22
23  include "dimensions.h"
24  include "paramet.h"
25  include "comgeom2.h"
26  include "iniprint.h"
27  include "academic.h"
28
29  ! arguments:
30  REAL, INTENT(out) :: ucov(iip1, jjp1, llm)
31  REAL, INTENT(out) :: vcov(iip1, jjm, llm)
32  REAL, INTENT(in) :: pdt ! time step
33
34  ! local variables:
35
36  REAL :: modv(iip1, jjp1), zco, zsi
37  REAL :: vpn, vps, upoln, upols, vpols, vpoln
38  REAL :: u2(iip1, jjp1), v2(iip1, jjm)
39  INTEGER :: i, j, l
40  REAL, PARAMETER :: cfric = 1.e-5
41  LOGICAL, SAVE :: firstcall = .TRUE.
42  INTEGER, SAVE :: friction_type = 1
43  CHARACTER(len = 20) :: modname = "friction"
44  CHARACTER(len = 80) :: abort_message
45
46  IF (firstcall) THEN
47    ! set friction type
48    CALL getin("friction_type", friction_type)
49    if ((friction_type<0).or.(friction_type>1)) then
50      abort_message = "wrong friction type"
51      write(lunout, *)'Friction: wrong friction type', friction_type
52      CALL abort_gcm(modname, abort_message, 42)
53    endif
54    firstcall = .FALSE.
55  ENDIF
56
57  if (friction_type==0) then
58    !   calcul des composantes au carre du vent naturel
59    do j = 1, jjp1
60      do i = 1, iip1
61        u2(i, j) = ucov(i, j, 1) * ucov(i, j, 1) * unscu2(i, j)
62      enddo
63    enddo
64    do j = 1, jjm
65      do i = 1, iip1
66        v2(i, j) = vcov(i, j, 1) * vcov(i, j, 1) * unscv2(i, j)
67      enddo
68    enddo
69
70    !   calcul du module de V en dehors des poles
71    do j = 2, jjm
72      do i = 2, iip1
73        modv(i, j) = sqrt(0.5 * (u2(i - 1, j) + u2(i, j) + v2(i, j - 1) + v2(i, j)))
74      enddo
75      modv(1, j) = modv(iip1, j)
76    enddo
77
78    !   les deux composantes du vent au pole sont obtenues comme
79    !   premiers modes de fourier de v pres du pole
80    upoln = 0.
81    vpoln = 0.
82    upols = 0.
83    vpols = 0.
84    do i = 2, iip1
85      zco = cos(rlonv(i)) * (rlonu(i) - rlonu(i - 1))
86      zsi = sin(rlonv(i)) * (rlonu(i) - rlonu(i - 1))
87      vpn = vcov(i, 1, 1) / cv(i, 1)
88      vps = vcov(i, jjm, 1) / cv(i, jjm)
89      upoln = upoln + zco * vpn
90      vpoln = vpoln + zsi * vpn
91      upols = upols + zco * vps
92      vpols = vpols + zsi * vps
93    enddo
94    vpn = sqrt(upoln * upoln + vpoln * vpoln) / pi
95    vps = sqrt(upols * upols + vpols * vpols) / pi
96    do i = 1, iip1
97      ! modv(i,1)=vpn
98      ! modv(i,jjp1)=vps
99      modv(i, 1) = modv(i, 2)
100      modv(i, jjp1) = modv(i, jjm)
101    enddo
102
103    !   calcul du frottement au sol.
104    do j = 2, jjm
105      do i = 1, iim
106        ucov(i, j, 1) = ucov(i, j, 1) &
107                - cfric * pdt * 0.5 * (modv(i + 1, j) + modv(i, j)) * ucov(i, j, 1)
108      enddo
109      ucov(iip1, j, 1) = ucov(1, j, 1)
110    enddo
111    do j = 1, jjm
112      do i = 1, iip1
113        vcov(i, j, 1) = vcov(i, j, 1) &
114                - cfric * pdt * 0.5 * (modv(i, j + 1) + modv(i, j)) * vcov(i, j, 1)
115      enddo
116      vcov(iip1, j, 1) = vcov(1, j, 1)
117    enddo
118  endif ! of if (friction_type.eq.0)
119
120  if (friction_type==1) then
121    do l = 1, llm
122      ucov(:, :, l) = ucov(:, :, l) * (1. - pdt * kfrict(l))
123      vcov(:, :, l) = vcov(:, :, l) * (1. - pdt * kfrict(l))
124    enddo
125  endif
126
127
128END SUBROUTINE friction
129
Note: See TracBrowser for help on using the repository browser.