36{
37 const char * argv[2] = {"foo", "\0"};
38
39
41 auto * factory = &app->getFactory();
42 std::string mesh_type = "MeshGeneratorMesh";
43
44 std::shared_ptr<MeshGeneratorMesh>
mesh;
45 {
48 }
49
50 app->actionWarehouse().mesh() =
mesh;
51
52 {
53 std::unique_ptr<MeshBase> lm_mesh;
54 InputParameters params = factory->getValidParams(
"GeneratedMeshGenerator");
55 params.
set<
unsigned int>(
"nx") = 2;
56 params.
set<
unsigned int>(
"ny") = 2;
58 auto mesh_gen =
60 lm_mesh = mesh_gen->generate();
61 mesh->setMeshBase(std::move(lm_mesh));
62 }
63
66 mesh->setCoordSystem({}, coord_type_enum);
67 mesh->buildFiniteVolumeInfo();
68 mesh->computeFiniteVolumeCoords();
69 const auto & all_fi =
mesh->allFaceInfo();
70
71
73 "u");
74
75
76 for (auto & fi : all_fi)
77 {
78 const auto & face_center = fi.faceCentroid();
80 -
sin(face_center(0)) *
cos(face_center(1)),
cos(face_center(0)) *
sin(face_center(1)), 0);
81 }
82
83
84 for (auto & fi : all_fi)
85 {
86 const auto & face_center = fi.faceCentroid();
88 &fi, Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr};
89
91
92 EXPECT_NEAR(result(0), -
sin(face_center(0)) *
cos(face_center(1)), 1e-14);
93 EXPECT_NEAR(result(1),
cos(face_center(0)) *
sin(face_center(1)), 1e-14);
94 EXPECT_EQ(result(2), 0);
95 }
96
97
98
99 auto test_gradient = [&u](const auto & arg)
100 {
101 try
102 {
104 EXPECT_TRUE(false);
105 }
106 catch (std::runtime_error & e)
107 {
108 EXPECT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
109 }
110 };
111
112
113
114 auto test_evaluate = [&u](const auto & arg)
115 {
116 try
117 {
119 EXPECT_TRUE(false);
120 }
121 catch (std::runtime_error & e)
122 {
123 EXPECT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
124 }
125 };
126
127
128
129 QGauss qrule(1, CONSTANT);
131 &all_fi[0], Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr};
132 const auto elem_arg =
ElemArg{all_fi[0].elemPtr(),
false};
133 const auto elem_qp_arg =
ElemQpArg({all_fi[0].elemPtr(), 0, &qrule, Point(0)});
134 const auto elem_side_qp_arg =
ElemSideQpArg({all_fi[0].elemPtr(), 0, 0, &qrule, Point(0)});
135 const auto elem_point_arg =
ElemPointArg({all_fi[0].elemPtr(), Point(0),
false});
136
137 test_gradient(elem_arg);
138 test_gradient(face_arg);
139
140 test_evaluate(elem_qp_arg);
141 test_evaluate(elem_side_qp_arg);
142 test_evaluate(elem_point_arg);
143
144
146 unrestricted_error_test(*mesh, "not_restricted");
147 try
148 {
149 unrestricted_error_test(
150 FaceArg{&all_fi[2], LimiterType::CentralDifference,
true,
false,
nullptr,
nullptr},
152 EXPECT_TRUE(false);
153 }
154 catch (std::runtime_error & e)
155 {
156 EXPECT_TRUE(std::string(e.what()).find("not_restricted") != std::string::npos);
157 EXPECT_TRUE(std::string(e.what()).find("Make sure to fill") != std::string::npos);
158 }
159
161 restricted_error_test(*mesh, {1}, "is_restricted");
162 try
163 {
164 restricted_error_test(
165 FaceArg{&all_fi[2], LimiterType::CentralDifference,
true,
false,
nullptr,
nullptr},
167 EXPECT_TRUE(false);
168 }
169 catch (std::runtime_error & e)
170 {
171 EXPECT_TRUE(std::string(e.what()).find("is_restricted") != std::string::npos);
172 EXPECT_TRUE(std::string(e.what()).find("0") != std::string::npos);
173 EXPECT_TRUE(
174 std::string(e.what()).find(
175 "that subdomain id is not one of the subdomain ids the functor is restricted to") !=
176 std::string::npos);
177 }
178}
A functor whose evaluation relies on querying a map where the keys are face info ids and the values c...
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sin(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tan
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template cos(_arg) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(cos
std::unique_ptr< MooseApp > createMooseApp(const std::string &default_app_type, int argc, char *argv[])
VectorValue< Real > RealVectorValue