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

Last change on this file since 4379 was 4379, checked in by fhourdin, 18 months ago

preff : un pas en avant, un pas en arriere

  • 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.6 KB
Line 
1!
2! $Id: iniacademic.F90 4379 2023-01-10 19:14:07Z fhourdin $
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, iqIsoPha, tracers, getKey, isoName
8  USE control_mod, ONLY: day_step,planet_type
9  use exner_hyb_m, only: exner_hyb
10  use exner_milieu_m, only: exner_milieu
11#ifdef CPP_IOIPSL
12  USE IOIPSL, ONLY: getin
13#else
14  ! if not using IOIPSL, we still need to use (a local version of) getin
15  USE ioipsl_getincom, ONLY: getin
16#endif
17  USE Write_Field
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, pa, 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  USE readTracFiles_mod, ONLY: addPhase
24
25  !   Author:    Frederic Hourdin      original: 15/01/93
26  ! The forcing defined here is from Held and Suarez, 1994, Bulletin
27  ! of the American Meteorological Society, 75, 1825.
28
29  IMPLICIT NONE
30
31  !   Declararations:
32  !   ---------------
33
34  include "dimensions.h"
35  include "paramet.h"
36  include "comgeom.h"
37  include "academic.h"
38  include "iniprint.h"
39
40  !   Arguments:
41  !   ----------
42
43  REAL,INTENT(OUT) :: time_0
44
45  !   fields
46  REAL,INTENT(OUT) :: vcov(ip1jm,llm) ! meridional covariant wind
47  REAL,INTENT(OUT) :: ucov(ip1jmp1,llm) ! zonal covariant wind
48  REAL,INTENT(OUT) :: teta(ip1jmp1,llm) ! potential temperature (K)
49  REAL,INTENT(OUT) :: q(ip1jmp1,llm,nqtot) ! advected tracers (.../kg_of_air)
50  REAL,INTENT(OUT) :: ps(ip1jmp1) ! surface pressure (Pa)
51  REAL,INTENT(OUT) :: masse(ip1jmp1,llm) ! air mass in grid cell (kg)
52  REAL,INTENT(OUT) :: phis(ip1jmp1) ! surface geopotential
53
54  !   Local:
55  !   ------
56
57  REAL p (ip1jmp1,llmp1  )               ! pression aux interfac.des couches
58  REAL pks(ip1jmp1)                      ! exner au  sol
59  REAL pk(ip1jmp1,llm)                   ! exner au milieu des couches
60  REAL phi(ip1jmp1,llm)                  ! geopotentiel
61  REAL ddsin,zsig,tetapv,w_pv  ! variables auxiliaires
62  real tetastrat ! potential temperature in the stratosphere, in K
63  real tetajl(jjp1,llm)
64  INTEGER i,j,l,lsup,ij, iq, iName, iPhase, iqParent
65
66  REAL teta0,ttp,delt_y,delt_z,eps ! Constantes pour profil de T
67  REAL k_f,k_c_a,k_c_s         ! Constantes de rappel
68  LOGICAL ok_geost             ! Initialisation vent geost. ou nul
69  LOGICAL ok_pv                ! Polar Vortex
70  REAL phi_pv,dphi_pv,gam_pv,tetanoise   ! Constantes pour polar vortex
71
72  real zz,ran1
73  integer idum
74
75  REAL zdtvr, tnat, alpha_ideal
76 
77  character(len=*),parameter :: modname="iniacademic"
78  character(len=80) :: abort_message
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     ps(:)=preff
123
124     ! ground geopotential
125     phis(:)=0.
126     CALL pression ( ip1jmp1, ap, bp, ps, p       )
127
128     if (pressure_exner) then
129       CALL exner_hyb( ip1jmp1, ps, p, pks, pk)
130     else
131       call exner_milieu(ip1jmp1,ps,p,pks,pk)
132     endif
133     CALL massdair(p,masse)
134  ENDIF
135
136  if (llm == 1) then
137     ! initialize fields for the shallow water case, if required
138     if (.not.read_start) then
139        phis(:)=0.
140        q(:,:,:)=0
141        CALL sw_case_williamson91_6(vcov,ucov,teta,masse,ps)
142     endif
143  endif
144
145  academic_case: if (iflag_phys >= 2) then
146     ! initializations
147
148     ! 1. local parameters
149     ! by convention, winter is in the southern hemisphere
150     ! Geostrophic wind or no wind?
151     ok_geost=.TRUE.
152     CALL getin('ok_geost',ok_geost)
153     ! Constants for Newtonian relaxation and friction
154     k_f=1.                !friction
155     CALL getin('k_j',k_f)
156     k_f=1./(daysec*k_f)
157     k_c_s=4.  !cooling surface
158     CALL getin('k_c_s',k_c_s)
159     k_c_s=1./(daysec*k_c_s)
160     k_c_a=40. !cooling free atm
161     CALL getin('k_c_a',k_c_a)
162     k_c_a=1./(daysec*k_c_a)
163     ! Constants for Teta equilibrium profile
164     teta0=315.     ! mean Teta (S.H. 315K)
165     CALL getin('teta0',teta0)
166     ttp=200.       ! Tropopause temperature (S.H. 200K)
167     CALL getin('ttp',ttp)
168     eps=0.         ! Deviation to N-S symmetry(~0-20K)
169     CALL getin('eps',eps)
170     delt_y=60.     ! Merid Temp. Gradient (S.H. 60K)
171     CALL getin('delt_y',delt_y)
172     delt_z=10.     ! Vertical Gradient (S.H. 10K)
173     CALL getin('delt_z',delt_z)
174     ! Polar vortex
175     ok_pv=.false.
176     CALL getin('ok_pv',ok_pv)
177     phi_pv=-50.            ! Latitude of edge of vortex
178     CALL getin('phi_pv',phi_pv)
179     phi_pv=phi_pv*pi/180.
180     dphi_pv=5.             ! Width of the edge
181     CALL getin('dphi_pv',dphi_pv)
182     dphi_pv=dphi_pv*pi/180.
183     gam_pv=4.              ! -dT/dz vortex (in K/km)
184     CALL getin('gam_pv',gam_pv)
185     tetanoise=0.005
186     CALL getin('tetanoise',tetanoise)
187
188     ! 2. Initialize fields towards which to relax
189     ! Friction
190     knewt_g=k_c_a
191     DO l=1,llm
192        zsig=presnivs(l)/preff
193        knewt_t(l)=(k_c_s-k_c_a)*MAX(0.,(zsig-0.7)/0.3)
194        kfrict(l)=k_f*MAX(0.,(zsig-0.7)/0.3)
195     ENDDO
196     DO j=1,jjp1
197        clat4((j-1)*iip1+1:j*iip1)=cos(rlatu(j))**4
198     ENDDO
199
200     ! Potential temperature
201     DO l=1,llm
202        zsig=presnivs(l)/preff
203        tetastrat=ttp*zsig**(-kappa)
204        tetapv=tetastrat
205        IF ((ok_pv).AND.(zsig.LT.0.1)) THEN
206           tetapv=tetastrat*(zsig*10.)**(kappa*cpp*gam_pv/1000./g)
207        ENDIF
208        DO j=1,jjp1
209           ! Troposphere
210           ddsin=sin(rlatu(j))
211           tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin &
212                -delt_z*(1.-ddsin*ddsin)*log(zsig)
213           if (planet_type=="giant") then
214             tetajl(j,l)=teta0+(delt_y*                   &
215                ((sin(rlatu(j)*3.14159*eps+0.0001))**2)   &
216                / ((rlatu(j)*3.14159*eps+0.0001)**2))     &
217                -delt_z*log(zsig)
218           endif
219           ! Profil stratospherique isotherme (+vortex)
220           w_pv=(1.-tanh((rlatu(j)-phi_pv)/dphi_pv))/2.
221           tetastrat=tetastrat*(1.-w_pv)+tetapv*w_pv             
222           tetajl(j,l)=MAX(tetajl(j,l),tetastrat) 
223        ENDDO
224     ENDDO
225
226     !          CALL writefield('theta_eq',tetajl)
227
228     do l=1,llm
229        do j=1,jjp1
230           do i=1,iip1
231              ij=(j-1)*iip1+i
232              tetarappel(ij,l)=tetajl(j,l)
233           enddo
234        enddo
235     enddo
236
237     ! 3. Initialize fields (if necessary)
238     IF (.NOT. read_start) THEN
239        ! bulk initialization of temperature
240        IF (iflag_phys>10000) THEN
241        ! Particular case to impose a constant temperature T0=0.01*iflag_physx
242           teta(:,:)= 0.01*iflag_phys/(pk(:,:)/cpp)
243        ELSE
244           teta(:,:)=tetarappel(:,:)
245        ENDIF
246        ! geopotential
247        CALL geopot(ip1jmp1,teta,pk,pks,phis,phi)
248
249        DO l=1,llm
250          print*,'presnivs,play,l',presnivs(l),(pk(1,l)/cpp)**(1./kappa)*preff
251         !pks(ij) = (cpp/preff) * ps(ij)
252         !pk(ij,1) = .5*pks(ij)
253         ! pk = cpp * (p/preff)^kappa
254        ENDDO
255
256        ! winds
257        if (ok_geost) then
258           call ugeostr(phi,ucov)
259        else
260           ucov(:,:)=0.
261        endif
262        vcov(:,:)=0.
263
264        ! bulk initialization of tracers
265        if (planet_type=="earth") then
266           ! Earth: first two tracers will be water
267           do iq=1,nqtot
268              q(:,:,iq)=0.
269              IF(tracers(iq)%name == addPhase('H2O', 'g')) q(:,:,iq)=1.e-10
270              IF(tracers(iq)%name == addPhase('H2O', 'l')) q(:,:,iq)=1.e-15
271
272              ! CRisi: init des isotopes
273              ! distill de Rayleigh très simplifiée
274              iName    = tracers(iq)%iso_iName
275              if (niso <= 0 .OR. iName <= 0) CYCLE
276              iPhase   = tracers(iq)%iso_iPhase
277              iqParent = tracers(iq)%iqParent
278              IF(tracers(iq)%iso_iZone == 0) THEN
279                 IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
280                    CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
281                 q(:,:,iq) = q(:,:,iqParent)*tnat*(q(:,:,iqParent)/30.e-3)**(alpha_ideal-1.)
282              ELSE
283                 q(:,:,iq) = q(:,:,iqIsoPha(iName,iPhase))
284              END IF
285           enddo
286        else
287           q(:,:,:)=0
288        endif ! of if (planet_type=="earth")
289
290        call check_isotopes_seq(q,1,ip1jmp1,'iniacademic_loc')
291
292        ! add random perturbation to temperature
293        idum  = -1
294        zz = ran1(idum)
295        idum  = 0
296        do l=1,llm
297           do ij=iip2,ip1jm
298              teta(ij,l)=teta(ij,l)*(1.+tetanoise*ran1(idum))
299           enddo
300        enddo
301
302        ! maintain periodicity in longitude
303        do l=1,llm
304           do ij=1,ip1jmp1,iip1
305              teta(ij+iim,l)=teta(ij,l)
306           enddo
307        enddo
308
309     ENDIF ! of IF (.NOT. read_start)
310  endif academic_case
311
312END SUBROUTINE iniacademic
Note: See TracBrowser for help on using the repository browser.