10 #include "gtest/gtest.h" 16 TEST(FunctionalExpansionsTest, zernikeConstructor)
18 const unsigned int order = 5;
26 EXPECT_EQ(zernike.getOrder(0), order);
29 TEST(FunctionalExpansionsTest, zernikeSeriesEvaluationXY)
31 const unsigned int order = 4;
32 const Point location(-0.90922108754014, 0.262698547343, 0.156796889218);
42 const std::array<Real, 15> truth = {{0.318309886183791,
58 auto & answer = zernike.getAllGeneration();
59 for (std::size_t i = 0; i < zernike.getNumberOfTerms(); ++i)
60 EXPECT_NEAR(answer[i], truth[i],
tol);
63 TEST(FunctionalExpansionsTest, zernikeSeriesEvaluationXZ)
65 const unsigned int order = 4;
66 const Point location(-0.90922108754014, 0.262698547343, 0.156796889218);
76 const std::array<Real, 15> truth = {{0.318309886183791,
92 auto & answer = zernike.getAllGeneration();
93 for (std::size_t i = 0; i < zernike.getNumberOfTerms(); ++i)
94 EXPECT_NEAR(answer[i], truth[i],
tol);
97 TEST(FunctionalExpansionsTest, zernikeSeriesEvaluationYZ)
99 const unsigned int order = 4;
100 const Point location(-0.90922108754014, 0.262698547343, 0.156796889218);
110 const std::array<Real, 15> truth = {{0.318309886183791,
126 auto & answer = zernike.getAllGeneration();
127 for (std::size_t i = 0; i < zernike.getNumberOfTerms(); ++i)
128 EXPECT_NEAR(answer[i], truth[i],
tol);
131 TEST(FunctionalExpansionsTest, zernikeSeriesSqrtMuEvaluation)
133 const unsigned int order = 4;
134 const Point location(-0.90922108754014, 0.262698547343, 0.156796889218);
144 const std::array<Real, 15> truth = {{0.318309886183791,
160 auto & answer = zernike.getAllGeneration();
161 EXPECT_NEAR(answer[0], truth[0] * std::sqrt(M_PI),
tol);
163 for (
size_t n = 1; n < order + 1; ++n)
165 for (
size_t m = 0; m < n + 1; ++m)
167 if (m != 0 && n / m == 2 && n % m == 0)
168 EXPECT_NEAR(answer[i], truth[i] * std::sqrt(M_PI / (n + 1)),
tol);
170 EXPECT_NEAR(answer[i], truth[i] * std::sqrt(M_PI / (2 * n + 2)),
tol);
176 TEST(FunctionalExpansionsTest, zernikeSeriesStandardEvaluation)
178 const unsigned int order = 4;
179 const Point location(-0.90922108754014, 0.262698547343, 0.156796889218);
189 const std::array<Real, 15> truth = {{0.318309886183791,
205 auto & answer = zernike.getAllGeneration();
206 EXPECT_NEAR(answer[0], truth[0] * M_PI,
tol);
208 for (
size_t n = 1; n < order + 1; ++n)
210 for (
size_t m = 0; m < n + 1; ++m)
212 if (m != 0 && n / m == 2 && n % m == 0)
213 EXPECT_NEAR(answer[i], truth[i] * M_PI / (n + 1),
tol);
215 EXPECT_NEAR(answer[i], truth[i] * M_PI / (2 * n + 2),
tol);
221 TEST(FunctionalExpansionsTest, cylindricalDuoConstructorAxialX)
226 const std::vector<std::size_t> orders = {5, 18};
234 (orders[0] + 1) * ((orders[1] + 1) * (orders[1] + 2)) / 2);
237 TEST(FunctionalExpansionsTest, cylindricalDuoConstructorAxialY)
242 const std::vector<std::size_t> orders = {23, 8};
250 (orders[0] + 1) * ((orders[1] + 1) * (orders[1] + 2)) / 2);
253 TEST(FunctionalExpansionsTest, cylindricalDuoConstructorAxialZ)
258 const std::vector<std::size_t> orders = {21, 23};
266 (orders[0] + 1) * ((orders[1] + 1) * (orders[1] + 2)) / 2);
269 TEST(FunctionalExpansionsTest, cylindricalDuoEvaluator)
274 const std::vector<std::size_t> orders = {15, 17};
282 const std::vector<Point> locations = {
283 Point(-0.14854612627465, 0.60364074055275, 0.76978431165674),
284 Point(0.93801805187856, 0.74175118177279, 0.45207131996044),
285 Point(0.35423736896098, -0.83921049062126, -0.02231845586669)};
286 const std::vector<Real> standard_truth = {
287 0.42889689399543629, 4.3724388003439207, 0.82275646257084989};
288 const std::vector<Real> orthogonal_truth = {
289 -10.386457517518826, -161.7959192066881, -3.9949571266605481};
291 for (std::size_t i = 0; i < locations.size(); ++i)
299 TEST(FunctionalExpansionsTest, functionalBasisInterfaceCylindrical)
304 const std::vector<std::size_t> orders = {4, 5};
312 const Point location(-0.38541903411291, 0.61369802505416, -0.04539307255549);
313 const Real truth = 0.10414963426362565;
317 EXPECT_NEAR(interface.getExpansionSeriesSum(), truth,
tol);
MooseEnum single_series_types_2D
This class provides the algorithms and properties of the Zernike polynomial series.
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
Real getGenerationSeriesSum()
Gets the sum of all terms in the generation functional basis.
MooseEnum single_series_types_1D
virtual void setLocation(const Point &p) final
Set the location that will be used by the series to compute values.
This class constructs a functional expansion in cylindrical space using a 1D series for the axial dir...
Real getExpansionSeriesSum()
Evaluates the sum of all terms in the expansion functional basis up to #_order.
virtual void setLocation(const Point &point) final
Set the location that will be used by the series to compute values.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::size_t getNumberOfTerms() const
Returns the number of terms in the series.
TEST(FunctionalExpansionsTest, zernikeConstructor)
MooseEnum generation_type
This class provides the basis for any custom functional basis, and is the parent class of both Single...