diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-11 13:43:40 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-11 13:43:40 +0200 |
commit | b36ae3d710858ee3ff2907eb2d780e0dff48a4f3 (patch) | |
tree | b9e075d38233106465481c25b0a777ef043fb1c7 /tests/testthat/test_analytical.R | |
parent | 576fbc9d86f4db3d1be2fbd4e97b3fcd58f43c2b (diff) |
Analytical solutions for all SFO variants
Diffstat (limited to 'tests/testthat/test_analytical.R')
-rw-r--r-- | tests/testthat/test_analytical.R | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/tests/testthat/test_analytical.R b/tests/testthat/test_analytical.R index 3d30e042..5972a18a 100644 --- a/tests/testthat/test_analytical.R +++ b/tests/testthat/test_analytical.R @@ -1,11 +1,46 @@ context("Analytical solutions for coupled models") -test_that("The analytical solution of SFO-SFO is correct", { - f_sfo_sfo.ff.analytical <- mkinfit(SFO_SFO.ff, - subset(FOCUS_2006_D, value != 0), - quiet = TRUE) +test_that("The analytical solutions of SFO-SFO are correct", { + # No sink, no formation fractions + SFO_SFO_nosink <- mkinmod( + parent = mkinsub("SFO", to = "m1", sink = FALSE), + m1 = mkinsub("SFO"), + use_of_ff = "min", quiet = TRUE) + f_sfo_sfo_nosink <- mkinfit(SFO_SFO_nosink, FOCUS_D, quiet = TRUE) + f_sfo_sfo_nosink_deSolve <- mkinfit(SFO_SFO_nosink, FOCUS_D, + solution_type = "deSolve", quiet = TRUE) + expect_equal( + parms(f_sfo_sfo_nosink), + parms(f_sfo_sfo_nosink_deSolve) + ) + + # No sink, with formation fractions + SFO_SFO.ff_nosink <- mkinmod( + parent = mkinsub("SFO", to = "m1", sink = FALSE), + m1 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) + f_sfo_sfo_nosink <- mkinfit(SFO_SFO.ff_nosink, FOCUS_D, quiet = TRUE) + f_sfo_sfo_nosink_deSolve <- mkinfit(SFO_SFO.ff_nosink, FOCUS_D, + solution_type = "deSolve", quiet = TRUE) + expect_equal( + parms(f_sfo_sfo_nosink), + parms(f_sfo_sfo_nosink_deSolve) + ) + + # Without formation fraction + f_sfo_sfo_analytical <- mkinfit(SFO_SFO, FOCUS_D, + solution_type = "analytical", quiet = TRUE) + expect_equal( + parms(f_sfo_sfo_analytical), + parms(f_sfo_sfo_desolve) + ) + + # With formation fraction + f_sfo_sfo.ff_desolve <- mkinfit(SFO_SFO.ff, FOCUS_D, + solution_type = "deSolve", quiet = TRUE) expect_equal( parms(f_sfo_sfo.ff), - parms(f_sfo_sfo.ff.analytical) + parms(f_sfo_sfo.ff_desolve) ) + }) |