source: LMDZ6/trunk/libf/dyn3d/iniacademic.F90 @ 3981

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