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

Last change on this file since 1849 was 1818, checked in by maronga, 9 years ago

last commit documented / copyright update

  • Property svn:keywords set to Id
File size: 4.2 KB
RevLine 
[1682]1!> @file init_advec.f90
[1036]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!
[1818]16! Copyright 1997-2016 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[484]19! Current revisions:
[1]20! -----------------
[1347]21!
[1683]22!
[1321]23! Former revisions:
24! -----------------
25! $Id: init_advec.f90 1818 2016-04-06 15:53:27Z hoffmann $
26!
[1683]27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
[1354]30! 1353 2014-04-08 15:21:23Z heinze
31! REAL constants provided with KIND-attribute
32!
[1347]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!
[1323]37! 1322 2014-03-20 16:38:49Z raasch
38! REAL constants defined as wp-kind
39!
[1321]40! 1320 2014-03-20 08:40:49Z raasch
[1320]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
[1321]47!
[1037]48! 1036 2012-10-22 13:43:42Z raasch
49! code put under GPL (PALM 3.9)
50!
[1004]51! 1003 2012-09-14 14:35:53Z raasch
52! obsolete variables removed
53!
[1002]54! 1001 2012-09-13 14:08:46Z raasch
55! all actions concerning upstream-spline-method removed
56!
[1]57! Revision 1.1  1999/02/05 09:07:38  raasch
58! Initial revision
59!
60!
61! Description:
62! ------------
[1682]63!> Initialize constant coefficients and parameters for certain advection schemes.
[1]64!------------------------------------------------------------------------------!
[1682]65 SUBROUTINE init_advec
66 
[1]67
[1320]68    USE advection,                                                             &
69        ONLY:  aex, bex, dex, eex
70       
71    USE kinds
72   
73    USE control_parameters,                                                    &
74        ONLY:  scalar_advec
[1]75
76    IMPLICIT NONE
77
[1682]78    INTEGER(iwp) ::  i          !<
79    INTEGER(iwp) ::  intervals  !<
80    INTEGER(iwp) ::  j          !<
[1320]81   
[1682]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  !<
[1]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
[1322]101       delt  = 1.0_wp / REAL( intervals, KIND=wp )
[1353]102       sterm = delt * 0.5_wp
[1]103
104       DO  i = 1, intervals
105
[1353]106          IF ( sterm > 0.5_wp )  THEN
107             dn = -5.0_wp
[1]108          ELSE
[1353]109             dn = 5.0_wp
[1]110          ENDIF
111
112          DO  j = 1, 15
[1353]113             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
[1]114             ex2 = EXP( dn ) - EXP( -dn )
[1353]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 )
[1]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
[1353]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 )
[1]126          ex1 = EXP( -dn )
127          ex2 = EXP( dn ) - ex1
128          aex(i) = -ex1 / ex2
[1353]129          bex(i) = 1.0_wp / ex2
[1]130          dex(i) = dn
[1353]131          eex(i) = EXP( dex(i) * 0.5_wp )
[1]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.