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

Last change on this file since 1491 was 1354, checked in by heinze, 11 years ago

last commit documented

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