source: palm/trunk/SOURCE/lpm_calc_liquid_water_content.f90 @ 1907

Last change on this file since 1907 was 1823, checked in by hoffmann, 9 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1!> @file lpm_calc_liquid_water_content.f90
2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2016 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! ------------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: lpm_calc_liquid_water_content.f90 1823 2016-04-07 08:57:52Z suehring $
26!
27! 1822 2016-04-07 07:49:42Z hoffmann
28! Unused variables removed.
29!
30! 1682 2015-10-07 23:56:08Z knoop
31! Code annotations made doxygen readable
32!
33! 1359 2014-04-11 17:15:14Z hoffmann
34! New particle structure integrated.
35! Kind definition added to all floating point numbers.
36!
37! 1320 2014-03-20 08:40:49Z raasch
38! ONLY-attribute added to USE-statements,
39! kind-parameters added to all INTEGER and REAL declaration statements,
40! kinds are defined in new module kinds,
41! comment fields (!:) to be used for variable explanations added to
42! all variable declaration statements
43!
44! 1036 2012-10-22 13:43:42Z raasch
45! code put under GPL (PALM 3.9)
46!
47! 849 2012-03-15 10:35:09Z raasch
48! initial revision (former part of advec_particles)
49!
50!
51! Description:
52! ------------
53!> Calculate the liquid water content for each grid box.
54!------------------------------------------------------------------------------!
55 SUBROUTINE lpm_calc_liquid_water_content
56 
57
58    USE arrays_3d,                                                             &
59        ONLY:  ql, ql_v, ql_vp
60
61    USE cloud_parameters,                                                      &
62        ONLY:  rho_l
63
64    USE constants,                                                             &
65        ONLY:  pi
66
67    USE control_parameters,                                                    &
68        ONLY:  dz, message_string, rho_surface
69
70    USE cpulog,                                                                &
71        ONLY:  cpu_log, log_point_s
72
73    USE grid_variables,                                                        &
74        ONLY:  dx, dy
75
76    USE indices,                                                               &
77        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
78
79    USE kinds
80
81    USE particle_attributes,                                                   &
82        ONLY:  grid_particles, number_of_particles, particles, prt_count
83
84    IMPLICIT NONE
85
86    INTEGER(iwp) ::  i   !<
87    INTEGER(iwp) ::  j   !<
88    INTEGER(iwp) ::  k   !<
89    INTEGER(iwp) ::  n   !<
90
91    CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'start' )
92
93!
94!-- Set water content initially to zero
95    ql = 0.0_wp;  ql_v = 0.0_wp;  ql_vp = 0.0_wp
96
97!
98!-- Calculate for each grid box
99    DO  i = nxl, nxr
100       DO  j = nys, nyn
101          DO  k = nzb+1, nzt
102
103             number_of_particles = prt_count(k,j,i)
104             IF ( number_of_particles <= 0 )  CYCLE
105             particles => grid_particles(k,j,i)%particles(1:number_of_particles)
106
107!
108!--          Calculate the total volume in the boxes (ql_v, weighting factor
109!--          has to beincluded)
110             DO  n = 1, prt_count(k,j,i)
111                ql_v(k,j,i)  = ql_v(k,j,i)  + particles(n)%weight_factor *  &
112                                              particles(n)%radius**3
113             ENDDO
114
115!
116!--          Calculate the liquid water content
117             IF ( ql_v(k,j,i) /= 0.0_wp )  THEN
118                ql(k,j,i) = ql(k,j,i) + rho_l * 1.33333333_wp * pi *           &
119                                        ql_v(k,j,i) /                       &
120                                        ( rho_surface * dx * dy * dz )
121
122                IF ( ql(k,j,i) < 0.0_wp )  THEN
123                   WRITE( message_string, * )  'LWC out of range: ' , &
124                                               ql(k,j,i),i,j,k
125                   CALL message( 'lpm_calc_liquid_water_content', '', 2, 2, &
126                                 -1, 6, 1 )
127                ENDIF
128
129             ELSE
130
131                ql(k,j,i) = 0.0_wp
132
133             ENDIF
134
135          ENDDO
136       ENDDO
137    ENDDO
138
139    CALL cpu_log( log_point_s(45), 'lpm_calc_ql', 'stop' )
140
141
142 END SUBROUTINE lpm_calc_liquid_water_content
Note: See TracBrowser for help on using the repository browser.