1 | |
---|
2 | ! $Id: iniphysiq.F90 2242 2015-03-24 08:08:43Z emillour $ |
---|
3 | |
---|
4 | |
---|
5 | SUBROUTINE iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, & |
---|
6 | rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & |
---|
7 | prad,pg,pr,pcpp,iflag_phys) |
---|
8 | USE dimphy, ONLY: klev ! number of atmospheric levels |
---|
9 | USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns |
---|
10 | ! (on full grid) |
---|
11 | USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid) |
---|
12 | klon_omp_begin, & ! start index of local omp subgrid |
---|
13 | klon_omp_end, & ! end index of local omp subgrid |
---|
14 | klon_mpi_begin ! start indes of columns (on local mpi grid) |
---|
15 | USE comgeomphy, ONLY: initcomgeomphy, & |
---|
16 | initcomgeomphy_vert, & |
---|
17 | initcomgeomphy_horiz,& |
---|
18 | airephy, & ! physics grid area (m2) |
---|
19 | cuphy, & ! cu coeff. (u_covariant = cu * u) |
---|
20 | cvphy, & ! cv coeff. (v_covariant = cv * v) |
---|
21 | rlond, & ! longitudes |
---|
22 | rlatd ! latitudes |
---|
23 | USE misc_mod, ONLY: debug |
---|
24 | USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,& |
---|
25 | niadv,conv_flg,pbl_flg,solsym |
---|
26 | USE control_mod, ONLY: dayref,anneeref,day_step,iphysiq,nday,& |
---|
27 | config_inca,raz_date,offline |
---|
28 | USE inifis_mod, ONLY: inifis |
---|
29 | USE infotrac_phy, ONLY: init_infotrac_phy |
---|
30 | USE phyaqua_mod, ONLY: iniaqua |
---|
31 | IMPLICIT NONE |
---|
32 | |
---|
33 | ! ======================================================================= |
---|
34 | ! Initialisation of the physical constants and some positional and |
---|
35 | ! geometrical arrays for the physics |
---|
36 | ! ======================================================================= |
---|
37 | |
---|
38 | ! include "YOMCST.h" |
---|
39 | include "dimensions.h" |
---|
40 | include "comvert.h" |
---|
41 | include "comconst.h" |
---|
42 | include "iniprint.h" |
---|
43 | include "temps.h" |
---|
44 | |
---|
45 | REAL, INTENT (IN) :: prad ! radius of the planet (m) |
---|
46 | REAL, INTENT (IN) :: pg ! gravitational acceleration (m/s2) |
---|
47 | REAL, INTENT (IN) :: pr ! ! reduced gas constant R/mu |
---|
48 | REAL, INTENT (IN) :: pcpp ! specific heat Cp |
---|
49 | REAL, INTENT (IN) :: punjours ! length (in s) of a standard day |
---|
50 | INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers |
---|
51 | INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes |
---|
52 | INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes |
---|
53 | REAL, INTENT (IN) :: rlatu(jj+1) ! latitudes of the physics grid |
---|
54 | REAL, INTENT (IN) :: rlatv(jj) ! latitude boundaries of the physics grid |
---|
55 | REAL, INTENT (IN) :: rlonv(ii+1) ! longitudes of the physics grid |
---|
56 | REAL, INTENT (IN) :: rlonu(ii+1) ! longitude boundaries of the physics grid |
---|
57 | REAL, INTENT (IN) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2) |
---|
58 | REAL, INTENT (IN) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) |
---|
59 | REAL, INTENT (IN) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) |
---|
60 | INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation |
---|
61 | REAL, INTENT (IN) :: ptimestep !physics time step (s) |
---|
62 | INTEGER, INTENT (IN) :: iflag_phys ! type of physics to be called |
---|
63 | |
---|
64 | INTEGER :: ibegin, iend, offset |
---|
65 | INTEGER :: i,j |
---|
66 | CHARACTER (LEN=20) :: modname = 'iniphysiq' |
---|
67 | CHARACTER (LEN=80) :: abort_message |
---|
68 | REAL :: total_area_phy, total_area_dyn |
---|
69 | |
---|
70 | |
---|
71 | ! global array, on full physics grid: |
---|
72 | REAL,ALLOCATABLE :: latfi(:) |
---|
73 | REAL,ALLOCATABLE :: lonfi(:) |
---|
74 | REAL,ALLOCATABLE :: cufi(:) |
---|
75 | REAL,ALLOCATABLE :: cvfi(:) |
---|
76 | REAL,ALLOCATABLE :: airefi(:) |
---|
77 | |
---|
78 | IF (nlayer/=klev) THEN |
---|
79 | WRITE (lunout, *) 'STOP in ', trim(modname) |
---|
80 | WRITE (lunout, *) 'Problem with dimensions :' |
---|
81 | WRITE (lunout, *) 'nlayer = ', nlayer |
---|
82 | WRITE (lunout, *) 'klev = ', klev |
---|
83 | abort_message = '' |
---|
84 | CALL abort_gcm(modname, abort_message, 1) |
---|
85 | END IF |
---|
86 | |
---|
87 | !call init_phys_lmdz(ii,jj+1,llm,1,(/(jj-1)*ii+2/)) |
---|
88 | |
---|
89 | ! Generate global arrays on full physics grid |
---|
90 | ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo)) |
---|
91 | ALLOCATE(airefi(klon_glo)) |
---|
92 | |
---|
93 | IF (klon_glo>1) THEN ! general case |
---|
94 | ! North pole |
---|
95 | latfi(1)=rlatu(1) |
---|
96 | lonfi(1)=0. |
---|
97 | cufi(1) = cu(1) |
---|
98 | cvfi(1) = cv(1) |
---|
99 | DO j=2,jj |
---|
100 | DO i=1,ii |
---|
101 | latfi((j-2)*ii+1+i)= rlatu(j) |
---|
102 | lonfi((j-2)*ii+1+i)= rlonv(i) |
---|
103 | cufi((j-2)*ii+1+i) = cu((j-1)*ii+1+i) |
---|
104 | cvfi((j-2)*ii+1+i) = cv((j-1)*ii+1+i) |
---|
105 | ENDDO |
---|
106 | ENDDO |
---|
107 | ! South pole |
---|
108 | latfi(klon_glo)= rlatu(jj+1) |
---|
109 | lonfi(klon_glo)= 0. |
---|
110 | cufi(klon_glo) = cu((ii+1)*jj+1) |
---|
111 | cvfi(klon_glo) = cv((ii+1)*jj-ii) |
---|
112 | |
---|
113 | ! build airefi(), mesh area on physics grid |
---|
114 | CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi) |
---|
115 | ! Poles are single points on physics grid |
---|
116 | airefi(1)=sum(aire(1:ii,1)) |
---|
117 | airefi(klon_glo)=sum(aire(1:ii,jj+1)) |
---|
118 | |
---|
119 | ! Sanity check: do total planet area match between physics and dynamics? |
---|
120 | total_area_dyn=sum(aire(1:ii,1:jj+1)) |
---|
121 | total_area_phy=sum(airefi(1:klon_glo)) |
---|
122 | IF (total_area_dyn/=total_area_phy) THEN |
---|
123 | WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!' |
---|
124 | WRITE (lunout, *) ' in the dynamics total_area_dyn=', total_area_dyn |
---|
125 | WRITE (lunout, *) ' but in the physics total_area_phy=', total_area_phy |
---|
126 | IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN |
---|
127 | ! stop here if the relative difference is more than 0.001% |
---|
128 | abort_message = 'planet total surface discrepancy' |
---|
129 | CALL abort_gcm(modname, abort_message, 1) |
---|
130 | ENDIF |
---|
131 | ENDIF |
---|
132 | ELSE ! klon_glo==1, running the 1D model |
---|
133 | ! just copy over input values |
---|
134 | latfi(1)=rlatu(1) |
---|
135 | lonfi(1)=rlonv(1) |
---|
136 | cufi(1)=cu(1) |
---|
137 | cvfi(1)=cv(1) |
---|
138 | airefi(1)=aire(1,1) |
---|
139 | ENDIF ! of IF (klon_glo>1) |
---|
140 | |
---|
141 | !$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/) |
---|
142 | ! Now generate local lon/lat/cu/cv/area arrays |
---|
143 | CALL initcomgeomphy(klon_omp) |
---|
144 | |
---|
145 | offset = klon_mpi_begin - 1 |
---|
146 | airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
147 | cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
148 | cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
149 | rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
150 | rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end) |
---|
151 | |
---|
152 | ! copy over global grid longitudes and latitudes |
---|
153 | CALL initcomgeomphy_horiz(iim,jjm,rlonu,rlonv,rlatu,rlatv) |
---|
154 | |
---|
155 | ! copy over preff , ap(), bp(), etc |
---|
156 | CALL initcomgeomphy_vert(nlayer,preff,ap,bp,presnivs,pseudoalt) |
---|
157 | |
---|
158 | ! ! suphel => initialize some physical constants (orbital parameters, |
---|
159 | ! ! geoid, gravity, thermodynamical constants, etc.) in the |
---|
160 | ! ! physics |
---|
161 | ! CALL suphel |
---|
162 | |
---|
163 | ! Initialize tracer names, numbers, etc. for physics |
---|
164 | CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,& |
---|
165 | niadv,conv_flg,pbl_flg,solsym) |
---|
166 | |
---|
167 | ! transfer some flags/infos from dynamics to physics |
---|
168 | call inifis(punjours,prad,pg,pr,pcpp,ptimestep,& |
---|
169 | day_step,iphysiq,dayref,anneeref,nday,& |
---|
170 | annee_ref,day_ini,day_end,& |
---|
171 | itau_phy,itaufin,& |
---|
172 | start_time,day_ref,jD_ref, & |
---|
173 | offline,raz_date,config_inca, & |
---|
174 | lunout,prt_level,debug) |
---|
175 | |
---|
176 | !!$OMP END PARALLEL |
---|
177 | |
---|
178 | ! Additional initializations for aquaplanets |
---|
179 | !!$OMP PARALLEL |
---|
180 | IF (iflag_phys>=100) THEN |
---|
181 | CALL iniaqua(klon_omp, rlatd, rlond, iflag_phys) |
---|
182 | END IF |
---|
183 | !$OMP END PARALLEL |
---|
184 | |
---|
185 | END SUBROUTINE iniphysiq |
---|