Changeset 5160 for LMDZ6/branches/Amaury_dev/libf/phy_common
- Timestamp:
- Aug 3, 2024, 2:56:58 PM (3 months ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/phy_common/lmdz_phys_constants.f90
r5131 r5160 1 ! Amaury 08/24: I created this module to declare some constants that were previously duplicated in several places 2 ! Feel free to move this to another better-suited module. 3 MODULE lmdz_phys_constants 4 IMPLICIT NONE; PRIVATE 5 PUBLIC dobson_u 1 6 2 ! $Id$ 3 4 MODULE lmdz_phys_para 5 USE lmdz_phys_transfert_para 6 USE lmdz_phys_mpi_data 7 USE lmdz_phys_omp_data 7 REAL, PARAMETER :: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2 8 END MODULE lmdz_phys_constants 8 9 9 INTEGER,SAVE :: klon_loc10 LOGICAL,SAVE :: is_sequential11 LOGICAL,SAVE :: is_parallel12 LOGICAL,SAVE :: is_master13 14 15 !$OMP THREADPRIVATE(klon_loc,is_master)16 17 CONTAINS18 19 SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,nbp_lev,grid_type, nvertex,communicator)20 IMPLICIT NONE21 INTEGER,INTENT(IN) :: nbp22 INTEGER,INTENT(IN) :: nbp_lon23 INTEGER,INTENT(IN) :: nbp_lat24 INTEGER,INTENT(IN) :: nbp_lev25 INTEGER,INTENT(IN) :: communicator26 INTEGER,INTENT(IN) :: grid_type27 INTEGER,INTENT(IN) :: nvertex28 29 CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,nbp_lev, grid_type, nvertex,communicator)30 !$OMP PARALLEL31 CALL Init_phys_lmdz_omp_data(klon_mpi)32 klon_loc=klon_omp33 IF (is_mpi_root .AND. is_omp_root) THEN34 is_master=.TRUE.35 ELSE36 is_master=.FALSE.37 ENDIF38 !ym CALL Test_transfert39 !$OMP END PARALLEL40 IF (is_using_mpi .OR. is_using_omp) THEN41 is_sequential=.FALSE.42 is_parallel=.TRUE.43 ELSE44 is_sequential=.TRUE.45 is_parallel=.FALSE.46 ENDIF47 48 49 50 END SUBROUTINE Init_phys_lmdz_para51 52 SUBROUTINE Test_transfert53 USE lmdz_grid_phy54 USE lmdz_print_control, ONLY: lunout55 IMPLICIT NONE56 REAL :: Test_Field1d_glo(klon_glo,nbp_lev)57 REAL :: tmp1d_glo(klon_glo,nbp_lev)58 REAL :: Test_Field2d_glo(nbp_lon,nbp_lat,nbp_lev)59 REAL :: tmp2d_glo(nbp_lon,nbp_lat,nbp_lev)60 REAL :: Test_Field1d_loc(klon_loc,nbp_lev)61 REAL :: Test_Field2d_loc(nbp_lon,jj_nb,nbp_lev)62 REAL :: CheckSum63 64 INTEGER :: i,l65 66 Test_Field1d_glo = 0.67 Test_Field2d_glo = 0.68 Test_Field1d_loc = 0.69 Test_Field2d_loc = 0.70 71 IF (is_mpi_root) THEN72 !$OMP MASTER73 DO l=1,nbp_lev74 DO i=1,klon_glo75 ! Test_Field1d_glo(i,l)=MOD(i,10)+10*(l-1)76 Test_Field1d_glo(i,l)=177 ENDDO78 ENDDO79 !$OMP END MASTER80 ENDIF81 82 CALL Scatter(Test_Field1d_glo,Test_Field1d_loc)83 CALL Gather(Test_Field1d_loc,tmp1d_glo)84 85 IF (is_mpi_root) THEN86 !$OMP MASTER87 Checksum=sum(Test_Field1d_glo-tmp1d_glo)88 WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"89 !$OMP END MASTER90 ENDIF91 92 CALL grid1dTo2d_glo(Test_Field1d_glo,Test_Field2d_glo)93 CALL scatter2D(Test_Field2d_glo,Test_Field1d_loc)94 CALL gather2d(Test_Field1d_loc,Test_Field2d_glo)95 CALL grid2dTo1d_glo(Test_Field2d_glo,tmp1d_glo)96 97 IF (is_mpi_root) THEN98 !$OMP MASTER99 Checksum=sum(Test_Field1d_glo-tmp1d_glo)100 WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"101 !$OMP END MASTER102 ENDIF103 104 CALL bcast(Test_Field1d_glo)105 CALL reduce_sum(Test_Field1d_glo,tmp1d_glo)106 107 IF (is_mpi_root) THEN108 !$OMP MASTER109 Checksum=sum(Test_Field1d_glo*omp_size*mpi_size-tmp1d_glo)110 WRITE(lunout,*) "------> Checksum =",Checksum," MUST BE 0"111 !$OMP END MASTER112 ENDIF113 114 115 END SUBROUTINE Test_transfert116 117 END MODULE lmdz_phys_para118
Note: See TracChangeset
for help on using the changeset viewer.