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

Last change on this file since 1682 was 1682, checked in by knoop, 6 years ago

Code annotations made doxygen readable

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1!> @file init_advec.f90
2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2014 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21! Code annotations made doxygen readable
22!
23! Former revisions:
24! -----------------
25! $Id: init_advec.f90 1682 2015-10-07 23:56:08Z knoop $
26!
27! 1353 2014-04-08 15:21:23Z heinze
28! REAL constants provided with KIND-attribute
29!
30! 1346 2014-03-27 13:18:20Z heinze
31! Bugfix: REAL constants provided with KIND-attribute especially in call of
32! intrinsic function like MAX, MIN, SIGN
33!
34! 1322 2014-03-20 16:38:49Z raasch
35! REAL constants defined as wp-kind
36!
37! 1320 2014-03-20 08:40:49Z raasch
38! ONLY-attribute added to USE-statements,
39! kind-parameters added to all INTEGER and REAL declaration statements,
40! kinds are defined in new module kinds,
41! revision history before 2012 removed,
42! comment fields (!:) to be used for variable explanations added to
43! all variable declaration statements
44!
45! 1036 2012-10-22 13:43:42Z raasch
46! code put under GPL (PALM 3.9)
47!
48! 1003 2012-09-14 14:35:53Z raasch
49! obsolete variables removed
50!
51! 1001 2012-09-13 14:08:46Z raasch
52! all actions concerning upstream-spline-method removed
53!
54! Revision 1.1  1999/02/05 09:07:38  raasch
55! Initial revision
56!
57!
58! Description:
59! ------------
60!> Initialize constant coefficients and parameters for certain advection schemes.
61!------------------------------------------------------------------------------!
62 SUBROUTINE init_advec
63 
64
65    USE advection,                                                             &
66        ONLY:  aex, bex, dex, eex
67       
68    USE kinds
69   
70    USE control_parameters,                                                    &
71        ONLY:  scalar_advec
72
73    IMPLICIT NONE
74
75    INTEGER(iwp) ::  i          !<
76    INTEGER(iwp) ::  intervals  !<
77    INTEGER(iwp) ::  j          !<
78   
79    REAL(wp) :: delt   !<
80    REAL(wp) :: dn     !<
81    REAL(wp) :: dnneu  !<
82    REAL(wp) :: ex1    !<
83    REAL(wp) :: ex2    !<
84    REAL(wp) :: ex3    !<
85    REAL(wp) :: ex4    !<
86    REAL(wp) :: ex5    !<
87    REAL(wp) :: ex6    !<
88    REAL(wp) :: sterm  !<
89
90
91    IF ( scalar_advec == 'bc-scheme' )  THEN
92
93!
94!--    Compute exponential coefficients for the Bott-Chlond scheme
95       intervals = 1000
96       ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) )
97
98       delt  = 1.0_wp / REAL( intervals, KIND=wp )
99       sterm = delt * 0.5_wp
100
101       DO  i = 1, intervals
102
103          IF ( sterm > 0.5_wp )  THEN
104             dn = -5.0_wp
105          ELSE
106             dn = 5.0_wp
107          ENDIF
108
109          DO  j = 1, 15
110             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
111             ex2 = EXP( dn ) - EXP( -dn )
112             ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP(  0.5_wp * dn ) &
113                                                - 0.5_wp * EXP( -0.5_wp * dn )
114             ex4 = EXP( dn ) + EXP( -dn )
115             ex5 = dn * sterm + ex1 / ex2
116             ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 )
117             dnneu = dn - ex5 / ex6
118             dn  = dnneu
119          ENDDO
120
121          IF ( sterm < 0.5_wp )  dn = MAX(  2.95E-2_wp, dn )
122          IF ( sterm > 0.5_wp )  dn = MIN( -2.95E-2_wp, dn )
123          ex1 = EXP( -dn )
124          ex2 = EXP( dn ) - ex1
125          aex(i) = -ex1 / ex2
126          bex(i) = 1.0_wp / ex2
127          dex(i) = dn
128          eex(i) = EXP( dex(i) * 0.5_wp )
129          sterm = sterm + delt
130
131       ENDDO
132
133    ENDIF
134
135 END SUBROUTINE init_advec
Note: See TracBrowser for help on using the repository browser.