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

Last change on this file since 5251 was 5251, checked in by abarral, 4 days ago

Wrap uses of cpp key INCA
Add INCA wrapper

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