How to solve stokes flow in 3D?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I am trying to extend stokes flow example to 3D but I get an error. Not sure what's wrong.
For example we define the region and this works:
[CapitalOmega] =
ImplicitRegion[-0.5 <= z <= 0.5 && 0 <= x <= 2 &&
0 <= y <=
0.5 && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y,
z];
RegionPlot3D[[CapitalOmega]]
Then we define the stokes flow operator,I am not sure this is right:
stokesFlowOperator = Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
u[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y],
Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], nactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z];
Subscript[[CapitalGamma],
D] = DirichletCondition[
u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., v[x, y, z] == 0.,
0 < x < 2], DirichletCondition[w[x, y, z] == 0., x == 2];
This lines fails:
xVel, yVel, zVel, pressure =
NDSolveValue[stokesFlowOperator == 0, 0, 0,
Subscript[[CapitalGamma], D], u, v,
w, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 1]
And I get this error:
NDSolveValue::dsvar: 0.35` cannot be used as a variable.
Set::shape: Lists xVel,yVel,zVel,pressure and NDSolveValue[False,DirichletCondition[u[x,y,0.35]==0.35 +7.13861 Plus[<<2>>] y,x==0.],DirichletCondition[u[x,y,0.35]==0.,v[x,y,0.35]==0.,0<x<2],DirichletCondition[w[x,y,0.35]==0.,x==2],u,v,w,x,y,0.35[Element]ImplicitRegion[-0.5<=z<=0.5&&0<=x<=2&&0<=y<=0.5&&!(x>=1&&y<=0.1)&&!(x>=1&&y>=0.4),x,y,z],Method->FiniteElement,InterpolationOrder->u->2,v->2,w->1] are not the same shape.
I am not sure what I am doing wrong when trying to extend to 3D.
differential-equations
add a comment |Â
up vote
3
down vote
favorite
I am trying to extend stokes flow example to 3D but I get an error. Not sure what's wrong.
For example we define the region and this works:
[CapitalOmega] =
ImplicitRegion[-0.5 <= z <= 0.5 && 0 <= x <= 2 &&
0 <= y <=
0.5 && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y,
z];
RegionPlot3D[[CapitalOmega]]
Then we define the stokes flow operator,I am not sure this is right:
stokesFlowOperator = Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
u[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y],
Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], nactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z];
Subscript[[CapitalGamma],
D] = DirichletCondition[
u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., v[x, y, z] == 0.,
0 < x < 2], DirichletCondition[w[x, y, z] == 0., x == 2];
This lines fails:
xVel, yVel, zVel, pressure =
NDSolveValue[stokesFlowOperator == 0, 0, 0,
Subscript[[CapitalGamma], D], u, v,
w, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 1]
And I get this error:
NDSolveValue::dsvar: 0.35` cannot be used as a variable.
Set::shape: Lists xVel,yVel,zVel,pressure and NDSolveValue[False,DirichletCondition[u[x,y,0.35]==0.35 +7.13861 Plus[<<2>>] y,x==0.],DirichletCondition[u[x,y,0.35]==0.,v[x,y,0.35]==0.,0<x<2],DirichletCondition[w[x,y,0.35]==0.,x==2],u,v,w,x,y,0.35[Element]ImplicitRegion[-0.5<=z<=0.5&&0<=x<=2&&0<=y<=0.5&&!(x>=1&&y<=0.1)&&!(x>=1&&y>=0.4),x,y,z],Method->FiniteElement,InterpolationOrder->u->2,v->2,w->1] are not the same shape.
I am not sure what I am doing wrong when trying to extend to 3D.
differential-equations
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am trying to extend stokes flow example to 3D but I get an error. Not sure what's wrong.
For example we define the region and this works:
[CapitalOmega] =
ImplicitRegion[-0.5 <= z <= 0.5 && 0 <= x <= 2 &&
0 <= y <=
0.5 && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y,
z];
RegionPlot3D[[CapitalOmega]]
Then we define the stokes flow operator,I am not sure this is right:
stokesFlowOperator = Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
u[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y],
Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], nactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z];
Subscript[[CapitalGamma],
D] = DirichletCondition[
u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., v[x, y, z] == 0.,
0 < x < 2], DirichletCondition[w[x, y, z] == 0., x == 2];
This lines fails:
xVel, yVel, zVel, pressure =
NDSolveValue[stokesFlowOperator == 0, 0, 0,
Subscript[[CapitalGamma], D], u, v,
w, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 1]
And I get this error:
NDSolveValue::dsvar: 0.35` cannot be used as a variable.
Set::shape: Lists xVel,yVel,zVel,pressure and NDSolveValue[False,DirichletCondition[u[x,y,0.35]==0.35 +7.13861 Plus[<<2>>] y,x==0.],DirichletCondition[u[x,y,0.35]==0.,v[x,y,0.35]==0.,0<x<2],DirichletCondition[w[x,y,0.35]==0.,x==2],u,v,w,x,y,0.35[Element]ImplicitRegion[-0.5<=z<=0.5&&0<=x<=2&&0<=y<=0.5&&!(x>=1&&y<=0.1)&&!(x>=1&&y>=0.4),x,y,z],Method->FiniteElement,InterpolationOrder->u->2,v->2,w->1] are not the same shape.
I am not sure what I am doing wrong when trying to extend to 3D.
differential-equations
I am trying to extend stokes flow example to 3D but I get an error. Not sure what's wrong.
For example we define the region and this works:
[CapitalOmega] =
ImplicitRegion[-0.5 <= z <= 0.5 && 0 <= x <= 2 &&
0 <= y <=
0.5 && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y,
z];
RegionPlot3D[[CapitalOmega]]
Then we define the stokes flow operator,I am not sure this is right:
stokesFlowOperator = Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
u[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y],
Inactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], nactive[
Div][(-1, 0, 0, -1.Inactive[Grad][
v[x, y, z], x, y, z]), x,
y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z];
Subscript[[CapitalGamma],
D] = DirichletCondition[
u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., v[x, y, z] == 0.,
0 < x < 2], DirichletCondition[w[x, y, z] == 0., x == 2];
This lines fails:
xVel, yVel, zVel, pressure =
NDSolveValue[stokesFlowOperator == 0, 0, 0,
Subscript[[CapitalGamma], D], u, v,
w, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 1]
And I get this error:
NDSolveValue::dsvar: 0.35` cannot be used as a variable.
Set::shape: Lists xVel,yVel,zVel,pressure and NDSolveValue[False,DirichletCondition[u[x,y,0.35]==0.35 +7.13861 Plus[<<2>>] y,x==0.],DirichletCondition[u[x,y,0.35]==0.,v[x,y,0.35]==0.,0<x<2],DirichletCondition[w[x,y,0.35]==0.,x==2],u,v,w,x,y,0.35[Element]ImplicitRegion[-0.5<=z<=0.5&&0<=x<=2&&0<=y<=0.5&&!(x>=1&&y<=0.1)&&!(x>=1&&y>=0.4),x,y,z],Method->FiniteElement,InterpolationOrder->u->2,v->2,w->1] are not the same shape.
I am not sure what I am doing wrong when trying to extend to 3D.
differential-equations
differential-equations
asked 4 hours ago


0x90
2027
2027
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
These are not the Stokes equations. You must have built in several errors when translating the 2D equations into 3D. The following works although it complains because there are no boundary conditions for the pressure that would make it unique. Also, I am don't know at all whether these are the boundary conditions that you would like to apply.
a = IdentityMatrix[3];
stokesFlowOperator =
Inactive[Div][a.Inactive[Grad][u[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], x],
Inactive[Div][a.Inactive[Grad][v[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], y],
Inactive[Div][a.Inactive[Grad][w[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], z],
Div[u[x, y, z], v[x, y, z], w[x, y, z], x, y, z]
;
ΓD =
DirichletCondition[u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., 0 < x < 2],
DirichletCondition[v[x, y, z] == 0., 0 < x < 2],
DirichletCondition[w[x, y, z] == 0., x == 2]
;
xVel, yVel, zVel, pressure = NDSolveValue[
stokesFlowOperator == 0, 0, 0, 0,
ΓD
,
u, v, w, p,
x, y, z ∈ Ω,
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1
]
add a comment |Â
up vote
2
down vote
Totally wrong. I will show an example with a Poiseuille profile at the inlet.
H = 1/2; L = 2;
[CapitalOmega] =
ImplicitRegion[
0 <= z <= H && 0 <= x <= L &&
0 <= y <=
H && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y, z];
RegionPlot3D[[CapitalOmega]]
Um = 45/100; [Nu] = 1;
U0[y_, z_] := 16*Um*y*z*(H - y)*(H - z)/H^4
U, V, W, P =
NDSolveValue[-[Nu]*Laplacian[u[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[v[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[w[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] == 0, 0, 0, 0,
DirichletCondition[u[x, y, z] == U0[y, z], v[x, y, z] == 0,
w[x, y, z] == 0, x == 0],
DirichletCondition[u[x, y, z] == 0, v[x, y, z] == 0,
w[x, y, z] == 0, 0 < x < L],
DirichletCondition[p[x, y, z] == 0, x == L], u, v, w,
p, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1,
"MeshOptions" -> "MaxCellMeasure" ->
0.0001];
ContourPlot[U[x, y, H/2], x, 0, L, y, 0, H,
AspectRatio -> Automatic, Contours -> 20, PlotPoints -> 50]
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
These are not the Stokes equations. You must have built in several errors when translating the 2D equations into 3D. The following works although it complains because there are no boundary conditions for the pressure that would make it unique. Also, I am don't know at all whether these are the boundary conditions that you would like to apply.
a = IdentityMatrix[3];
stokesFlowOperator =
Inactive[Div][a.Inactive[Grad][u[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], x],
Inactive[Div][a.Inactive[Grad][v[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], y],
Inactive[Div][a.Inactive[Grad][w[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], z],
Div[u[x, y, z], v[x, y, z], w[x, y, z], x, y, z]
;
ΓD =
DirichletCondition[u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., 0 < x < 2],
DirichletCondition[v[x, y, z] == 0., 0 < x < 2],
DirichletCondition[w[x, y, z] == 0., x == 2]
;
xVel, yVel, zVel, pressure = NDSolveValue[
stokesFlowOperator == 0, 0, 0, 0,
ΓD
,
u, v, w, p,
x, y, z ∈ Ω,
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1
]
add a comment |Â
up vote
3
down vote
These are not the Stokes equations. You must have built in several errors when translating the 2D equations into 3D. The following works although it complains because there are no boundary conditions for the pressure that would make it unique. Also, I am don't know at all whether these are the boundary conditions that you would like to apply.
a = IdentityMatrix[3];
stokesFlowOperator =
Inactive[Div][a.Inactive[Grad][u[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], x],
Inactive[Div][a.Inactive[Grad][v[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], y],
Inactive[Div][a.Inactive[Grad][w[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], z],
Div[u[x, y, z], v[x, y, z], w[x, y, z], x, y, z]
;
ΓD =
DirichletCondition[u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., 0 < x < 2],
DirichletCondition[v[x, y, z] == 0., 0 < x < 2],
DirichletCondition[w[x, y, z] == 0., x == 2]
;
xVel, yVel, zVel, pressure = NDSolveValue[
stokesFlowOperator == 0, 0, 0, 0,
ΓD
,
u, v, w, p,
x, y, z ∈ Ω,
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1
]
add a comment |Â
up vote
3
down vote
up vote
3
down vote
These are not the Stokes equations. You must have built in several errors when translating the 2D equations into 3D. The following works although it complains because there are no boundary conditions for the pressure that would make it unique. Also, I am don't know at all whether these are the boundary conditions that you would like to apply.
a = IdentityMatrix[3];
stokesFlowOperator =
Inactive[Div][a.Inactive[Grad][u[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], x],
Inactive[Div][a.Inactive[Grad][v[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], y],
Inactive[Div][a.Inactive[Grad][w[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], z],
Div[u[x, y, z], v[x, y, z], w[x, y, z], x, y, z]
;
ΓD =
DirichletCondition[u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., 0 < x < 2],
DirichletCondition[v[x, y, z] == 0., 0 < x < 2],
DirichletCondition[w[x, y, z] == 0., x == 2]
;
xVel, yVel, zVel, pressure = NDSolveValue[
stokesFlowOperator == 0, 0, 0, 0,
ΓD
,
u, v, w, p,
x, y, z ∈ Ω,
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1
]
These are not the Stokes equations. You must have built in several errors when translating the 2D equations into 3D. The following works although it complains because there are no boundary conditions for the pressure that would make it unique. Also, I am don't know at all whether these are the boundary conditions that you would like to apply.
a = IdentityMatrix[3];
stokesFlowOperator =
Inactive[Div][a.Inactive[Grad][u[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], x],
Inactive[Div][a.Inactive[Grad][v[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], y],
Inactive[Div][a.Inactive[Grad][w[x, y, z], x, y, z], x, y, z] -
D[p[x, y, z], z],
Div[u[x, y, z], v[x, y, z], w[x, y, z], x, y, z]
;
ΓD =
DirichletCondition[u[x, y, z] == z + 4*0.3*y*(0.5 - y)/(0.41)^2, x == 0.],
DirichletCondition[u[x, y, z] == 0., 0 < x < 2],
DirichletCondition[v[x, y, z] == 0., 0 < x < 2],
DirichletCondition[w[x, y, z] == 0., x == 2]
;
xVel, yVel, zVel, pressure = NDSolveValue[
stokesFlowOperator == 0, 0, 0, 0,
ΓD
,
u, v, w, p,
x, y, z ∈ Ω,
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1
]
edited 13 mins ago
answered 1 hour ago


Henrik Schumacher
40.5k256121
40.5k256121
add a comment |Â
add a comment |Â
up vote
2
down vote
Totally wrong. I will show an example with a Poiseuille profile at the inlet.
H = 1/2; L = 2;
[CapitalOmega] =
ImplicitRegion[
0 <= z <= H && 0 <= x <= L &&
0 <= y <=
H && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y, z];
RegionPlot3D[[CapitalOmega]]
Um = 45/100; [Nu] = 1;
U0[y_, z_] := 16*Um*y*z*(H - y)*(H - z)/H^4
U, V, W, P =
NDSolveValue[-[Nu]*Laplacian[u[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[v[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[w[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] == 0, 0, 0, 0,
DirichletCondition[u[x, y, z] == U0[y, z], v[x, y, z] == 0,
w[x, y, z] == 0, x == 0],
DirichletCondition[u[x, y, z] == 0, v[x, y, z] == 0,
w[x, y, z] == 0, 0 < x < L],
DirichletCondition[p[x, y, z] == 0, x == L], u, v, w,
p, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1,
"MeshOptions" -> "MaxCellMeasure" ->
0.0001];
ContourPlot[U[x, y, H/2], x, 0, L, y, 0, H,
AspectRatio -> Automatic, Contours -> 20, PlotPoints -> 50]
add a comment |Â
up vote
2
down vote
Totally wrong. I will show an example with a Poiseuille profile at the inlet.
H = 1/2; L = 2;
[CapitalOmega] =
ImplicitRegion[
0 <= z <= H && 0 <= x <= L &&
0 <= y <=
H && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y, z];
RegionPlot3D[[CapitalOmega]]
Um = 45/100; [Nu] = 1;
U0[y_, z_] := 16*Um*y*z*(H - y)*(H - z)/H^4
U, V, W, P =
NDSolveValue[-[Nu]*Laplacian[u[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[v[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[w[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] == 0, 0, 0, 0,
DirichletCondition[u[x, y, z] == U0[y, z], v[x, y, z] == 0,
w[x, y, z] == 0, x == 0],
DirichletCondition[u[x, y, z] == 0, v[x, y, z] == 0,
w[x, y, z] == 0, 0 < x < L],
DirichletCondition[p[x, y, z] == 0, x == L], u, v, w,
p, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1,
"MeshOptions" -> "MaxCellMeasure" ->
0.0001];
ContourPlot[U[x, y, H/2], x, 0, L, y, 0, H,
AspectRatio -> Automatic, Contours -> 20, PlotPoints -> 50]
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Totally wrong. I will show an example with a Poiseuille profile at the inlet.
H = 1/2; L = 2;
[CapitalOmega] =
ImplicitRegion[
0 <= z <= H && 0 <= x <= L &&
0 <= y <=
H && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y, z];
RegionPlot3D[[CapitalOmega]]
Um = 45/100; [Nu] = 1;
U0[y_, z_] := 16*Um*y*z*(H - y)*(H - z)/H^4
U, V, W, P =
NDSolveValue[-[Nu]*Laplacian[u[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[v[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[w[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] == 0, 0, 0, 0,
DirichletCondition[u[x, y, z] == U0[y, z], v[x, y, z] == 0,
w[x, y, z] == 0, x == 0],
DirichletCondition[u[x, y, z] == 0, v[x, y, z] == 0,
w[x, y, z] == 0, 0 < x < L],
DirichletCondition[p[x, y, z] == 0, x == L], u, v, w,
p, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1,
"MeshOptions" -> "MaxCellMeasure" ->
0.0001];
ContourPlot[U[x, y, H/2], x, 0, L, y, 0, H,
AspectRatio -> Automatic, Contours -> 20, PlotPoints -> 50]
Totally wrong. I will show an example with a Poiseuille profile at the inlet.
H = 1/2; L = 2;
[CapitalOmega] =
ImplicitRegion[
0 <= z <= H && 0 <= x <= L &&
0 <= y <=
H && ! (x >= 1 && y <= 0.1) && ! (x >= 1 && y >= 0.4), x, y, z];
RegionPlot3D[[CapitalOmega]]
Um = 45/100; [Nu] = 1;
U0[y_, z_] := 16*Um*y*z*(H - y)*(H - z)/H^4
U, V, W, P =
NDSolveValue[-[Nu]*Laplacian[u[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[v[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z], -[Nu]*
Laplacian[w[x, y, z], x, y, z] +
!(*SuperscriptBox[(p),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z],
!(*SuperscriptBox[(u),
TagBox[
RowBox["(",
RowBox["1", ",", "0", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(v),
TagBox[
RowBox["(",
RowBox["0", ",", "1", ",", "0"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] +
!(*SuperscriptBox[(w),
TagBox[
RowBox["(",
RowBox["0", ",", "0", ",", "1"], ")"],
Derivative],
MultilineFunction->None])[x, y, z] == 0, 0, 0, 0,
DirichletCondition[u[x, y, z] == U0[y, z], v[x, y, z] == 0,
w[x, y, z] == 0, x == 0],
DirichletCondition[u[x, y, z] == 0, v[x, y, z] == 0,
w[x, y, z] == 0, 0 < x < L],
DirichletCondition[p[x, y, z] == 0, x == L], u, v, w,
p, x, y, z [Element] [CapitalOmega],
Method -> "FiniteElement",
"InterpolationOrder" -> u -> 2, v -> 2, w -> 2, p -> 1,
"MeshOptions" -> "MaxCellMeasure" ->
0.0001];
ContourPlot[U[x, y, H/2], x, 0, L, y, 0, H,
AspectRatio -> Automatic, Contours -> 20, PlotPoints -> 50]
answered 1 hour ago


Alex Trounev
2,655312
2,655312
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183011%2fhow-to-solve-stokes-flow-in-3d%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password