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

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

Bugfix: made "unit" and "found" intend INOUT in module interface subroutines + automatic copyright update

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