source: LMDZ6/trunk/libf/phy_common/mod_phys_lmdz_omp_data.F90 @ 4305

Last change on this file since 4305 was 3435, checked in by Laurent Fairhead, 6 years ago

"Historic" :-) commit merging the physics branch used for DYNAMICO with the LMDZ trunk.
The same physics branch can now be used seamlessly with the traditional lon-lat LMDZ
dynamical core and DYNAMICO.
Testing consisted in running a lon-lat LMDZ bucket simulation with the NPv6.1 physics package
with the original trunk sources and the merged sources. Tests were succesful in the sense that
numeric continuity was preserved in the restart files from both simulation. Further tests
included running both versions of the physics codes for one year in a LMDZOR setting in which
the restart files also came out identical.

Caution:

  • as the physics package now manages unstructured grids, grid information needs to be transmitted

to the surface scheme ORCHIDEE. This means that the interface defined in surf_land_orchidee_mod.F90
is only compatible with ORCHIDEE version orchidee2.1 and later versions. If previous versions of
ORCHIDEE need to be used, the CPP key ORCHIDEE_NOUNSTRUCT needs to be set at compilation time.
This is done automatically if makelmdz/makelmdz_fcm are called with the veget orchidee2.0 switch

  • due to a limitation in XIOS, the time at which limit conditions will be read in by DYNAMICO will be

delayed by one physic timestep with respect to the time it is read in by the lon-lat model. This is caused
by the line

IF (MOD(itime-1, lmt_pas) == 0 .OR. (jour_lu /= jour .AND. grid_type /= unstructured)) THEN ! time to read

in limit_read_mod.F90

Work still needed on COSP integration and XML files for DYNAMICO

EM, YM, LF

  • 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.4 KB
Line 
1!
2!$Id: mod_phys_lmdz_omp_data.F90 3435 2019-01-22 15:21:59Z jghattas $
3!
4MODULE mod_phys_lmdz_omp_data
5
6  INTEGER,SAVE :: omp_size
7  INTEGER,SAVE :: omp_rank
8  LOGICAL,SAVE :: is_omp_root
9  LOGICAL,SAVE :: is_omp_master  ! alias of is_omp_root
10  LOGICAL,SAVE :: is_using_omp
11  LOGICAL,SAVE :: is_north_pole_phy, is_south_pole_phy
12 
13  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_nb
14  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_begin
15  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_end   
16 
17  INTEGER,SAVE :: klon_omp
18  INTEGER,SAVE :: klon_omp_begin
19  INTEGER,SAVE :: klon_omp_end
20!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,is_omp_master,klon_omp_begin,klon_omp_end)
21!$OMP  THREADPRIVATE(is_north_pole_phy, is_south_pole_phy)
22
23CONTAINS
24 
25  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
26    USE dimphy
27    USE mod_phys_lmdz_mpi_data, ONLY : is_north_pole_dyn, is_south_pole_dyn
28    IMPLICIT NONE
29    INTEGER, INTENT(in) :: klon_mpi
30
31    INTEGER :: i
32
33    CHARACTER (LEN=20) :: modname='Init_phys_lmdz_omp_data'
34    CHARACTER (LEN=80) :: abort_message
35
36
37#ifdef CPP_OMP   
38    INTEGER :: OMP_GET_NUM_THREADS
39    EXTERNAL OMP_GET_NUM_THREADS
40    INTEGER :: OMP_GET_THREAD_NUM
41    EXTERNAL OMP_GET_THREAD_NUM
42#endif 
43
44#ifdef CPP_OMP
45!$OMP MASTER
46        is_using_omp=.TRUE.
47        omp_size=OMP_GET_NUM_THREADS()
48!$OMP END MASTER
49!$OMP BARRIER
50        omp_rank=OMP_GET_THREAD_NUM()   
51#else   
52    is_using_omp=.FALSE.
53    omp_size=1
54    omp_rank=0
55#endif
56
57   is_omp_root=.FALSE.
58!$OMP MASTER
59   IF (omp_rank==0) THEN
60     is_omp_root=.TRUE.
61   ELSE
62     abort_message = 'ANORMAL : OMP_MASTER /= 0'
63     CALL abort_physic (modname,abort_message,1)
64   ENDIF
65!$OMP END MASTER
66   is_omp_master=is_omp_root
67
68!$OMP MASTER
69
70    ALLOCATE(klon_omp_para_nb(0:omp_size-1))
71    ALLOCATE(klon_omp_para_begin(0:omp_size-1))
72    ALLOCATE(klon_omp_para_end(0:omp_size-1))
73   
74    DO i=0,omp_size-1
75      klon_omp_para_nb(i)=klon_mpi/omp_size
76      IF (i<MOD(klon_mpi,omp_size)) klon_omp_para_nb(i)=klon_omp_para_nb(i)+1
77    ENDDO
78   
79    klon_omp_para_begin(0) = 1
80    klon_omp_para_end(0) = klon_omp_para_nb(0)
81   
82    DO i=1,omp_size-1
83      klon_omp_para_begin(i)=klon_omp_para_end(i-1)+1
84      klon_omp_para_end(i)=klon_omp_para_begin(i)+klon_omp_para_nb(i)-1
85    ENDDO
86!$OMP END MASTER
87!$OMP BARRIER
88
89   if ((is_north_pole_dyn) .AND. (omp_rank == 0 )) then
90      is_north_pole_phy = .TRUE.
91    else
92      is_north_pole_phy = .FALSE.
93    endif
94    if ((is_south_pole_dyn) .AND. (omp_rank == omp_size-1)) then
95      is_south_pole_phy = .TRUE.
96    else
97      is_south_pole_phy = .FALSE.
98    endif
99   
100    klon_omp=klon_omp_para_nb(omp_rank)
101    klon_omp_begin=klon_omp_para_begin(omp_rank)
102    klon_omp_end=klon_omp_para_end(omp_rank)
103   
104    CALL Print_module_data
105   
106  END SUBROUTINE Init_phys_lmdz_omp_data
107
108  SUBROUTINE Print_module_data
109  USE print_control_mod, ONLY: lunout
110  IMPLICIT NONE
111!  INCLUDE "iniprint.h"
112
113!$OMP CRITICAL 
114  WRITE(lunout,*)'--------> TASK ',omp_rank
115  WRITE(lunout,*)'omp_size =',omp_size
116  WRITE(lunout,*)'omp_rank =',omp_rank
117  WRITE(lunout,*)'is_omp_root =',is_omp_root
118  WRITE(lunout,*)'klon_omp_para_nb =',klon_omp_para_nb
119  WRITE(lunout,*)'klon_omp_para_begin =',klon_omp_para_begin
120  WRITE(lunout,*)'klon_omp_para_end =',klon_omp_para_end   
121  WRITE(lunout,*)'klon_omp =',klon_omp
122  WRITE(lunout,*)'klon_omp_begin =',klon_omp_begin
123  WRITE(lunout,*)'klon_omp_end =',klon_omp_end   
124!$OMP END CRITICAL
125
126  END SUBROUTINE Print_module_data
127END MODULE mod_phys_lmdz_omp_data
Note: See TracBrowser for help on using the repository browser.