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

Last change on this file since 2481 was 2101, checked in by suehring, 8 years ago

last commit documented

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