Skip to content
Snippets Groups Projects
Commit 2b8daac7 authored by Ian Bell's avatar Ian Bell
Browse files

Add B12

parent 98580c31
No related branches found
No related tags found
No related merge requests found
......@@ -179,6 +179,17 @@ auto get_Bnvir(const Model& model, const TType T, const ContainerType& molefrac)
return o;
}
template <typename Model, typename TType, typename ContainerType>
typename ContainerType::value_type get_B12vir(const Model& model, const TType T, const ContainerType& molefrac) {
auto B2 = get_B2vir(model, T, molefrac); // Overall B2 for mixture
auto B20 = get_B2vir(model, T, std::valarray<double>({ 1,0 })); // Pure first component with index 0
auto B21 = get_B2vir(model, T, std::valarray<double>({ 0,1 })); // Pure second component with index 1
auto z0 = molefrac[0];
auto B12 = (B2 - z0*z0*B20 - (1-z0)*(1-z0)*B21)/(2*z0*(1-z0));
return B12;
}
/***
* \brief Calculate the residual entropy (s^+ = -sr/R) from derivatives of alphar
*/
......
......@@ -145,4 +145,11 @@ TEST_CASE("Trace critical locus for vdW", "[vdW][crit]")
std::string filename = "";
trace_critical_arclength_binary(vdW, T0, rhovec0, filename);
auto tic1 = std::chrono::steady_clock::now();
}
TEST_CASE("TEST B12", "") {
const auto model = build_vdW();
const double T = 298.15;
const std::valarray<double> molefrac = { 1/3, 2/3 };
auto B12 = get_B12vir(model, T, molefrac);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment