source: LMDZ5/trunk/libf/phy_common/geometry_mod.F90 @ 4613

Last change on this file since 4613 was 2395, checked in by Ehouarn Millour, 9 years ago

Bug fix for aquaplanets: "rlat" and "rlon" were uninitialized when written to startphy.nc; phyredem should write "longitude_deg" and "latitude_deg" to the file. Overall "rlat" and "rlon" should not be used and "latitude_deg" and "longitude_deg" should be used instead in the physics. To be further cleaned up.
Some cleanup on that mater also made in phydev.
Note that this change will make bench test results different for longitudes and latitudes, because of roundoff effects.
EM

File size: 2.3 KB
RevLine 
[2351]1MODULE geometry_mod
2
3! Store informations concerning the local (to MPI/OpenMP core) geometry
4
5  REAL,SAVE,ALLOCATABLE :: longitude(:) ! longitude of the cell (rad)
6!$OMP THREADPRIVATE(longitude)
7
8  REAL,SAVE,ALLOCATABLE :: latitude(:)! latitude of the cell (rad)
9!$OMP THREADPRIVATE(latitude)
10
11  REAL,SAVE,ALLOCATABLE :: longitude_deg(:) ! longitude of the cell (degree)
12!$OMP THREADPRIVATE(longitude_deg)
13
14  REAL,SAVE,ALLOCATABLE :: latitude_deg(:)! latitude of the cell (degree)
15!$OMP THREADPRIVATE(latitude_deg)
16
17  REAL,SAVE,ALLOCATABLE :: boundslon(:,:)  ! boundaries of the cell (rad)
18!$OMP THREADPRIVATE(boundslon)
19
20  REAL,SAVE,ALLOCATABLE :: boundslat(:,:) ! boundaries of the cell (rad)
21!$OMP THREADPRIVATE(boundslat)
22
23  REAL,SAVE,ALLOCATABLE :: dx(:)      ! resolution of longitude cell (valid only for 2D grid)
24!$OMP THREADPRIVATE(dx)
25 
26  REAL,SAVE,ALLOCATABLE :: dy(:)      ! resolution of latitude cell (valid only for 2D grid)
27!$OMP THREADPRIVATE(dy)
28
29  REAL,SAVE,ALLOCATABLE :: cell_area(:)      ! area of the cell
30!$OMP THREADPRIVATE(cell_area)
31
32
33CONTAINS
34
35  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
36                           boundslon_,boundslat_, &
37                           cell_area_,dx_,dy_)
38  USE mod_grid_phy_lmdz, ONLY: nvertex
39  USE nrtype, ONLY : PI
40  IMPLICIT NONE
41    INTEGER,INTENT(IN) :: klon ! number of columns for this MPI/OpenMP domain
42    REAL,INTENT(IN) :: longitude_(klon)
43    REAL,INTENT(IN) :: latitude_(klon)
44    REAL,INTENT(IN) :: boundslon_(klon,nvertex)
45    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
46    REAL,INTENT(IN) :: cell_area_(klon)
47    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
48    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
49   
50    ALLOCATE(longitude(klon))
51    ALLOCATE(latitude(klon))
52    ALLOCATE(longitude_deg(klon))
53    ALLOCATE(latitude_deg(klon))
54    ALLOCATE(boundslon(klon,nvertex))
55    ALLOCATE(boundslat(klon,nvertex))
56    ALLOCATE(cell_area(klon))
57    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
58    IF (PRESENT(dy_))ALLOCATE(dy(klon))
59   
60    longitude(:) = longitude_(:)
61    latitude(:) = latitude_(:)
62    longitude_deg(:) = longitude(:)*180./PI
63    latitude_deg(:) = latitude(:)*180./PI
64    boundslon(:,:) = boundslon_(:,:)
65    boundslat(:,:) = boundslat_(:,:)
66    cell_area(:) = cell_area_(:)
67    IF (PRESENT(dx_)) dx(:) = dx_(:)
68    IF (PRESENT(dy_)) dy(:) = dy_(:)
69   
70  END SUBROUTINE init_geometry
71
72
73END MODULE geometry_mod
74
Note: See TracBrowser for help on using the repository browser.