source: LMDZ5/trunk/libf/dynlonlat_phylonlat/phydev/iniphysiq.F90 @ 2320

Last change on this file since 2320 was 2320, checked in by Ehouarn Millour, 9 years ago

Physics/dynamics separation: make an infotrac_phy module, which should be used from within the physics, and is initialized from infotrac (dynamics) via iniphysiq.
EM

  • 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
File size: 5.8 KB
Line 
1!
2! $Id: iniphysiq.F 1403 2010-07-01 09:02:53Z fairhead $
3!
4SUBROUTINE iniphysiq(iim,jjm,nlayer,punjours, pdayref,ptimestep,         &
5                     rlatu,rlonv,aire,cu,cv,                             &
6                     prad,pg,pr,pcpp,iflag_phys)
7  USE dimphy, ONLY: klev ! number of atmospheric levels
8  USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns
9                                        ! (on full grid)
10  USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid)
11                                klon_omp_begin, & ! start index of local omp subgrid
12                                klon_omp_end, & ! end index of local omp subgrid
13                                klon_mpi_begin ! start indes of columns (on local mpi grid)
14  USE comgeomphy, ONLY: initcomgeomphy, &
15                        airephy, & ! physics grid area (m2)
16                        cuphy, & ! cu coeff. (u_covariant = cu * u)
17                        cvphy, & ! cv coeff. (v_covariant = cv * v)
18                        rlond, & ! longitudes
19                        rlatd ! latitudes
20  USE infotrac, ONLY: nqtot, type_trac
21  USE infotrac_phy, ONLY: init_infotrac_phy
22!  USE comcstphy, ONLY: rradius, & ! planet radius (m)
23!                       rr, & ! recuced gas constant: R/molar mass of atm
24!                       rg, & ! gravity
25!                       rcpp  ! specific heat of the atmosphere
26  USE inifis_mod, ONLY: inifis
27  USE phyaqua_mod, ONLY: iniaqua
28  IMPLICIT NONE
29  !
30  !=======================================================================
31  !   Initialisation of the physical constants and some positional and
32  !   geometrical arrays for the physics
33  !=======================================================================
34 
35 
36  include "iniprint.h"
37
38  REAL,INTENT(IN) :: prad ! radius of the planet (m)
39  REAL,INTENT(IN) :: pg ! gravitational acceleration (m/s2)
40  REAL,INTENT(IN) :: pr ! ! reduced gas constant R/mu
41  REAL,INTENT(IN) :: pcpp ! specific heat Cp
42  REAL,INTENT(IN) :: punjours ! length (in s) of a standard day
43  INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers
44  INTEGER, INTENT (IN) :: iim ! number of atmospheric coulumns along longitudes
45  INTEGER, INTENT (IN) :: jjm  ! number of atompsheric columns along latitudes
46  REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
47  REAL, INTENT (IN) :: rlonv(iim+1) ! longitudes of the physics grid
48  REAL, INTENT (IN) :: aire(iim+1,jjm+1) ! area of the dynamics grid (m2)
49  REAL, INTENT (IN) :: cu((iim+1)*(jjm+1)) ! cu coeff. (u_covariant = cu * u)
50  REAL, INTENT (IN) :: cv((iim+1)*jjm) ! cv coeff. (v_covariant = cv * v)
51  INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation
52  REAL,INTENT(IN) :: ptimestep !physics time step (s)
53  INTEGER,INTENT(IN) :: iflag_phys ! type of physics to be called
54
55  INTEGER :: ibegin,iend,offset
56  INTEGER :: i,j
57  CHARACTER (LEN=20) :: modname='iniphysiq'
58  CHARACTER (LEN=80) :: abort_message
59  REAL :: total_area_phy, total_area_dyn
60
61
62  ! global array, on full physics grid:
63  REAL,ALLOCATABLE :: latfi(:)
64  REAL,ALLOCATABLE :: lonfi(:)
65  REAL,ALLOCATABLE :: cufi(:)
66  REAL,ALLOCATABLE :: cvfi(:)
67  REAL,ALLOCATABLE :: airefi(:)
68
69  IF (nlayer.NE.klev) THEN
70    WRITE(lunout,*) 'STOP in ',trim(modname)
71    WRITE(lunout,*) 'Problem with dimensions :'
72    WRITE(lunout,*) 'nlayer     = ',nlayer
73    WRITE(lunout,*) 'klev   = ',klev
74    abort_message = ''
75    CALL abort_gcm (modname,abort_message,1)
76  ENDIF
77
78  !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
79 
80  ! Generate global arrays on full physics grid
81  ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
82  ALLOCATE(airefi(klon_glo))
83
84    ! North pole
85    latfi(1)=rlatu(1)
86    lonfi(1)=0.
87    cufi(1) = cu(1)
88    cvfi(1) = cv(1)
89    DO j=2,jjm
90      DO i=1,iim
91        latfi((j-2)*iim+1+i)= rlatu(j)
92        lonfi((j-2)*iim+1+i)= rlonv(i)
93        cufi((j-2)*iim+1+i) = cu((j-1)*iim+1+i)
94        cvfi((j-2)*iim+1+i) = cv((j-1)*iim+1+i)
95      ENDDO
96    ENDDO
97    ! South pole
98    latfi(klon_glo)= rlatu(jjm+1)
99    lonfi(klon_glo)= 0.
100    cufi(klon_glo) = cu((iim+1)*jjm+1)
101    cvfi(klon_glo) = cv((iim+1)*jjm-iim)
102
103    ! build airefi(), mesh area on physics grid
104    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi)
105    ! Poles are single points on physics grid
106    airefi(1)=sum(aire(1:iim,1))
107    airefi(klon_glo)=sum(aire(1:iim,jjm+1))
108
109    ! Sanity check: do total planet area match between physics and dynamics?
110    total_area_dyn=sum(aire(1:iim,1:jjm+1))
111    total_area_phy=sum(airefi(1:klon_glo))
112    IF (total_area_dyn/=total_area_phy) THEN
113      WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
114      WRITE (lunout, *) '     in the dynamics total_area_dyn=', total_area_dyn
115      WRITE (lunout, *) '  but in the physics total_area_phy=', total_area_phy
116      IF (abs(total_area_dyn-total_area_phy)>0.00001*total_area_dyn) THEN
117        ! stop here if the relative difference is more than 0.001%
118        abort_message = 'planet total surface discrepancy'
119        CALL abort_gcm(modname, abort_message, 1)
120      ENDIF
121    ENDIF
122
123!$OMP PARALLEL
124  ! Initialize physical constants in physics:
125  CALL inifis(prad,pg,pr,pcpp)
126 
127  ! Initialize tracer names, numbers, etc. for physics
128  CALL init_infotrac_phy(nqtot,type_trac)
129
130  ! Now generate local lon/lat/cu/cv/area arrays
131  CALL initcomgeomphy
132
133  offset = klon_mpi_begin - 1
134  airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
135  cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
136  cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
137  rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
138  rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
139
140  ! Additional initializations for aquaplanets
141  IF (iflag_phys>=100) THEN
142    CALL iniaqua(klon_omp,rlatd,rlond,iflag_phys)
143  ENDIF
144!$OMP END PARALLEL
145
146END SUBROUTINE iniphysiq
Note: See TracBrowser for help on using the repository browser.