6#if defined(ENABLE_CATCH)
8# include <catch2/catch_all.hpp>
10# include "../Backends/Cubics/GeneralizedCubic.h"
18TEST_CASE(
"calc_all_terms matches term() for non-default alpha functions",
"[cubic_alpha]") {
19 const std::vector<double> tau_vals = {0.5, 0.7, 1.0, 1.3, 2.0};
21 SECTION(
"BasicMathiasCopemanAlphaFunction") {
23 const double omega = 0.152;
24 const double m = 0.37464 + 1.54226 * omega - 0.26992 * omega * omega;
25 const double a0 = 1.0;
26 const double Tr_over_Tci = 1.0;
28 for (
double tau : tau_vals) {
30 std::array<double, 5> terms;
31 alpha.calc_all_terms(tau, terms);
32 for (
int k = 0; k < 5; ++k) {
34 double ref = alpha.term(tau, k);
35 double rel = (ref != 0.0) ? std::abs(terms[k] - ref) / std::abs(ref) : std::abs(terms[k]);
41 SECTION(
"MathiasCopemanAlphaFunction") {
43 const double c1 = 0.8240, c2 = -0.4800, c3 = 0.6200;
44 const double a0 = 1.0;
45 const double Tr_over_Tci = 0.95;
47 for (
double tau : tau_vals) {
49 std::array<double, 5> terms;
50 alpha.calc_all_terms(tau, terms);
51 for (
int k = 0; k < 5; ++k) {
53 double ref = alpha.term(tau, k);
54 double rel = (ref != 0.0) ? std::abs(terms[k] - ref) / std::abs(ref) : std::abs(terms[k]);
60 SECTION(
"TwuAlphaFunction") {
62 const double L = 0.4692, M = 0.8610, N = 1.9127;
63 const double a0 = 1.0;
64 const double Tr_over_Tci = 1.0;
66 for (
double tau : tau_vals) {
68 std::array<double, 5> terms;
69 alpha.calc_all_terms(tau, terms);
70 for (
int k = 0; k < 5; ++k) {
72 double ref = alpha.term(tau, k);
73 double rel = (ref != 0.0) ? std::abs(terms[k] - ref) / std::abs(ref) : std::abs(terms[k]);
79 SECTION(
"TwuAlphaFunction - Tr_over_Tci != 1") {
80 const double L = 0.3000, M = 0.9200, N = 2.1000;
81 const double a0 = 1.5;
82 const double Tr_over_Tci = 0.85;
84 for (
double tau : tau_vals) {
86 std::array<double, 5> terms;
87 alpha.calc_all_terms(tau, terms);
88 for (
int k = 0; k < 5; ++k) {
90 double ref = alpha.term(tau, k);
91 double rel = (ref != 0.0) ? std::abs(terms[k] - ref) / std::abs(ref) : std::abs(terms[k]);