MONC
test_saturation.F90
Go to the documentation of this file.
1 ! Tests the logging_mod utility functions
3  use fruit, only : assert_equals, assert_not_equals, assert_true
6  implicit none
7 
8 contains
9 
10  ! Test qsaturation when P=T=0.0
12  real(kind=default_precision) :: res
13  real(kind=default_precision),parameter :: expected = -0.62203306596824359_default_precision
14  res = qsaturation(0.0_default_precision, 0.0_default_precision)
15  call assert_equals(expected, res, "Result when P=0 and T=0")
16  end subroutine test_qsaturation_zero
17 
18  ! Test dqwsatdt when SATURATION=T=0.0
19  subroutine test_dqwsatdt_zero
20  real(kind=default_precision) :: res
21  real(kind=default_precision),parameter :: expected = 0.0_default_precision
22  res = dqwsatdt(0.0_default_precision, 0.0_default_precision)
23  call assert_equals(expected, res, "Result when SAT=0 and T=0 is 0")
24  end subroutine test_dqwsatdt_zero
25 
26  ! Test dqwsatdt result is 0 when T=qsa3
28  real(kind=default_precision) :: res
29  real(kind=default_precision),parameter :: expected = 0.0_default_precision
30  res = dqwsatdt(0.0_default_precision,35.86_default_precision)
31  call assert_equals(expected, res, "Result when T=qsa3 should be 0")
32  write(*,*)res
33  end subroutine test_dqwsatdt_temp_qsa3
34 
35 
36  end module test_saturation_mod
37 
38 
39 
40  ! Driver for maths_mod utility tests
42  use fruit, only : init_fruit, run_test_case, fruit_summary
44 
45  implicit none
46 
47  call init_fruit
48  call run_test_case(test_qsaturation_zero, "Test the result of qsaturation with T=P=0")
49  call run_test_case(test_dqwsatdt_zero, "Test the result of dqwsatdt with SAT=P=0")
50  call run_test_case(test_dqwsatdt_temp_qsa3, "Test the result of dqwsatdt when T=qsa3")
51  call fruit_summary
52  end program test_saturation_driver
saturation_mod
Saturation physics functionality which is used throughout the code.
Definition: saturation.F90:2
saturation_mod::qsaturation
real(kind=default_precision) function, public qsaturation(temperature, pressure)
Function to return the saturation mixing ratio over water based on tetans formular QS=3....
Definition: saturation.F90:22
test_saturation_driver
program test_saturation_driver
Definition: test_saturation.F90:41
test_saturation_mod::test_qsaturation_zero
subroutine test_qsaturation_zero
Definition: test_saturation.F90:12
test_saturation_mod
Definition: test_saturation.F90:2
test_saturation_mod::test_dqwsatdt_temp_qsa3
subroutine test_dqwsatdt_temp_qsa3
Definition: test_saturation.F90:28
test_saturation_mod::test_dqwsatdt_zero
subroutine test_dqwsatdt_zero
Definition: test_saturation.F90:20
saturation_mod::dqwsatdt
real(kind=default_precision) function, public dqwsatdt(saturation_mixing_ratio, temperature)
Calculated the rate of change with temperature of saturation mixing ratio over liquid water....
Definition: saturation.F90:33
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17