source: LMDZ6/trunk/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90 @ 3666

Last change on this file since 3666 was 3666, checked in by lfalletti, 5 years ago

Adding changes for Reprobus

  • 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: 7.5 KB
RevLine 
[2347]1!
[1403]2! $Id: iniphysiq_mod.F90 3666 2020-04-20 10:13:34Z lfalletti $
[2347]3!
4MODULE iniphysiq_mod
[1671]5
[2347]6CONTAINS
[1671]7
[2351]8SUBROUTINE iniphysiq(ii,jj,nlayer, &
9                     nbp, communicator, &
10                     punjours, pdayref,ptimestep, &
[2656]11                     rlatudyn,rlatvdyn,rlonudyn,rlonvdyn,airedyn,cudyn,cvdyn, &
[2225]12                     prad,pg,pr,pcpp,iflag_phys)
[2351]13  USE dimphy, ONLY: init_dimphy
[2588]14  USE inigeomphy_mod, ONLY: inigeomphy
[2608]15  USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat,nbp_lev,klon_glo ! number of atmospheric columns (on full grid)
[2588]16  USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid)
[2315]17  USE vertical_layers_mod, ONLY : init_vertical_layers
[2320]18  USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,&
19                      niadv,conv_flg,pbl_flg,solsym,&
20                      nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,&
21                      ok_isotopes,ok_iso_verif,ok_isotrac,&
22                      ok_init_iso,niso_possibles,tnat,&
23                      alpha_ideal,use_iso,iqiso,iso_num,&
24                      iso_indnum,zone_num,phase_num,&
25                      indnum_fn_num,index_trac,&
26                      niso,ntraceurs_zone,ntraciso
[2351]27#ifdef REPROBUS
28  USE CHEM_REP, ONLY : Init_chem_rep_phys
[3666]29#ifdef CPP_PARA
30  USE parallel_lmdz, ONLY : mpi_size, mpi_rank
31  USE bands, ONLY : distrib_phys
[2351]32#endif
[3666]33  USE mod_phys_lmdz_omp_data, ONLY: klon_omp
34#endif
[2609]35  USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq, config_inca
[2311]36  USE inifis_mod, ONLY: inifis
[2343]37  USE time_phylmdz_mod, ONLY: init_time
[3579]38  USE temps_mod, ONLY: annee_ref, day_ini, day_ref, start_time, calend, year_len
[2320]39  USE infotrac_phy, ONLY: init_infotrac_phy
[2343]40  USE phystokenc_mod, ONLY: init_phystokenc
[1992]41  USE phyaqua_mod, ONLY: iniaqua
[3435]42  USE comconst_mod, ONLY: omeg, rad
[2372]43#ifdef INCA
44  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic
[2457]45#ifdef CPP_PARA
46  USE parallel_lmdz, ONLY : mpi_size, mpi_rank
[2372]47  USE bands, ONLY : distrib_phys
[2457]48#endif
[2372]49  USE mod_phys_lmdz_omp_data, ONLY: klon_omp
50#endif
[2656]51  USE ioipsl_getin_p_mod, ONLY: getin_p
52  USE slab_heat_transp_mod, ONLY: ini_slab_transp_geom
[1992]53  IMPLICIT NONE
[1671]54
[1992]55  ! =======================================================================
56  ! Initialisation of the physical constants and some positional and
57  ! geometrical arrays for the physics
58  ! =======================================================================
[1403]59
[2315]60  include "dimensions.h"
[2656]61  include "paramet.h"
[1992]62  include "iniprint.h"
[2343]63  include "tracstoke.h"
[2656]64  include "comgeom.h"
[1992]65
66  REAL, INTENT (IN) :: prad ! radius of the planet (m)
67  REAL, INTENT (IN) :: pg ! gravitational acceleration (m/s2)
68  REAL, INTENT (IN) :: pr ! ! reduced gas constant R/mu
69  REAL, INTENT (IN) :: pcpp ! specific heat Cp
70  REAL, INTENT (IN) :: punjours ! length (in s) of a standard day
71  INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers
[2315]72  INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes
73  INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes
[2351]74  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
75  INTEGER, INTENT(IN) :: communicator ! MPI communicator
[2656]76  REAL, INTENT (IN) :: rlatudyn(jj+1) ! latitudes of the physics grid
77  REAL, INTENT (IN) :: rlatvdyn(jj) ! latitude boundaries of the physics grid
78  REAL, INTENT (IN) :: rlonvdyn(ii+1) ! longitudes of the physics grid
79  REAL, INTENT (IN) :: rlonudyn(ii+1) ! longitude boundaries of the physics grid
80  REAL, INTENT (IN) :: airedyn(ii+1,jj+1) ! area of the dynamics grid (m2)
81  REAL, INTENT (IN) :: cudyn((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u)
82  REAL, INTENT (IN) :: cvdyn((ii+1)*jj) ! cv coeff. (v_covariant = cv * v)
[1992]83  INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation
84  REAL, INTENT (IN) :: ptimestep !physics time step (s)
85  INTEGER, INTENT (IN) :: iflag_phys ! type of physics to be called
86
87  INTEGER :: ibegin, iend, offset
[2351]88  INTEGER :: i,j,k
[1992]89  CHARACTER (LEN=20) :: modname = 'iniphysiq'
90  CHARACTER (LEN=80) :: abort_message
[2656]91 
92  LOGICAL :: slab_hdiff
93  INTEGER :: slab_ekman
94  CHARACTER (LEN = 6) :: type_ocean
[1992]95
[2457]96#ifndef CPP_PARA
97  INTEGER,PARAMETER :: mpi_rank=0
98  INTEGER, PARAMETER :: mpi_size = 1
99  INTEGER :: distrib_phys(mpi_rank:mpi_rank)=(jjm-1)*iim+2
100#endif
101
[2588]102  ! --> initialize physics distribution, global fields and geometry
103  ! (i.e. things in phy_common or dynphy_lonlat)
104  CALL inigeomphy(ii,jj,nlayer, &
105               nbp, communicator, &
[2656]106               rlatudyn,rlatvdyn, &
107               rlonudyn,rlonvdyn, &
108               airedyn,cudyn,cvdyn)
[2346]109
[2588]110  ! --> now initialize things specific to the phylmd physics package
[2351]111 
[2601]112!!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/)
113!$OMP PARALLEL DEFAULT(SHARED) &
114!       Copy all threadprivate variables in temps_mod
115!$OMP COPYIN(annee_ref, day_ini, day_ref, start_time)
[2351]116
[2311]117  ! Initialize physical constants in physics:
118  CALL inifis(punjours,prad,pg,pr,pcpp)
[2351]119
[2343]120  CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep)
121
[2354]122  ! Initialize dimphy module (unless in 1D where it has already been done)
[3435]123!  IF (klon_glo>1) CALL Init_dimphy(klon_omp,nlayer)
[2351]124
[2343]125  ! Copy over "offline" settings
126  CALL init_phystokenc(offline,istphy)
127
[2656]128  ! Initialization for slab heat transport
129  type_ocean="force"
130  CALL getin_p('type_ocean',type_ocean)
131  slab_hdiff=.FALSE.
132  CALL getin_p('slab_hdiff',slab_hdiff)
133  slab_ekman=0
134  CALL getin_p('slab_ekman',slab_ekman)
135  IF ((type_ocean=='slab').AND.(slab_hdiff.OR.(slab_ekman.GT.0))) THEN
136     CALL ini_slab_transp_geom(ip1jm,ip1jmp1,unsairez,fext,unsaire,&
137                                  cu,cuvsurcv,cv,cvusurcu, &
138                                  aire,apoln,apols, &
[3435]139                                  aireu,airev,rlatvdyn,rad,omeg)
[2656]140  END IF
141
[2320]142  ! Initialize tracer names, numbers, etc. for physics
143  CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,&
144                         niadv,conv_flg,pbl_flg,solsym,&
145                         nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,&
146                         ok_isotopes,ok_iso_verif,ok_isotrac,&
147                         ok_init_iso,niso_possibles,tnat,&
148                         alpha_ideal,use_iso,iqiso,iso_num,&
149                         iso_indnum,zone_num,phase_num,&
150                         indnum_fn_num,index_trac,&
151                         niso,ntraceurs_zone,ntraciso)
152
[2351]153  ! Initializations for Reprobus
154  IF (type_trac == 'repr') THEN
155#ifdef REPROBUS
[3666]156    call Init_chem_rep_phys(klon_omp,nlayer)
157    call init_reprobus_para( &
158          nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, &
159          distrib_phys,communicator)
[2351]160#endif
161  ENDIF
[2372]162!$OMP END PARALLEL
[2225]163
[2372]164  IF (type_trac == 'inca') THEN
165#ifdef INCA
166     call init_const_lmdz( &
[2457]167          anneeref,dayref, iphysiq,day_step,nday,  &
[2609]168          nbsrf, is_oce,is_sic, is_ter,is_lic, calend, &
169          config_inca)
[2372]170     call init_inca_para( &
171          nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, &
[2457]172          distrib_phys,communicator)
[2372]173#endif
174  END IF
[3666]175  IF (type_trac == 'repr') THEN
176#ifdef REPROBUS
177    call init_reprobus_para( &
178          nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, &
179          distrib_phys,communicator)
180#endif
181  ENDIF
[2372]182
[2601]183!!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/)
184!$OMP PARALLEL DEFAULT(SHARED)
[2311]185  ! Additional initializations for aquaplanets
[1992]186  IF (iflag_phys>=100) THEN
[3579]187    CALL iniaqua(klon_omp,year_len,iflag_phys)
[1992]188  END IF
[2372]189
190  IF (type_trac == 'inca') THEN
191#ifdef INCA
192     CALL init_inca_dim(klon_omp,nbp_lev,nbp_lon,nbp_lat - 1, &
[2656]193          rlonudyn,rlatudyn,rlonvdyn,rlatvdyn)
[2372]194#endif
[3125]195    IF (type_trac == 'repr') THEN
196#ifdef REPROBUS
197       CALL Init_chem_rep_phys(klon_omp,nbp_lev)
198#endif
199    END IF
[2372]200  END IF
201
[2225]202!$OMP END PARALLEL
[1992]203
204END SUBROUTINE iniphysiq
[2347]205
206END MODULE iniphysiq_mod
Note: See TracBrowser for help on using the repository browser.