1 | ! |
---|
2 | ! $Id: iniphysiq_mod.F90 3629 2020-02-10 08:54:26Z fhourdin $ |
---|
3 | ! |
---|
4 | MODULE iniphysiq_mod |
---|
5 | |
---|
6 | CONTAINS |
---|
7 | |
---|
8 | SUBROUTINE iniphysiq(ii,jj,nlayer, & |
---|
9 | nbp, communicator, & |
---|
10 | punjours, pdayref,ptimestep, & |
---|
11 | rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & |
---|
12 | prad,pg,pr,pcpp,iflag_phys) |
---|
13 | USE dimphy, ONLY: init_dimphy |
---|
14 | USE comvert_mod, ONLY: preff, ap, bp, aps, bps, presnivs, & |
---|
15 | scaleheight, pseudoalt |
---|
16 | USE inigeomphy_mod, ONLY: inigeomphy |
---|
17 | USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat,nbp_lev,klon_glo ! number of atmospheric columns (on full grid) |
---|
18 | USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) |
---|
19 | USE vertical_layers_mod, ONLY : init_vertical_layers |
---|
20 | USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,& |
---|
21 | niadv,conv_flg,pbl_flg,solsym,& |
---|
22 | nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,& |
---|
23 | ok_isotopes,ok_iso_verif,ok_isotrac,& |
---|
24 | ok_init_iso,niso_possibles,tnat,& |
---|
25 | alpha_ideal,use_iso,iqiso,iso_num,& |
---|
26 | iso_indnum,zone_num,phase_num,& |
---|
27 | indnum_fn_num,index_trac,& |
---|
28 | niso,ntraceurs_zone,ntraciso |
---|
29 | #ifdef REPROBUS |
---|
30 | USE CHEM_REP, ONLY : Init_chem_rep_phys |
---|
31 | #endif |
---|
32 | USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline, iphysiq, config_inca |
---|
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 |
---|
36 | USE infotrac_phy, ONLY: init_infotrac_phy |
---|
37 | USE phystokenc_mod, ONLY: init_phystokenc |
---|
38 | USE phyaqua_mod, ONLY: iniaqua |
---|
39 | #ifdef INCA |
---|
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 | #endif |
---|
47 | IMPLICIT NONE |
---|
48 | |
---|
49 | ! ======================================================================= |
---|
50 | ! Initialisation of the physical constants and some positional and |
---|
51 | ! geometrical arrays for the physics |
---|
52 | ! ======================================================================= |
---|
53 | |
---|
54 | include "dimensions.h" |
---|
55 | include "iniprint.h" |
---|
56 | include "tracstoke.h" |
---|
57 | |
---|
58 | REAL, INTENT (IN) :: prad ! radius of the planet (m) |
---|
59 | REAL, INTENT (IN) :: pg ! gravitational acceleration (m/s2) |
---|
60 | REAL, INTENT (IN) :: pr ! ! reduced gas constant R/mu |
---|
61 | REAL, INTENT (IN) :: pcpp ! specific heat Cp |
---|
62 | REAL, INTENT (IN) :: punjours ! length (in s) of a standard day |
---|
63 | INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers |
---|
64 | INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes |
---|
65 | INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes |
---|
66 | INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process |
---|
67 | INTEGER, INTENT(IN) :: communicator ! MPI communicator |
---|
68 | REAL, INTENT (IN) :: rlatu(jj+1) ! latitudes of the physics grid |
---|
69 | REAL, INTENT (IN) :: rlatv(jj) ! latitude boundaries of the physics grid |
---|
70 | REAL, INTENT (IN) :: rlonv(ii+1) ! longitudes of the physics grid |
---|
71 | REAL, INTENT (IN) :: rlonu(ii+1) ! longitude boundaries of the physics grid |
---|
72 | REAL, INTENT (IN) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2) |
---|
73 | REAL, INTENT (IN) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) |
---|
74 | REAL, INTENT (IN) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) |
---|
75 | INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation |
---|
76 | REAL, INTENT (IN) :: ptimestep !physics time step (s) |
---|
77 | INTEGER, INTENT (IN) :: iflag_phys ! type of physics to be called |
---|
78 | |
---|
79 | INTEGER :: ibegin, iend, offset |
---|
80 | INTEGER :: i,j,k |
---|
81 | CHARACTER (LEN=20) :: modname = 'iniphysiq' |
---|
82 | CHARACTER (LEN=80) :: abort_message |
---|
83 | |
---|
84 | |
---|
85 | #ifndef CPP_PARA |
---|
86 | INTEGER,PARAMETER :: mpi_rank=0 |
---|
87 | INTEGER, PARAMETER :: mpi_size = 1 |
---|
88 | INTEGER :: distrib_phys(mpi_rank:mpi_rank)=(jjm-1)*iim+2 |
---|
89 | #endif |
---|
90 | |
---|
91 | ! --> initialize physics distribution, global fields and geometry |
---|
92 | ! (i.e. things in phy_common or dynphy_lonlat) |
---|
93 | CALL inigeomphy(ii,jj,nlayer, & |
---|
94 | nbp, communicator, & |
---|
95 | rlatu,rlatv, & |
---|
96 | rlonu,rlonv, & |
---|
97 | aire,cu,cv) |
---|
98 | |
---|
99 | ! --> now initialize things specific to the phylmd physics package |
---|
100 | |
---|
101 | !!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) |
---|
102 | !$OMP PARALLEL DEFAULT(SHARED) & |
---|
103 | ! Copy all threadprivate variables in temps_mod |
---|
104 | !$OMP COPYIN(annee_ref, day_ini, day_ref, start_time) |
---|
105 | |
---|
106 | ! copy over preff , ap(), bp(), etc |
---|
107 | CALL init_vertical_layers(nlayer,preff,scaleheight, & |
---|
108 | ap,bp,aps,bps,presnivs,pseudoalt) |
---|
109 | |
---|
110 | ! Initialize physical constants in physics: |
---|
111 | CALL inifis(punjours,prad,pg,pr,pcpp) |
---|
112 | |
---|
113 | CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep) |
---|
114 | |
---|
115 | ! Initialize dimphy module (unless in 1D where it has already been done) |
---|
116 | IF (klon_glo>1) CALL Init_dimphy(klon_omp,nlayer) |
---|
117 | |
---|
118 | ! Copy over "offline" settings |
---|
119 | CALL init_phystokenc(offline,istphy) |
---|
120 | |
---|
121 | ! Initialize tracer names, numbers, etc. for physics |
---|
122 | CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,& |
---|
123 | niadv,conv_flg,pbl_flg,solsym,& |
---|
124 | nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,& |
---|
125 | ok_isotopes,ok_iso_verif,ok_isotrac,& |
---|
126 | ok_init_iso,niso_possibles,tnat,& |
---|
127 | alpha_ideal,use_iso,iqiso,iso_num,& |
---|
128 | iso_indnum,zone_num,phase_num,& |
---|
129 | indnum_fn_num,index_trac,& |
---|
130 | niso,ntraceurs_zone,ntraciso) |
---|
131 | |
---|
132 | ! Initializations for Reprobus |
---|
133 | IF (type_trac == 'repr') THEN |
---|
134 | #ifdef REPROBUS |
---|
135 | CALL Init_chem_rep_phys(klon_omp,nlayer) |
---|
136 | #endif |
---|
137 | ENDIF |
---|
138 | !$OMP END PARALLEL |
---|
139 | |
---|
140 | IF (type_trac == 'inca') THEN |
---|
141 | #ifdef INCA |
---|
142 | call init_const_lmdz( & |
---|
143 | anneeref,dayref, iphysiq,day_step,nday, & |
---|
144 | nbsrf, is_oce,is_sic, is_ter,is_lic, calend, & |
---|
145 | config_inca) |
---|
146 | call init_inca_para( & |
---|
147 | nbp_lon,nbp_lat,nbp_lev,klon_glo,mpi_size, & |
---|
148 | distrib_phys,communicator) |
---|
149 | #endif |
---|
150 | END IF |
---|
151 | |
---|
152 | !!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) |
---|
153 | !$OMP PARALLEL DEFAULT(SHARED) |
---|
154 | ! Additional initializations for aquaplanets |
---|
155 | IF (iflag_phys>=100) THEN |
---|
156 | CALL iniaqua(klon_omp,iflag_phys) |
---|
157 | END IF |
---|
158 | |
---|
159 | IF (type_trac == 'inca') THEN |
---|
160 | #ifdef INCA |
---|
161 | CALL init_inca_dim(klon_omp,nbp_lev,nbp_lon,nbp_lat - 1, & |
---|
162 | rlonu,rlatu,rlonv,rlatv) |
---|
163 | #endif |
---|
164 | END IF |
---|
165 | |
---|
166 | !$OMP END PARALLEL |
---|
167 | |
---|
168 | END SUBROUTINE iniphysiq |
---|
169 | |
---|
170 | END MODULE iniphysiq_mod |
---|