https://mooseframework.inl.gov
Functions
Cartesian.C File Reference

Go to the source code of this file.

Functions

 TEST (FunctionalExpansionsTest, legendreConstructor)
 
 TEST (FunctionalExpansionsTest, legendreSeriesOrthonormalEvaluation)
 
 TEST (FunctionalExpansionsTest, legendreSeriesSqrtMuEvaluation)
 
 TEST (FunctionalExpansionsTest, legendreSeriesStandardEvaluation)
 
 TEST (FunctionalExpansionsTest, CartesianConstructor)
 
 TEST (FunctionalExpansionsTest, Cartesian3D)
 
 TEST (FunctionalExpansionsTest, functionalBasisInterfaceCartesian)
 

Function Documentation

◆ TEST() [1/7]

TEST ( FunctionalExpansionsTest  ,
legendreConstructor   
)

Definition at line 16 of file Cartesian.C.

17 {
18  const unsigned int order = 5;
19 
21  {order},
22  expansion_type = "orthonormal",
23  generation_type = "standard");
24  EXPECT_EQ(legendre.getOrder(0), order);
25 }
This class provides the algorithms and properties of the Legendre polynomial series.
Definition: Legendre.h:17
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
Real legendre(const unsigned int order, const Real x, const Real lower_bound=-1.0, const Real upper_bound=1.0)
Legendre polynomial of specified order.
MooseEnum generation_type

◆ TEST() [2/7]

TEST ( FunctionalExpansionsTest  ,
legendreSeriesOrthonormalEvaluation   
)

Definition at line 27 of file Cartesian.C.

28 {
29  const unsigned int order = 15;
30  Real location = -0.90922108754014;
31  const std::array<Real, order> truth = {{0.50000000000000,
32  -1.36383163131021,
33  1.85006119760378,
34  -1.80341832197563,
35  1.19175581122701,
36  -0.11669847057321,
37  -1.20462734483853,
38  2.48341349094950,
39  -3.41981864606651,
40  3.76808851494207,
41  -3.39261995754146,
42  2.30300489952095,
43  -0.66011244776270,
44  -1.24901920248131,
45  3.06342136027001}};
46 
48  {order},
49  expansion_type = "standard",
50  generation_type = "orthonormal");
51 
52  legendre.setLocation(Point(location));
53  auto & answer = legendre.getAllGeneration();
54  for (std::size_t i = 0; i < order; ++i)
55  EXPECT_NEAR(answer[i], truth[i], tol);
56 }
This class provides the algorithms and properties of the Legendre polynomial series.
Definition: Legendre.h:17
const double tol
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real legendre(const unsigned int order, const Real x, const Real lower_bound=-1.0, const Real upper_bound=1.0)
Legendre polynomial of specified order.
MooseEnum generation_type

◆ TEST() [3/7]

TEST ( FunctionalExpansionsTest  ,
legendreSeriesSqrtMuEvaluation   
)

Definition at line 58 of file Cartesian.C.

59 {
60  const unsigned int order = 15;
61  Real location = -0.90922108754014;
62  const std::array<Real, order> truth = {{0.50000000000000,
63  -1.36383163131021,
64  1.85006119760378,
65  -1.80341832197563,
66  1.19175581122701,
67  -0.11669847057321,
68  -1.20462734483853,
69  2.48341349094950,
70  -3.41981864606651,
71  3.76808851494207,
72  -3.39261995754146,
73  2.30300489952095,
74  -0.66011244776270,
75  -1.24901920248131,
76  3.06342136027001}};
77 
79  {order},
80  expansion_type = "standard",
81  generation_type = "sqrt_mu");
82 
83  legendre.setLocation(Point(location));
84  auto & answer = legendre.getAllGeneration();
85  for (std::size_t i = 0; i < order; ++i)
86  EXPECT_NEAR(answer[i], truth[i] / std::sqrt(i + 0.5), tol);
87 }
This class provides the algorithms and properties of the Legendre polynomial series.
Definition: Legendre.h:17
const double tol
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real legendre(const unsigned int order, const Real x, const Real lower_bound=-1.0, const Real upper_bound=1.0)
Legendre polynomial of specified order.
MooseEnum generation_type

◆ TEST() [4/7]

TEST ( FunctionalExpansionsTest  ,
legendreSeriesStandardEvaluation   
)

Definition at line 89 of file Cartesian.C.

90 {
91  const unsigned int order = 15;
92  Real location = -0.90922108754014;
93  const std::array<Real, order> truth = {{0.50000000000000,
94  -1.36383163131021,
95  1.85006119760378,
96  -1.80341832197563,
97  1.19175581122701,
98  -0.11669847057321,
99  -1.20462734483853,
100  2.48341349094950,
101  -3.41981864606651,
102  3.76808851494207,
103  -3.39261995754146,
104  2.30300489952095,
105  -0.66011244776270,
106  -1.24901920248131,
107  3.06342136027001}};
108 
110  {order},
111  expansion_type = "standard",
112  generation_type = "standard");
113 
114  legendre.setLocation(Point(location));
115  auto & answer = legendre.getAllGeneration();
116  for (std::size_t i = 0; i < order; ++i)
117  EXPECT_NEAR(answer[i], truth[i] / (i + 0.5), tol);
118 }
This class provides the algorithms and properties of the Legendre polynomial series.
Definition: Legendre.h:17
const double tol
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real legendre(const unsigned int order, const Real x, const Real lower_bound=-1.0, const Real upper_bound=1.0)
Legendre polynomial of specified order.
MooseEnum generation_type

◆ TEST() [5/7]

TEST ( FunctionalExpansionsTest  ,
CartesianConstructor   
)

Definition at line 120 of file Cartesian.C.

121 {
122  std::vector<MooseEnum> domains;
123  std::vector<std::size_t> orders;
124  std::vector<MooseEnum> series;
125  expansion_type = "standard";
126  generation_type = "orthonormal";
127 
128  domains.push_back(FunctionalBasisInterface::_domain_options = "x");
129  orders = {19};
130  series.push_back(single_series_types_1D = "Legendre");
131  Cartesian legendreOne(domains, orders, series, name, expansion_type, generation_type);
132  EXPECT_EQ(legendreOne.getNumberOfTerms(), orders[0] + 1);
133 
134  domains.push_back(FunctionalBasisInterface::_domain_options = "y");
135  orders = {{13, 15}};
136  series.push_back(single_series_types_1D = "Legendre");
137  Cartesian legendreTwo(domains, orders, series, name, expansion_type, generation_type);
138  EXPECT_EQ(legendreTwo.getNumberOfTerms(), (orders[0] + 1) * (orders[1] + 1));
139 
140  domains.push_back(FunctionalBasisInterface::_domain_options = "z");
141  orders = {{14, 21, 22}};
142  series.push_back(single_series_types_1D = "Legendre");
143  Cartesian legendreThree(domains, orders, series, name, expansion_type, generation_type);
144  EXPECT_EQ(legendreThree.getNumberOfTerms(), (orders[0] + 1) * (orders[1] + 1) * (orders[2] + 1));
145 }
This class constructs a functional expansion using a separate series for each Cartesian dimension...
Definition: Cartesian.h:18
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
MooseEnum single_series_types_1D
const std::string name
Definition: Setup.h:20
MooseEnum generation_type

◆ TEST() [6/7]

TEST ( FunctionalExpansionsTest  ,
Cartesian3D   
)

Definition at line 147 of file Cartesian.C.

148 {
149  const std::vector<MooseEnum> domains = {FunctionalBasisInterface::_domain_options = "x",
152  const std::vector<std::size_t> orders = {14, 21, 22};
153  const std::vector<MooseEnum> series = {single_series_types_1D = "Legendre",
154  single_series_types_1D = "Legendre",
155  single_series_types_1D = "Legendre"};
156 
157  Cartesian legendre3D(
158  domains, orders, series, name, expansion_type = "standard", generation_type = "orthonormal");
159 
160  const std::vector<Point> locations = {
161  Point(-0.14854612627465, 0.60364074055275, 0.76978431165674),
162  Point(0.93801805187856, 0.74175118177279, 0.74211345600994),
163  Point(0.35423736896098, -0.83921049062126, -0.02231845586669)};
164  const std::vector<Real> standard_truth = {1.32257143058688, 3.68047786932034, 0.17515811557416};
165  const std::vector<Real> orthogonal_truth = {
166  -2.33043696271172, 74.48747654183713, -14.48091828923379};
167 
168  for (std::size_t i = 0; i < locations.size(); ++i)
169  {
170  legendre3D.setLocation(locations[i]);
171  EXPECT_NEAR(legendre3D.getExpansionSeriesSum(), standard_truth[i], tol);
172  EXPECT_NEAR(legendre3D.getGenerationSeriesSum(), orthogonal_truth[i], tol);
173  }
174 }
This class constructs a functional expansion using a separate series for each Cartesian dimension...
Definition: Cartesian.h:18
const double tol
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
MooseEnum single_series_types_1D
const std::string name
Definition: Setup.h:20
MooseEnum generation_type

◆ TEST() [7/7]

TEST ( FunctionalExpansionsTest  ,
functionalBasisInterfaceCartesian   
)

Definition at line 176 of file Cartesian.C.

177 {
178  const std::vector<MooseEnum> domains = {FunctionalBasisInterface::_domain_options = "x",
181  const std::vector<std::size_t> orders = {4, 5, 3};
182  const std::vector<MooseEnum> series = {single_series_types_1D = "Legendre",
183  single_series_types_1D = "Legendre",
184  single_series_types_1D = "Legendre"};
185 
186  Cartesian legendre3D(
187  domains, orders, series, name, expansion_type = "standard", generation_type = "orthonormal");
188 
189  const Point location(-0.38541903411291, 0.61369802505416, -0.04539307255549);
190  const Real truth = 0.26458908225718;
191  FunctionalBasisInterface & interface = (FunctionalBasisInterface &)legendre3D;
192 
193  interface.setLocation(location);
194  EXPECT_NEAR(interface.getExpansionSeriesSum(), truth, tol);
195 }
This class constructs a functional expansion using a separate series for each Cartesian dimension...
Definition: Cartesian.h:18
const double tol
static MooseEnum _domain_options
An enumeration of the domains available to each functional series.
MooseEnum expansion_type
MooseEnum single_series_types_1D
const std::string name
Definition: Setup.h:20
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void setLocation(const Point &point)=0
Set the location that will be used by the series to compute values.
MooseEnum generation_type
This class provides the basis for any custom functional basis, and is the parent class of both Single...