MAIC-2  Revision 19
 All Classes Files Functions Variables
condensation.f90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Module : c o n d e n s a t i o n
4 !
5 !> @file
6 !!
7 !! Computation of the condensation rate.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2010-2013 Ralf Greve, Bjoern Grieger, Oliver J. Stenzel
12 !!
13 !! @section License
14 !!
15 !! This file is part of MAIC-2.
16 !!
17 !! MAIC-2 is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! MAIC-2 is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with MAIC-2. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Computation of the condensation rate.
34 !<------------------------------------------------------------------------------
36 
37  use maic2_types
38 
39  implicit none
40  real(dp), private :: g
41  real(dp), private :: tau
42 
43 contains
44 
45 !-------------------------------------------------------------------------------
46 !> Setting of parameters.
47 !<------------------------------------------------------------------------------
48  subroutine setcondpar(gravity, timescale)
49 
50  implicit none
51 
52  real(dp), optional :: gravity, timescale
53 
54  if ( present(gravity) ) then
55  g = gravity
56  else
57  g = 3.7_dp ! m/s**2
58  end if
59 
60  if ( present(timescale) ) then
61  tau = timescale
62  else
63  tau = 24.622962_dp*3600.0_dp ! length of Martian day (sol) in seconds
64  end if
65 
66  end subroutine setcondpar
67 
68 !-------------------------------------------------------------------------------
69 !> Computation of condensation
70 !! (removal of water exceeding the saturation pressure at the surface).
71 !<------------------------------------------------------------------------------
72  subroutine getcond_1(temp, water, cond, dtime)
73 
74  implicit none
75 
76  real(dp) :: temp(:), water(:), cond(:)
77  real(dp) :: dtime
78 
79  integer(i4b) :: i, n
80  real(dp) :: g_inv, dtime_inv
81  real(dp) :: p_sat, water_excess
82 
83  g_inv = 1.0_dp/g
84  dtime_inv = 1.0_dp/dtime
85 
86  n = size(cond)
87 
88  do i = 1, n
89  water_excess = water(i) - p_sat(temp(i))*g_inv
90  if (water_excess > 0.0_dp) then
91  cond(i) = water_excess*dtime_inv
92  else
93  cond(i) = 0.0_dp
94  end if
95  end do
96 
97  end subroutine getcond_1
98 
99 !-------------------------------------------------------------------------------
100 !> Computation of condensation (continuous, quadratic dependence on humidity).
101 !<------------------------------------------------------------------------------
102  subroutine getcond_2(temp, water, cond)
103 
104  implicit none
105 
106  real(dp) :: temp(:), water(:), cond(:)
107  real(dp) :: p_sat
108 
109  integer(i4b) :: i, n
110 
111  n = size(cond)
112 
113  do i = 1, n
114  cond(i) = (g/tau) * water(i)**2 / p_sat(temp(i))
115  end do
116 
117  end subroutine getcond_2
118 
119 end module condensation
120 !