00001
00002
00003
00004
00005 !> @file
00006 !!
00007 !! Computation of the condensation rate.
00008 !!
00009 !! @section Copyright
00010 !!
00011 !! Copyright 2010, 2011 Ralf Greve, Bjoern Grieger, Oliver J. Stenzel
00012 !!
00013 !! @section License
00014 !!
00015 !! This file is part of MAIC-2.
00016 !!
00017 !! MAIC-2 is free software: you can redistribute it and/or modify
00018 !! it under the terms of the GNU General Public License as published by
00019 !! the Free Software Foundation, either version 3 of the License, or
00020 !! (at your option) any later version.
00021 !!
00022 !! MAIC-2 is distributed in the hope that it will be useful,
00023 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00025 !! GNU General Public License for more details.
00026 !!
00027 !! You should have received a copy of the GNU General Public License
00028 !! along with MAIC-2. If not, see <http://www.gnu.org/licenses/>.
00029 !<
00030 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00031
00032
00033 !> Computation of the condensation rate.
00034 !<------------------------------------------------------------------------------
00035 module condensation
00036
00037 use maic2_types
00038
00039 implicit none
00040 real(dp), private :: g
00041 real(dp), private :: tau
00042
00043 contains
00044
00045
00046 !> Setting of parameters.
00047 !<------------------------------------------------------------------------------
00048 subroutine setcondpar(gravity, timescale)
00049
00050 implicit none
00051
00052 real(dp), optional :: gravity, timescale
00053
00054 if ( present(gravity) ) then
00055 g = gravity
00056 else
00057 g = 3.7_dp
00058 end if
00059
00060 if ( present(timescale) ) then
00061 tau = timescale
00062 else
00063 tau = 24.622962_dp*3600.0_dp
00064 end if
00065
00066 end subroutine setcondpar
00067
00068
00069 !> Computation of condensation
00070 !! (removal of water exceeding the saturation pressure at the surface).
00071 !<------------------------------------------------------------------------------
00072 subroutine getcond_1(temp, water, cond, dtime)
00073
00074 implicit none
00075
00076 real(dp) :: temp(:), water(:), cond(:)
00077 real(dp) :: dtime
00078
00079 integer(i4b) :: i, n
00080 real(dp) :: g_inv, dtime_inv
00081 real(dp) :: p_sat, water_excess
00082
00083 g_inv = 1.0_dp/g
00084 dtime_inv = 1.0_dp/dtime
00085
00086 n = size(cond)
00087
00088 do i = 1, n
00089 water_excess = water(i) - p_sat(temp(i))*g_inv
00090 if (water_excess > 0.0_dp) then
00091 cond(i) = water_excess*dtime_inv
00092 else
00093 cond(i) = 0.0_dp
00094 end if
00095 end do
00096
00097 end subroutine getcond_1
00098
00099
00100 !> Computation of condensation (continuous, quadratic dependence on humidity).
00101 !<------------------------------------------------------------------------------
00102 subroutine getcond_2(temp, water, cond)
00103
00104 implicit none
00105
00106 real(dp) :: temp(:), water(:), cond(:)
00107 real(dp) :: p_sat
00108
00109 integer(i4b) :: i, n
00110
00111 n = size(cond)
00112
00113 do i = 1, n
00114 cond(i) = (g/tau) * water(i)**2 / p_sat(temp(i))
00115 end do
00116
00117 end subroutine getcond_2
00118
00119 end module condensation
00120