https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MoelansInterfaceFitsTest.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "gtest/gtest.h"
11
13
14using namespace MoelansInterfaceFits;
15
16TEST(MoelansInterfaceFitsTest, moelans2022Table1)
17{
18 // gamma values from Table 1 of N. Moelans, Mater. Des. 217, 110592 (2022), which are given to
19 // four decimals, with g^2 = sigma^2 / (kappa m)
20 struct Sample
21 {
22 Real sigma, kappa, m, gamma;
23 } samples[] = {{0.4, 0.36, 1.125, 5.1364},
24 {0.15, 0.36, 1.125, 0.6328},
25 {0.75, 0.6, 1.875, 13.7765},
26 {0.15, 0.6, 1.875, 0.5424}};
27
28 for (const auto & s : samples)
29 {
30 const Real g2 = s.sigma * s.sigma / (s.kappa * s.m);
31 EXPECT_NEAR(1.0 / inverseGamma(g2, Fit::MOELANS2022), s.gamma, 5e-5);
32 }
33}
34
35TEST(MoelansInterfaceFitsTest, gamma1p5)
36{
37 // gamma = 1.5 is the one case with analytical values, g^2 = 2/9 and f0_interf = 1/8; the
38 // tolerances reflect the accuracy of each fit there
39 EXPECT_NEAR(inverseGamma(2.0 / 9.0, Fit::MOELANS2022), 1.0 / 1.5, 1e-3);
40 EXPECT_NEAR(inverseGamma(2.0 / 9.0, Fit::MOELANS2009), 1.0 / 1.5, 1e-4);
41 EXPECT_NEAR(f0Interf(1.0 / 1.5, Fit::MOELANS2022), 0.125, 1e-3);
42 EXPECT_NEAR(f0Interf(1.0 / 1.5, Fit::MOELANS2009), 0.125, 1e-5);
43}
44
45TEST(MoelansInterfaceFitsTest, inRange)
46{
47 // the 2022 fit covers 0.098 <= g <= 0.766
48 EXPECT_FALSE(inRange(0.097 * 0.097, Fit::MOELANS2022));
49 EXPECT_TRUE(inRange(0.099 * 0.099, Fit::MOELANS2022));
50 EXPECT_TRUE(inRange(0.765 * 0.765, Fit::MOELANS2022));
51 EXPECT_FALSE(inRange(0.767 * 0.767, Fit::MOELANS2022));
52
53 // the 2009 fit is not range checked
54 EXPECT_TRUE(inRange(0.9, Fit::MOELANS2009));
55}
TEST(MoelansInterfaceFitsTest, moelans2022Table1)
Polynomial fits for the interface relations of the multi-order-parameter model of Moelans et al....
Real inverseGamma(Real g2, Fit fit)
1/gamma as a function of g^2
bool inRange(Real g2, Fit fit)
Whether g^2 lies within the range the fit was made for.
Real f0Interf(Real inverse_gamma, Fit fit)
f0_interf as a function of 1/gamma