source: palm/trunk/SOURCE/ls_forcing_mod.f90 @ 2101

Last change on this file since 2101 was 2101, checked in by suehring, 7 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 22.2 KB
Line 
1!> @file ls_forcing_mod.f90
2!------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2017 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: ls_forcing_mod.f90 2101 2017-01-05 16:42:31Z suehring $
27!
28! 2071 2016-11-17 11:22:14Z maronga
29! Small bugfix (Resler)
30!
31! 2037 2016-10-26 11:15:40Z knoop
32! Anelastic approximation implemented
33!
34! 2000 2016-08-20 18:09:15Z knoop
35! Forced header and separation lines into 80 columns
36!
37! 1850 2016-04-08 13:29:27Z maronga
38! Module renamed
39!
40!
41! 1682 2015-10-07 23:56:08Z knoop
42! Code annotations made doxygen readable
43!
44! 1602 2015-06-22 07:50:56Z heinze
45! PA0370 changed to PA0363
46!
47! 1382 2014-04-30 12:15:41Z boeske
48! Renamed variables which store large scale forcing tendencies
49! pt_lsa -> td_lsa_lpt, pt_subs -> td_sub_lpt,
50! q_lsa  -> td_lsa_q,   q_subs  -> td_sub_q,
51! high|lowpt_lsa -> high|low_td_lsa_lpt, ...
52!
53! 1365 2014-04-22 15:03:56Z boeske
54! Usage of large scale forcing for pt and q enabled:
55! Added new subroutine ls_advec for horizontal large scale advection and large
56! scale subsidence,
57! error message in init_ls_forcing specified,
58! variable t renamed nt
59!
60! 1353 2014-04-08 15:21:23Z heinze
61! REAL constants provided with KIND-attribute
62!
63! 1320 2014-03-20 08:40:49Z raasch
64! ONLY-attribute added to USE-statements,
65! kind-parameters added to all INTEGER and REAL declaration statements,
66! kinds are defined in new module kinds,
67! comment fields (!:) to be used for variable explanations added to
68! all variable declaration statements
69!
70! 1318 2014-03-17 13:35:16Z raasch
71! module interfaces removed
72!
73! 1299 2014-03-06 13:15:21Z heinze
74! Ensure a zero large scale vertical velocity at the surface
75! Bugfix: typo in case of boundary condition in if-clause
76!
77! 1276 2014-01-15 13:40:41Z heinze
78! Use LSF_DATA also in case of Dirichlet bottom boundary condition for scalars
79!
80! 1249 2013-11-06 10:45:47Z heinze
81! remove call of user module
82! reformatting
83!
84! 1241 2013-10-30 11:36:58Z heinze
85! Initial revision
86!
87! Description:
88! ------------
89!> Calculates large scale forcings (geostrophic wind and subsidence velocity) as
90!> well as surfaces fluxes dependent on time given in an external file (LSF_DATA).
91!> Code is based in parts on DALES and UCLA-LES.
92!--------------------------------------------------------------------------------!
93 MODULE ls_forcing_mod
94 
95
96    PRIVATE
97    PUBLIC init_ls_forcing, ls_forcing_surf, ls_forcing_vert, ls_advec
98    SAVE
99
100    INTERFACE ls_advec
101       MODULE PROCEDURE ls_advec
102       MODULE PROCEDURE ls_advec_ij
103    END INTERFACE ls_advec
104
105 CONTAINS
106
107!------------------------------------------------------------------------------!
108! Description:
109! ------------
110!> @todo Missing subroutine description.
111!------------------------------------------------------------------------------!
112    SUBROUTINE init_ls_forcing
113
114       USE arrays_3d,                                                          &
115           ONLY:  p_surf, pt_surf, q_surf, qsws_surf, shf_surf, td_lsa_lpt,    &
116                  td_lsa_q, td_sub_lpt, td_sub_q, time_surf, time_vert,        &
117                  heatflux_input_conversion, waterflux_input_conversion,       &
118                  ug_vert, vg_vert, wsubs_vert, zu
119
120       USE control_parameters,                                                 &
121           ONLY:  end_time, lsf_surf, lsf_vert, message_string, nlsf
122
123       USE indices,                                                            &
124           ONLY:  ngp_sums_ls, nzb, nz, nzt
125
126       USE kinds
127
128       USE statistics,                                                         &
129           ONLY:  sums_ls_l
130
131
132       IMPLICIT NONE
133
134       CHARACTER(100) ::  chmess      !<
135       CHARACTER(1)   ::  hash        !<
136
137       INTEGER(iwp) ::  ierrn         !<
138       INTEGER(iwp) ::  finput = 90   !<
139       INTEGER(iwp) ::  k             !<
140       INTEGER(iwp) ::  nt             !<
141
142       REAL(wp) ::  fac               !<
143       REAL(wp) ::  highheight        !<
144       REAL(wp) ::  highug_vert       !<
145       REAL(wp) ::  highvg_vert       !<
146       REAL(wp) ::  highwsubs_vert    !<
147       REAL(wp) ::  lowheight         !<
148       REAL(wp) ::  lowug_vert        !<
149       REAL(wp) ::  lowvg_vert        !<
150       REAL(wp) ::  lowwsubs_vert     !<
151       REAL(wp) ::  high_td_lsa_lpt   !<
152       REAL(wp) ::  low_td_lsa_lpt    !<
153       REAL(wp) ::  high_td_lsa_q     !<
154       REAL(wp) ::  low_td_lsa_q      !<
155       REAL(wp) ::  high_td_sub_lpt   !<
156       REAL(wp) ::  low_td_sub_lpt    !<
157       REAL(wp) ::  high_td_sub_q     !<
158       REAL(wp) ::  low_td_sub_q      !<
159       REAL(wp) ::  r_dummy           !<
160
161       ALLOCATE( p_surf(0:nlsf), pt_surf(0:nlsf), q_surf(0:nlsf),              &
162                 qsws_surf(0:nlsf), shf_surf(0:nlsf),                          &
163                 td_lsa_lpt(nzb:nzt+1,0:nlsf), td_lsa_q(nzb:nzt+1,0:nlsf),     &
164                 td_sub_lpt(nzb:nzt+1,0:nlsf), td_sub_q(nzb:nzt+1,0:nlsf),     &
165                 time_vert(0:nlsf), time_surf(0:nlsf),                         &
166                 ug_vert(nzb:nzt+1,0:nlsf), vg_vert(nzb:nzt+1,0:nlsf),         &
167                 wsubs_vert(nzb:nzt+1,0:nlsf) )
168
169       p_surf = 0.0_wp; pt_surf = 0.0_wp; q_surf = 0.0_wp; qsws_surf = 0.0_wp
170       shf_surf = 0.0_wp; time_vert = 0.0_wp; td_lsa_lpt = 0.0_wp
171       td_lsa_q = 0.0_wp; td_sub_lpt = 0.0_wp; td_sub_q = 0.0_wp
172       time_surf = 0.0_wp; ug_vert = 0.0_wp; vg_vert = 0.0_wp
173       wsubs_vert = 0.0_wp
174
175!
176!--    Array for storing large scale forcing and nudging tendencies at each
177!--    timestep for data output
178       ALLOCATE( sums_ls_l(nzb:nzt+1,0:7) )
179       sums_ls_l = 0.0_wp
180
181       ngp_sums_ls = (nz+2)*6
182
183       OPEN ( finput, FILE='LSF_DATA', STATUS='OLD', &
184              FORM='FORMATTED', IOSTAT=ierrn )
185
186       IF ( ierrn /= 0 )  THEN
187          message_string = 'file LSF_DATA does not exist'
188          CALL message( 'ls_forcing', 'PA0368', 1, 2, 0, 6, 0 )
189       ENDIF
190
191       ierrn = 0
192!
193!--    First three lines of LSF_DATA contain header
194       READ ( finput, FMT='(a100)', IOSTAT=ierrn ) chmess
195       READ ( finput, FMT='(a100)', IOSTAT=ierrn ) chmess
196       READ ( finput, FMT='(a100)', IOSTAT=ierrn ) chmess
197
198       IF ( ierrn /= 0 )  THEN
199          message_string = 'errors in file LSF_DATA'
200          CALL message( 'ls_forcing', 'PA0369', 1, 2, 0, 6, 0 )
201       ENDIF
202
203!
204!--    Surface values are read in
205       nt     = 0
206       ierrn = 0
207
208       DO WHILE ( time_surf(nt) < end_time )
209          nt = nt + 1
210          READ ( finput, *, IOSTAT = ierrn ) time_surf(nt), shf_surf(nt),      &
211                                             qsws_surf(nt), pt_surf(nt),       &
212                                             q_surf(nt), p_surf(nt)
213
214          IF ( ierrn < 0 )  THEN
215            WRITE ( message_string, * ) 'No time dependent surface variables ',&
216                              'in&LSF_DATA for end of run found'
217
218             CALL message( 'ls_forcing', 'PA0363', 1, 2, 0, 6, 0 )
219          ENDIF
220       ENDDO
221
222       IF ( time_surf(1) > end_time )  THEN
223          WRITE ( message_string, * ) 'No time dependent surface variables in ',&
224                                     '&LSF_DATA for end of run found - ',      &
225                                     'lsf_surf is set to FALSE'
226          CALL message( 'ls_forcing', 'PA0371', 0, 0, 0, 6, 0 )
227          lsf_surf = .FALSE.
228       ELSE
229          shf_surf  = shf_surf  * heatflux_input_conversion(nzb)
230          qsws_surf = qsws_surf * waterflux_input_conversion(nzb)
231       ENDIF
232
233!
234!--    Go to the end of the list with surface variables
235       DO WHILE ( ierrn == 0 )
236          READ ( finput, *, IOSTAT = ierrn ) r_dummy
237       ENDDO
238
239!
240!--    Profiles of ug, vg and w_subs are read in (large scale forcing)
241
242       nt = 0
243       DO WHILE ( time_vert(nt) < end_time )
244          nt = nt + 1
245          hash = "#"
246          ierrn = 1 ! not zero
247!
248!--       Search for the next line consisting of "# time",
249!--       from there onwards the profiles will be read
250          DO WHILE ( .NOT. ( hash == "#" .AND. ierrn == 0 ) ) 
251             READ ( finput, *, IOSTAT=ierrn ) hash, time_vert(nt)
252             IF ( ierrn < 0 )  THEN
253                WRITE( message_string, * ) 'No time dependent vertical profiles',&
254                                 ' in&LSF_DATA for end of run found'
255                CALL message( 'ls_forcing', 'PA0372', 1, 2, 0, 6, 0 )
256             ENDIF
257          ENDDO
258
259          IF ( nt == 1 .AND. time_vert(nt) > end_time ) EXIT
260
261          READ ( finput, *, IOSTAT=ierrn ) lowheight, lowug_vert, lowvg_vert,  &
262                                           lowwsubs_vert, low_td_lsa_lpt,      &
263                                           low_td_lsa_q, low_td_sub_lpt,       &
264                                           low_td_sub_q
265          IF ( ierrn /= 0 )  THEN
266             message_string = 'errors in file LSF_DATA'
267             CALL message( 'ls_forcing', 'PA0369', 1, 2, 0, 6, 0 )
268          ENDIF
269
270          READ ( finput, *, IOSTAT=ierrn ) highheight, highug_vert,            &
271                                           highvg_vert, highwsubs_vert,        &
272                                           high_td_lsa_lpt, high_td_lsa_q,     &
273                                           high_td_sub_lpt, high_td_sub_q
274     
275          IF ( ierrn /= 0 )  THEN
276             message_string = 'errors in file LSF_DATA'
277             CALL message( 'ls_forcing', 'PA0369', 1, 2, 0, 6, 0 )
278          ENDIF
279
280
281          DO  k = nzb, nzt+1
282             IF ( highheight < zu(k) )  THEN
283                lowheight      = highheight
284                lowug_vert     = highug_vert
285                lowvg_vert     = highvg_vert
286                lowwsubs_vert  = highwsubs_vert
287                low_td_lsa_lpt = high_td_lsa_lpt
288                low_td_lsa_q   = high_td_lsa_q
289                low_td_sub_lpt = high_td_sub_lpt
290                low_td_sub_q   = high_td_sub_q
291
292                ierrn = 0
293                READ ( finput, *, IOSTAT=ierrn ) highheight, highug_vert,      &
294                                                 highvg_vert, highwsubs_vert,  &
295                                                 high_td_lsa_lpt,              &
296                                                 high_td_lsa_q,                &
297                                                 high_td_sub_lpt, high_td_sub_q
298
299                IF ( ierrn /= 0 )  THEN
300                   WRITE( message_string, * ) 'zu(nzt+1) = ', zu(nzt+1), 'm ', &
301                        'is higher than the maximum height in LSF_DATA which ',&
302                        'is ', lowheight, 'm. Interpolation on PALM ',         &
303                        'grid is not possible.'
304                   CALL message( 'ls_forcing', 'PA0395', 1, 2, 0, 6, 0 )
305                ENDIF
306
307             ENDIF
308
309!
310!--          Interpolation of prescribed profiles in space
311             fac = (highheight-zu(k))/(highheight - lowheight)
312
313             ug_vert(k,nt)    = fac * lowug_vert                               &
314                                + ( 1.0_wp - fac ) * highug_vert
315             vg_vert(k,nt)    = fac * lowvg_vert                               &
316                                + ( 1.0_wp - fac ) * highvg_vert
317             wsubs_vert(k,nt) = fac * lowwsubs_vert                            &
318                                + ( 1.0_wp - fac ) * highwsubs_vert
319
320             td_lsa_lpt(k,nt) = fac * low_td_lsa_lpt                           &
321                                + ( 1.0_wp - fac ) * high_td_lsa_lpt
322             td_lsa_q(k,nt)   = fac * low_td_lsa_q                             &
323                                + ( 1.0_wp - fac ) * high_td_lsa_q
324             td_sub_lpt(k,nt) = fac * low_td_sub_lpt                           &
325                                + ( 1.0_wp - fac ) * high_td_sub_lpt
326             td_sub_q(k,nt)   = fac * low_td_sub_q                             &
327                                + ( 1.0_wp - fac ) * high_td_sub_q
328
329          ENDDO
330
331       ENDDO 
332
333!
334!--    Large scale vertical velocity has to be zero at the surface
335       wsubs_vert(nzb,:) = 0.0_wp
336 
337       IF ( time_vert(1) > end_time )  THEN
338          WRITE ( message_string, * ) 'Time dependent large scale profile ',   &
339                             'forcing from&LSF_DATA sets in after end of ' ,   &
340                             'simulation - lsf_vert is set to FALSE'
341          CALL message( 'ls_forcing', 'PA0373', 0, 0, 0, 6, 0 )
342          lsf_vert = .FALSE.
343       ENDIF
344
345       CLOSE( finput )
346
347
348    END SUBROUTINE init_ls_forcing 
349
350
351!------------------------------------------------------------------------------!
352! Description:
353! ------------
354!> @todo Missing subroutine description.
355!------------------------------------------------------------------------------!
356    SUBROUTINE ls_forcing_surf ( time )
357
358       USE arrays_3d,                                                          &
359           ONLY:  p_surf, pt_surf, q_surf, qsws, qsws_surf, shf, shf_surf,     &
360                  time_surf, time_vert, ug, ug_vert, vg, vg_vert
361
362       USE control_parameters,                                                 &
363           ONLY:  bc_q_b, ibc_pt_b, ibc_q_b, pt_surface, q_surface,            &
364                  surface_pressure
365
366       USE kinds
367
368       IMPLICIT NONE
369
370       INTEGER(iwp) ::  nt                     !<
371
372       REAL(wp)             :: fac            !<
373       REAL(wp), INTENT(in) :: time           !<
374
375!
376!--    Interpolation in time of LSF_DATA at the surface
377       nt = 1
378       DO WHILE ( time > time_surf(nt) )
379          nt = nt + 1
380       ENDDO
381       IF ( time /= time_surf(nt) )  THEN
382         nt = nt - 1
383       ENDIF
384
385       fac = ( time -time_surf(nt) ) / ( time_surf(nt+1) - time_surf(nt) )
386
387       IF ( ibc_pt_b == 0 )  THEN
388!
389!--       In case of Dirichlet boundary condition shf must not
390!--       be set - it is calculated via MOST in prandtl_fluxes
391          pt_surface = pt_surf(nt) + fac * ( pt_surf(nt+1) - pt_surf(nt) )
392
393       ELSEIF ( ibc_pt_b == 1 )  THEN
394!
395!--       In case of Neumann boundary condition pt_surface is needed for
396!--       calculation of reference density
397          shf        = shf_surf(nt) + fac * ( shf_surf(nt+1) - shf_surf(nt) )
398          pt_surface = pt_surf(nt) + fac * ( pt_surf(nt+1) - pt_surf(nt) )
399
400       ENDIF
401
402       IF ( ibc_q_b == 0 )  THEN
403!
404!--       In case of Dirichlet boundary condition qsws must not
405!--       be set - it is calculated via MOST in prandtl_fluxes
406          q_surface = q_surf(nt) + fac * ( q_surf(nt+1) - q_surf(nt) )
407
408       ELSEIF ( ibc_q_b == 1 )  THEN
409
410          qsws = qsws_surf(nt) + fac * ( qsws_surf(nt+1) - qsws_surf(nt) )
411
412       ENDIF
413
414       surface_pressure = p_surf(nt) + fac * ( p_surf(nt+1) - p_surf(nt) )
415
416    END SUBROUTINE ls_forcing_surf 
417
418
419!------------------------------------------------------------------------------!
420! Description:
421! ------------
422!> @todo Missing subroutine description.
423!------------------------------------------------------------------------------!
424    SUBROUTINE ls_forcing_vert ( time )
425
426       USE arrays_3d,                                                          &
427           ONLY:  time_vert, ug, ug_vert, vg, vg_vert, w_subs, wsubs_vert
428
429       USE control_parameters,                                                 &
430           ONLY:  large_scale_subsidence
431
432       USE kinds
433
434       IMPLICIT NONE
435
436       INTEGER(iwp) ::  nt                     !<
437
438       REAL(wp)             ::  fac           !<
439       REAL(wp), INTENT(in) ::  time          !<
440
441!
442!--    Interpolation in time of LSF_DATA for ug, vg and w_subs
443       nt = 1
444       DO WHILE ( time > time_vert(nt) )
445          nt = nt + 1
446       ENDDO
447       IF ( time /= time_vert(nt) )  THEN
448         nt = nt - 1
449       ENDIF
450
451       fac = ( time-time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) )
452
453       ug     = ug_vert(:,nt) + fac * ( ug_vert(:,nt+1) - ug_vert(:,nt) )
454       vg     = vg_vert(:,nt) + fac * ( vg_vert(:,nt+1) - vg_vert(:,nt) )
455
456       IF ( large_scale_subsidence )  THEN
457          w_subs = wsubs_vert(:,nt)                                            &
458                   + fac * ( wsubs_vert(:,nt+1) - wsubs_vert(:,nt) )
459       ENDIF
460
461    END SUBROUTINE ls_forcing_vert
462
463
464!------------------------------------------------------------------------------!
465! Description:
466! ------------
467!> Call for all grid points
468!------------------------------------------------------------------------------!
469    SUBROUTINE ls_advec ( time, prog_var )
470
471       USE arrays_3d,                                                          &
472           ONLY:  td_lsa_lpt, td_lsa_q, td_sub_lpt, td_sub_q, tend, time_vert       
473       
474       USE control_parameters,                                                 &
475           ONLY:  large_scale_subsidence, use_subsidence_tendencies
476       
477       USE indices
478       
479       USE kinds
480
481       IMPLICIT NONE
482
483       CHARACTER (LEN=*) ::  prog_var   !<
484
485       REAL(wp), INTENT(in)  :: time    !<
486       REAL(wp) :: fac                  !< 
487
488       INTEGER(iwp) ::  i               !<
489       INTEGER(iwp) ::  j               !<
490       INTEGER(iwp) ::  k               !<
491       INTEGER(iwp) ::  nt               !<
492
493!
494!--    Interpolation in time of LSF_DATA
495       nt = 1
496       DO WHILE ( time > time_vert(nt) )
497          nt = nt + 1
498       ENDDO
499       IF ( time /= time_vert(nt) )  THEN
500         nt = nt - 1
501       ENDIF
502
503       fac = ( time-time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) )
504
505!
506!--    Add horizontal large scale advection tendencies of pt and q
507       SELECT CASE ( prog_var )
508
509          CASE ( 'pt' )
510
511             DO  i = nxl, nxr
512                DO  j = nys, nyn
513                   DO  k = nzb_u_inner(j,i)+1, nzt
514                      tend(k,j,i) = tend(k,j,i) + td_lsa_lpt(k,nt) + fac *     &
515                                    ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) )
516                   ENDDO
517                ENDDO
518             ENDDO
519
520          CASE ( 'q' )
521
522             DO  i = nxl, nxr
523                DO  j = nys, nyn
524                   DO  k = nzb_u_inner(j,i)+1, nzt
525                      tend(k,j,i) = tend(k,j,i) + td_lsa_q(k,nt) + fac *       &
526                                    ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) )
527                   ENDDO
528                ENDDO
529             ENDDO
530
531       END SELECT
532
533!
534!--    Subsidence of pt and q with prescribed subsidence tendencies
535       IF ( large_scale_subsidence .AND. use_subsidence_tendencies )  THEN
536
537          SELECT CASE ( prog_var )
538
539             CASE ( 'pt' )
540
541                DO  i = nxl, nxr
542                   DO  j = nys, nyn
543                      DO  k = nzb_u_inner(j,i)+1, nzt
544                         tend(k,j,i) = tend(k,j,i) + td_sub_lpt(k,nt) + fac *  &
545                                       ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) )
546                      ENDDO
547                   ENDDO
548                ENDDO
549 
550             CASE ( 'q' )
551
552                DO  i = nxl, nxr
553                   DO  j = nys, nyn
554                      DO  k = nzb_u_inner(j,i)+1, nzt
555                         tend(k,j,i) = tend(k,j,i) + td_sub_q(k,nt) + fac *    &
556                                       ( td_sub_q(k,nt+1) - td_sub_q(k,nt) )
557                      ENDDO
558                   ENDDO
559                ENDDO
560
561          END SELECT
562
563       ENDIF
564
565    END SUBROUTINE ls_advec
566
567
568!------------------------------------------------------------------------------!
569! Description:
570! ------------
571!> Call for grid point i,j
572!------------------------------------------------------------------------------!
573    SUBROUTINE ls_advec_ij ( i, j, time, prog_var )
574
575       USE arrays_3d,                                                          &
576           ONLY:  td_lsa_lpt, td_lsa_q, td_sub_lpt, td_sub_q, tend, time_vert       
577       
578       USE control_parameters,                                                 &
579           ONLY:  large_scale_subsidence, use_subsidence_tendencies
580       
581       USE indices
582       
583       USE kinds
584
585       IMPLICIT NONE
586
587       CHARACTER (LEN=*) ::  prog_var   !<
588
589       REAL(wp), INTENT(in)  :: time    !<
590       REAL(wp) :: fac                  !<
591
592       INTEGER(iwp) ::  i               !<
593       INTEGER(iwp) ::  j               !<
594       INTEGER(iwp) ::  k               !<
595       INTEGER(iwp) ::  nt               !<
596
597!
598!--    Interpolation in time of LSF_DATA
599       nt = 1
600       DO WHILE ( time > time_vert(nt) )
601          nt = nt + 1
602       ENDDO
603       IF ( time /= time_vert(nt) )  THEN
604         nt = nt - 1
605       ENDIF
606
607       fac = ( time-time_vert(nt) ) / ( time_vert(nt+1)-time_vert(nt) )
608
609!
610!--    Add horizontal large scale advection tendencies of pt and q
611       SELECT CASE ( prog_var )
612
613          CASE ( 'pt' )
614
615             DO  k = nzb_u_inner(j,i)+1, nzt
616                tend(k,j,i) = tend(k,j,i) + td_lsa_lpt(k,nt)                   &
617                              + fac * ( td_lsa_lpt(k,nt+1) - td_lsa_lpt(k,nt) )
618             ENDDO
619
620          CASE ( 'q' )
621
622             DO  k = nzb_u_inner(j,i)+1, nzt
623                tend(k,j,i) = tend(k,j,i) + td_lsa_q(k,nt)                     &
624                              + fac * ( td_lsa_q(k,nt+1) - td_lsa_q(k,nt) )
625             ENDDO
626
627       END SELECT
628
629!
630!--    Subsidence of pt and q with prescribed profiles
631       IF ( large_scale_subsidence .AND. use_subsidence_tendencies )  THEN
632
633          SELECT CASE ( prog_var )
634
635             CASE ( 'pt' )
636
637                DO  k = nzb_u_inner(j,i)+1, nzt
638                   tend(k,j,i) = tend(k,j,i) + td_sub_lpt(k,nt) + fac *        &
639                                 ( td_sub_lpt(k,nt+1) - td_sub_lpt(k,nt) )
640                ENDDO
641 
642             CASE ( 'q' )
643
644                DO  k = nzb_u_inner(j,i)+1, nzt
645                   tend(k,j,i) = tend(k,j,i) + td_sub_q(k,nt) + fac *          &
646                                 ( td_sub_q(k,nt+1) - td_sub_q(k,nt) )
647                ENDDO
648
649          END SELECT
650
651       ENDIF
652
653    END SUBROUTINE ls_advec_ij
654
655
656 END MODULE ls_forcing_mod
Note: See TracBrowser for help on using the repository browser.