PolyFEM
Loading...
Searching...
No Matches
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 // for(int i : boundary_ids_)
338 // std::cout<<"i "<<i<<std::endl;
339 }
340
341 FlowWithObstacle::FlowWithObstacle(const std::string &name)
343 {
344 boundary_ids_ = {1, 2, 4, 5, 6, 7};
346 U_ = 1.5;
347 }
348
349 void FlowWithObstacle::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
350 {
351 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
352 }
353
354 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
355 {
356 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
357
358 for (long i = 0; i < pts.rows(); ++i)
359 {
360 if (pts.cols() == 2)
361 {
362 if (mesh.get_boundary_id(global_ids(i)) == 1)
363 {
364 const double y = pts(i, 1);
365 val(i, 0) = U_ * 4 * y * (0.41 - y) / (0.41 * 0.41);
366 }
367 }
368 else
369 {
370 if (mesh.get_boundary_id(global_ids(i)) == 1)
371 {
372 const double y = pts(i, 1);
373 const double z = pts(i, 2);
374 val(i, 0) = U_ * 4 * y * (0.41 - y) / (0.41 * 0.41) * 4 * z * (0.41 - z) / (0.41 * 0.41);
375 }
376 }
377 }
378
380 val *= (1 - exp(-5 * t));
381 }
382
384 {
386
387 if (params.find("U") != params.end())
388 {
389 U_ = params["U"];
390 }
391 }
392
393 Kovnaszy::Kovnaszy(const std::string &name)
394 : Problem(name), viscosity_(1)
395 {
396 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
397 is_time_dependent_ = false;
398 }
399
400 void Kovnaszy::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
401 {
402 exact(pts, 0, val);
403 }
404
405 void Kovnaszy::set_parameters(const json &params)
406 {
407 if (params.count("viscosity"))
408 {
409 viscosity_ = params["viscosity"];
410 }
411 if (params.find("time_dependent") != params.end())
412 {
413 is_time_dependent_ = params["time_dependent"];
414 }
415 }
416
417 void Kovnaszy::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
418 {
419 val.resize(pts.rows(), pts.cols());
420 const double a = 0.5 / viscosity_ - sqrt(0.25 / viscosity_ / viscosity_ + 4 * M_PI * M_PI);
421 for (int i = 0; i < pts.rows(); ++i)
422 {
423 const double x = pts(i, 0);
424 const double y = pts(i, 1);
425
426 if (pts.cols() == 2)
427 {
428 val(i, 0) = 1 - exp(a * x) * cos(2 * M_PI * y);
429 val(i, 1) = a * exp(a * x) * sin(2 * M_PI * y) / (2 * M_PI);
430 }
431 else
432 {
433 val(i, 0) = 1 - exp(a * x) * cos(2 * M_PI * y);
434 val(i, 1) = a * exp(a * x) * sin(2 * M_PI * y) / (2 * M_PI);
435 val(i, 2) = 0;
436 }
437 }
438 }
439
440 void Kovnaszy::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
441 {
442 val.resize(pts.rows(), pts.cols() * pts.cols());
443 const double a = 0.5 / viscosity_ - sqrt(0.25 / viscosity_ / viscosity_ + 4 * M_PI * M_PI);
444 for (int i = 0; i < pts.rows(); ++i)
445 {
446 const double x = pts(i, 0);
447 const double y = pts(i, 1);
448
449 val(i, 0) = -a * exp(a * x) * cos(2 * M_PI * y);
450 val(i, 1) = 2 * M_PI * exp(a * x) * sin(2 * M_PI * y);
451 val(i, 2) = a * a * exp(a * x) * sin(2 * M_PI * y) / (2 * M_PI);
452 val(i, 3) = a * exp(a * x) * cos(2 * M_PI * y);
453 }
454 }
455
456 void Kovnaszy::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
457 {
458 val.resize(pts.rows(), pts.cols());
459 val.setZero();
460 }
461
462 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
463 {
464 exact(pts, t, val);
465 }
466
467 CornerFlow::CornerFlow(const std::string &name)
469 {
470 boundary_ids_ = {1, 2, 4, 7};
472 U_ = 1.5;
473 }
474
475 void CornerFlow::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
476 {
477 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
478 }
479
480 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
481 {
482 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
483
484 for (long i = 0; i < pts.rows(); ++i)
485 {
486 if (mesh.get_boundary_id(global_ids(i)) == 2)
487 {
488 const double x = pts(i, 0);
489 const double y = pts(i, 1);
490 val(i, 1) = U_ * 4 * x * (0.5 - x) / 0.5 / 0.5;
491 // val(i, 1) = U_;
492 }
493 }
494
496 val *= (1 - exp(-5 * t));
497 }
498
500 {
502
503 if (params.find("U") != params.end())
504 {
505 U_ = params["U"];
506 }
507 if (params.find("time_dependent") != params.end())
508 {
509 is_time_dependent_ = params["time_dependent"];
510 }
511 }
512
513 Lshape::Lshape(const std::string &name)
515 {
516 boundary_ids_ = {1, 2, 4, 7};
518 U_ = 1;
519 }
520
521 void Lshape::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
522 {
523 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
524 }
525
526 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
527 {
528 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
529
530 for (long i = 0; i < pts.rows(); ++i)
531 {
532 if (mesh.get_boundary_id(global_ids(i)) == 1)
533 {
534 const double x = pts(i, 0);
535 const double y = pts(i, 1);
536 // val(i, 0) = U_ * (y - 0.2) * (0.5 - y) / 0.15 / 0.15;
537 val(i, 0) = U_;
538 }
539 }
540
542 val *= (1 - exp(-5 * t));
543 }
544
545 void Lshape::set_parameters(const json &params)
546 {
548
549 if (params.find("U") != params.end())
550 {
551 U_ = params["U"];
552 }
553 if (params.find("time_dependent") != params.end())
554 {
555 is_time_dependent_ = params["time_dependent"];
556 }
557 }
558
561 {
562 boundary_ids_ = {1, 2, 4, 7};
563 U_ = 1.5;
564 inflow_ = 1;
565 dir_ = 0;
566 }
567
568 void UnitFlowWithObstacle::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
569 {
570 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
571 }
572
573 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
574 {
575 val = Eigen::MatrixXd::Zero(pts.rows(), pts.cols());
576
577 for (long i = 0; i < pts.rows(); ++i)
578 {
579 if (mesh.get_boundary_id(global_ids(i)) == inflow_)
580 {
581 if (pts.cols() == 3)
582 {
583 const double u = pts(i, (dir_ + 1) % 3);
584 const double v = pts(i, (dir_ + 2) % 3);
585 val(i, dir_) = U_ * 24 * (1 - u) * u * (1 - v) * v;
586 }
587 else
588 {
589 const double v = pts(i, (dir_ + 1) % 2);
590 val(i, dir_) = U_ * 4 * (1 - v) * v;
591 }
592 }
593 }
594
596 val *= (1 - exp(-5 * t));
597 }
598
600 {
602
603 if (params.find("U") != params.end())
604 {
605 U_ = params["U"];
606 }
607
608 if (params.find("inflow_id") != params.end())
609 {
610 inflow_ = params["inflow_id"];
611 }
612
613 if (params.find("direction") != params.end())
614 {
615 dir_ = params["direction"];
616 }
617
618 if (params.find("no_slip") != params.end())
619 {
620 boundary_ids_.clear();
621
622 const auto no_slip = params["no_slip"];
623 if (no_slip.is_array())
624 {
625 for (size_t k = 0; k < no_slip.size(); ++k)
626 {
627 const auto tmp = no_slip[k];
628 if (tmp.is_string())
629 {
630 const std::string tmps = tmp;
631 const auto endings = StringUtils::split(tmps, ":");
632 assert(endings.size() == 2);
633 const int start = atoi(endings[0].c_str());
634 const int end = atoi(endings[1].c_str());
635
636 for (int i = start; i <= end; ++i)
637 boundary_ids_.push_back(i);
638 }
639 else
640 boundary_ids_.push_back(tmp);
641 }
642 }
643 }
644
645 boundary_ids_.push_back(inflow_);
646
647 std::sort(boundary_ids_.begin(), boundary_ids_.end());
648 auto it = std::unique(boundary_ids_.begin(), boundary_ids_.end());
649 boundary_ids_.resize(std::distance(boundary_ids_.begin(), it));
650
651 // for(int i : boundary_ids_)
652 // std::cout<<"i "<<i<<std::endl;
653 }
654
655 StokesLawProblem::StokesLawProblem(const std::string &name)
656 : Problem(name), viscosity_(1e2), radius(0.5)
657 {
658 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
659 is_time_dependent_ = false;
660 }
661
662 void StokesLawProblem::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
663 {
664 exact(pts, 0, val);
665 }
666
668 {
669 if (params.count("viscosity"))
670 {
671 viscosity_ = params["viscosity"];
672 }
673 if (params.count("radius"))
674 {
675 radius = params["radius"];
676 }
677 if (params.find("time_dependent") != params.end())
678 {
679 is_time_dependent_ = params["time_dependent"];
680 }
681 }
682
683 void StokesLawProblem::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
684 {
685 val.resize(pts.rows(), pts.cols());
686 val.setZero();
687 for (int i = 0; i < pts.rows(); ++i)
688 {
689 const double x = pts(i, 0);
690 const double y = pts(i, 1);
691
692 if (pts.cols() == 2)
693 {
694 val(i, 1) = 1;
695 }
696 else
697 {
698 const double z = pts(i, 2);
699 const double norm = sqrt(x * x + y * y + z * z);
700 const double tmp1 = 3 * (x + y + z) / pow(norm, 5);
701 const double tmp2 = (x + y + z) / pow(norm, 3);
702 val(i, 0) = pow(radius, 3) / 4 * (tmp1 * x - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * x);
703 val(i, 1) = pow(radius, 3) / 4 * (tmp1 * y - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * y);
704 val(i, 2) = pow(radius, 3) / 4 * (tmp1 * z - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * z);
705 }
706 }
707 }
708
709 void StokesLawProblem::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
710 {
711 val.resize(pts.rows(), pts.cols() * pts.cols());
712 val.setZero();
713 }
714
715 void StokesLawProblem::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
716 {
717 val.resize(pts.rows(), pts.cols());
718 val.setZero();
719 }
720
721 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
722 {
723 val.resize(pts.rows(), pts.cols());
724 val.setZero();
725 for (int i = 0; i < pts.rows(); ++i)
726 {
727 const double x = pts(i, 0);
728 const double y = pts(i, 1);
729
730 if (pts.cols() == 2)
731 {
732 if (mesh.get_boundary_id(global_ids(i)) != 7)
733 {
734 val(i, 1) = 1;
735 }
736 }
737 else
738 {
739 const double z = pts(i, 2);
740 const double norm = sqrt(x * x + y * y + z * z);
741 const double tmp1 = 3 * (x + y + z) / pow(norm, 5);
742 const double tmp2 = (x + y + z) / pow(norm, 3);
743 val(i, 0) = pow(radius, 3) / 4 * (tmp1 * x - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * x);
744 val(i, 1) = pow(radius, 3) / 4 * (tmp1 * y - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * y);
745 val(i, 2) = pow(radius, 3) / 4 * (tmp1 * z - 1 / pow(norm, 3)) + 1 - 3 * radius / 4 * (1 / norm + tmp2 * z);
746 }
747 }
748 }
749
750 Airfoil::Airfoil(const std::string &name)
751 : Problem(name)
752 {
753 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
754 is_time_dependent_ = false;
755 }
756
757 void Airfoil::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
758 {
759 exact(pts, 0, val);
760 }
761
762 void Airfoil::set_parameters(const json &params)
763 {
764 if (params.find("time_dependent") != params.end())
765 {
766 is_time_dependent_ = params["time_dependent"];
767 }
768 }
769
770 void Airfoil::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
771 {
772 val.resize(pts.rows(), pts.cols());
773 val.setZero();
774 for (int i = 0; i < pts.rows(); ++i)
775 {
776 const double x = pts(i, 0);
777 const double y = pts(i, 1);
778
779 val(i, 0) = 1;
780 }
781
783 val *= (1 - exp(-5 * t));
784 }
785
786 void Airfoil::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
787 {
788 val.resize(pts.rows(), pts.cols() * pts.cols());
789 val.setZero();
790 }
791
792 void Airfoil::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
793 {
794 val.resize(pts.rows(), pts.cols());
795 val.setZero();
796 }
797
798 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
799 {
800 val.resize(pts.rows(), pts.cols());
801 val.setZero();
802 for (int i = 0; i < pts.rows(); ++i)
803 {
804 const double x = pts(i, 0);
805 const double y = pts(i, 1);
806
807 if (mesh.get_boundary_id(global_ids(i)) != 7)
808 {
809 val(i, 0) = 1;
810 }
811 }
813 val *= (1 - exp(-5 * t));
814 }
815
817 : Problem(name), viscosity_(1)
818 {
819 boundary_ids_ = {1, 2, 3, 4, 5, 6, 7};
820 }
821
822 void TaylorGreenVortexProblem::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
823 {
824 exact(pts, 0, val);
825 }
826
828 {
829 if (params.count("viscosity"))
830 {
831 viscosity_ = params["viscosity"];
832 }
833 }
834
835 void TaylorGreenVortexProblem::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
836 {
837 val.resize(pts.rows(), pts.cols());
838 const double T = 6.283185307179586;
839 for (int i = 0; i < pts.rows(); ++i)
840 {
841 const double x = pts(i, 0);
842 const double y = pts(i, 1);
843
844 if (pts.cols() == 2)
845 {
846 const double time_scaling = exp(-2 * viscosity_ * T * T * t);
847 val(i, 0) = cos(T * x) * sin(T * y) * time_scaling;
848 val(i, 1) = -sin(T * x) * cos(T * y) * time_scaling;
849 }
850 else
851 {
852 const double z = pts(i, 2);
853 const double time_scaling = -exp(-viscosity_ * t);
854 val(i, 0) = (exp(x) * sin(y + z) + exp(z) * cos(x + y)) * time_scaling;
855 val(i, 1) = (exp(y) * sin(z + x) + exp(x) * cos(y + z)) * time_scaling;
856 val(i, 2) = (exp(z) * sin(x + y) + exp(y) * cos(z + x)) * time_scaling;
857 }
858 }
859 }
860
861 void TaylorGreenVortexProblem::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
862 {
863 val.resize(pts.rows(), pts.cols() * pts.cols());
864 const double T = 6.283185307179586;
865 for (int i = 0; i < pts.rows(); ++i)
866 {
867 const double x = pts(i, 0);
868 const double y = pts(i, 1);
869
870 if (pts.cols() == 2)
871 {
872 const double time_scaling = exp(-2 * viscosity_ * T * T * t);
873 val(i, 0) = -T * sin(T * x) * sin(T * y) * time_scaling;
874 val(i, 1) = T * cos(T * x) * cos(T * y) * time_scaling;
875 val(i, 2) = -T * cos(T * x) * cos(T * y) * time_scaling;
876 val(i, 3) = T * sin(T * x) * sin(T * y) * time_scaling;
877 }
878 else
879 {
880 const double z = pts(i, 2);
881 const double time_scaling = exp(-viscosity_ * t);
882 val(i, 0) = time_scaling * (exp(z) * sin(x + y) - exp(x) * sin(y + z));
883 val(i, 1) = time_scaling * (exp(z) * sin(y + x) - exp(x) * cos(z + y));
884 val(i, 2) = -time_scaling * (exp(z) * cos(x + y) + exp(x) * cos(y + z));
885 val(i, 3) = -time_scaling * (exp(y) * cos(x + z) + exp(x) * cos(y + z));
886 val(i, 4) = time_scaling * (exp(x) * sin(z + y) - exp(y) * sin(x + z));
887 val(i, 5) = time_scaling * (exp(x) * sin(z + y) - exp(y) * cos(x + z));
888 val(i, 6) = time_scaling * (exp(y) * sin(x + z) - exp(z) * cos(y + x));
889 val(i, 7) = -time_scaling * (exp(z) * cos(x + y) + exp(y) * cos(x + z));
890 val(i, 8) = time_scaling * (exp(y) * sin(x + z) - exp(z) * sin(y + x));
891 }
892 }
893 }
894
895 void TaylorGreenVortexProblem::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
896 {
897 val.resize(pts.rows(), pts.cols());
898 val.setZero();
899 }
900
901 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
902 {
903 exact(pts, t, val);
904 }
905
906 template <typename T>
907 Eigen::Matrix<T, 2, 1> simple_function_const(T x, T y, const double t)
908 {
909 Eigen::Matrix<T, 2, 1> res;
910
911 res(0) = 1;
912 res(1) = 1;
913
914 return res;
915 }
916
917 template <typename T>
918 Eigen::Matrix<T, 3, 1> simple_function_const(T x, T y, T z, const double t)
919 {
920 Eigen::Matrix<T, 3, 1> res;
921
922 res(0) = 1;
923 res(1) = 1;
924 res(2) = 0;
925
926 return res;
927 }
928
929 template <typename T>
930 Eigen::Matrix<T, 2, 1> simple_function_lin(T x, T y, const double t)
931 {
932 Eigen::Matrix<T, 2, 1> res;
933
934 res(0) = x / 2. + y;
935 res(1) = -x - y / 2.;
936
937 return res;
938 }
939
940 template <typename T>
941 Eigen::Matrix<T, 3, 1> simple_function_lin(T x, T y, T z, const double t)
942 {
943 Eigen::Matrix<T, 3, 1> res;
944
945 res(0) = x / 2. + y;
946 res(1) = -x - y / 2.;
947 res(2) = 0;
948
949 return res;
950 }
951
952 template <typename T>
953 Eigen::Matrix<T, 2, 1> simple_function_cub(T x, T y, const double t)
954 {
955 Eigen::Matrix<T, 2, 1> res;
956
957 res(0) = x * x * x / 3. + x * y * y;
958 res(1) = -x * x * y - y * y * y / 3.;
959
960 return res;
961 }
962
963 template <typename T>
964 Eigen::Matrix<T, 3, 1> simple_function_cub(T x, T y, T z, const double t)
965 {
966 Eigen::Matrix<T, 3, 1> res;
967
968 res(0) = x * x * x / 3. + x * y * y;
969 res(1) = -x * x * y - y * y * y / 3.;
970 res(2) = 0;
971
972 return res;
973 }
974
975 template <typename T>
976 Eigen::Matrix<T, 2, 1> simple_function_quad(T x, T y, const double t)
977 {
978 Eigen::Matrix<T, 2, 1> res;
979
980 res(0) = x * x / 2. + x * y;
981 res(1) = -x * y - y * y / 2.;
982
983 return res;
984 }
985
986 template <typename T>
987 Eigen::Matrix<T, 3, 1> simple_function_quad(T x, T y, T z, const double t)
988 {
989 Eigen::Matrix<T, 3, 1> res;
990
991 res(0) = x * x / 2. + x * y;
992 res(1) = -x * y - y * y / 2.;
993 res(2) = 0;
994
995 return res;
996 }
997
998 template <typename T>
999 Eigen::Matrix<T, 2, 1> sine_function(T x, T y, const double t)
1000 {
1001 Eigen::Matrix<T, 2, 1> res;
1002
1003 res(0) = cos(x) * sin(y);
1004 res(1) = -sin(x) * cos(y);
1005
1006 return res;
1007 }
1008
1009 template <typename T>
1010 Eigen::Matrix<T, 3, 1> sine_function(T x, T y, T z, const double t)
1011 {
1012 Eigen::Matrix<T, 3, 1> res;
1013
1014 res(0) = cos(x) * sin(y);
1015 res(1) = -sin(x) * cos(y);
1016 res(2) = 0;
1017
1018 return res;
1019 }
1020
1022 : ProblemWithSolution(name)
1023 {
1024 func_ = 0;
1025 }
1026
1028 {
1029 if (params.find("func") != params.end())
1030 {
1031 func_ = params["func"];
1032 }
1033 }
1034
1035 VectorNd SimpleStokeProblemExact::eval_fun(const VectorNd &pt, const double t) const
1036 {
1037 if (pt.size() == 2)
1038 {
1039 switch (func_)
1040 {
1041 case 0:
1042 return simple_function_quad(pt(0), pt(1), t);
1043 case 1:
1044 return simple_function_cub(pt(0), pt(1), t);
1045 case 2:
1046 return simple_function_lin(pt(0), pt(1), t);
1047 case 3:
1048 return simple_function_const(pt(0), pt(1), t);
1049 default:
1050 assert(false);
1051 }
1052 }
1053 else if (pt.size() == 3)
1054 {
1055 switch (func_)
1056 {
1057 case 0:
1058 return simple_function_quad(pt(0), pt(1), pt(2), t);
1059 case 1:
1060 return simple_function_cub(pt(0), pt(1), pt(2), t);
1061 case 2:
1062 return simple_function_lin(pt(0), pt(1), pt(2), t);
1063 case 3:
1064 return simple_function_const(pt(0), pt(1), pt(2), t);
1065 default:
1066 assert(false);
1067 }
1068 }
1069
1070 assert(false);
1071 return VectorNd(pt.size());
1072 }
1073
1075 {
1076 if (pt.size() == 2)
1077 {
1078 switch (func_)
1079 {
1080 case 0:
1081 return simple_function_quad(pt(0), pt(1), t);
1082 case 1:
1083 return simple_function_cub(pt(0), pt(1), t);
1084 case 2:
1085 return simple_function_lin(pt(0), pt(1), t);
1086 case 3:
1087 return simple_function_const(pt(0), pt(1), t);
1088 default:
1089 assert(false);
1090 }
1091 }
1092 else if (pt.size() == 3)
1093 {
1094 switch (func_)
1095 {
1096 case 0:
1097 return simple_function_quad(pt(0), pt(1), pt(2), t);
1098 case 1:
1099 return simple_function_cub(pt(0), pt(1), pt(2), t);
1100 case 2:
1101 return simple_function_lin(pt(0), pt(1), pt(2), t);
1102 case 3:
1103 return simple_function_const(pt(0), pt(1), pt(2), t);
1104 default:
1105 assert(false);
1106 }
1107 }
1108
1109 assert(false);
1110 return AutodiffGradPt(pt.size());
1111 }
1112
1114 {
1115 if (pt.size() == 2)
1116 {
1117 switch (func_)
1118 {
1119 case 0:
1120 return simple_function_quad(pt(0), pt(1), t);
1121 case 1:
1122 return simple_function_cub(pt(0), pt(1), t);
1123 case 2:
1124 return simple_function_lin(pt(0), pt(1), t);
1125 case 3:
1126 return simple_function_const(pt(0), pt(1), t);
1127 default:
1128 assert(false);
1129 }
1130 }
1131 else if (pt.size() == 3)
1132 {
1133 switch (func_)
1134 {
1135 case 0:
1136 return simple_function_quad(pt(0), pt(1), pt(2), t);
1137 case 1:
1138 return simple_function_cub(pt(0), pt(1), pt(2), t);
1139 case 2:
1140 return simple_function_lin(pt(0), pt(1), pt(2), t);
1141 case 3:
1142 return simple_function_const(pt(0), pt(1), pt(2), t);
1143 default:
1144 assert(false);
1145 }
1146 }
1147
1148 assert(false);
1149 return AutodiffHessianPt(pt.size());
1150 }
1151
1153 : ProblemWithSolution(name)
1154 {
1155 }
1156
1157 VectorNd SineStokeProblemExact::eval_fun(const VectorNd &pt, const double t) const
1158 {
1159 if (pt.size() == 2)
1160 return sine_function(pt(0), pt(1), t);
1161 else if (pt.size() == 3)
1162 return sine_function(pt(0), pt(1), pt(2), t);
1163
1164 assert(false);
1165 return VectorNd(pt.size());
1166 }
1167
1169 {
1170 if (pt.size() == 2)
1171 return sine_function(pt(0), pt(1), t);
1172 else if (pt.size() == 3)
1173 return sine_function(pt(0), pt(1), pt(2), t);
1174
1175 assert(false);
1176 return AutodiffGradPt(pt.size());
1177 }
1178
1180 {
1181 if (pt.size() == 2)
1182 return sine_function(pt(0), pt(1), t);
1183 else if (pt.size() == 3)
1184 return sine_function(pt(0), pt(1), pt(2), t);
1185
1186 assert(false);
1187 return AutodiffHessianPt(pt.size());
1188 }
1189
1191 : Problem(name), func_(0), viscosity_(1)
1192 {
1193 }
1194
1195 void TransientStokeProblemExact::initial_solution(const mesh::Mesh &mesh, const Eigen::MatrixXi &global_ids, const Eigen::MatrixXd &pts, Eigen::MatrixXd &val) const
1196 {
1197 exact(pts, 0, val);
1198 }
1199
1201 {
1202 if (params.count("viscosity"))
1203 {
1204 viscosity_ = params["viscosity"];
1205 }
1206
1207 if (params.find("func") != params.end())
1208 {
1209 func_ = params["func"];
1210 }
1211 }
1212
1213 void TransientStokeProblemExact::exact(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1214 {
1215 val.resize(pts.rows(), pts.cols());
1216 for (int i = 0; i < pts.rows(); ++i)
1217 {
1218 const double x = pts(i, 0);
1219 const double y = pts(i, 1);
1220
1221 if (pts.cols() == 2)
1222 {
1223 val(i, 0) = -t + x * x / 2 + x * y;
1224 val(i, 1) = t - x * y - y * y / 2;
1225 }
1226 else
1227 {
1228 const double z = pts(i, 2);
1229 val(i, 0) = x * x;
1230 val(i, 1) = y * y;
1231 val(i, 2) = -2 * z * (x + y);
1232 }
1233
1234 // const double w = 1.;
1235 // const double k = sqrt(0.5 * w / viscosity_);
1236 // const double Q = 1./(pow(cosh(k), 2) - pow(cos(k), 2));
1237
1238 // 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);
1239 // val(i, 1) = 0;
1240 }
1241 }
1242
1243 void TransientStokeProblemExact::exact_grad(const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1244 {
1245 val.resize(pts.rows(), pts.cols() * pts.cols());
1246
1247 // for (int i = 0; i < pts.rows(); ++i)
1248 // {
1249 // const double x = pts(i, 0);
1250 // const double y = pts(i, 1);
1251
1252 // val(i, 0) = -sin(x) * sin(y) * time_scaling;
1253 // val(i, 1) = cos(x) * cos(y) * time_scaling;
1254 // val(i, 2) = -cos(x) * cos(y) * time_scaling;
1255 // val(i, 3) = sin(x) * sin(y) * time_scaling;
1256 // }
1257 }
1258
1259 void TransientStokeProblemExact::rhs(const assembler::Assembler &assembler, const Eigen::MatrixXd &pts, const double t, Eigen::MatrixXd &val) const
1260 {
1261 val.resize(pts.rows(), pts.cols());
1262
1263 for (int i = 0; i < pts.rows(); ++i)
1264 {
1265 const double x = pts(i, 0);
1266 const double y = pts(i, 1);
1267 if (pts.cols() == 2)
1268 {
1269 val(i, 0) = -viscosity_ - t * y + 1. / 2. * x * (x * x + x * y + y * y);
1270 val(i, 1) = viscosity_ - t * x + 1. / 2. * y * (x * x + x * y + y * y) + 2;
1271 }
1272 else
1273 {
1274 const double z = pts(i, 2);
1275 val(i, 0) = 2 * (x * x * x - 1);
1276 val(i, 1) = 2 * (y * y * y - 1);
1277 val(i, 2) = 2 * z * (x * x + 4 * x * y + y * y);
1278 }
1279 }
1280 val *= -1;
1281 }
1282
1283 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
1284 {
1285 exact(pts, t, val);
1286 }
1287 } // namespace problem
1288} // 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:478
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:9
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< AutodiffScalarGrad, Eigen::Dynamic, 1, 0, 3, 1 > AutodiffGradPt