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

Last change on this file since 3568 was 3274, checked in by knoop, 6 years ago

Modularization of all bulk cloud physics code components

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