网上看到的有限元求解流体力学微分方程,不知道怎么修改了。
mathematica吧
全部回复
仅看楼主
level 1
\[CapitalOmega]1 =
RegionUnion[Rectangle[{0, 0}, {1, 1/2}],
Rectangle[{1, 1/10}, {2.5, 2/5}], Rectangle[{0.9, -0.2}, {1, 0}],
RegularPolygon[{1 + 0.5/2*Sqrt[3], 0.25}, {0.5, Pi/6}, 6]];
bk = RegionDifference[\[CapitalOmega]1,
Triangle[{{0.8, 0.3}, {1.7, 0.5}, {1.3, -0.1}}]];
Region[bk]
{xVel, yVel} =
{u, v} /. First[
NDSolve[
{{D[({{-\[Mu], 0}, {0, -\[Mu]}}*D[u[x, y], {{x, y}}]), {{x,
y}}] + D[p[x, y], x],
D[({{-\[Mu], 0}, {0, -\[Mu]}}*D[u[x, y], {{x, y}}]), {{x,
y}}] + D[p[x, y], y],
D[u[x, y], x] + D[v[x, y], y]} == {0, 0, 0} /. \[Mu] -> 1,
{DirichletCondition[u[x, y] == 4*0.3*y*(0.5 - y)/(0.41)^2,
x == 0.],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0.}, 0 < x < 0.9],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0.}, 1 < x < 2.5],
DirichletCondition[{u[x, y] == 0., v[x, y] == 2.5},
0.9 <= x <= 1 && y == -0.2],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0},
0.9 <= x <= 1 && y == 0.5],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0},
0.8 <= x <= 1.7 &&
y - 0.3 == (0.5 - 0.3)/(1.7 - 0.8)*(x - 0.8)],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0},
0.8 <= x <= 1.3 &&
y - 0.3 == (-0.1 - 0.3)/(1.3 - 0.8) (x - 0.8)],
DirichletCondition[p[x, y] == 0., x == 2.5]}},
{u, v, p}, {x, y} \[Element] bk,
Method -> {"FiniteElement",
"InterpolationOrder" -> {u -> 2, v -> 2, p -> 1},
"MeshOptions" -> {MaxCellMeasure -> 0.0005}},
AccuracyGoal -> 20, PrecisionGoal -> 20, WorkingPrecision -> 35]];
VectorPlot[{xVel[x, y], yVel[x, y]}, {x, y} \[Element] bk,
AspectRatio -> Automatic, StreamPoints -> 10,
StreamColorFunctionScaling -> False]
2019年11月07日 13点11分 1
吧务
level 12
方程没列对
\[CapitalOmega]1 =
RegionUnion[Rectangle[{0, 0}, {1, 1/2}],
Rectangle[{1, 1/10}, {2.5, 2/5}], Rectangle[{0.9, -0.2}, {1, 0}],
RegularPolygon[{1 + 0.5/2*Sqrt[3], 0.25}, {0.5, Pi/6}, 6]];
bk = RegionDifference[\[CapitalOmega]1,
Triangle[{{0.8, 0.3}, {1.7, 0.5}, {1.3, -0.1}}]];
pde = {-\[Mu] (D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}]) +
D[p[x, y],
x], -\[Mu] (D[v[x, y], {x, 2}] + D[v[x, y], {y, 2}]) +
D[p[x, y], y], D[u[x, y], x] + D[v[x, y], y]} == {0, 0,
0} /. \[Mu] -> 1;
bcs = {DirichletCondition[u[x, y] == 4*0.3*y*(0.5 - y)/(0.41)^2,
x == 0.],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0.}, 0 < x < 0.9],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0.}, 1 < x < 2.5],
DirichletCondition[{u[x, y] == 0., v[x, y] == 2.5},
0.9 <= x <= 1 && y == -0.2],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0},
0.9 <= x <= 1 && y == 0.5],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0},
0.8 <= x <= 1.7 && y - 0.3 == (0.5 - 0.3)/(1.7 - 0.8)*(x - 0.8)],
DirichletCondition[{u[x, y] == 0., v[x, y] == 0},
0.8 <= x <= 1.3 && y - 0.3 == (-0.1 - 0.3)/(1.3 - 0.8) (x - 0.8)],
DirichletCondition[p[x, y] == 0., x == 2.5]};
{xVel, yVel, pSol} = {u, v, p} /.
First[NDSolve[{pde, bcs}, {u, v, p}, {x, y} \[Element] bk,
Method -> {"FiniteElement",
"InterpolationOrder" -> {u -> 2, v -> 2, p -> 1},
"MeshOptions" -> {MaxCellMeasure -> 0.0005}},
AccuracyGoal -> 20, PrecisionGoal -> 20, WorkingPrecision -> 35]];
VectorPlot[{xVel[x, y], yVel[x, y]}, {x, y} \[Element] bk,
AspectRatio -> Automatic, StreamPoints -> 10,
StreamColorFunctionScaling -> False]
2019年11月08日 08点11分 2
1