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

Last change on this file since 1321 was 1321, checked in by raasch, 11 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1 SUBROUTINE init_advec
2
3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later 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-2014 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: init_advec.f90 1321 2014-03-20 09:40:40Z raasch $
27!
28! 1320 2014-03-20 08:40:49Z raasch
29! ONLY-attribute added to USE-statements,
30! kind-parameters added to all INTEGER and REAL declaration statements,
31! kinds are defined in new module kinds,
32! revision history before 2012 removed,
33! comment fields (!:) to be used for variable explanations added to
34! all variable declaration statements
35!
36! 1036 2012-10-22 13:43:42Z raasch
37! code put under GPL (PALM 3.9)
38!
39! 1003 2012-09-14 14:35:53Z raasch
40! obsolete variables removed
41!
42! 1001 2012-09-13 14:08:46Z raasch
43! all actions concerning upstream-spline-method removed
44!
45! Revision 1.1  1999/02/05 09:07:38  raasch
46! Initial revision
47!
48!
49! Description:
50! ------------
51! Initialize constant coefficients and parameters for certain advection schemes.
52!------------------------------------------------------------------------------!
53
54    USE advection,                                                             &
55        ONLY:  aex, bex, dex, eex
56       
57    USE kinds
58   
59    USE control_parameters,                                                    &
60        ONLY:  scalar_advec
61
62    IMPLICIT NONE
63
64    INTEGER(iwp) ::  i          !:
65    INTEGER(iwp) ::  intervals  !:
66    INTEGER(iwp) ::  j          !:
67   
68    REAL(wp) :: delt   !:
69    REAL(wp) :: dn     !:
70    REAL(wp) :: dnneu  !:
71    REAL(wp) :: ex1    !:
72    REAL(wp) :: ex2    !:
73    REAL(wp) :: ex3    !:
74    REAL(wp) :: ex4    !:
75    REAL(wp) :: ex5    !:
76    REAL(wp) :: ex6    !:
77    REAL(wp) :: sterm  !:
78
79
80    IF ( scalar_advec == 'bc-scheme' )  THEN
81
82!
83!--    Compute exponential coefficients for the Bott-Chlond scheme
84       intervals = 1000
85       ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) )
86
87       delt  = 1.0 / REAL( intervals )
88       sterm = delt * 0.5
89
90       DO  i = 1, intervals
91
92          IF ( sterm > 0.5 )  THEN
93             dn = -5.0
94          ELSE
95             dn = 5.0
96          ENDIF
97
98          DO  j = 1, 15
99             ex1 = dn * EXP( -dn ) - EXP( 0.5 * dn ) + EXP( -0.5 * dn )
100             ex2 = EXP( dn ) - EXP( -dn )
101             ex3 = EXP( -dn ) * ( 1.0 - dn ) - 0.5 * EXP(  0.5 * dn ) &
102                                             - 0.5 * EXP( -0.5 * dn )
103             ex4 = EXP( dn ) + EXP( -dn )
104             ex5 = dn * sterm + ex1 / ex2
105             ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 )
106             dnneu = dn - ex5 / ex6
107             dn  = dnneu
108          ENDDO
109
110          IF ( sterm < 0.5 )  dn = MAX(  2.95E-2, dn )
111          IF ( sterm > 0.5 )  dn = MIN( -2.95E-2, dn )
112          ex1 = EXP( -dn )
113          ex2 = EXP( dn ) - ex1
114          aex(i) = -ex1 / ex2
115          bex(i) = 1.0 / ex2
116          dex(i) = dn
117          eex(i) = EXP( dex(i) * 0.5 )
118          sterm = sterm + delt
119
120       ENDDO
121
122    ENDIF
123
124 END SUBROUTINE init_advec
Note: See TracBrowser for help on using the repository browser.