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

Last change on this file since 1353 was 1353, checked in by heinze, 7 years ago

REAL constants provided with KIND-attribute

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