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

Last change on this file since 4180 was 4180, checked in by scharf, 2 years ago

removed comments in 'Former revisions' section that are older than 01.01.2019

  • Property svn:keywords set to Id
File size: 3.2 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 4180 2019-08-21 14:37:54Z scharf $
27! Corrected "Former revisions" section
28!
29!
30! Description:
31! ------------
32!> Initialize constant coefficients and parameters for certain advection schemes.
33!------------------------------------------------------------------------------!
34 SUBROUTINE init_advec
35 
36
37    USE advection,                                                             &
38        ONLY:  aex, bex, dex, eex
39       
40    USE kinds
41   
42    USE control_parameters,                                                    &
43        ONLY:  scalar_advec
44
45    IMPLICIT NONE
46
47    INTEGER(iwp) ::  i          !<
48    INTEGER(iwp) ::  intervals  !<
49    INTEGER(iwp) ::  j          !<
50   
51    REAL(wp) :: delt   !<
52    REAL(wp) :: dn     !<
53    REAL(wp) :: dnneu  !<
54    REAL(wp) :: ex1    !<
55    REAL(wp) :: ex2    !<
56    REAL(wp) :: ex3    !<
57    REAL(wp) :: ex4    !<
58    REAL(wp) :: ex5    !<
59    REAL(wp) :: ex6    !<
60    REAL(wp) :: sterm  !<
61
62
63    IF ( scalar_advec == 'bc-scheme' )  THEN
64
65!
66!--    Compute exponential coefficients for the Bott-Chlond scheme
67       intervals = 1000
68       ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) )
69
70       delt  = 1.0_wp / REAL( intervals, KIND=wp )
71       sterm = delt * 0.5_wp
72
73       DO  i = 1, intervals
74
75          IF ( sterm > 0.5_wp )  THEN
76             dn = -5.0_wp
77          ELSE
78             dn = 5.0_wp
79          ENDIF
80
81          DO  j = 1, 15
82             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
83             ex2 = EXP( dn ) - EXP( -dn )
84             ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP(  0.5_wp * dn ) &
85                                                - 0.5_wp * EXP( -0.5_wp * dn )
86             ex4 = EXP( dn ) + EXP( -dn )
87             ex5 = dn * sterm + ex1 / ex2
88             ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 )
89             dnneu = dn - ex5 / ex6
90             dn  = dnneu
91          ENDDO
92
93          IF ( sterm < 0.5_wp )  dn = MAX(  2.95E-2_wp, dn )
94          IF ( sterm > 0.5_wp )  dn = MIN( -2.95E-2_wp, dn )
95          ex1 = EXP( -dn )
96          ex2 = EXP( dn ) - ex1
97          aex(i) = -ex1 / ex2
98          bex(i) = 1.0_wp / ex2
99          dex(i) = dn
100          eex(i) = EXP( dex(i) * 0.5_wp )
101          sterm = sterm + delt
102
103       ENDDO
104
105    ENDIF
106
107 END SUBROUTINE init_advec
Note: See TracBrowser for help on using the repository browser.