1 | !> @file lpm_calc_liquid_water_content.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: lpm_calc_liquid_water_content.f90 3039 2018-05-24 13:13:11Z knoop $ |
---|
27 | ! bugfix for lcm with grid stretching |
---|
28 | ! |
---|
29 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
30 | ! Corrected "Former revisions" section |
---|
31 | ! |
---|
32 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
33 | ! Change in file header (GPL part) |
---|
34 | ! |
---|
35 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
36 | ! |
---|
37 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
38 | ! Forced header and separation lines into 80 columns |
---|
39 | ! |
---|
40 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
41 | ! Unused variables removed. |
---|
42 | ! |
---|
43 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
44 | ! Code annotations made doxygen readable |
---|
45 | ! |
---|
46 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
47 | ! New particle structure integrated. |
---|
48 | ! Kind definition added to all floating point numbers. |
---|
49 | ! |
---|
50 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
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 | ! comment fields (!:) to be used for variable explanations added to |
---|
55 | ! all variable declaration statements |
---|
56 | ! |
---|
57 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
58 | ! code put under GPL (PALM 3.9) |
---|
59 | ! |
---|
60 | ! 849 2012-03-15 10:35:09Z raasch |
---|
61 | ! initial revision (former part of advec_particles) |
---|
62 | ! |
---|
63 | ! |
---|
64 | ! Description: |
---|
65 | ! ------------ |
---|
66 | !> Calculate the liquid water content for each grid box. |
---|
67 | !------------------------------------------------------------------------------! |
---|
68 | SUBROUTINE lpm_calc_liquid_water_content |
---|
69 | |
---|
70 | |
---|
71 | USE arrays_3d, & |
---|
72 | ONLY: dzw, ql, ql_v, ql_vp |
---|
73 | |
---|
74 | USE cloud_parameters, & |
---|
75 | ONLY: rho_l |
---|
76 | |
---|
77 | USE constants, & |
---|
78 | ONLY: pi |
---|
79 | |
---|
80 | USE control_parameters, & |
---|
81 | ONLY: dz, message_string, rho_surface |
---|
82 | |
---|
83 | USE cpulog, & |
---|
84 | ONLY: cpu_log, log_point_s |
---|
85 | |
---|
86 | USE grid_variables, & |
---|
87 | ONLY: dx, dy |
---|
88 | |
---|
89 | USE indices, & |
---|
90 | ONLY: nxl, nxr, nyn, nys, nzb, nzt |
---|
91 | |
---|
92 | USE kinds |
---|
93 | |
---|
94 | USE particle_attributes, & |
---|
95 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
96 | |
---|
97 | IMPLICIT NONE |
---|
98 | |
---|
99 | INTEGER(iwp) :: i !< |
---|
100 | INTEGER(iwp) :: j !< |
---|
101 | INTEGER(iwp) :: k !< |
---|
102 | INTEGER(iwp) :: n !< |
---|
103 | |
---|
104 | CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'start' ) |
---|
105 | |
---|
106 | ! |
---|
107 | !-- Set water content initially to zero |
---|
108 | ql = 0.0_wp; ql_v = 0.0_wp; ql_vp = 0.0_wp |
---|
109 | |
---|
110 | ! |
---|
111 | !-- Calculate for each grid box |
---|
112 | DO i = nxl, nxr |
---|
113 | DO j = nys, nyn |
---|
114 | DO k = nzb+1, nzt |
---|
115 | |
---|
116 | number_of_particles = prt_count(k,j,i) |
---|
117 | IF ( number_of_particles <= 0 ) CYCLE |
---|
118 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
119 | |
---|
120 | ! |
---|
121 | !-- Calculate the total volume in the boxes (ql_v, weighting factor |
---|
122 | !-- has to beincluded) |
---|
123 | DO n = 1, prt_count(k,j,i) |
---|
124 | ql_v(k,j,i) = ql_v(k,j,i) + particles(n)%weight_factor * & |
---|
125 | particles(n)%radius**3 |
---|
126 | ENDDO |
---|
127 | |
---|
128 | ! |
---|
129 | !-- Calculate the liquid water content |
---|
130 | IF ( ql_v(k,j,i) /= 0.0_wp ) THEN |
---|
131 | ql(k,j,i) = ql(k,j,i) + rho_l * 1.33333333_wp * pi * & |
---|
132 | ql_v(k,j,i) / & |
---|
133 | ( rho_surface * dx * dy * dzw(k) ) |
---|
134 | |
---|
135 | IF ( ql(k,j,i) < 0.0_wp ) THEN |
---|
136 | WRITE( message_string, * ) 'LWC out of range: ' , & |
---|
137 | ql(k,j,i),i,j,k |
---|
138 | CALL message( 'lpm_calc_liquid_water_content', '', 2, 2, & |
---|
139 | -1, 6, 1 ) |
---|
140 | ENDIF |
---|
141 | |
---|
142 | ELSE |
---|
143 | |
---|
144 | ql(k,j,i) = 0.0_wp |
---|
145 | |
---|
146 | ENDIF |
---|
147 | |
---|
148 | ENDDO |
---|
149 | ENDDO |
---|
150 | ENDDO |
---|
151 | |
---|
152 | CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'stop' ) |
---|
153 | |
---|
154 | |
---|
155 | END SUBROUTINE lpm_calc_liquid_water_content |
---|