source: LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/iniphysiq.F90 @ 2331

Last change on this file since 2331 was 2331, checked in by lguez, 9 years ago

Fixed regression from revision 2315: comvert.h was replaced by
vertical_layers_mod in test_disvert, but variables ap, bp, preff of
vertical_layers_mod were not defined. So, in main program ce0l, moved
call to test_disvert after call to Init_Phys_lmdz, and inserted in
between them calls to infotrac_init and iniphysiq (required). Had then
to remove the call to infotrac_init in etat0dyn_netcdf. In main
program ce0l, had to remove the call to InitComgeomphy? since this is
done in iniphysiq.

In main program ce0l: no need to use indice_sol_mod; removed
preprocessor tests on CPP_PHYS in ce0l.

  • 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.9 KB
Line 
1
2! $Id: iniphysiq.F90 2331 2015-07-17 12:17:02Z lguez $
3
4
5SUBROUTINE iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,           &
6                     rlatu,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 vertical_layers_mod, ONLY : init_vertical_layers
16  USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,&
17                      niadv,conv_flg,pbl_flg,solsym,&
18                      nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,&
19                      ok_isotopes,ok_iso_verif,ok_isotrac,&
20                      ok_init_iso,niso_possibles,tnat,&
21                      alpha_ideal,use_iso,iqiso,iso_num,&
22                      iso_indnum,zone_num,phase_num,&
23                      indnum_fn_num,index_trac,&
24                      niso,ntraceurs_zone,ntraciso
25  USE comgeomphy, ONLY: initcomgeomphy, &
26                        airephy, & ! physics grid area (m2)
27                        cuphy, & ! cu coeff. (u_covariant = cu * u)
28                        cvphy, & ! cv coeff. (v_covariant = cv * v)
29                        rlond, & ! longitudes
30                        rlatd ! latitudes
31  USE inifis_mod, ONLY: inifis
32  USE infotrac_phy, ONLY: init_infotrac_phy
33  USE phyaqua_mod, ONLY: iniaqua
34  IMPLICIT NONE
35
36  ! =======================================================================
37  ! Initialisation of the physical constants and some positional and
38  ! geometrical arrays for the physics
39  ! =======================================================================
40
41  include "dimensions.h"
42  include "comvert.h"
43  include "iniprint.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) :: rlonv(ii+1) ! longitudes of the physics grid
55  REAL, INTENT (IN) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2)
56  REAL, INTENT (IN) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u)
57  REAL, INTENT (IN) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v)
58  INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation
59  REAL, INTENT (IN) :: ptimestep !physics time step (s)
60  INTEGER, INTENT (IN) :: iflag_phys ! type of physics to be called
61
62  INTEGER :: ibegin, iend, offset
63  INTEGER :: i,j
64  CHARACTER (LEN=20) :: modname = 'iniphysiq'
65  CHARACTER (LEN=80) :: abort_message
66  REAL :: total_area_phy, total_area_dyn
67
68
69  ! global array, on full physics grid:
70  REAL,ALLOCATABLE :: latfi(:)
71  REAL,ALLOCATABLE :: lonfi(:)
72  REAL,ALLOCATABLE :: cufi(:)
73  REAL,ALLOCATABLE :: cvfi(:)
74  REAL,ALLOCATABLE :: airefi(:)
75
76  IF (nlayer/=klev) THEN
77    WRITE (lunout, *) 'nlayer     = ', nlayer
78    WRITE (lunout, *) 'klev   = ', klev
79    CALL abort_gcm(modname, 'Problem with dimensions', 1)
80  END IF
81
82  !call init_phys_lmdz(ii,jj+1,llm,1,(/(jj-1)*ii+2/))
83 
84  ! Generate global arrays on full physics grid
85  ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
86  ALLOCATE(airefi(klon_glo))
87
88  IF (klon_glo>1) THEN ! general case
89    ! North pole
90    latfi(1)=rlatu(1)
91    lonfi(1)=0.
92    cufi(1) = cu(1)
93    cvfi(1) = cv(1)
94    DO j=2,jj
95      DO i=1,ii
96        latfi((j-2)*ii+1+i)= rlatu(j)
97        lonfi((j-2)*ii+1+i)= rlonv(i)
98        cufi((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)
99        cvfi((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)
100      ENDDO
101    ENDDO
102    ! South pole
103    latfi(klon_glo)= rlatu(jj+1)
104    lonfi(klon_glo)= 0.
105    cufi(klon_glo) = cu((ii+1)*jj+1)
106    cvfi(klon_glo) = cv((ii+1)*jj-ii)
107
108    ! build airefi(), mesh area on physics grid
109    CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
110    ! Poles are single points on physics grid
111    airefi(1)=sum(aire(1:ii,1))
112    airefi(klon_glo)=sum(aire(1:ii,jj+1))
113
114    ! Sanity check: do total planet area match between physics and dynamics?
115    total_area_dyn=sum(aire(1:ii,1:jj+1))
116    total_area_phy=sum(airefi(1:klon_glo))
117    IF (total_area_dyn/=total_area_phy) THEN
118      WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
119      WRITE (lunout, *) '     in the dynamics total_area_dyn=', total_area_dyn
120      WRITE (lunout, *) '  but in the physics total_area_phy=', total_area_phy
121      IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN
122        ! stop here if the relative difference is more than 0.001%
123        abort_message = 'planet total surface discrepancy'
124        CALL abort_gcm(modname, abort_message, 1)
125      ENDIF
126    ENDIF
127  ELSE ! klon_glo==1, running the 1D model
128    ! just copy over input values
129    latfi(1)=rlatu(1)
130    lonfi(1)=rlonv(1)
131    cufi(1)=cu(1)
132    cvfi(1)=cv(1)
133    airefi(1)=aire(1,1)
134  ENDIF ! of IF (klon_glo>1)
135
136!$OMP PARALLEL
137  ! Initialize physical constants in physics:
138  CALL inifis(punjours,prad,pg,pr,pcpp)
139 
140  ! copy over preff , ap(), bp(), etc
141  CALL init_vertical_layers(nlayer,preff,scaleheight, &
142                            ap,bp,presnivs,pseudoalt)
143
144  ! Initialize tracer names, numbers, etc. for physics
145  CALL init_infotrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,&
146                         niadv,conv_flg,pbl_flg,solsym,&
147                         nqfils,nqdesc,nqdesc_tot,iqfils,iqpere,&
148                         ok_isotopes,ok_iso_verif,ok_isotrac,&
149                         ok_init_iso,niso_possibles,tnat,&
150                         alpha_ideal,use_iso,iqiso,iso_num,&
151                         iso_indnum,zone_num,phase_num,&
152                         indnum_fn_num,index_trac,&
153                         niso,ntraceurs_zone,ntraciso)
154
155  ! Now generate local lon/lat/cu/cv/area arrays
156  CALL initcomgeomphy
157
158  offset = klon_mpi_begin - 1
159  airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
160  cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
161  cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
162  rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
163  rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
164
165  ! Additional initializations for aquaplanets
166  IF (iflag_phys>=100) THEN
167    CALL iniaqua(klon_omp, rlatd, rlond, iflag_phys)
168  END IF
169!$OMP END PARALLEL
170
171END SUBROUTINE iniphysiq
Note: See TracBrowser for help on using the repository browser.