37{
38 const char * argv[2] = {"foo", "\0"};
39
40
42 auto * factory = &app->getFactory();
43 std::string mesh_type = "MeshGeneratorMesh";
44
45 std::shared_ptr<MeshGeneratorMesh>
mesh;
46 {
49 }
50
51 app->actionWarehouse().mesh() =
mesh;
52
53 {
54 std::unique_ptr<MeshBase> lm_mesh;
55 InputParameters params = factory->getValidParams(
"GeneratedMeshGenerator");
56 params.
set<
unsigned int>(
"nx") = 2;
57 params.
set<
unsigned int>(
"ny") = 2;
59 auto mesh_gen =
61 lm_mesh = mesh_gen->generate();
62 mesh->setMeshBase(std::move(lm_mesh));
63 }
64
65 mesh->prepare(
nullptr);
67 mesh->setCoordSystem({}, coord_type_enum);
68 mesh->buildFiniteVolumeInfo();
69 mesh->computeFiniteVolumeCoords();
70 const auto & all_fi =
mesh->allFaceInfo();
71
72
74 "u");
75
76
77 for (auto & fi : all_fi)
78 {
79 const auto & face_center = fi.faceCentroid();
81 -
sin(face_center(0)) *
cos(face_center(1)),
cos(face_center(0)) *
sin(face_center(1)), 0);
82 }
83
84
85 for (auto & fi : all_fi)
86 {
87 const auto & face_center = fi.faceCentroid();
89 &fi, Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr};
90
92
93 EXPECT_NEAR(result(0), -
sin(face_center(0)) *
cos(face_center(1)), 1e-14);
94 EXPECT_NEAR(result(1),
cos(face_center(0)) *
sin(face_center(1)), 1e-14);
95 EXPECT_EQ(result(2), 0);
96 }
97
98
99
100 auto test_gradient = [&u](const auto & arg)
101 {
102 try
103 {
105 EXPECT_TRUE(false);
106 }
107 catch (std::runtime_error & e)
108 {
109 EXPECT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
110 }
111 };
112
113
114
115 auto test_evaluate = [&u](const auto & arg)
116 {
117 try
118 {
120 EXPECT_TRUE(false);
121 }
122 catch (std::runtime_error & e)
123 {
124 EXPECT_TRUE(std::string(e.what()).find("not implemented") != std::string::npos);
125 }
126 };
127
128
129
132 &all_fi[0], Moose::FV::LimiterType::CentralDifference, true, false, nullptr, nullptr};
133 const auto elem_arg =
ElemArg{all_fi[0].elemPtr(),
false};
134 const auto elem_qp_arg =
ElemQpArg({all_fi[0].elemPtr(), 0, &qrule,
Point(0)});
135 const auto elem_side_qp_arg =
ElemSideQpArg({all_fi[0].elemPtr(), 0, 0, &qrule,
Point(0)});
136 const auto elem_point_arg =
ElemPointArg({all_fi[0].elemPtr(),
Point(0),
false});
137
138 test_gradient(elem_arg);
139 test_gradient(face_arg);
140
141 test_evaluate(elem_qp_arg);
142 test_evaluate(elem_side_qp_arg);
143 test_evaluate(elem_point_arg);
144
145
147 unrestricted_error_test(*mesh, "not_restricted");
148 try
149 {
150 unrestricted_error_test(
151 FaceArg{&all_fi[2], LimiterType::CentralDifference,
true,
false,
nullptr,
nullptr},
153 EXPECT_TRUE(false);
154 }
155 catch (std::runtime_error & e)
156 {
157 EXPECT_TRUE(std::string(e.what()).find("not_restricted") != std::string::npos);
158 EXPECT_TRUE(std::string(e.what()).find("Make sure to fill") != std::string::npos);
159 }
160
162 restricted_error_test(*mesh, {1}, "is_restricted");
163 try
164 {
165 restricted_error_test(
166 FaceArg{&all_fi[2], LimiterType::CentralDifference,
true,
false,
nullptr,
nullptr},
168 EXPECT_TRUE(false);
169 }
170 catch (std::runtime_error & e)
171 {
172 EXPECT_TRUE(std::string(e.what()).find("is_restricted") != std::string::npos);
173 EXPECT_TRUE(std::string(e.what()).find("0") != std::string::npos);
174 EXPECT_TRUE(
175 std::string(e.what()).find(
176 "that subdomain id is not one of the subdomain ids the functor is restricted to") !=
177 std::string::npos);
178 }
179}
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