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

Last change on this file since 4124 was 4124, checked in by dcugnet, 2 years ago

Remove solsym, ok_isotopes (=niso>0), ok_isotrac (=nzone>0)

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