source: LMDZ6/trunk/libf/dyn3dmem/iniacademic_loc.F90 @ 3982

Last change on this file since 3982 was 3976, checked in by fhourdin, 3 years ago

Options supplementaires pour iniacademic

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