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

Last change on this file since 1806 was 1683, checked in by knoop, 9 years ago

last commit documented

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