source: LMDZ6/branches/LMDZ-tracers/libf/dyn3d/iniacademic.F90 @ 4350

Last change on this file since 4350 was 3852, checked in by dcugnet, 3 years ago

Extension of the tracers management.

The tracers files can be:

1) "traceur.def": old format, with:

  • the number of tracers on the first line
  • one line for each tracer: <tracer name> <hadv> <vadv> [<parent name>]

2) "tracer.def": new format with one section each model component.
3) "tracer_<name>.def": new format with a single section.

The formats 2 and 3 reading is driven by the "type_trac" key, which can be a

coma-separated list of components.

  • Format 2: read the sections from the "tracer.def" file.
  • format 3: read one section each "tracer_<section name>.def" file.
  • the first line of a section is "&<section name>
  • the other lines start with a tracer name followed by <key>=<val> pairs.
  • the "default" tracer name is reserved ; the other tracers of the section inherit its <key>=<val>, except for the keys that are redefined locally.

This format helps keeping the tracers files compact, thanks to the "default"
special tracer and the three levels of factorization:

  • on the tracers names: a tracer name can be a coma-separated list of tracers => all the tracers of the list have the same <key>=<val> properties
  • on the parents names: the value of the "parent" property can be a coma-separated list of tracers => only possible for geographic tagging tracers
  • on the phases: the property "phases" is [g](l][s] (gas/liquid/solid)

Read information is stored in the vector "tracers(:)", of derived type "tra".

"isotopes_params.def" is a similar file, with one section each isotopes family.
It contains a database of isotopes properties ; if there are second generation
tracers (isotopes), the corresponding sections are read.

Read information is stored in the vector "isotopes(:)", of derived type "iso".

The "getKey" function helps to get the values of the parameters stored in
"tracers" or "isotopes".

  • 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.2 KB
Line 
1!
2! $Id: iniacademic.F90 3852 2021-02-22 16:28:31Z 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, tracers, iTraPha, tnat, alpha_ideal, tra
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   ! Constantes pour polar vortex
70
71  real zz,ran1
72  integer idum
73
74  REAL zdtvr
75
76  TYPE(tra), POINTER :: tr
77 
78  character(len=*),parameter :: modname="iniacademic"
79  character(len=80) :: abort_message
80
81
82  ! Sanity check: verify that options selected by user are not incompatible
83  if ((iflag_phys==1).and. .not. read_start) then
84    write(lunout,*) trim(modname)," error: if read_start is set to ", &
85    " false then iflag_phys should not be 1"
86    write(lunout,*) "You most likely want an aquaplanet initialisation", &
87    " (iflag_phys >= 100)"
88    call abort_gcm(modname,"incompatible iflag_phys==1 and read_start==.false.",1)
89  endif
90 
91  !-----------------------------------------------------------------------
92  ! 1. Initializations for Earth-like case
93  ! --------------------------------------
94  !
95  ! initialize planet radius, rotation rate,...
96  call conf_planete
97
98  time_0=0.
99  day_ref=1
100!  annee_ref=0
101
102  im         = iim
103  jm         = jjm
104  day_ini    = 1
105  dtvr    = daysec/REAL(day_step)
106  zdtvr=dtvr
107  etot0      = 0.
108  ptot0      = 0.
109  ztot0      = 0.
110  stot0      = 0.
111  ang0       = 0.
112
113  if (llm == 1) then
114     ! specific initializations for the shallow water case
115     kappa=1
116  endif
117
118  CALL iniconst
119  CALL inigeom
120  CALL inifilr
121
122  if (llm == 1) then
123     ! initialize fields for the shallow water case, if required
124     if (.not.read_start) then
125        phis(:)=0.
126        q(:,:,:)=0
127        CALL sw_case_williamson91_6(vcov,ucov,teta,masse,ps)
128     endif
129  endif
130
131  academic_case: if (iflag_phys >= 2) then
132     ! initializations
133
134     ! 1. local parameters
135     ! by convention, winter is in the southern hemisphere
136     ! Geostrophic wind or no wind?
137     ok_geost=.TRUE.
138     CALL getin('ok_geost',ok_geost)
139     ! Constants for Newtonian relaxation and friction
140     k_f=1.                !friction
141     CALL getin('k_j',k_f)
142     k_f=1./(daysec*k_f)
143     k_c_s=4.  !cooling surface
144     CALL getin('k_c_s',k_c_s)
145     k_c_s=1./(daysec*k_c_s)
146     k_c_a=40. !cooling free atm
147     CALL getin('k_c_a',k_c_a)
148     k_c_a=1./(daysec*k_c_a)
149     ! Constants for Teta equilibrium profile
150     teta0=315.     ! mean Teta (S.H. 315K)
151     CALL getin('teta0',teta0)
152     ttp=200.       ! Tropopause temperature (S.H. 200K)
153     CALL getin('ttp',ttp)
154     eps=0.         ! Deviation to N-S symmetry(~0-20K)
155     CALL getin('eps',eps)
156     delt_y=60.     ! Merid Temp. Gradient (S.H. 60K)
157     CALL getin('delt_y',delt_y)
158     delt_z=10.     ! Vertical Gradient (S.H. 10K)
159     CALL getin('delt_z',delt_z)
160     ! Polar vortex
161     ok_pv=.false.
162     CALL getin('ok_pv',ok_pv)
163     phi_pv=-50.            ! Latitude of edge of vortex
164     CALL getin('phi_pv',phi_pv)
165     phi_pv=phi_pv*pi/180.
166     dphi_pv=5.             ! Width of the edge
167     CALL getin('dphi_pv',dphi_pv)
168     dphi_pv=dphi_pv*pi/180.
169     gam_pv=4.              ! -dT/dz vortex (in K/km)
170     CALL getin('gam_pv',gam_pv)
171
172     ! 2. Initialize fields towards which to relax
173     ! Friction
174     knewt_g=k_c_a
175     DO l=1,llm
176        zsig=presnivs(l)/preff
177        knewt_t(l)=(k_c_s-k_c_a)*MAX(0.,(zsig-0.7)/0.3)
178        kfrict(l)=k_f*MAX(0.,(zsig-0.7)/0.3)
179     ENDDO
180     DO j=1,jjp1
181        clat4((j-1)*iip1+1:j*iip1)=cos(rlatu(j))**4
182     ENDDO
183
184     ! Potential temperature
185     DO l=1,llm
186        zsig=presnivs(l)/preff
187        tetastrat=ttp*zsig**(-kappa)
188        tetapv=tetastrat
189        IF ((ok_pv).AND.(zsig.LT.0.1)) THEN
190           tetapv=tetastrat*(zsig*10.)**(kappa*cpp*gam_pv/1000./g)
191        ENDIF
192        DO j=1,jjp1
193           ! Troposphere
194           ddsin=sin(rlatu(j))
195           tetajl(j,l)=teta0-delt_y*ddsin*ddsin+eps*ddsin &
196                -delt_z*(1.-ddsin*ddsin)*log(zsig)
197           if (planet_type=="giant") then
198             tetajl(j,l)=teta0+(delt_y*                   &
199                ((sin(rlatu(j)*3.14159*eps+0.0001))**2)   &
200                / ((rlatu(j)*3.14159*eps+0.0001)**2))     &
201                -delt_z*log(zsig)
202           endif
203           ! Profil stratospherique isotherme (+vortex)
204           w_pv=(1.-tanh((rlatu(j)-phi_pv)/dphi_pv))/2.
205           tetastrat=tetastrat*(1.-w_pv)+tetapv*w_pv             
206           tetajl(j,l)=MAX(tetajl(j,l),tetastrat) 
207        ENDDO
208     ENDDO
209
210     !          CALL writefield('theta_eq',tetajl)
211
212     do l=1,llm
213        do j=1,jjp1
214           do i=1,iip1
215              ij=(j-1)*iip1+i
216              tetarappel(ij,l)=tetajl(j,l)
217           enddo
218        enddo
219     enddo
220
221     ! 3. Initialize fields (if necessary)
222     IF (.NOT. read_start) THEN
223        ! surface pressure
224        if (iflag_phys>2) then
225           ! specific value for CMIP5 aqua/terra planets
226           ! "Specify the initial dry mass to be equivalent to
227           !  a global mean surface pressure (101325 minus 245) Pa."
228           ps(:)=101080. 
229        else
230           ! use reference surface pressure
231           ps(:)=preff
232        endif
233       
234        ! ground geopotential
235        phis(:)=0.
236
237        CALL pression ( ip1jmp1, ap, bp, ps, p       )
238        if (pressure_exner) then
239          CALL exner_hyb( ip1jmp1, ps, p, pks, pk)
240        else
241          call exner_milieu(ip1jmp1,ps,p,pks,pk)
242        endif
243        CALL massdair(p,masse)
244
245        ! bulk initialization of temperature
246        teta(:,:)=tetarappel(:,:)
247
248        ! geopotential
249        CALL geopot(ip1jmp1,teta,pk,pks,phis,phi)
250
251        ! winds
252        if (ok_geost) then
253           call ugeostr(phi,ucov)
254        else
255           ucov(:,:)=0.
256        endif
257        vcov(:,:)=0.
258
259        ! bulk initialization of tracers
260        if (planet_type=="earth") then
261           ! Earth: first two tracers will be water
262           do i=1,nqtot
263              if (i == 1) q(:,:,i)=1.e-10
264              if (i == 2) q(:,:,i)=1.e-15
265              if (i.gt.2) q(:,:,i)=0.
266
267              ! CRisi: init des isotopes
268              ! distill de Rayleigh très simplifiée
269              tr => tracers(i)
270              if (niso > 0 .AND. tr%iso_num > 0) then
271                 if(tr%iso_zon == 0) q(:,:,i) =         &
272      &            q(:,:,tr%iprnt)*tnat(tr%iso_num)     &
273      &          *(q(:,:,tr%iprnt)/30.e-3)              &
274      &           **(alpha_ideal(tr%iso_num)-1)
275                 if (tr%iso_zon == 1) q(:,:,i) =        &
276                   q(:,:,iTraPha(tr%iso_num,tr%iso_pha))
277              endif !if (niso > 0 .AND. tr%iso_num > 0)
278
279           enddo
280        else
281           q(:,:,:)=0
282        endif ! of if (planet_type=="earth")
283
284        call check_isotopes_seq(q,1,ip1jmp1,'iniacademic_loc')
285
286        ! add random perturbation to temperature
287        idum  = -1
288        zz = ran1(idum)
289        idum  = 0
290        do l=1,llm
291           do ij=iip2,ip1jm
292              teta(ij,l)=teta(ij,l)*(1.+0.005*ran1(idum))
293           enddo
294        enddo
295
296        ! maintain periodicity in longitude
297        do l=1,llm
298           do ij=1,ip1jmp1,iip1
299              teta(ij+iim,l)=teta(ij,l)
300           enddo
301        enddo
302
303     ENDIF ! of IF (.NOT. read_start)
304  endif academic_case
305
306END SUBROUTINE iniacademic
Note: See TracBrowser for help on using the repository browser.