source: LMDZ6/branches/Amaury_dev/libf/phylmd/geo2atm.F90 @ 5119

Last change on this file since 5119 was 5116, checked in by abarral, 4 months ago

rename modules properly lmdz_*
move ismin, ismax, minmax into new lmdz_libmath.f90
(lint) uppercase fortran keywords

  • 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
File size: 2.2 KB
Line 
1
2! $Header: /home/cvsroot/LMDZ4/libf/phylmd/geo2atm.F90,v 1.1 2008-12-05 17:56:40 lsce Exp $
3
4SUBROUTINE geo2atm(im, jm, px, py, pz, plon, plat, pu, pv, pr)
5  USE dimphy
6  USE lmdz_phys_para
7  USE lmdz_grid_phy, ONLY: grid_type, unstructured, regular_lonlat
8  USE lmdz_abort_physic, ONLY: abort_physic
9  IMPLICIT NONE
10  INCLUDE 'YOMCST.h'
11  CHARACTER (len = 6)                :: clmodnam
12  CHARACTER (len = 20)               :: modname = 'geo2atm'
13  CHARACTER (len = 80)               :: abort_message
14
15! Change wind coordinates from cartesian geocentric to local spherical
16! NB! Fonctionne probablement uniquement en MPI seul (sans OpenMP)
17
18! Geocentric :
19  ! axe x is eastward : crosses (0N,90E) point.
20  ! axe y  crosses (0N,180E) point.
21  ! axe z is 'up' : crosses north pole.
22
23! NB! Aux poles, fonctionne probablement uniquement en MPI seul (sans OpenMP)
24
25  INTEGER, INTENT (IN)                 :: im, jm
26  REAL, DIMENSION (im,jm), INTENT(IN)  :: px, py, pz
27  REAL, DIMENSION (im,jm), INTENT(IN)  :: plon, plat
28  REAL, DIMENSION (im,jm), INTENT(OUT) :: pu, pv, pr
29
30  REAL :: rad,reps
31
32
33  rad = rpi / 180.0E0
34  reps = 1.0e-5
35
36  pu(:,:) = &
37       - px(:,:) * SIN(rad * plon(:,:)) &
38       + py(:,:) * COS(rad * plon(:,:))
39
40  pv(:,:) = &
41       - px(:,:) * SIN(rad * plat(:,:)) * COS(rad * plon(:,:)) &
42       - py(:,:) * SIN(rad * plat(:,:)) * SIN(rad * plon(:,:)) &
43       + pz(:,:) * COS(rad * plat(:,:)) 
44
45  pr(:,:) = &
46       + px(:,:) * COS(rad * plat(:,:)) * COS(rad * plon(:,:)) &
47       + py(:,:) * COS(rad * plat(:,:)) * SIN(rad * plon(:,:)) &
48       + pz(:,:) * SIN(rad * plat(:,:))
49
50  IF (grid_type==regular_lonlat) THEN
51    ! Value at North Pole
52    IF (is_north_pole_dyn) THEN
53       pu(:, 1) = -px (1,1)
54       pv(:, 1) = -py (1,1)
55       pr(:, 1) = 0.0
56    ENDIF
57 
58    ! Value at South Pole     
59    IF (is_south_pole_dyn) THEN
60       pu(:,jm) = -px (1,jm)
61       pv(:,jm) = -py (1,jm)
62       pr(:,jm) = 0.0
63    ENDIF
64
65  ELSE IF (grid_type==unstructured) THEN
66     ! Pole nord pour Dynamico
67     WHERE ( plat(:,:) >= 90.0-reps )
68        pu(:,:) =  py(:,:)
69        pv(:,:) = -px(:,:)
70        pr(:,:) = 0.0e0
71     END WHERE
72
73  ELSE
74     abort_message='Problem: unknown grid type'
75     CALL abort_physic(modname,abort_message,1)
76  END IF
77
78 
79 
80 
81END SUBROUTINE geo2atm
Note: See TracBrowser for help on using the repository browser.