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

Last change on this file since 1320 was 1320, checked in by raasch, 10 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

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