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

Last change on this file since 4532 was 4360, checked in by suehring, 5 years ago

Bugfix in output of time-averaged plant-canopy quanities; Output of plant-canopy data only where tall canopy is defined; land-surface model: fix wrong location strings; tests: update urban test case; all source code files: copyright update

  • Property svn:keywords set to Id
File size: 3.3 KB
RevLine 
[1682]1!> @file init_advec.f90
[2000]2!------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]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!
[4360]17! Copyright 1997-2020 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 4360 2020-01-07 11:25:50Z schwenkel $
[2716]27! Corrected "Former revisions" section
28!
[4182]29! 3655 2019-01-07 16:51:22Z knoop
30! Corrected "Former revisions" section
[1321]31!
[4182]32! Revision 1.1  1999/02/05 09:07:38  raasch
33! Initial revision
34!
35!
[1]36! Description:
37! ------------
[1682]38!> Initialize constant coefficients and parameters for certain advection schemes.
[1]39!------------------------------------------------------------------------------!
[1682]40 SUBROUTINE init_advec
41 
[1]42
[1320]43    USE advection,                                                             &
44        ONLY:  aex, bex, dex, eex
45       
46    USE kinds
47   
48    USE control_parameters,                                                    &
49        ONLY:  scalar_advec
[1]50
51    IMPLICIT NONE
52
[1682]53    INTEGER(iwp) ::  i          !<
54    INTEGER(iwp) ::  intervals  !<
55    INTEGER(iwp) ::  j          !<
[1320]56   
[1682]57    REAL(wp) :: delt   !<
58    REAL(wp) :: dn     !<
59    REAL(wp) :: dnneu  !<
60    REAL(wp) :: ex1    !<
61    REAL(wp) :: ex2    !<
62    REAL(wp) :: ex3    !<
63    REAL(wp) :: ex4    !<
64    REAL(wp) :: ex5    !<
65    REAL(wp) :: ex6    !<
66    REAL(wp) :: sterm  !<
[1]67
68
69    IF ( scalar_advec == 'bc-scheme' )  THEN
70
71!
72!--    Compute exponential coefficients for the Bott-Chlond scheme
73       intervals = 1000
74       ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) )
75
[1322]76       delt  = 1.0_wp / REAL( intervals, KIND=wp )
[1353]77       sterm = delt * 0.5_wp
[1]78
79       DO  i = 1, intervals
80
[1353]81          IF ( sterm > 0.5_wp )  THEN
82             dn = -5.0_wp
[1]83          ELSE
[1353]84             dn = 5.0_wp
[1]85          ENDIF
86
87          DO  j = 1, 15
[1353]88             ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn )
[1]89             ex2 = EXP( dn ) - EXP( -dn )
[1353]90             ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP(  0.5_wp * dn ) &
91                                                - 0.5_wp * EXP( -0.5_wp * dn )
[1]92             ex4 = EXP( dn ) + EXP( -dn )
93             ex5 = dn * sterm + ex1 / ex2
94             ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 )
95             dnneu = dn - ex5 / ex6
96             dn  = dnneu
97          ENDDO
98
[1353]99          IF ( sterm < 0.5_wp )  dn = MAX(  2.95E-2_wp, dn )
100          IF ( sterm > 0.5_wp )  dn = MIN( -2.95E-2_wp, dn )
[1]101          ex1 = EXP( -dn )
102          ex2 = EXP( dn ) - ex1
103          aex(i) = -ex1 / ex2
[1353]104          bex(i) = 1.0_wp / ex2
[1]105          dex(i) = dn
[1353]106          eex(i) = EXP( dex(i) * 0.5_wp )
[1]107          sterm = sterm + delt
108
109       ENDDO
110
111    ENDIF
112
113 END SUBROUTINE init_advec
Note: See TracBrowser for help on using the repository browser.