Loading [MathJax]/jax/output/HTML-CSS/config.js
PolyFEM
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StokesProblem.cpp
Go to the documentation of this file.
1#include "StokesProblem.hpp"
2
4
5namespace polyfem
6{
7 using namespace utils;
8
9 namespace problem
10 {
11 namespace
12 {
13 // https://math.stackexchange.com/questions/101480/are-there-other-kinds-of-bump-functions-than-e-frac1x2-1
14 double bump(double r)
15 {
16 const auto f = [](double x) { return x <= 0 ? 0 : exp(-1. / x); };
17 const auto g = [&f](double x) { return f(x) / (f(x) + f(1. - x)); };
18 const auto h = [&g](double x) { return g(x - 1); };
19 const auto k = [&h](double x) { return h(x * x); };
20 return 1 - k(r);
21 }
22 } // namespace
23
25 : Problem(name)
26 {
27 is_time_dependent_ = false;
28 }
29
31 {
32 if (params.find("time_dependent") != params.end())
33 {
34 is_time_dependent_ = params["time_dependent"];
35 }
36 }
37
38 void TimeDepentendStokesProblem::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
39 {
40 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
41 // val = Eigen::MatrixXd::Ones(pts.rows(), pts.cols())*(1 - exp(-5 * 0.01));
42 }
43
44 ConstantVelocity::ConstantVelocity(const std::string &name)
46 {
47 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
48 }
49
50 void ConstantVelocity::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
51 {
52 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
53 }
54
55 void ConstantVelocity::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
56 {
57 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
58
59 for (long i = 0; i < pts.rows(); ++i)
60 {
61 if (mesh.get_boundary_id(global_ids(i)) != 7)
62 {
63 val(i, 1) = 1;
64 }
65 }
66
67 // val *= t;
68
69 // if (is_time_dependent_)
70 // val *= (1 - exp(-5 * t));
71 }
72
73 TwoSpheres::TwoSpheres(const std::string &name)
75 {
76 // boundary_ids_ = {1};
77 }
78
79 void TwoSpheres::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
80 {
81 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
82 }
83
84 void TwoSpheres::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
85 {
86 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
87 }
88
89 void TwoSpheres::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
90 {
91 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
92
93 for (int i = 0; i < pts.rows(); ++i)
94 {
95 if (pts.cols() == 2)
96 {
97 const double r1 = sqrt((pts(i, 0) - 0.04) * (pts(i, 0) - 0.04) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2));
98 const double r2 = sqrt((pts(i, 0) - 0.16) * (pts(i, 0) - 0.16) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2));
99
100 val(i, 0) = 0.05 * bump(r1 * 70) - 0.05 * bump(r2 * 70);
101 }
102 else
103 {
104 const double r1 = sqrt((pts(i, 0) - 0.04) * (pts(i, 0) - 0.04) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2) + (pts(i, 2) - 0.2) * (pts(i, 2) - 0.2));
105 const double r2 = sqrt((pts(i, 0) - 0.16) * (pts(i, 0) - 0.16) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2) + (pts(i, 2) - 0.2) * (pts(i, 2) - 0.2));
106
107 val(i, 0) = 0.05 * bump(r1 * 70) - 0.05 * bump(r2 * 70);
108 }
109 }
110 }
111
112 void TwoSpheres::initial_density(const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
113 {
114 val = Eigen::MatrixXd::Zero(pts.rows(), 1);
115 for (int i = 0; i < pts.rows(); ++i)
116 {
117 const double x = pts(i, 0);
118 const double y = pts(i, 1);
119
120 if (pts.cols() == 2)
121 {
122 const double r1 = sqrt((pts(i, 0) - 0.04) * (pts(i, 0) - 0.04) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2));
123 const double r2 = sqrt((pts(i, 0) - 0.16) * (pts(i, 0) - 0.16) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2));
124
125 val(i, 0) = bump(r1 * 70) + bump(r2 * 70);
126 }
127 else
128 {
129 const double r1 = sqrt((pts(i, 0) - 0.04) * (pts(i, 0) - 0.04) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2) + (pts(i, 2) - 0.2) * (pts(i, 2) - 0.2));
130 const double r2 = sqrt((pts(i, 0) - 0.16) * (pts(i, 0) - 0.16) + (pts(i, 1) - 0.2) * (pts(i, 1) - 0.2) + (pts(i, 2) - 0.2) * (pts(i, 2) - 0.2));
131
132 val(i, 0) = bump(r1 * 70) + bump(r2 * 70);
133 }
134 }
135 }
136
137 DrivenCavity::DrivenCavity(const std::string &name)
139 {
140 // boundary_ids_ = {1};
141 }
142
143 void DrivenCavity::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
144 {
145 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
146 }
147
148 void DrivenCavity::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
149 {
150 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
151
152 for (long i = 0; i < pts.rows(); ++i)
153 {
154 if (mesh.get_boundary_id(global_ids(i)) == 4)
155 val(i, 0) = 1;
156 // else if(mesh.get_boundary_id(global_ids(i))== 3)
157 // val(i, 1)=-0.25;
158 }
159
161 // val *= (1 - exp(-5 * t));
162 {
163 if (t < 1)
164 val *= sin(M_PI * t / 2);
165 }
166 }
167
168 DrivenCavityC0::DrivenCavityC0(const std::string &name)
170 {
171 // boundary_ids_ = {1};
172 }
173
174 void DrivenCavityC0::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
175 {
176 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
177 }
178
179 void DrivenCavityC0::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
180 {
181 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
182
183 for (long i = 0; i < pts.rows(); ++i)
184 {
185 if (pts.cols() == 2)
186 {
187 if (mesh.get_boundary_id(global_ids(i)) == 4)
188 {
189 const double x = pts(i, 0);
190 val(i, 0) = 4 * x * (1 - x);
191 }
192 }
193 }
194
196 // val *= (1 - exp(-5 * t));
197 {
198 if (t < 1)
199 val *= sin(M_PI * t / 2);
200 }
201 }
202
205 {
206 // boundary_ids_ = {1};
207 }
208
209 void DrivenCavitySmooth::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
210 {
211 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
212 }
213
214 void DrivenCavitySmooth::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
215 {
216 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
217
218 for (long i = 0; i < pts.rows(); ++i)
219 {
220 if (pts.cols() == 2)
221 {
222 if (mesh.get_boundary_id(global_ids(i)) == 4)
223 {
224 const double x = pts(i, 0);
225 if (x < 0.02 || x > 1 - 0.02)
226 val(i, 0) = 0;
227 else
228 val(i, 0) = 50 * exp(1. / ((x - 0.5) * (x - 0.5) - 0.25));
229 }
230 }
231 }
232
234 // val *= (1 - exp(-5 * t));
235 {
236 if (t < 1)
237 val *= sin(M_PI * t / 2);
238 }
239 }
240
241 Flow::Flow(const std::string &name)
243 {
244 boundary_ids_ = {1, 3, 7};
245 inflow_ = 1;
246 outflow_ = 3;
247 flow_dir_ = 0;
248
249 inflow_amout_ = 0.25;
250 outflow_amout_ = 0.25;
251 }
252
253 void Flow::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
254 {
255 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
256 }
257
258 void Flow::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
259 {
260 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
261
262 for (long i = 0; i < pts.rows(); ++i)
263 {
264 if (mesh.get_boundary_id(global_ids(i)) == inflow_)
266 else if (mesh.get_boundary_id(global_ids(i)) == outflow_)
268 }
269
271 val *= (1 - exp(-5 * t));
272 }
273
274 void Flow::set_parameters(const json &params)
275 {
277
278 if (params.find("inflow") != params.end())
279 {
280 inflow_ = params["inflow"];
281 }
282
283 if (params.find("outflow") != params.end())
284 {
285 outflow_ = params["outflow"];
286 }
287
288 if (params.find("inflow_amout") != params.end())
289 {
290 inflow_amout_ = params["inflow_amout"];
291 }
292
293 if (params.find("outflow_amout") != params.end())
294 {
295 outflow_amout_ = params["outflow_amout"];
296 }
297
298 if (params.find("direction") != params.end())
299 {
300 flow_dir_ = params["direction"];
301 }
302
303 boundary_ids_.clear();
304
305 if (params.find("obstacle") != params.end())
306 {
307 const auto obstacle = params["obstacle"];
308 if (obstacle.is_array())
309 {
310 for (size_t k = 0; k < obstacle.size(); ++k)
311 {
312 const auto tmp = obstacle[k];
313 if (tmp.is_string())
314 {
315 const std::string tmps = tmp;
316 const auto endings = StringUtils::split(tmps, ":");
317 assert(endings.size() == 2);
318 const int start = atoi(endings[0].c_str());
319 const int end = atoi(endings[1].c_str());
320
321 for (int i = start; i <= end; ++i)
322 boundary_ids_.push_back(i);
323 }
324 else
325 boundary_ids_.push_back(tmp);
326 }
327 }
328 }
329
330 boundary_ids_.push_back(inflow_);
331 boundary_ids_.push_back(outflow_);
332
333 std::sort(boundary_ids_.begin(), boundary_ids_.end());
334 auto it = std::unique(boundary_ids_.begin(), boundary_ids_.end());
335 boundary_ids_.resize(std::distance(boundary_ids_.begin(), it));
336 }
337
338 FlowWithObstacle::FlowWithObstacle(const std::string &name)
340 {
341 boundary_ids_ = {1, 2, 4, 5, 6, 7};
343 U_ = 1.5;
344 }
345
346 void FlowWithObstacle::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
347 {
348 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
349 }
350
351 void FlowWithObstacle::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
352 {
353 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
354
355 for (long i = 0; i < pts.rows(); ++i)
356 {
357 if (pts.cols() == 2)
358 {
359 if (mesh.get_boundary_id(global_ids(i)) == 1)
360 {
361 const double y = pts(i, 1);
362 val(i, 0) = U_ * 4 * y * (0.41 - y) / (0.41 * 0.41);
363 }
364 }
365 else
366 {
367 if (mesh.get_boundary_id(global_ids(i)) == 1)
368 {
369 const double y = pts(i, 1);
370 const double z = pts(i, 2);
371 val(i, 0) = U_ * 4 * y * (0.41 - y) / (0.41 * 0.41) * 4 * z * (0.41 - z) / (0.41 * 0.41);
372 }
373 }
374 }
375
377 val *= (1 - exp(-5 * t));
378 }
379
381 {
383
384 if (params.find("U") != params.end())
385 {
386 U_ = params["U"];
387 }
388 }
389
390 Kovnaszy::Kovnaszy(const std::string &name)
391 : Problem(name), viscosity_(1)
392 {
393 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
394 is_time_dependent_ = false;
395 }
396
397 void Kovnaszy::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
398 {
399 exact(pts, 0, val);
400 }
401
402 void Kovnaszy::set_parameters(const json &params)
403 {
404 if (params.count("viscosity"))
405 {
406 viscosity_ = params["viscosity"];
407 }
408 if (params.find("time_dependent") != params.end())
409 {
410 is_time_dependent_ = params["time_dependent"];
411 }
412 }
413
414 void Kovnaszy::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
415 {
416 val.resize(pts.rows(), pts.cols());
417 const double a = 0.5 / viscosity_ - sqrt(0.25 / viscosity_ / viscosity_ + 4 * M_PI * M_PI);
418 for (int i = 0; i < pts.rows(); ++i)
419 {
420 const double x = pts(i, 0);
421 const double y = pts(i, 1);
422
423 if (pts.cols() == 2)
424 {
425 val(i, 0) = 1 - exp(a * x) * cos(2 * M_PI * y);
426 val(i, 1) = a * exp(a * x) * sin(2 * M_PI * y) / (2 * M_PI);
427 }
428 else
429 {
430 val(i, 0) = 1 - exp(a * x) * cos(2 * M_PI * y);
431 val(i, 1) = a * exp(a * x) * sin(2 * M_PI * y) / (2 * M_PI);
432 val(i, 2) = 0;
433 }
434 }
435 }
436
437 void Kovnaszy::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
438 {
439 val.resize(pts.rows(), pts.cols() * pts.cols());
440 const double a = 0.5 / viscosity_ - sqrt(0.25 / viscosity_ / viscosity_ + 4 * M_PI * M_PI);
441 for (int i = 0; i < pts.rows(); ++i)
442 {
443 const double x = pts(i, 0);
444 const double y = pts(i, 1);
445
446 val(i, 0) = -a * exp(a * x) * cos(2 * M_PI * y);
447 val(i, 1) = 2 * M_PI * exp(a * x) * sin(2 * M_PI * y);
448 val(i, 2) = a * a * exp(a * x) * sin(2 * M_PI * y) / (2 * M_PI);
449 val(i, 3) = a * exp(a * x) * cos(2 * M_PI * y);
450 }
451 }
452
453 void Kovnaszy::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
454 {
455 val.resize(pts.rows(), pts.cols());
456 val.setZero();
457 }
458
459 void Kovnaszy::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
460 {
461 exact(pts, t, val);
462 }
463
464 CornerFlow::CornerFlow(const std::string &name)
466 {
467 boundary_ids_ = {1, 2, 4, 7};
469 U_ = 1.5;
470 }
471
472 void CornerFlow::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
473 {
474 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
475 }
476
477 void CornerFlow::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
478 {
479 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
480
481 for (long i = 0; i < pts.rows(); ++i)
482 {
483 if (mesh.get_boundary_id(global_ids(i)) == 2)
484 {
485 const double x = pts(i, 0);
486 const double y = pts(i, 1);
487 val(i, 1) = U_ * 4 * x * (0.5 - x) / 0.5 / 0.5;
488 // val(i, 1) = U_;
489 }
490 }
491
493 val *= (1 - exp(-5 * t));
494 }
495
497 {
499
500 if (params.find("U") != params.end())
501 {
502 U_ = params["U"];
503 }
504 if (params.find("time_dependent") != params.end())
505 {
506 is_time_dependent_ = params["time_dependent"];
507 }
508 }
509
510 Lshape::Lshape(const std::string &name)
512 {
513 boundary_ids_ = {1, 2, 4, 7};
515 U_ = 1;
516 }
517
518 void Lshape::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
519 {
520 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
521 }
522
523 void Lshape::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
524 {
525 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
526
527 for (long i = 0; i < pts.rows(); ++i)
528 {
529 if (mesh.get_boundary_id(global_ids(i)) == 1)
530 {
531 const double x = pts(i, 0);
532 const double y = pts(i, 1);
533 // val(i, 0) = U_ * (y - 0.2) * (0.5 - y) / 0.15 / 0.15;
534 val(i, 0) = U_;
535 }
536 }
537
539 val *= (1 - exp(-5 * t));
540 }
541
542 void Lshape::set_parameters(const json &params)
543 {
545
546 if (params.find("U") != params.end())
547 {
548 U_ = params["U"];
549 }
550 if (params.find("time_dependent") != params.end())
551 {
552 is_time_dependent_ = params["time_dependent"];
553 }
554 }
555
558 {
559 boundary_ids_ = {1, 2, 4, 7};
560 U_ = 1.5;
561 inflow_ = 1;
562 dir_ = 0;
563 }
564
565 void UnitFlowWithObstacle::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
566 {
567 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
568 }
569
570 void UnitFlowWithObstacle::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
571 {
572 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
573
574 for (long i = 0; i < pts.rows(); ++i)
575 {
576 if (mesh.get_boundary_id(global_ids(i)) == inflow_)
577 {
578 if (pts.cols() == 3)
579 {
580 const double u = pts(i, (dir_ + 1) % 3);
581 const double v = pts(i, (dir_ + 2) % 3);
582 val(i, dir_) = U_ * 24 * (1 - u) * u * (1 - v) * v;
583 }
584 else
585 {
586 const double v = pts(i, (dir_ + 1) % 2);
587 val(i, dir_) = U_ * 4 * (1 - v) * v;
588 }
589 }
590 }
591
593 val *= (1 - exp(-5 * t));
594 }
595
597 {
599
600 if (params.find("U") != params.end())
601 {
602 U_ = params["U"];
603 }
604
605 if (params.find("inflow_id") != params.end())
606 {
607 inflow_ = params["inflow_id"];
608 }
609
610 if (params.find("direction") != params.end())
611 {
612 dir_ = params["direction"];
613 }
614
615 if (params.find("no_slip") != params.end())
616 {
617 boundary_ids_.clear();
618
619 const auto no_slip = params["no_slip"];
620 if (no_slip.is_array())
621 {
622 for (size_t k = 0; k < no_slip.size(); ++k)
623 {
624 const auto tmp = no_slip[k];
625 if (tmp.is_string())
626 {
627 const std::string tmps = tmp;
628 const auto endings = StringUtils::split(tmps, ":");
629 assert(endings.size() == 2);
630 const int start = atoi(endings[0].c_str());
631 const int end = atoi(endings[1].c_str());
632
633 for (int i = start; i <= end; ++i)
634 boundary_ids_.push_back(i);
635 }
636 else
637 boundary_ids_.push_back(tmp);
638 }
639 }
640 }
641
642 boundary_ids_.push_back(inflow_);
643
644 std::sort(boundary_ids_.begin(), boundary_ids_.end());
645 auto it = std::unique(boundary_ids_.begin(), boundary_ids_.end());
646 boundary_ids_.resize(std::distance(boundary_ids_.begin(), it));
647 }
648
649 StokesLawProblem::StokesLawProblem(const std::string &name)
650 : Problem(name), viscosity_(1e2), radius(0.5)
651 {
652 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
653 is_time_dependent_ = false;
654 }
655
656 void StokesLawProblem::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
657 {
658 exact(pts, 0, val);
659 }
660
662 {
663 if (params.count("viscosity"))
664 {
665 viscosity_ = params["viscosity"];
666 }
667 if (params.count("radius"))
668 {
669 radius = params["radius"];
670 }
671 if (params.find("time_dependent") != params.end())
672 {
673 is_time_dependent_ = params["time_dependent"];
674 }
675 }
676
677 void StokesLawProblem::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
678 {
679 val.resize(pts.rows(), pts.cols());
680 val.setZero();
681 for (int i = 0; i < pts.rows(); ++i)
682 {
683 const double x = pts(i, 0);
684 const double y = pts(i, 1);
685
686 if (pts.cols() == 2)
687 {
688 val(i, 1) = 1;
689 }
690 else
691 {
692 const double z = pts(i, 2);
693 const double norm = sqrt(x * x + y * y + z * z);
694 const double tmp1 = 3 * (x + y + z) / pow(norm, 5);
695 const double tmp2 = (x + y + z) / pow(norm, 3);
696 val(i, 0) = pow(radius, 3) / 4 * (tmp1 * x - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * x);
697 val(i, 1) = pow(radius, 3) / 4 * (tmp1 * y - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * y);
698 val(i, 2) = pow(radius, 3) / 4 * (tmp1 * z - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * z);
699 }
700 }
701 }
702
703 void StokesLawProblem::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
704 {
705 val.resize(pts.rows(), pts.cols() * pts.cols());
706 val.setZero();
707 }
708
709 void StokesLawProblem::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
710 {
711 val.resize(pts.rows(), pts.cols());
712 val.setZero();
713 }
714
715 void StokesLawProblem::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
716 {
717 val.resize(pts.rows(), pts.cols());
718 val.setZero();
719 for (int i = 0; i < pts.rows(); ++i)
720 {
721 const double x = pts(i, 0);
722 const double y = pts(i, 1);
723
724 if (pts.cols() == 2)
725 {
726 if (mesh.get_boundary_id(global_ids(i)) != 7)
727 {
728 val(i, 1) = 1;
729 }
730 }
731 else
732 {
733 const double z = pts(i, 2);
734 const double norm = sqrt(x * x + y * y + z * z);
735 const double tmp1 = 3 * (x + y + z) / pow(norm, 5);
736 const double tmp2 = (x + y + z) / pow(norm, 3);
737 val(i, 0) = pow(radius, 3) / 4 * (tmp1 * x - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * x);
738 val(i, 1) = pow(radius, 3) / 4 * (tmp1 * y - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * y);
739 val(i, 2) = pow(radius, 3) / 4 * (tmp1 * z - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * z);
740 }
741 }
742 }
743
744 Airfoil::Airfoil(const std::string &name)
745 : Problem(name)
746 {
747 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
748 is_time_dependent_ = false;
749 }
750
751 void Airfoil::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
752 {
753 exact(pts, 0, val);
754 }
755
756 void Airfoil::set_parameters(const json &params)
757 {
758 if (params.find("time_dependent") != params.end())
759 {
760 is_time_dependent_ = params["time_dependent"];
761 }
762 }
763
764 void Airfoil::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
765 {
766 val.resize(pts.rows(), pts.cols());
767 val.setZero();
768 for (int i = 0; i < pts.rows(); ++i)
769 {
770 const double x = pts(i, 0);
771 const double y = pts(i, 1);
772
773 val(i, 0) = 1;
774 }
775
777 val *= (1 - exp(-5 * t));
778 }
779
780 void Airfoil::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
781 {
782 val.resize(pts.rows(), pts.cols() * pts.cols());
783 val.setZero();
784 }
785
786 void Airfoil::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
787 {
788 val.resize(pts.rows(), pts.cols());
789 val.setZero();
790 }
791
792 void Airfoil::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
793 {
794 val.resize(pts.rows(), pts.cols());
795 val.setZero();
796 for (int i = 0; i < pts.rows(); ++i)
797 {
798 const double x = pts(i, 0);
799 const double y = pts(i, 1);
800
801 if (mesh.get_boundary_id(global_ids(i)) != 7)
802 {
803 val(i, 0) = 1;
804 }
805 }
807 val *= (1 - exp(-5 * t));
808 }
809
811 : Problem(name), viscosity_(1)
812 {
813 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
814 }
815
816 void TaylorGreenVortexProblem::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
817 {
818 exact(pts, 0, val);
819 }
820
822 {
823 if (params.count("viscosity"))
824 {
825 viscosity_ = params["viscosity"];
826 }
827 }
828
829 void TaylorGreenVortexProblem::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
830 {
831 val.resize(pts.rows(), pts.cols());
832 const double T = 6.283185307179586;
833 for (int i = 0; i < pts.rows(); ++i)
834 {
835 const double x = pts(i, 0);
836 const double y = pts(i, 1);
837
838 if (pts.cols() == 2)
839 {
840 const double time_scaling = exp(-2 * viscosity_ * T * T * t);
841 val(i, 0) = cos(T * x) * sin(T * y) * time_scaling;
842 val(i, 1) = -sin(T * x) * cos(T * y) * time_scaling;
843 }
844 else
845 {
846 const double z = pts(i, 2);
847 const double time_scaling = -exp(-viscosity_ * t);
848 val(i, 0) = (exp(x) * sin(y + z) + exp(z) * cos(x + y)) * time_scaling;
849 val(i, 1) = (exp(y) * sin(z + x) + exp(x) * cos(y + z)) * time_scaling;
850 val(i, 2) = (exp(z) * sin(x + y) + exp(y) * cos(z + x)) * time_scaling;
851 }
852 }
853 }
854
855 void TaylorGreenVortexProblem::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
856 {
857 val.resize(pts.rows(), pts.cols() * pts.cols());
858 const double T = 6.283185307179586;
859 for (int i = 0; i < pts.rows(); ++i)
860 {
861 const double x = pts(i, 0);
862 const double y = pts(i, 1);
863
864 if (pts.cols() == 2)
865 {
866 const double time_scaling = exp(-2 * viscosity_ * T * T * t);
867 val(i, 0) = -T * sin(T * x) * sin(T * y) * time_scaling;
868 val(i, 1) = T * cos(T * x) * cos(T * y) * time_scaling;
869 val(i, 2) = -T * cos(T * x) * cos(T * y) * time_scaling;
870 val(i, 3) = T * sin(T * x) * sin(T * y) * time_scaling;
871 }
872 else
873 {
874 const double z = pts(i, 2);
875 const double time_scaling = exp(-viscosity_ * t);
876 val(i, 0) = time_scaling * (exp(z) * sin(x + y) - exp(x) * sin(y + z));
877 val(i, 1) = time_scaling * (exp(z) * sin(y + x) - exp(x) * cos(z + y));
878 val(i, 2) = -time_scaling * (exp(z) * cos(x + y) + exp(x) * cos(y + z));
879 val(i, 3) = -time_scaling * (exp(y) * cos(x + z) + exp(x) * cos(y + z));
880 val(i, 4) = time_scaling * (exp(x) * sin(z + y) - exp(y) * sin(x + z));
881 val(i, 5) = time_scaling * (exp(x) * sin(z + y) - exp(y) * cos(x + z));
882 val(i, 6) = time_scaling * (exp(y) * sin(x + z) - exp(z) * cos(y + x));
883 val(i, 7) = -time_scaling * (exp(z) * cos(x + y) + exp(y) * cos(x + z));
884 val(i, 8) = time_scaling * (exp(y) * sin(x + z) - exp(z) * sin(y + x));
885 }
886 }
887 }
888
889 void TaylorGreenVortexProblem::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
890 {
891 val.resize(pts.rows(), pts.cols());
892 val.setZero();
893 }
894
895 void TaylorGreenVortexProblem::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
896 {
897 exact(pts, t, val);
898 }
899
900 template <typename T>
901 Eigen::Matrix<T, 2, 1> simple_function_const(T x, T y, const double t)
902 {
903 Eigen::Matrix<T, 2, 1> res;
904
905 res(0) = 1;
906 res(1) = 1;
907
908 return res;
909 }
910
911 template <typename T>
912 Eigen::Matrix<T, 3, 1> simple_function_const(T x, T y, T z, const double t)
913 {
914 Eigen::Matrix<T, 3, 1> res;
915
916 res(0) = 1;
917 res(1) = 1;
918 res(2) = 0;
919
920 return res;
921 }
922
923 template <typename T>
924 Eigen::Matrix<T, 2, 1> simple_function_lin(T x, T y, const double t)
925 {
926 Eigen::Matrix<T, 2, 1> res;
927
928 res(0) = x / 2. + y;
929 res(1) = -x - y / 2.;
930
931 return res;
932 }
933
934 template <typename T>
935 Eigen::Matrix<T, 3, 1> simple_function_lin(T x, T y, T z, const double t)
936 {
937 Eigen::Matrix<T, 3, 1> res;
938
939 res(0) = x / 2. + y;
940 res(1) = -x - y / 2.;
941 res(2) = 0;
942
943 return res;
944 }
945
946 template <typename T>
947 Eigen::Matrix<T, 2, 1> simple_function_cub(T x, T y, const double t)
948 {
949 Eigen::Matrix<T, 2, 1> res;
950
951 res(0) = x * x * x / 3. + x * y * y;
952 res(1) = -x * x * y - y * y * y / 3.;
953
954 return res;
955 }
956
957 template <typename T>
958 Eigen::Matrix<T, 3, 1> simple_function_cub(T x, T y, T z, const double t)
959 {
960 Eigen::Matrix<T, 3, 1> res;
961
962 res(0) = x * x * x / 3. + x * y * y;
963 res(1) = -x * x * y - y * y * y / 3.;
964 res(2) = 0;
965
966 return res;
967 }
968
969 template <typename T>
970 Eigen::Matrix<T, 2, 1> simple_function_quad(T x, T y, const double t)
971 {
972 Eigen::Matrix<T, 2, 1> res;
973
974 res(0) = x * x / 2. + x * y;
975 res(1) = -x * y - y * y / 2.;
976
977 return res;
978 }
979
980 template <typename T>
981 Eigen::Matrix<T, 3, 1> simple_function_quad(T x, T y, T z, const double t)
982 {
983 Eigen::Matrix<T, 3, 1> res;
984
985 res(0) = x * x / 2. + x * y;
986 res(1) = -x * y - y * y / 2.;
987 res(2) = 0;
988
989 return res;
990 }
991
992 template <typename T>
993 Eigen::Matrix<T, 2, 1> sine_function(T x, T y, const double t)
994 {
995 Eigen::Matrix<T, 2, 1> res;
996
997 res(0) = cos(x) * sin(y);
998 res(1) = -sin(x) * cos(y);
999
1000 return res;
1001 }
1002
1003 template <typename T>
1004 Eigen::Matrix<T, 3, 1> sine_function(T x, T y, T z, const double t)
1005 {
1006 Eigen::Matrix<T, 3, 1> res;
1007
1008 res(0) = cos(x) * sin(y);
1009 res(1) = -sin(x) * cos(y);
1010 res(2) = 0;
1011
1012 return res;
1013 }
1014
1016 : ProblemWithSolution(name)
1017 {
1018 func_ = 0;
1019 }
1020
1022 {
1023 if (params.find("func") != params.end())
1024 {
1025 func_ = params["func"];
1026 }
1027 }
1028
1029 VectorNd SimpleStokeProblemExact::eval_fun(const VectorNd &pt, const double t) const
1030 {
1031 if (pt.size() == 2)
1032 {
1033 switch (func_)
1034 {
1035 case 0:
1036 return simple_function_quad(pt(0), pt(1), t);
1037 case 1:
1038 return simple_function_cub(pt(0), pt(1), t);
1039 case 2:
1040 return simple_function_lin(pt(0), pt(1), t);
1041 case 3:
1042 return simple_function_const(pt(0), pt(1), t);
1043 default:
1044 assert(false);
1045 }
1046 }
1047 else if (pt.size() == 3)
1048 {
1049 switch (func_)
1050 {
1051 case 0:
1052 return simple_function_quad(pt(0), pt(1), pt(2), t);
1053 case 1:
1054 return simple_function_cub(pt(0), pt(1), pt(2), t);
1055 case 2:
1056 return simple_function_lin(pt(0), pt(1), pt(2), t);
1057 case 3:
1058 return simple_function_const(pt(0), pt(1), pt(2), t);
1059 default:
1060 assert(false);
1061 }
1062 }
1063
1064 assert(false);
1065 return VectorNd(pt.size());
1066 }
1067
1069 {
1070 if (pt.size() == 2)
1071 {
1072 switch (func_)
1073 {
1074 case 0:
1075 return simple_function_quad(pt(0), pt(1), t);
1076 case 1:
1077 return simple_function_cub(pt(0), pt(1), t);
1078 case 2:
1079 return simple_function_lin(pt(0), pt(1), t);
1080 case 3:
1081 return simple_function_const(pt(0), pt(1), t);
1082 default:
1083 assert(false);
1084 }
1085 }
1086 else if (pt.size() == 3)
1087 {
1088 switch (func_)
1089 {
1090 case 0:
1091 return simple_function_quad(pt(0), pt(1), pt(2), t);
1092 case 1:
1093 return simple_function_cub(pt(0), pt(1), pt(2), t);
1094 case 2:
1095 return simple_function_lin(pt(0), pt(1), pt(2), t);
1096 case 3:
1097 return simple_function_const(pt(0), pt(1), pt(2), t);
1098 default:
1099 assert(false);
1100 }
1101 }
1102
1103 assert(false);
1104 return AutodiffGradPt(pt.size());
1105 }
1106
1108 {
1109 if (pt.size() == 2)
1110 {
1111 switch (func_)
1112 {
1113 case 0:
1114 return simple_function_quad(pt(0), pt(1), t);
1115 case 1:
1116 return simple_function_cub(pt(0), pt(1), t);
1117 case 2:
1118 return simple_function_lin(pt(0), pt(1), t);
1119 case 3:
1120 return simple_function_const(pt(0), pt(1), t);
1121 default:
1122 assert(false);
1123 }
1124 }
1125 else if (pt.size() == 3)
1126 {
1127 switch (func_)
1128 {
1129 case 0:
1130 return simple_function_quad(pt(0), pt(1), pt(2), t);
1131 case 1:
1132 return simple_function_cub(pt(0), pt(1), pt(2), t);
1133 case 2:
1134 return simple_function_lin(pt(0), pt(1), pt(2), t);
1135 case 3:
1136 return simple_function_const(pt(0), pt(1), pt(2), t);
1137 default:
1138 assert(false);
1139 }
1140 }
1141
1142 assert(false);
1143 return AutodiffHessianPt(pt.size());
1144 }
1145
1147 : ProblemWithSolution(name)
1148 {
1149 }
1150
1151 VectorNd SineStokeProblemExact::eval_fun(const VectorNd &pt, const double t) const
1152 {
1153 if (pt.size() == 2)
1154 return sine_function(pt(0), pt(1), t);
1155 else if (pt.size() == 3)
1156 return sine_function(pt(0), pt(1), pt(2), t);
1157
1158 assert(false);
1159 return VectorNd(pt.size());
1160 }
1161
1163 {
1164 if (pt.size() == 2)
1165 return sine_function(pt(0), pt(1), t);
1166 else if (pt.size() == 3)
1167 return sine_function(pt(0), pt(1), pt(2), t);
1168
1169 assert(false);
1170 return AutodiffGradPt(pt.size());
1171 }
1172
1174 {
1175 if (pt.size() == 2)
1176 return sine_function(pt(0), pt(1), t);
1177 else if (pt.size() == 3)
1178 return sine_function(pt(0), pt(1), pt(2), t);
1179
1180 assert(false);
1181 return AutodiffHessianPt(pt.size());
1182 }
1183
1185 : Problem(name), func_(0), viscosity_(1)
1186 {
1187 }
1188
1189 void TransientStokeProblemExact::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
1190 {
1191 exact(pts, 0, val);
1192 }
1193
1195 {
1196 if (params.count("viscosity"))
1197 {
1198 viscosity_ = params["viscosity"];
1199 }
1200
1201 if (params.find("func") != params.end())
1202 {
1203 func_ = params["func"];
1204 }
1205 }
1206
1207 void TransientStokeProblemExact::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1208 {
1209 val.resize(pts.rows(), pts.cols());
1210 for (int i = 0; i < pts.rows(); ++i)
1211 {
1212 const double x = pts(i, 0);
1213 const double y = pts(i, 1);
1214
1215 if (pts.cols() == 2)
1216 {
1217 val(i, 0) = -t + x * x / 2 + x * y;
1218 val(i, 1) = t - x * y - y * y / 2;
1219 }
1220 else
1221 {
1222 const double z = pts(i, 2);
1223 val(i, 0) = x * x;
1224 val(i, 1) = y * y;
1225 val(i, 2) = -2 * z * (x + y);
1226 }
1227
1228 // const double w = 1.;
1229 // const double k = sqrt(0.5 * w / viscosity_);
1230 // const double Q = 1./(pow(cosh(k), 2) - pow(cos(k), 2));
1231
1232 // val(i, 0) = Q * ( sinh(k * y) * cos(k * y) * sinh(k) * cos(k) + cosh(k * y) * sin(k * y) * cosh(k) * sin(k) ) * cos(w * t) + Q * ( sinh(k * y) * cos(k * y) * sin(k) * cosh(k) - cosh(k * y) * sin(k * y) * cos(k) * sinh(k) ) * sin(w * t);
1233 // val(i, 1) = 0;
1234 }
1235 }
1236
1237 void TransientStokeProblemExact::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1238 {
1239 val.resize(pts.rows(), pts.cols() * pts.cols());
1240
1241 // for (int i = 0; i < pts.rows(); ++i)
1242 // {
1243 // const double x = pts(i, 0);
1244 // const double y = pts(i, 1);
1245
1246 // val(i, 0) = -sin(x) * sin(y) * time_scaling;
1247 // val(i, 1) = cos(x) * cos(y) * time_scaling;
1248 // val(i, 2) = -cos(x) * cos(y) * time_scaling;
1249 // val(i, 3) = sin(x) * sin(y) * time_scaling;
1250 // }
1251 }
1252
1253 void TransientStokeProblemExact::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1254 {
1255 val.resize(pts.rows(), pts.cols());
1256
1257 for (int i = 0; i < pts.rows(); ++i)
1258 {
1259 const double x = pts(i, 0);
1260 const double y = pts(i, 1);
1261 if (pts.cols() == 2)
1262 {
1263 val(i, 0) = -viscosity_ - t * y + 1. / 2. * x * (x * x + x * y + y * y);
1264 val(i, 1) = viscosity_ - t * x + 1. / 2. * y * (x * x + x * y + y * y) + 2;
1265 }
1266 else
1267 {
1268 const double z = pts(i, 2);
1269 val(i, 0) = 2 * (x * x * x - 1);
1270 val(i, 1) = 2 * (y * y * y - 1);
1271 val(i, 2) = 2 * z * (x * x + 4 * x * y + y * y);
1272 }
1273 }
1274 val *= -1;
1275 }
1276
1277 void TransientStokeProblemExact::dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1278 {
1279 exact(pts, t, val);
1280 }
1281 } // namespace problem
1282} // namespace polyfem
double val
Definition Assembler.cpp:86
int y
int z
int x
std::vector< int > pressure_boundary_ids_
Definition Problem.hpp:81
std::vector< int > boundary_ids_
Definition Problem.hpp:78
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:39
virtual int get_boundary_id(const int primitive) const
Get the boundary selection of an element (face in 3d, edge in 2d)
Definition Mesh.hpp:475
void set_parameters(const json &params) override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
Airfoil(const std::string &name)
void exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
ConstantVelocity(const std::string &name)
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
CornerFlow(const std::string &name)
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
DrivenCavityC0(const std::string &name)
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
DrivenCavity(const std::string &name)
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
DrivenCavitySmooth(const std::string &name)
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
Flow(const std::string &name)
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
FlowWithObstacle(const std::string &name)
void set_parameters(const json &params) override
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
Kovnaszy(const std::string &name)
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
Lshape(const std::string &name)
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
VectorNd eval_fun(const VectorNd &pt, const double t) const override
SimpleStokeProblemExact(const std::string &name)
void set_parameters(const json &params) override
SineStokeProblemExact(const std::string &name)
VectorNd eval_fun(const VectorNd &pt, const double t) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
StokesLawProblem(const std::string &name)
void set_parameters(const json &params) override
void exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
TaylorGreenVortexProblem(const std::string &name)
void exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
virtual void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
virtual void set_parameters(const json &params) override
TimeDepentendStokesProblem(const std::string &name)
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
TwoSpheres(const std::string &name)
void initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void initial_density(const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
void set_parameters(const json &params) override
UnitFlowWithObstacle(const std::string &name)
void dirichlet_bc(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &uv, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const override
Eigen::Matrix< T, 2, 1 > sine_function(T x, T y, const double t)
Eigen::Matrix< T, 2, 1 > simple_function_const(T x, T y, const double t)
Eigen::Matrix< T, 2, 1 > simple_function_lin(T x, T y, const double t)
Eigen::Matrix< T, 2, 1 > simple_function_cub(T x, T y, const double t)
Eigen::Matrix< T, 2, 1 > simple_function_quad(T x, T y, const double t)
std::vector< std::string > split(const std::string &str, const std::string &delimiters=" ")
Eigen::Matrix< AutodiffScalarHessian, Eigen::Dynamic, 1, 0, 3, 1 > AutodiffHessianPt
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 3, 1 > VectorNd
Definition Types.hpp:11
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< AutodiffScalarGrad, Eigen::Dynamic, 1, 0, 3, 1 > AutodiffGradPt