source: LMDZ6/branches/Amaury_dev/libf/phy_common/lmdz_geometry.F90 @ 5117

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

rename modules properly lmdz_*
move some unused files to obsolete/
(lint) uppercase fortran keywords

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