-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetBoundaries.cpp
More file actions
74 lines (70 loc) · 3.13 KB
/
setBoundaries.cpp
File metadata and controls
74 lines (70 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "core.hpp"
void IcoNS::setBoundaryConditions()
{
std::shared_ptr<BoundaryFunction> u_func;
std::shared_ptr<BoundaryFunction> v_func, v_func1;
std::shared_ptr<BoundaryFunction> w_func, w_func1;
if (testCase == 1)
{
u_func = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 0; });
v_func = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 0.0; });
v_func1 = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 1.0; });
w_func = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 0; });
for (int i = 0; i < 6 /*nfaces*/; i++)
{
boundary.addFunction(U, u_func);
boundary.addFunction(W, v_func);
if (i == RIGHT)
{
boundary.addFunction(V, v_func1);
}
else
{
boundary.addFunction(V, v_func);
}
}
}
else if (testCase == 2)
{
u_func = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 0; });
v_func = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 0.0; });
v_func1 = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 1.0; });
w_func = std::make_shared<Dirichlet>([&](Real /*x*/, Real /*y*/, Real /*z*/, Real /*t*/)
{ return 0; });
for (int i = 0; i < 6 /*nfaces*/; i++)
{
boundary.addFunction(U, u_func);
boundary.addFunction(W, v_func);
if (i == LEFT)
{
boundary.addFunction(V, v_func1);
}
else
{
boundary.addFunction(V, v_func);
}
}
}
else
{
u_func = std::make_shared<Dirichlet>([&](Real x, Real y, Real z, Real t)
{ return std::sin(SX + (x + 0.5) * DX) * std::cos(SY + y * DY) * std::sin(SZ + z * DZ) * std::sin(t); });
v_func = std::make_shared<Dirichlet>([&](Real x, Real y, Real z, Real t)
{ return std::cos(SX + x * DX) * std::sin(SY + (y + 0.5) * DY) * std::sin(SZ + z * DZ) * std::sin(t); });
w_func = std::make_shared<Dirichlet>([&](Real x, Real y, Real z, Real t)
{ return 2 * (std::cos(SZ + x * DX) * std::cos(SY + y * DY) * std::cos(SZ + (z + 0.5) * DZ) * std::sin(t)); });
for (int i = 0; i < 6 /*nfaces*/; i++)
{
boundary.addFunction(U, u_func);
boundary.addFunction(V, v_func);
boundary.addFunction(W, w_func);
}
}
}