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
11  subroutine test_qsaturation_zero
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
27  subroutine test_dqwsatdt_temp_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
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
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
Saturation physics functionality which is used throughout the code.
Definition: saturation.F90:2
subroutine test_dqwsatdt_zero
subroutine test_qsaturation_zero
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
program test_saturation_driver
subroutine test_dqwsatdt_temp_qsa3