1 | SUBROUTINE lpm_calc_liquid_water_content |
---|
2 | |
---|
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 | ! |
---|
17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: lpm_calc_liquid_water_content.f90 1360 2014-04-11 17:20:32Z maronga $ |
---|
27 | ! |
---|
28 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
29 | ! New particle structure integrated. |
---|
30 | ! Kind definition added to all floating point numbers. |
---|
31 | ! |
---|
32 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
33 | ! ONLY-attribute added to USE-statements, |
---|
34 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
35 | ! kinds are defined in new module kinds, |
---|
36 | ! comment fields (!:) to be used for variable explanations added to |
---|
37 | ! all variable declaration statements |
---|
38 | ! |
---|
39 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
40 | ! code put under GPL (PALM 3.9) |
---|
41 | ! |
---|
42 | ! 849 2012-03-15 10:35:09Z raasch |
---|
43 | ! initial revision (former part of advec_particles) |
---|
44 | ! |
---|
45 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
48 | ! Calculate the liquid water content for each grid box. |
---|
49 | !------------------------------------------------------------------------------! |
---|
50 | |
---|
51 | USE arrays_3d, & |
---|
52 | ONLY: ql, ql_v, ql_vp |
---|
53 | |
---|
54 | USE cloud_parameters, & |
---|
55 | ONLY: rho_l |
---|
56 | |
---|
57 | USE constants, & |
---|
58 | ONLY: pi |
---|
59 | |
---|
60 | USE control_parameters, & |
---|
61 | ONLY: dz, message_string, rho_surface |
---|
62 | |
---|
63 | USE cpulog, & |
---|
64 | ONLY: cpu_log, log_point_s |
---|
65 | |
---|
66 | USE grid_variables, & |
---|
67 | ONLY: dx, dy |
---|
68 | |
---|
69 | USE indices, & |
---|
70 | ONLY: nxl, nxr, nyn, nys, nzb, nzt |
---|
71 | |
---|
72 | USE kinds |
---|
73 | |
---|
74 | USE particle_attributes, & |
---|
75 | ONLY: grid_particles, number_of_particles, particles, prt_count |
---|
76 | |
---|
77 | IMPLICIT NONE |
---|
78 | |
---|
79 | INTEGER(iwp) :: i !: |
---|
80 | INTEGER(iwp) :: j !: |
---|
81 | INTEGER(iwp) :: k !: |
---|
82 | INTEGER(iwp) :: n !: |
---|
83 | INTEGER(iwp) :: psi !: |
---|
84 | |
---|
85 | CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'start' ) |
---|
86 | |
---|
87 | ! |
---|
88 | !-- Set water content initially to zero |
---|
89 | ql = 0.0_wp; ql_v = 0.0_wp; ql_vp = 0.0_wp |
---|
90 | |
---|
91 | ! |
---|
92 | !-- Calculate for each grid box |
---|
93 | DO i = nxl, nxr |
---|
94 | DO j = nys, nyn |
---|
95 | DO k = nzb+1, nzt |
---|
96 | |
---|
97 | number_of_particles = prt_count(k,j,i) |
---|
98 | IF ( number_of_particles <= 0 ) CYCLE |
---|
99 | particles => grid_particles(k,j,i)%particles(1:number_of_particles) |
---|
100 | |
---|
101 | ! |
---|
102 | !-- Calculate the total volume in the boxes (ql_v, weighting factor |
---|
103 | !-- has to beincluded) |
---|
104 | DO n = 1, prt_count(k,j,i) |
---|
105 | ql_v(k,j,i) = ql_v(k,j,i) + particles(n)%weight_factor * & |
---|
106 | particles(n)%radius**3 |
---|
107 | ENDDO |
---|
108 | |
---|
109 | ! |
---|
110 | !-- Calculate the liquid water content |
---|
111 | IF ( ql_v(k,j,i) /= 0.0_wp ) THEN |
---|
112 | ql(k,j,i) = ql(k,j,i) + rho_l * 1.33333333_wp * pi * & |
---|
113 | ql_v(k,j,i) / & |
---|
114 | ( rho_surface * dx * dy * dz ) |
---|
115 | |
---|
116 | IF ( ql(k,j,i) < 0.0_wp ) THEN |
---|
117 | WRITE( message_string, * ) 'LWC out of range: ' , & |
---|
118 | ql(k,j,i),i,j,k |
---|
119 | CALL message( 'lpm_calc_liquid_water_content', '', 2, 2, & |
---|
120 | -1, 6, 1 ) |
---|
121 | ENDIF |
---|
122 | |
---|
123 | ELSE |
---|
124 | |
---|
125 | ql(k,j,i) = 0.0_wp |
---|
126 | |
---|
127 | ENDIF |
---|
128 | |
---|
129 | ENDDO |
---|
130 | ENDDO |
---|
131 | ENDDO |
---|
132 | |
---|
133 | CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'stop' ) |
---|
134 | |
---|
135 | |
---|
136 | END SUBROUTINE lpm_calc_liquid_water_content |
---|