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

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

Code annotations made doxygen readable

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