[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 | ! |
---|
[3655] | 17 | ! Copyright 1997-2019 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 4180 2019-08-21 14:37:54Z scharf $ |
---|
[2716] | 27 | ! Corrected "Former revisions" section |
---|
| 28 | ! |
---|
[1321] | 29 | ! |
---|
[1] | 30 | ! Description: |
---|
| 31 | ! ------------ |
---|
[1682] | 32 | !> Initialize constant coefficients and parameters for certain advection schemes. |
---|
[1] | 33 | !------------------------------------------------------------------------------! |
---|
[1682] | 34 | SUBROUTINE init_advec |
---|
| 35 | |
---|
[1] | 36 | |
---|
[1320] | 37 | USE advection, & |
---|
| 38 | ONLY: aex, bex, dex, eex |
---|
| 39 | |
---|
| 40 | USE kinds |
---|
| 41 | |
---|
| 42 | USE control_parameters, & |
---|
| 43 | ONLY: scalar_advec |
---|
[1] | 44 | |
---|
| 45 | IMPLICIT NONE |
---|
| 46 | |
---|
[1682] | 47 | INTEGER(iwp) :: i !< |
---|
| 48 | INTEGER(iwp) :: intervals !< |
---|
| 49 | INTEGER(iwp) :: j !< |
---|
[1320] | 50 | |
---|
[1682] | 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 !< |
---|
[1] | 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 | |
---|
[1322] | 70 | delt = 1.0_wp / REAL( intervals, KIND=wp ) |
---|
[1353] | 71 | sterm = delt * 0.5_wp |
---|
[1] | 72 | |
---|
| 73 | DO i = 1, intervals |
---|
| 74 | |
---|
[1353] | 75 | IF ( sterm > 0.5_wp ) THEN |
---|
| 76 | dn = -5.0_wp |
---|
[1] | 77 | ELSE |
---|
[1353] | 78 | dn = 5.0_wp |
---|
[1] | 79 | ENDIF |
---|
| 80 | |
---|
| 81 | DO j = 1, 15 |
---|
[1353] | 82 | ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn ) |
---|
[1] | 83 | ex2 = EXP( dn ) - EXP( -dn ) |
---|
[1353] | 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 ) |
---|
[1] | 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 | |
---|
[1353] | 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 ) |
---|
[1] | 95 | ex1 = EXP( -dn ) |
---|
| 96 | ex2 = EXP( dn ) - ex1 |
---|
| 97 | aex(i) = -ex1 / ex2 |
---|
[1353] | 98 | bex(i) = 1.0_wp / ex2 |
---|
[1] | 99 | dex(i) = dn |
---|
[1353] | 100 | eex(i) = EXP( dex(i) * 0.5_wp ) |
---|
[1] | 101 | sterm = sterm + delt |
---|
| 102 | |
---|
| 103 | ENDDO |
---|
| 104 | |
---|
| 105 | ENDIF |
---|
| 106 | |
---|
| 107 | END SUBROUTINE init_advec |
---|