[1682] | 1 | !> @file init_advec.f90 |
---|
[4648] | 2 | !--------------------------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[4648] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General |
---|
| 6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
| 7 | ! (at your option) any later version. |
---|
[1036] | 8 | ! |
---|
[4648] | 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
| 10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
| 11 | ! Public License for more details. |
---|
[1036] | 12 | ! |
---|
[4648] | 13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
| 14 | ! <http://www.gnu.org/licenses/>. |
---|
[1036] | 15 | ! |
---|
[4360] | 16 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
[4648] | 17 | !--------------------------------------------------------------------------------------------------! |
---|
[1036] | 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[4648] | 21 | ! |
---|
| 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: init_advec.f90 4648 2020-08-25 07:52:08Z raasch $ |
---|
[4648] | 26 | ! file re-formatted to follow the PALM coding standard |
---|
| 27 | ! |
---|
| 28 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
[2716] | 29 | ! Corrected "Former revisions" section |
---|
[4648] | 30 | ! |
---|
[4182] | 31 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
| 32 | ! Corrected "Former revisions" section |
---|
[1321] | 33 | ! |
---|
[4182] | 34 | ! Revision 1.1 1999/02/05 09:07:38 raasch |
---|
| 35 | ! Initial revision |
---|
| 36 | ! |
---|
| 37 | ! |
---|
[1] | 38 | ! Description: |
---|
| 39 | ! ------------ |
---|
[1682] | 40 | !> Initialize constant coefficients and parameters for certain advection schemes. |
---|
[4648] | 41 | !--------------------------------------------------------------------------------------------------! |
---|
[1682] | 42 | SUBROUTINE init_advec |
---|
[1] | 43 | |
---|
[4648] | 44 | |
---|
| 45 | USE advection, & |
---|
[1320] | 46 | ONLY: aex, bex, dex, eex |
---|
[4648] | 47 | |
---|
[1320] | 48 | USE kinds |
---|
[4648] | 49 | |
---|
| 50 | USE control_parameters, & |
---|
[1320] | 51 | ONLY: scalar_advec |
---|
[1] | 52 | |
---|
| 53 | IMPLICIT NONE |
---|
| 54 | |
---|
[1682] | 55 | INTEGER(iwp) :: i !< |
---|
[4648] | 56 | INTEGER(iwp) :: intervals !< |
---|
[1682] | 57 | INTEGER(iwp) :: j !< |
---|
[4648] | 58 | |
---|
[1682] | 59 | REAL(wp) :: delt !< |
---|
| 60 | REAL(wp) :: dn !< |
---|
| 61 | REAL(wp) :: dnneu !< |
---|
| 62 | REAL(wp) :: ex1 !< |
---|
| 63 | REAL(wp) :: ex2 !< |
---|
| 64 | REAL(wp) :: ex3 !< |
---|
| 65 | REAL(wp) :: ex4 !< |
---|
| 66 | REAL(wp) :: ex5 !< |
---|
| 67 | REAL(wp) :: ex6 !< |
---|
| 68 | REAL(wp) :: sterm !< |
---|
[1] | 69 | |
---|
| 70 | |
---|
| 71 | IF ( scalar_advec == 'bc-scheme' ) THEN |
---|
| 72 | |
---|
| 73 | ! |
---|
| 74 | !-- Compute exponential coefficients for the Bott-Chlond scheme |
---|
| 75 | intervals = 1000 |
---|
| 76 | ALLOCATE( aex(intervals), bex(intervals), dex(intervals), eex(intervals) ) |
---|
| 77 | |
---|
[1322] | 78 | delt = 1.0_wp / REAL( intervals, KIND=wp ) |
---|
[1353] | 79 | sterm = delt * 0.5_wp |
---|
[1] | 80 | |
---|
| 81 | DO i = 1, intervals |
---|
| 82 | |
---|
[1353] | 83 | IF ( sterm > 0.5_wp ) THEN |
---|
| 84 | dn = -5.0_wp |
---|
[1] | 85 | ELSE |
---|
[1353] | 86 | dn = 5.0_wp |
---|
[1] | 87 | ENDIF |
---|
| 88 | |
---|
| 89 | DO j = 1, 15 |
---|
[1353] | 90 | ex1 = dn * EXP( -dn ) - EXP( 0.5_wp * dn ) + EXP( -0.5_wp * dn ) |
---|
[1] | 91 | ex2 = EXP( dn ) - EXP( -dn ) |
---|
[4648] | 92 | ex3 = EXP( -dn ) * ( 1.0_wp - dn ) - 0.5_wp * EXP( 0.5_wp * dn ) & |
---|
[1353] | 93 | - 0.5_wp * EXP( -0.5_wp * dn ) |
---|
[1] | 94 | ex4 = EXP( dn ) + EXP( -dn ) |
---|
| 95 | ex5 = dn * sterm + ex1 / ex2 |
---|
| 96 | ex6 = sterm + ( ex3 * ex2 - ex4 * ex1 ) / ( ex2 * ex2 ) |
---|
| 97 | dnneu = dn - ex5 / ex6 |
---|
| 98 | dn = dnneu |
---|
| 99 | ENDDO |
---|
| 100 | |
---|
[1353] | 101 | IF ( sterm < 0.5_wp ) dn = MAX( 2.95E-2_wp, dn ) |
---|
| 102 | IF ( sterm > 0.5_wp ) dn = MIN( -2.95E-2_wp, dn ) |
---|
[1] | 103 | ex1 = EXP( -dn ) |
---|
| 104 | ex2 = EXP( dn ) - ex1 |
---|
| 105 | aex(i) = -ex1 / ex2 |
---|
[1353] | 106 | bex(i) = 1.0_wp / ex2 |
---|
[1] | 107 | dex(i) = dn |
---|
[1353] | 108 | eex(i) = EXP( dex(i) * 0.5_wp ) |
---|
[1] | 109 | sterm = sterm + delt |
---|
| 110 | |
---|
| 111 | ENDDO |
---|
| 112 | |
---|
| 113 | ENDIF |
---|
| 114 | |
---|
| 115 | END SUBROUTINE init_advec |
---|