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

Last change on this file since 2076 was 2001, checked in by knoop, 8 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1!> @file init_advec.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-2016 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: init_advec.f90 2001 2016-08-20 18:41:22Z raasch $
27!
28! 2000 2016-08-20 18:09:15Z knoop
29! Forced header and separation lines into 80 columns
30!
31! 1682 2015-10-07 23:56:08Z knoop
32! Code annotations made doxygen readable
33!
34! 1353 2014-04-08 15:21:23Z heinze
35! REAL constants provided with KIND-attribute
36!
37! 1346 2014-03-27 13:18:20Z heinze
38! Bugfix: REAL constants provided with KIND-attribute especially in call of
39! intrinsic function like MAX, MIN, SIGN
40!
41! 1322 2014-03-20 16:38:49Z raasch
42! REAL constants defined as wp-kind
43!
44! 1320 2014-03-20 08:40:49Z raasch
45! ONLY-attribute added to USE-statements,
46! kind-parameters added to all INTEGER and REAL declaration statements,
47! kinds are defined in new module kinds,
48! revision history before 2012 removed,
49! comment fields (!:) to be used for variable explanations added to
50! all variable declaration statements
51!
52! 1036 2012-10-22 13:43:42Z raasch
53! code put under GPL (PALM 3.9)
54!
55! 1003 2012-09-14 14:35:53Z raasch
56! obsolete variables removed
57!
58! 1001 2012-09-13 14:08:46Z raasch
59! all actions concerning upstream-spline-method removed
60!
61! Revision 1.1  1999/02/05 09:07:38  raasch
62! Initial revision
63!
64!
65! Description:
66! ------------
67!> Initialize constant coefficients and parameters for certain advection schemes.
68!------------------------------------------------------------------------------!
69 SUBROUTINE init_advec
70 
71
72    USE advection,                                                             &
73        ONLY:  aex, bex, dex, eex
74       
75    USE kinds
76   
77    USE control_parameters,                                                    &
78        ONLY:  scalar_advec
79
80    IMPLICIT NONE
81
82    INTEGER(iwp) ::  i          !<
83    INTEGER(iwp) ::  intervals  !<
84    INTEGER(iwp) ::  j          !<
85   
86    REAL(wp) :: delt   !<
87    REAL(wp) :: dn     !<
88    REAL(wp) :: dnneu  !<
89    REAL(wp) :: ex1    !<
90    REAL(wp) :: ex2    !<
91    REAL(wp) :: ex3    !<
92    REAL(wp) :: ex4    !<
93    REAL(wp) :: ex5    !<
94    REAL(wp) :: ex6    !<
95    REAL(wp) :: sterm  !<
96
97
98    IF ( scalar_advec == 'bc-scheme' )  THEN
99
100!
101!--    Compute exponential coefficients for the Bott-Chlond scheme
102       intervals = 1000
103       ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) )
104
105       delt  = 1.0_wp / REAL( intervals, KIND=wp )
106       sterm = delt * 0.5_wp
107
108       DO  i = 1, intervals
109
110          IF ( sterm > 0.5_wp )  THEN
111             dn = -5.0_wp
112          ELSE
113             dn = 5.0_wp
114          ENDIF
115
116          DO  j = 1, 15
117             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
118             ex2 = EXP( dn ) - EXP( -dn )
119             ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP(  0.5_wp * dn ) &
120                                                - 0.5_wp * EXP( -0.5_wp * dn )
121             ex4 = EXP( dn ) + EXP( -dn )
122             ex5 = dn * sterm + ex1 / ex2
123             ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 )
124             dnneu = dn - ex5 / ex6
125             dn  = dnneu
126          ENDDO
127
128          IF ( sterm < 0.5_wp )  dn = MAX(  2.95E-2_wp, dn )
129          IF ( sterm > 0.5_wp )  dn = MIN( -2.95E-2_wp, dn )
130          ex1 = EXP( -dn )
131          ex2 = EXP( dn ) - ex1
132          aex(i) = -ex1 / ex2
133          bex(i) = 1.0_wp / ex2
134          dex(i) = dn
135          eex(i) = EXP( dex(i) * 0.5_wp )
136          sterm = sterm + delt
137
138       ENDDO
139
140    ENDIF
141
142 END SUBROUTINE init_advec
Note: See TracBrowser for help on using the repository browser.