2
$\begingroup$

Modeling a simple stepped nozzle for gas flow and having difficulties with the application of the mass conservation equation as part of the boundary conditions.

I am following the fluid flow example from http://reference.wolfram.com/language/FEMDocumentation/tutorial/SolvingPDEwithFEM.html

Easy enough... however

Setting up the PDE is easy enough but the boundary conditions have me stumped. The example makes arbitrate conditions on the pressure which is exactly the quantity I want to solve for.

Region

\[CapitalOmega]=RegionUnion[Rectangle[{0,0},{.25,1}],Rectangle[{.25,.25},{.5,.75}]];
RegionPlot[\[CapitalOmega],AspectRatio->Automatic,MaxRecursion->1]

Kernel

op = {Inactive[
   Div][({{-\[Mu], 0}, {0, -\[Mu]}}.Inactive[Grad][
     u[x, y], {x, y}]), {x, y}] + \!\(\*SuperscriptBox[\(p\), TagBox[RowBox[{"(", RowBox[{"1", ",", "0"}], ")"}],Derivative], MultilineFunction->None]\)[x, y], 
Inactive[
   Div][({{-\[Mu], 0}, {0, -\[Mu]}}.Inactive[Grad][
     v[x, y], {x, y}]), {x, y}] + \!\(\*SuperscriptBox[\(p\), TagBox[RowBox[{"(", RowBox[{"0", ",", "1"}], ")"}],Derivative], MultilineFunction->None]\)[x, y], \!\(\*SuperscriptBox[\(u\), TagBox[RowBox[{"(", RowBox[{"1", ",", "0"}], ")"}], Derivative],MultilineFunction->None]\)[x, y] + \!\(\*SuperscriptBox[\(v\), TagBox[RowBox[{"(", RowBox[{"0", ",", "1"}], ")"}],Derivative],MultilineFunction->None]\)[x, y]} /. \[Mu] -> 1;

Equation

pde = op == {0, 0, 0};

Boundary Conditions

Input (x=0) uniform input velocity and pressure

bsc1 = DirichletCondition[u[x, y] == 1, x == 0.], DirichletCondition[p[x, y] == 1, x == 0.]

Sidewalls, obviously no velocity

bsc2 = DirichletCondition[{u[x, y] == 0., v[x, y] == 0.}, 0 < x < 0.5]

Output, the part I have issues with since the mass conservation equation is related to the boundary conditions is something like

Integrate[u[0.5,y]*p[0.5,y],{y,.025,.75}] == Integrate[u[0,y]*p[0,y],{y,.025,.75}]

bcs3 = DirichletCondition[?????, x == 0.5]};

bcs = {bcs1,bsc2,bcs3}

NDSolve

{xVel, yVel, pressure} =  NDSolveValue[{op == {0, 0, 0}, bcs}, {u, v, 
p}, {x, y} \[Element] \[CapitalOmega], Method -> {"FiniteElement", 
 "InterpolationOrder" -> {u -> 2, v -> 2, p -> 1}, "MeshOptions" -> {"MaxCellMeasure" -> 0.0005}}];

Plot

ContourPlot[xVel[x, y], {x, y} \[Element] \[CapitalOmega], AspectRatio -> Automatic, ColorFunction -> "TemperatureMap", Contours -> 10]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.