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