source: trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_para.F90 @ 3525

Last change on this file since 3525 was 1682, checked in by emillour, 8 years ago

All GCMs: set things up to enable pluging physics with dynamico

  • dyn3d
  • gcm.F90 : move I/O initialization (dates) to be done before physics

initialization

  • dyn3dpar
  • gcm.F : move I/O initialization (dates) to be done before physics

initialization

  • dynphy_lonlat:
  • inigeomphy_mod.F90 : add ind_cell_glo computation and transfer

to init_geometry

  • phy_common:
  • geometry_mod.F90 : add ind_cell_glo module variable to store global

column index

  • print_control_mod.F90 : make initialization occur via init_print_control_mod

to avoid circular module dependencies

  • init_print_control_mod.F90 : added to initialize print_control_mod module

variables

  • mod_phys_lmdz_mpi_data.F90 : use print_control_mod (rather than iniprint.h)
  • mod_phys_lmdz_para.F90 : use print_control_mod (rather than iniprint.h)
  • mod_phys_lmdz_omp_data.F90 : add is_omp_master (alias of is_omp_root) module

variable and use print_control_mod (rather than
iniprint.h)

  • physics_distribution_mod.F90 : add call to init_dimphy in

init_physics_distribution

  • xios_writefield.F90 : generic routine to output field with XIOS (for debug)
  • misc:
  • handle_err_m.F90 : call abort_physic, rather than abort_gcm
  • wxios.F90 : updates to enable unstructured grids

set module variable g_ctx_name to "LMDZ"
wxios_init(): remove call to wxios_context_init
wxios_context_init(): call xios_context_initialize with COMM_LMDZ_PHY
add routine wxios_set_context() to get handle and set context to XIOS
wxios_domain_param(): change arguments and generate the domain in-place
add wxios_domain_param_unstructured(): generate domain for unstructured case

NB: access is via "domain group" (whereas it is via "domain" in

wxios_domain_param)

  • dynphy_lonlat/phy[std|mars|venus|titan]:
  • iniphysiq_mod.F90 : Remove call to init_dimphy (which is now done in

phy_common/physics_distribution_mod.F90)

EM

File size: 2.9 KB
Line 
1!
2! $Id: mod_phys_lmdz_para.F90 2429 2016-01-27 12:43:09Z fairhead $
3!
4MODULE mod_phys_lmdz_para
5  USE mod_phys_lmdz_transfert_para
6  USE mod_phys_lmdz_mpi_data
7  USE mod_phys_lmdz_omp_data
8   
9  INTEGER,SAVE :: klon_loc
10  LOGICAL,SAVE :: is_sequential
11  LOGICAL,SAVE :: is_parallel
12  LOGICAL,SAVE :: is_master
13
14 
15!$OMP THREADPRIVATE(klon_loc,is_master)
16 
17CONTAINS
18
19  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
20  IMPLICIT NONE
21    INTEGER,INTENT(IN) :: nbp
22    INTEGER,INTENT(IN) :: nbp_lon
23    INTEGER,INTENT(IN) :: nbp_lat
24    INTEGER,INTENT(IN) :: communicator
25
26    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator)
27!$OMP PARALLEL
28    CALL Init_phys_lmdz_omp_data(klon_mpi)
29    klon_loc=klon_omp
30    IF (is_mpi_root .AND. is_omp_root) THEN
31       is_master=.TRUE.
32     ELSE
33       is_master=.FALSE.
34     ENDIF
35     CALL Test_transfert
36!$OMP END PARALLEL   
37     IF (is_using_mpi .OR. is_using_omp) THEN
38       is_sequential=.FALSE.
39       is_parallel=.TRUE.
40     ELSE
41       is_sequential=.TRUE.
42       is_parallel=.FALSE.
43     ENDIF
44
45
46     
47  END SUBROUTINE Init_phys_lmdz_para
48
49  SUBROUTINE Test_transfert
50  USE mod_grid_phy_lmdz
51  USE print_control_mod, ONLY: lunout
52  IMPLICIT NONE
53 
54    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
55    REAL :: tmp1d_glo(klon_glo,nbp_lev)
56    REAL :: Test_Field2d_glo(nbp_lon,nbp_lat,nbp_lev)
57    REAL :: tmp2d_glo(nbp_lon,nbp_lat,nbp_lev)
58    REAL :: Test_Field1d_loc(klon_loc,nbp_lev)
59    REAL :: Test_Field2d_loc(nbp_lon,jj_nb,nbp_lev)
60    REAL :: CheckSum
61   
62    INTEGER :: i,l
63 
64    Test_Field1d_glo = 0.
65    Test_Field2d_glo = 0.
66    Test_Field1d_loc = 0.
67    Test_Field2d_loc = 0.
68 
69    IF (is_mpi_root) THEN
70!$OMP MASTER
71      DO l=1,nbp_lev
72        DO i=1,klon_glo
73!          Test_Field1d_glo(i,l)=MOD(i,10)+10*(l-1)
74           Test_Field1d_glo(i,l)=1
75        ENDDO
76      ENDDO
77!$OMP END MASTER 
78    ENDIF
79 
80    CALL Scatter(Test_Field1d_glo,Test_Field1d_loc)
81    CALL Gather(Test_Field1d_loc,tmp1d_glo)
82 
83    IF (is_mpi_root) THEN
84!$OMP MASTER 
85      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
86      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
87!$OMP END MASTER
88    ENDIF
89   
90    CALL grid1dTo2d_glo(Test_Field1d_glo,Test_Field2d_glo)
91    CALL scatter2D(Test_Field2d_glo,Test_Field1d_loc)
92    CALL gather2d(Test_Field1d_loc,Test_Field2d_glo)
93    CALL grid2dTo1d_glo(Test_Field2d_glo,tmp1d_glo)
94
95    IF (is_mpi_root) THEN
96!$OMP MASTER 
97      Checksum=sum(Test_Field1d_glo-tmp1d_glo)
98      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
99!$OMP END MASTER
100    ENDIF
101
102    CALL bcast(Test_Field1d_glo)
103    CALL reduce_sum(Test_Field1d_glo,tmp1d_glo)
104
105    IF (is_mpi_root) THEN
106!$OMP MASTER 
107      Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)
108      WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"
109!$OMP END MASTER
110    ENDIF
111   
112     
113   END SUBROUTINE Test_transfert
114 
115END MODULE mod_phys_lmdz_para
116   
Note: See TracBrowser for help on using the repository browser.