Skip to content

Commit 4e2e16d

Browse files
author
Sam Cox
committed
Add unit test for calcPhotolysisRaw
1 parent 4c2d515 commit 4e2e16d

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module constraint_test
2+
use fruit
3+
use types_mod
4+
implicit none
5+
6+
contains
7+
8+
subroutine test_calcPhotolysisRaw
9+
use types_mod
10+
use constraint_functions_mod, only : calcPhotolysisRaw
11+
use zenith_data_mod, only : cosx, secx
12+
implicit none
13+
14+
! photolysis = l * cosx ** m * exp( -n * secx ) * tf
15+
cosx = 1.0_DP
16+
secx = 1.0_DP / cosx
17+
call assert_true(calcPhotolysisRaw( 1.0_DP, 1.0_DP, 1.0_DP, 1.0_DP ) == exp( -1.0_DP ), "calcPhotolysisRaw all ones")
18+
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 1.0_DP, 1.0_DP ) == 2.0_DP * exp( -1.0_DP ), "calcPhotolysisRaw 2")
19+
20+
cosx = 0.5_DP
21+
secx = 1.0_DP / cosx
22+
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 1.0_DP, 1.0_DP ) == exp( -2.0_DP ), "calcPhotolysisRaw 3")
23+
call assert_true(calcPhotolysisRaw( 2.0_DP, 2.0_DP, 1.0_DP, 1.0_DP ) == 0.5_DP * exp( -2.0_DP ), "calcPhotolysisRaw 4")
24+
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 2.0_DP, 1.0_DP ) == exp( -4.0_DP ), "calcPhotolysisRaw 5")
25+
call assert_true(calcPhotolysisRaw( 2.0_DP, 1.0_DP, 1.0_DP, 2.0_DP ) == 2.0_DP * exp( -2.0_DP ), "calcPhotolysisRaw 6")
26+
27+
end subroutine test_calcPhotolysisRaw
28+
29+
end module constraint_test

0 commit comments

Comments
 (0)