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