source: LMDZ6/branches/LMDZ-tracers/libf/dyn3dmem/iniacademic_loc.F90 @ 3891

Last change on this file since 3891 was 3891, checked in by dcugnet, 3 years ago
  • Bugs corrections:
    • sequential gcm fixed
    • parallel gcm compilation fixed ; to be tested
  • Some generic operations moved from infotrac to readTracFile
  • Fixed algebrical reduction routine, used in the isotopes parameters file.
  • Additional component "comp" in the tracers descriptor derived type "tra",

specifying the model component name(s) (cf. tracers sections) it belongs.

  • isotopes class selection tool fixed.
  • 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: 10.4 KB
Line 
1!
2! $Id: iniacademic.F90 1625 2012-05-09 13:14:48Z lguez $
3!
4SUBROUTINE iniacademic_loc(vcov,ucov,teta,q,masse,ps,phis,time_0)
5
6  USE filtreg_mod, ONLY: inifilr
7  use exner_hyb_m, only: exner_hyb
8  use exner_milieu_m, only: exner_milieu
9  USE infotrac, ONLY: nqtot, niso, tracers, iTraPha, tnat, alpha_ideal, tra
10  USE control_mod, ONLY: day_step,planet_type
11  USE parallel_lmdz, ONLY: ijb_u, ije_u, ijb_v, ije_v
12#ifdef CPP_IOIPSL
13  USE IOIPSL, ONLY: getin
14#else
15  ! if not using IOIPSL, we still need to use (a local version of) getin
16  USE ioipsl_getincom, ONLY: getin
17#endif
18  USE Write_Field
19  USE comconst_mod, ONLY: cpp, kappa, g, daysec, dtvr, pi, im, jm
20  USE logic_mod, ONLY: iflag_phys, read_start
21  USE comvert_mod, ONLY: ap, bp, preff, presnivs, pressure_exner
22  USE temps_mod, ONLY: annee_ref, day_ini, day_ref
23  USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
24
25
26  !   Author:    Frederic Hourdin      original: 15/01/93
27  ! The forcing defined here is from Held and Suarez, 1994, Bulletin
28  ! of the American Meteorological Society, 75, 1825.
29
30  IMPLICIT NONE
31
32  !   Declararations:
33  !   ---------------
34
35  include "dimensions.h"
36  include "paramet.h"
37  include "comgeom.h"
38  include "academic.h"
39  include "iniprint.h"
40
41  !   Arguments:
42  !   ----------
43
44  REAL,INTENT(OUT) :: time_0
45
46  !   fields
47  REAL,INTENT(OUT) :: vcov(ijb_v:ije_v,llm) ! meridional covariant wind
48  REAL,INTENT(OUT) :: ucov(ijb_u:ije_u,llm) ! zonal covariant wind
49  REAL,INTENT(OUT) :: teta(ijb_u:ije_u,llm) ! potential temperature (K)
50  REAL,INTENT(OUT) :: q(ijb_u:ije_u,llm,nqtot) ! advected tracers (.../kg_of_air)
51  REAL,INTENT(OUT) :: ps(ijb_u:ije_u) ! surface pressure (Pa)
52  REAL,INTENT(OUT) :: masse(ijb_u:ije_u,llm) ! air mass in grid cell (kg)
53  REAL,INTENT(OUT) :: phis(ijb_u:ije_u) ! surface geopotential
54
55  !   Local:
56  !   ------
57
58  REAL,ALLOCATABLE :: vcov_glo(:,:),ucov_glo(:,:),teta_glo(:,:)
59  REAL,ALLOCATABLE :: q_glo(:,:),masse_glo(:,:),ps_glo(:)
60  REAL,ALLOCATABLE :: phis_glo(:)
61  REAL p (ip1jmp1,llmp1  )               ! pression aux interfac.des couches
62  REAL pks(ip1jmp1)                      ! exner au  sol
63  REAL pk(ip1jmp1,llm)                   ! exner au milieu des couches
64  REAL phi(ip1jmp1,llm)                  ! geopotentiel
65  REAL ddsin,zsig,tetapv,w_pv  ! variables auxiliaires
66  real tetastrat ! potential temperature in the stratosphere, in K
67  real tetajl(jjp1,llm)
68  INTEGER i,j,l,lsup,ij
69
70  REAL teta0,ttp,delt_y,delt_z,eps ! Constantes pour profil de T
71  REAL k_f,k_c_a,k_c_s         ! Constantes de rappel
72  LOGICAL ok_geost             ! Initialisation vent geost. ou nul
73  LOGICAL ok_pv                ! Polar Vortex
74  REAL phi_pv,dphi_pv,gam_pv   ! Constantes pour polar vortex
75
76  real zz,ran1
77  integer idum
78
79  REAL zdtvr
80
81  TYPE(tra), POINTER :: tr
82
83  character(len=*),parameter :: modname="iniacademic"
84  character(len=80) :: abort_message
85
86  ! Sanity check: verify that options selected by user are not incompatible
87  if ((iflag_phys==1).and. .not. read_start) then
88    write(lunout,*) trim(modname)," error: if read_start is set to ", &
89    " false then iflag_phys should not be 1"
90    write(lunout,*) "You most likely want an aquaplanet initialisation", &
91    " (iflag_phys >= 100)"
92    call abort_gcm(modname,"incompatible iflag_phys==1 and read_start==.false.",1)
93  endif
94 
95  !-----------------------------------------------------------------------
96  ! 1. Initializations for Earth-like case
97  ! --------------------------------------
98  !
99  ! initialize planet radius, rotation rate,...
100  call conf_planete
101
102  time_0=0.
103  day_ref=1
104  ! annee_ref=0
105
106  im         = iim
107  jm         = jjm
108  day_ini    = 1
109  dtvr    = daysec/REAL(day_step)
110  zdtvr=dtvr
111  etot0      = 0.
112  ptot0      = 0.
113  ztot0      = 0.
114  stot0      = 0.
115  ang0       = 0.     
116
117  if (llm == 1) then
118     ! specific initializations for the shallow water case
119     kappa=1
120  endif
121
122  CALL iniconst
123  CALL inigeom
124  CALL inifilr
125
126  if (llm == 1) then
127     ! initialize fields for the shallow water case, if required
128     if (.not.read_start) then
129        phis(ijb_u:ije_u)=0.
130        q(ijb_u:ije_u,1:llm,1:nqtot)=0
131        CALL sw_case_williamson91_6_loc(vcov,ucov,teta,masse,ps)
132     endif
133  endif
134
135  academic_case: if (iflag_phys >= 2) then
136     ! initializations
137
138     ! 1. local parameters
139     ! by convention, winter is in the southern hemisphere
140     ! Geostrophic wind or no wind?
141     ok_geost=.TRUE.
142     CALL getin('ok_geost',ok_geost)
143     ! Constants for Newtonian relaxation and friction
144     k_f=1.                !friction
145     CALL getin('k_j',k_f)
146     k_f=1./(daysec*k_f)
147     k_c_s=4.  !cooling surface
148     CALL getin('k_c_s',k_c_s)
149     k_c_s=1./(daysec*k_c_s)
150     k_c_a=40. !cooling free atm
151     CALL getin('k_c_a',k_c_a)
152     k_c_a=1./(daysec*k_c_a)
153     ! Constants for Teta equilibrium profile
154     teta0=315.     ! mean Teta (S.H. 315K)
155     CALL getin('teta0',teta0)
156     ttp=200.       ! Tropopause temperature (S.H. 200K)
157     CALL getin('ttp',ttp)
158     eps=0.         ! Deviation to N-S symmetry(~0-20K)
159     CALL getin('eps',eps)
160     delt_y=60.     ! Merid Temp. Gradient (S.H. 60K)
161     CALL getin('delt_y',delt_y)
162     delt_z=10.     ! Vertical Gradient (S.H. 10K)
163     CALL getin('delt_z',delt_z)
164     ! Polar vortex
165     ok_pv=.false.
166     CALL getin('ok_pv',ok_pv)
167     phi_pv=-50.            ! Latitude of edge of vortex
168     CALL getin('phi_pv',phi_pv)
169     phi_pv=phi_pv*pi/180.
170     dphi_pv=5.             ! Width of the edge
171     CALL getin('dphi_pv',dphi_pv)
172     dphi_pv=dphi_pv*pi/180.
173     gam_pv=4.              ! -dT/dz vortex (in K/km)
174     CALL getin('gam_pv',gam_pv)
175
176     ! 2. Initialize fields towards which to relax
177     ! Friction
178     knewt_g=k_c_a
179     DO l=1,llm
180        zsig=presnivs(l)/preff
181        knewt_t(l)=(k_c_s-k_c_a)*MAX(0.,(zsig-0.7)/0.3)
182        kfrict(l)=k_f*MAX(0.,(zsig-0.7)/0.3)
183     ENDDO
184     DO j=1,jjp1
185        clat4((j-1)*iip1+1:j*iip1)=cos(rlatu(j))**4
186     ENDDO
187
188     ! Potential temperature
189     DO l=1,llm
190        zsig=presnivs(l)/preff
191        tetastrat=ttp*zsig**(-kappa)
192        tetapv=tetastrat
193        IF ((ok_pv).AND.(zsig.LT.0.1)) THEN
194           tetapv=tetastrat*(zsig*10.)**(kappa*cpp*gam_pv/1000./g)
195        ENDIF
196        DO j=1,jjp1
197           ! Troposphere
198           ddsin=sin(rlatu(j))
199           tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin &
200                -delt_z*(1.-ddsin*ddsin)*log(zsig)
201           if (planet_type=="giant") then
202             tetajl(j,l)=teta0+(delt_y*                   &
203                ((sin(rlatu(j)*3.14159*eps+0.0001))**2)   &
204                / ((rlatu(j)*3.14159*eps+0.0001)**2))     &
205                -delt_z*log(zsig)
206           endif
207           ! Profil stratospherique isotherme (+vortex)
208           w_pv=(1.-tanh((rlatu(j)-phi_pv)/dphi_pv))/2.
209           tetastrat=tetastrat*(1.-w_pv)+tetapv*w_pv             
210           tetajl(j,l)=MAX(tetajl(j,l),tetastrat) 
211        ENDDO
212     ENDDO
213
214     !          CALL writefield('theta_eq',tetajl)
215
216     do l=1,llm
217        do j=1,jjp1
218           do i=1,iip1
219              ij=(j-1)*iip1+i
220              tetarappel(ij,l)=tetajl(j,l)
221           enddo
222        enddo
223     enddo
224
225     ! 3. Initialize fields (if necessary)
226     IF (.NOT. read_start) THEN
227       ! allocate global fields:
228!       allocate(vcov_glo(ip1jm,llm))
229       allocate(ucov_glo(ip1jmp1,llm))
230       allocate(teta_glo(ip1jmp1,llm))
231       allocate(ps_glo(ip1jmp1))
232       allocate(masse_glo(ip1jmp1,llm))
233       allocate(phis_glo(ip1jmp1))
234
235        ! surface pressure
236        if (iflag_phys>2) then
237           ! specific value for CMIP5 aqua/terra planets
238           ! "Specify the initial dry mass to be equivalent to
239           !  a global mean surface pressure (101325 minus 245) Pa."
240           ps_glo(:)=101080. 
241        else
242           ! use reference surface pressure
243           ps_glo(:)=preff
244        endif
245       
246        ! ground geopotential
247        phis_glo(:)=0.
248
249        CALL pression ( ip1jmp1, ap, bp, ps_glo, p       )
250        if (pressure_exner) then
251          CALL exner_hyb( ip1jmp1, ps_glo, p, pks, pk )
252        else
253          call exner_milieu(ip1jmp1,ps_glo,p,pks,pk)
254        endif
255        CALL massdair(p,masse_glo)
256
257        ! bulk initialization of temperature
258        teta_glo(:,:)=tetarappel(:,:)
259
260        ! geopotential
261        CALL geopot(ip1jmp1,teta_glo,pk,pks,phis_glo,phi)
262
263        ! winds
264        if (ok_geost) then
265           call ugeostr(phi,ucov_glo)
266        else
267           ucov_glo(:,:)=0.
268        endif
269        vcov(ijb_v:ije_v,1:llm)=0.
270
271        ! bulk initialization of tracers
272        if (planet_type=="earth") then
273           ! Earth: first two tracers will be water
274
275           do i=1,nqtot
276              if (i == 1) q(ijb_u:ije_u,:,i)=1.e-10
277              if (i == 2) q(ijb_u:ije_u,:,i)=1.e-15
278              if (i.gt.2) q(ijb_u:ije_u,:,i)=0.
279
280              ! CRisi: init des isotopes
281              ! distill de Rayleigh très simplifiée
282              tr => tracers(i)
283              IF(niso > 0 .AND. tr%iso_num > 0) THEN
284                IF(tr%iso_zon == 0) &
285                  q(ijb_u:ije_u,:,i) = q(ijb_u:ije_u,:,tr%iprnt)         *        tnat(tr%iso_num) &
286                                     *(q(ijb_u:ije_u,:,tr%iprnt)/30.e-3)**(alpha_ideal(tr%iso_num)-1)
287                IF(tr%iso_zon == 1) &
288                  q(ijb_u:ije_u,:,i) = q(ijb_u:ije_u,:,iTraPha(tr%iso_num,tr%iso_pha))
289              END IF
290
291           enddo
292        else
293           q(ijb_u:ije_u,:,:)=0
294        endif ! of if (planet_type=="earth")
295
296        call check_isotopes(q,ijb_u,ije_u,'iniacademic_loc')
297
298        ! add random perturbation to temperature
299        idum  = -1
300        zz = ran1(idum)
301        idum  = 0
302        do l=1,llm
303           do ij=iip2,ip1jm
304              teta_glo(ij,l)=teta_glo(ij,l)*(1.+0.005*ran1(idum))
305           enddo
306        enddo
307
308        ! maintain periodicity in longitude
309        do l=1,llm
310           do ij=1,ip1jmp1,iip1
311              teta_glo(ij+iim,l)=teta_glo(ij,l)
312           enddo
313        enddo
314
315        ! copy data from global array to local array:
316        teta(ijb_u:ije_u,:)=teta_glo(ijb_u:ije_u,:)
317        ucov(ijb_u:ije_u,:)=ucov_glo(ijb_u:ije_u,:)
318!        vcov(ijb_v:ije_v,:)=vcov_glo(ijb_v:ije_v,:)
319        masse(ijb_u:ije_u,:)=masse_glo(ijb_u:ije_u,:)
320        ps(ijb_u:ije_u)=ps_glo(ijb_u:ije_u)
321        phis(ijb_u:ije_u)=phis_glo(ijb_u:ije_u)
322
323        deallocate(teta_glo)
324        deallocate(ucov_glo)
325!        deallocate(vcov_glo)
326        deallocate(masse_glo)
327        deallocate(ps_glo)
328        deallocate(phis_glo)
329     ENDIF ! of IF (.NOT. read_start)
330  endif academic_case
331
332END SUBROUTINE iniacademic_loc
Note: See TracBrowser for help on using the repository browser.