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