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

Last change on this file since 4284 was 4243, checked in by dcugnet, 22 months ago

Fix for r4241

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