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

Last change on this file since 1323 was 1323, checked in by raasch, 8 years ago

last commit documented

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