source: LMDZ6/trunk/libf/phy_common/geometry_mod.f90 @ 5420

Last change on this file since 5420 was 5268, checked in by abarral, 2 months ago

.f90 <-> .F90 depending on cpp key use

File size: 2.7 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
[3435]32  INTEGER,SAVE,ALLOCATABLE :: ind_cell_glo(:)      ! global indice of a local cell
33!$OMP THREADPRIVATE(ind_cell_glo)
[2351]34
35CONTAINS
36
37  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
38                           boundslon_,boundslat_, &
[3435]39                           cell_area_,ind_cell_glo_,dx_,dy_)
[2351]40  USE mod_grid_phy_lmdz, ONLY: nvertex
41  USE nrtype, ONLY : PI
42  IMPLICIT NONE
43    INTEGER,INTENT(IN) :: klon ! number of columns for this MPI/OpenMP domain
44    REAL,INTENT(IN) :: longitude_(klon)
45    REAL,INTENT(IN) :: latitude_(klon)
46    REAL,INTENT(IN) :: boundslon_(klon,nvertex)
47    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
48    REAL,INTENT(IN) :: cell_area_(klon)
[3435]49    INTEGER,OPTIONAL,INTENT(IN) :: ind_cell_glo_(klon)
[2351]50    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
51    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
52   
53    ALLOCATE(longitude(klon))
54    ALLOCATE(latitude(klon))
55    ALLOCATE(longitude_deg(klon))
56    ALLOCATE(latitude_deg(klon))
57    ALLOCATE(boundslon(klon,nvertex))
58    ALLOCATE(boundslat(klon,nvertex))
59    ALLOCATE(cell_area(klon))
[3435]60    IF (PRESENT(ind_cell_glo_)) ALLOCATE(ind_cell_glo(klon))
[2351]61    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
62    IF (PRESENT(dy_))ALLOCATE(dy(klon))
63   
64    longitude(:) = longitude_(:)
65    latitude(:) = latitude_(:)
66    longitude_deg(:) = longitude(:)*180./PI
67    latitude_deg(:) = latitude(:)*180./PI
68    boundslon(:,:) = boundslon_(:,:)
69    boundslat(:,:) = boundslat_(:,:)
70    cell_area(:) = cell_area_(:)
[3435]71    IF (PRESENT(ind_cell_glo_)) ind_cell_glo(:) = ind_cell_glo_(:)
[2351]72    IF (PRESENT(dx_)) dx(:) = dx_(:)
73    IF (PRESENT(dy_)) dy(:) = dy_(:)
74   
75  END SUBROUTINE init_geometry
76
77
78END MODULE geometry_mod
79
Note: See TracBrowser for help on using the repository browser.