forked from ESCOMP/CLUBB_CESM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
T_in_K_module.F90
87 lines (63 loc) · 2.46 KB
/
T_in_K_module.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
!-------------------------------------------------------------------------
! $Id$
!===============================================================================
module T_in_K_module
implicit none
private ! Default scope
public :: thlm2T_in_K, T_in_K2thlm
contains
!-------------------------------------------------------------------------------
elemental function thlm2T_in_K( thlm, exner, rcm ) &
result( T_in_K )
! Description:
! Calculates absolute temperature from liquid water potential
! temperature. (Does not include ice.)
! References:
! Cotton and Anthes (1989), "Storm and Cloud Dynamics", Eqn. (2.51).
!-------------------------------------------------------------------------------
use constants_clubb, only: &
! Variable(s)
Cp, & ! Dry air specific heat at constant p [J/kg/K]
Lv ! Latent heat of vaporization [J/kg]
use clubb_precision, only: &
core_rknd ! Variable(s)
implicit none
! Input
real( kind = core_rknd ), intent(in) :: &
thlm, & ! Liquid potential temperature [K]
exner, & ! Exner function [-]
rcm ! Liquid water mixing ratio [kg/kg]
real( kind = core_rknd ) :: &
T_in_K ! Result temperature [K]
! ---- Begin Code ----
T_in_K = thlm * exner + Lv * rcm / Cp
return
end function thlm2T_in_K
!-------------------------------------------------------------------------------
elemental function T_in_K2thlm( T_in_K, exner, rcm ) &
result( thlm )
! Description:
! Calculates liquid water potential temperature from absolute temperature
! References:
! None
!-------------------------------------------------------------------------------
use constants_clubb, only: &
! Variable(s)
Cp, & ! Dry air specific heat at constant p [J/kg/K]
Lv ! Latent heat of vaporization [J/kg]
use clubb_precision, only: &
core_rknd ! Variable(s)
implicit none
! Input
real( kind = core_rknd ), intent(in) :: &
T_in_K, &! Result temperature [K]
exner, & ! Exner function [-]
rcm ! Liquid water mixing ratio [kg/kg]
real( kind = core_rknd ) :: &
thlm ! Liquid potential temperature [K]
! ---- Begin Code ----
thlm = ( T_in_K - Lv/Cp * rcm ) / exner
return
end function T_in_K2thlm
!-------------------------------------------------------------------------------
end module T_in_K_module