source: palm/trunk/SOURCE/init_advec.f90 @ 4380

Last change on this file since 4380 was 4360, checked in by suehring, 5 years ago

Bugfix in output of time-averaged plant-canopy quanities; Output of plant-canopy data only where tall canopy is defined; land-surface model: fix wrong location strings; tests: update urban test case; all source code files: copyright update

  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1!> @file init_advec.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
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-2020 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: init_advec.f90 4360 2020-01-07 11:25:50Z monakurppa $
27! Corrected "Former revisions" section
28!
29! 3655 2019-01-07 16:51:22Z knoop
30! Corrected "Former revisions" section
31!
32! Revision 1.1  1999/02/05 09:07:38  raasch
33! Initial revision
34!
35!
36! Description:
37! ------------
38!> Initialize constant coefficients and parameters for certain advection schemes.
39!------------------------------------------------------------------------------!
40 SUBROUTINE init_advec
41 
42
43    USE advection,                                                             &
44        ONLY:  aex, bex, dex, eex
45       
46    USE kinds
47   
48    USE control_parameters,                                                    &
49        ONLY:  scalar_advec
50
51    IMPLICIT NONE
52
53    INTEGER(iwp) ::  i          !<
54    INTEGER(iwp) ::  intervals  !<
55    INTEGER(iwp) ::  j          !<
56   
57    REAL(wp) :: delt   !<
58    REAL(wp) :: dn     !<
59    REAL(wp) :: dnneu  !<
60    REAL(wp) :: ex1    !<
61    REAL(wp) :: ex2    !<
62    REAL(wp) :: ex3    !<
63    REAL(wp) :: ex4    !<
64    REAL(wp) :: ex5    !<
65    REAL(wp) :: ex6    !<
66    REAL(wp) :: sterm  !<
67
68
69    IF ( scalar_advec == 'bc-scheme' )  THEN
70
71!
72!--    Compute exponential coefficients for the Bott-Chlond scheme
73       intervals = 1000
74       ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) )
75
76       delt  = 1.0_wp / REAL( intervals, KIND=wp )
77       sterm = delt * 0.5_wp
78
79       DO  i = 1, intervals
80
81          IF ( sterm > 0.5_wp )  THEN
82             dn = -5.0_wp
83          ELSE
84             dn = 5.0_wp
85          ENDIF
86
87          DO  j = 1, 15
88             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
89             ex2 = EXP( dn ) - EXP( -dn )
90             ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP(  0.5_wp * dn ) &
91                                                - 0.5_wp * EXP( -0.5_wp * dn )
92             ex4 = EXP( dn ) + EXP( -dn )
93             ex5 = dn * sterm + ex1 / ex2
94             ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 )
95             dnneu = dn - ex5 / ex6
96             dn  = dnneu
97          ENDDO
98
99          IF ( sterm < 0.5_wp )  dn = MAX(  2.95E-2_wp, dn )
100          IF ( sterm > 0.5_wp )  dn = MIN( -2.95E-2_wp, dn )
101          ex1 = EXP( -dn )
102          ex2 = EXP( dn ) - ex1
103          aex(i) = -ex1 / ex2
104          bex(i) = 1.0_wp / ex2
105          dex(i) = dn
106          eex(i) = EXP( dex(i) * 0.5_wp )
107          sterm = sterm + delt
108
109       ENDDO
110
111    ENDIF
112
113 END SUBROUTINE init_advec
Note: See TracBrowser for help on using the repository browser.