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

Last change on this file since 3398 was 3125, checked in by acozic, 7 years ago

Update some routines to coupled LMDZ6 with 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.0 KB
Line 
1!
2! $Id: iniphysiq_mod.F90 3125 2017-12-14 07:55:21Z idelkadi $
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: 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
27#ifdef REPROBUS
28  USE CHEM_REP, ONLY : Init_chem_rep_phys
29#endif
30  USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq, config_inca
31  USE inifis_mod, ONLY: inifis
32  USE time_phylmdz_mod, ONLY: init_time
33  USE temps_mod, ONLY: annee_ref, day_ini, day_ref, start_time, calend
34  USE infotrac_phy, ONLY: init_infotrac_phy
35  USE phystokenc_mod, ONLY: init_phystokenc
36  USE phyaqua_mod, ONLY: iniaqua
37#ifdef INCA
38  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic
39#ifdef CPP_PARA
40  USE parallel_lmdz, ONLY : mpi_size, mpi_rank
41  USE bands, ONLY : distrib_phys
42#endif
43  USE mod_phys_lmdz_omp_data, ONLY: klon_omp
44#endif
45  USE ioipsl_getin_p_mod, ONLY: getin_p
46  USE slab_heat_transp_mod, ONLY: ini_slab_transp_geom
47#ifdef REPROBUS
48  USE CHEM_REP, ONLY : Init_chem_rep_phys
49#endif
50  IMPLICIT NONE
51
52  ! =======================================================================
53  ! Initialisation of the physical constants and some positional and
54  ! geometrical arrays for the physics
55  ! =======================================================================
56
57  include "dimensions.h"
58  include "paramet.h"
59  include "iniprint.h"
60  include "tracstoke.h"
61  include "comgeom.h"
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
69  INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes
70  INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes
71  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
72  INTEGER, INTENT(IN) :: communicator ! MPI communicator
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)
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
85  INTEGER :: i,j,k
86  CHARACTER (LEN=20) :: modname = 'iniphysiq'
87  CHARACTER (LEN=80) :: abort_message
88 
89  LOGICAL :: slab_hdiff
90  INTEGER :: slab_ekman
91  CHARACTER (LEN = 6) :: type_ocean
92
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
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, &
103               rlatudyn,rlatvdyn, &
104               rlonudyn,rlonvdyn, &
105               airedyn,cudyn,cvdyn)
106
107  ! --> now initialize things specific to the phylmd physics package
108 
109!!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/)
110!$OMP PARALLEL DEFAULT(SHARED) &
111!       Copy all threadprivate variables in temps_mod
112!$OMP COPYIN(annee_ref, day_ini, day_ref, start_time)
113
114  ! Initialize physical constants in physics:
115  CALL inifis(punjours,prad,pg,pr,pcpp)
116
117  CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep)
118
119  ! Initialize dimphy module (unless in 1D where it has already been done)
120  IF (klon_glo>1) CALL Init_dimphy(klon_omp,nlayer)
121
122  ! Copy over "offline" settings
123  CALL init_phystokenc(offline,istphy)
124
125  ! Initialization for slab heat transport
126  type_ocean="force"
127  CALL getin_p('type_ocean',type_ocean)
128  slab_hdiff=.FALSE.
129  CALL getin_p('slab_hdiff',slab_hdiff)
130  slab_ekman=0
131  CALL getin_p('slab_ekman',slab_ekman)
132  IF ((type_ocean=='slab').AND.(slab_hdiff.OR.(slab_ekman.GT.0))) THEN
133     CALL ini_slab_transp_geom(ip1jm,ip1jmp1,unsairez,fext,unsaire,&
134                                  cu,cuvsurcv,cv,cvusurcu, &
135                                  aire,apoln,apols, &
136                                  aireu,airev,rlatvdyn)
137  END IF
138
139  ! Initialize tracer names, numbers, etc. for physics
140  CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,&
141                         niadv,conv_flg,pbl_flg,solsym,&
142                         nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,&
143                         ok_isotopes,ok_iso_verif,ok_isotrac,&
144                         ok_init_iso,niso_possibles,tnat,&
145                         alpha_ideal,use_iso,iqiso,iso_num,&
146                         iso_indnum,zone_num,phase_num,&
147                         indnum_fn_num,index_trac,&
148                         niso,ntraceurs_zone,ntraciso)
149
150  ! Initializations for Reprobus
151  IF (type_trac == 'repr') THEN
152#ifdef REPROBUS
153    CALL Init_chem_rep_phys(klon_omp,nlayer)
154#endif
155  ENDIF
156!$OMP END PARALLEL
157
158  IF (type_trac == 'inca') THEN
159#ifdef INCA
160     call init_const_lmdz( &
161          anneeref,dayref, iphysiq,day_step,nday,  &
162          nbsrf, is_oce,is_sic, is_ter,is_lic, calend, &
163          config_inca)
164     call init_inca_para( &
165          nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, &
166          distrib_phys,communicator)
167#endif
168  END IF
169
170!!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/)
171!$OMP PARALLEL DEFAULT(SHARED)
172  ! Additional initializations for aquaplanets
173  IF (iflag_phys>=100) THEN
174    CALL iniaqua(klon_omp,iflag_phys)
175  END IF
176
177  IF (type_trac == 'inca') THEN
178#ifdef INCA
179     CALL init_inca_dim(klon_omp,nbp_lev,nbp_lon,nbp_lat - 1, &
180          rlonudyn,rlatudyn,rlonvdyn,rlatvdyn)
181#endif
182    IF (type_trac == 'repr') THEN
183#ifdef REPROBUS
184       CALL Init_chem_rep_phys(klon_omp,nbp_lev)
185#endif
186    END IF
187  END IF
188
189!$OMP END PARALLEL
190
191END SUBROUTINE iniphysiq
192
193END MODULE iniphysiq_mod
Note: See TracBrowser for help on using the repository browser.