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

Last change on this file since 2690 was 2101, checked in by suehring, 8 years ago

last commit documented

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