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

Last change on this file since 2000 was 2000, checked in by knoop, 5 years ago

Forced header and separation lines into 80 columns

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