Numerical solutions to the Stokes equations

This is still a draft version with little prose to describe anything.  This was a try at solving the Stokes equations (a.k.a, Creeping flows) in a plane for some flows of interest.

Ω = ImplicitRegion[0≤x≤1&&0≤y≤1,{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

The entire differential operator is the Stokes equation components in x (u[x,y] and y (v[x,y]) and the continuity equation.

stokesFlowOperator = {Inactive[Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x,y}] + Derivative[1,0][p][x, y], 
                                                 Inactive[Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x,y}] + Derivative[0,1][p][x, y],         
                                                                                                                                                                                                              Derivative[0,1][v][x, y] + Derivative[1,0][u][x, y]};

The boundary conditions are named (Subscript[Γ, D]).  “DirichletCondition” is telling us the velocity has a specific value on the boundaries.  The first is the bottom wall.  The second is the two sides and last tells the top -- which is driving the flow.  There may be other ways to do this and get the same answer.

Subscript[Γ,D]={DirichletCondition[{u[x,y]==0.,v[x,y]==0.},y ==0],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<y<1],DirichletCondition[{u[x,y]==1.,v[x,y] ==0},y==1],DirichletCondition[{p[x,y] ==0},y==1]};

??NDSolveValue

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,p},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,p->1}}];

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,p},{x,y}∈Ω];

??RegionMember

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,1},{y,0,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,1},{y,0,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[0≤x≤2&&0≤y≤0.5&&!(x≥1&&y≤0.1)&&!(x≥1&&y≥0.4),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][p][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][p][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==y (.5-y),x==0.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<x<2],DirichletCondition[p[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,p},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,p->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,0,1/2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Plot[(xVel[x,y])/.x->0,{y,0,.5}]

NIntegrate[(xVel[x,y])/.x->0,{y,0,.5}]

Plot[(xVel[x,y])/.x->1.3,{y,.1,.4}]

NIntegrate[(xVel[x,y])/.x->1.1,{y,.1,.4}]

Show[%,%%, PlotRange->{0,.5}]

We see that the pressure continually drops.

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,0,1/2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[0≤x≤2&&0≤y≤0.5&&!(1.5≥x≥1&&y≤0.4),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][p][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][p][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={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<2],DirichletCondition[p[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,p},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,p->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,0,1/2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,0,1/2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

plot1=Plot[(xVel[x,y])/.x->.3,{y,0,.5}]

NIntegrate[(xVel[x,y])/.x->0,{y,0,.5}]

plot2=Plot[(xVel[x,y])/.x->1.3,{y,.4,.5}]

NIntegrate[(xVel[x,y])/.x->1.3,{y,.4,.5}]

Show[plot1,plot2, PlotRange->{{0,.5},{0,3}}]

Ω = ImplicitRegion[0≤x≤2&&0≤y≤0.5&&!(x≥1&&y≤0.15)&&!(x≥1&&y≥0.35),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

Subscript[Γ,D]={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<2],DirichletCondition[p[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,p},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,p->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,0,1/2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,0,1/2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Plot[4*0.3*y*(0.5-y)/(0.41)^2,{y,0,.5}]

Ω = ImplicitRegion[0≤x≤2&&0≤y≤0.5&&!(1.5≥x≥1&&y≤0.4),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

notstokesFlowOperator = {1/10 Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y]+ u[x,y] Derivative[1,0][u][x, y]+v[x,y]Derivative[0,1][u][x, y] , 
   1/10 Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y] + u[x,y] Derivative[1,0][v][x, y]+v[x,y]Derivative[0,1][v][x, y]  , 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==40*0.3*y*(0.5-y)/(0.41)^2,x==0.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<x<2],DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{notstokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,0,1/2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,0,1/2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Plot[4*0.3*y*(0.5-y)/(0.41)^2,{y,0,.5}]

Ω=ImplicitRegion[!((x-5)^2+(y-5)^2≤3^2),{{x,0,5},{y,0,10}}];
RegionPlot[Ω,AspectRatio->Automatic]

Ω = ImplicitRegion[0≤x≤2&&0≤y≤0.5&&!((x-1)^2+(y)^2≤.3^2),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==y (.5-y),x==0.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<x<2],DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,0,1/2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

pressureplot=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[{pressure[x,y]},{x,0,2},{y,0,1/2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,0,1/2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = RegionDifference[Rectangle[{-1,-1},{1,1}],Disk[{0,0},{.5,.5}]];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

Ω =RegionDifference[Rectangle[{-1,-1},{1,1}],Rectangle[{-1/2,-1/2},{1/2,1/2}]];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1-y^2,x==-1.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},Abs[y] == 1/2&&-1/2≤x≤1/2||Abs[x] == 1/2&&-1/2≤y≤1/2],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},Abs[y] ==1],DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

These two are flow past a square and I think they work!

Ω = RegionDifference[Rectangle[{-1,-1},{1,1}],Circle[{0,0},1/2]];

Ω =RegionDifference[Rectangle[{-1,-1},{1,1}],Rectangle[{-1/2,-1/2},{1/2,1/2}]];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==.1,x==-1.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},Abs[y] == 1/2&&-1/2≤x≤1/2||Abs[x] == 1/2&&-1/2≤y≤1/2],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},Abs[y] ==1],DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[0≤x≤2&&-1≤y≤1&&!((x-1)^2+(y)^2≤.3^2 ),{x,y}];

Ω = RegionDifference[Rectangle[{-1,-1},{1,1}],Disk[{0,0},{.15,.15}]];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1-y^2,x==-1.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.15<y<.15],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-1<x<1],DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

plot2=Plot[(xVel[x,y])/.x->0,{y,.15,1}]

plot2=Plot[(yVel[x,y])/.x->0,{y,.15,1}]

NIntegrate[(xVel[x,y])/.x->1.3,{y,.4,.5}]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

These two are flow past a lens

Ω =RegionDifference[Rectangle[{-2,-2},{2,2}],RegionDifference[Disk[{0,0},1/2],Disk[{-1/8,0},1/2]]]

Ω =RegionDifference[Rectangle[{-1,-1},{1,1}],RegionDifference[Disk[{0,0},1/2],Disk[{-1/8,0},1/2]]]

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

DiscretizeRegion[Ω]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==.01,x==-1.],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.99≤x≤.99&&Abs[y]≤.6],
DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1},"MeshOptions"->{"MeshOrder"->2}},AccuracyGoal->10,PrecisionGoal->10];

??FiniteElement

??NDSolveValue

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Subscript[Γ,D]={DirichletCondition[u[x,y]==-1,x==-1.],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.99≤x≤.99],
DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[0≤x≤2&&-1≤y≤1&&!((x-1)^2+(y)^2≤.3^2 ),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1-y^2,x==0.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.3<y<.3],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<x<2],DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

These two are flow past a lens

Ω = RegionDifference[Rectangle[{-1,-1},{1,1}],Circle[{0,0},1/2]];

Ω =RegionDifference[Disk[{0,0},1/2],Disk[{-1/8,0},1/2]];

Ω =RegionDifference[Rectangle[{-1,-1},{1,1}],RegionDifference[Disk[{0,0},1/2],Disk[{-1/8,0},1/2]]]

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

DiscretizeRegion[Ω]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1,x==-1.],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.99≤x≤.99],
DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Subscript[Γ,D]={DirichletCondition[u[x,y]==-1,x==-1.],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.99≤x≤.99],
DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[0≤x≤2&&-1≤y≤1&&!((x-1)^2+(y)^2≤.3^2 ),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1-y^2,x==0.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-.3<y<.3],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<x<2],DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,0,2},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

These two are flow past a circle  first one works!!

Ω = ImplicitRegion[x^2+y^2≥1/4,{{x,-1,1},{y,-1,1}}];;

RegionPlot[Ω,AspectRatio->1,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1,x==-1.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},x^2 + y^2==1/4 ],
DirichletCondition[{u[x,y]==0.,v[x,y]==0.},y==1||y==-1],DirichletCondition[w[x,y]==0.,x==1]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-1,1},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-1,1},{y,-1,1},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[x^2+y^2≥1/8,{{x,-2,2},{y,-2,2}}];;

RegionPlot[Ω,AspectRatio->1,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1,x==-2.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},x^2 + y^2==1/8 ],
DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-2,2},{y,-2,2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-2,2},{y,-2,2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[x^2+y^2/4≥1/8,{{x,-2,2},{y,-2,2}}];;

RegionPlot[Ω,AspectRatio->1,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1,x==-2.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},x^2 + y^2/4==1/8 ],
DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-2,2},{y,-2,2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-2,2},{y,-2,2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω1= ImplicitRegion[0≤x≤2&&-1≤y≤1&&!((-(x-1 )+ (2y^2)≤ .2^2)),{x,y}];

RegionPlot[Ω1,AspectRatio->Automatic,ImageSize->300]

Ω3= ImplicitRegion[0≤x≤2&&-1≤y≤1&&!(((x-1)^2+(y)^2≤.8^2)),{x,y}];

RegionPlot[Ω3,AspectRatio->Automatic,ImageSize->300]

Ω = ImplicitRegion[0≤x≤2&&-1≤y≤1&&!((-(x-.5 )+ (1.6y^2)≤ .2^2)&&(-(x-.7 )+ (y^2)>= .2^2)),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1-y^2,x==0.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},0<x<2],DirichletCondition[w[x,y]==0.,x==2]};

??NDSolveValue

??InterpolationOrder

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->5,v->5,w->1}}];

??DirichletCondition

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,0,2},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

Ω = ImplicitRegion[-2≤x≤4&&-1≤y≤1&&!((-(x-.5 )+ (2y^2)≤ .2^2)&&(-(x-.9 )+ (y^2)>= .2^2)),{x,y}];

RegionPlot[Ω,AspectRatio->Automatic,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]== (1-y^2),x==-2.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},-2<x<4],DirichletCondition[w[x,y]==0.,x==4]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-2,4},{y,-1,1},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

DiscretizeRegion[Ω,{{-2,2},{-2,2}}]

DiscretizeRegion[ImplicitRegion[x^2-y^2≤1||x^2+y^2==4,{x,y}],{{-2,2},{-2,2}}]

Let’s try 3-D

Ω = ImplicitRegion[x^2+y^2+z^2≥1/8,{{x,-2,2},{y,-2,2},{z,-2,2}}];

RegionPlot[Ω,AspectRatio->1,ImageSize->300]

ContourPlot[Ω,AspectRatio->1,ImageSize->300]

stokesFlowOperator = {Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][u[x, y], {x, y}]), {x, 
      y}] + 
Derivative[1,0][w][x, y], 
   Inactive[
      Div][({{-1, 0}, {0, -1}}.Inactive[Grad][v[x, y], {x, y}]), {x, 
      y}] + 
Derivative[0,1][w][x, y], 
Derivative[0,1][v][x, y] + 
Derivative[1,0][u][x, y]};

Subscript[Γ,D]={DirichletCondition[u[x,y]==1,x==-2.],DirichletCondition[{u[x,y]==0.,v[x,y]==0.},x^2 + y^2==1/8 ],
DirichletCondition[w[x,y]==0.,x==2]};

{xVel,yVel,pressure}=NDSolveValue[{stokesFlowOperator=={0,0,0},Subscript[Γ,D]},{u,v,w},{x,y}∈Ω,Method->{"FiniteElement","InterpolationOrder"->{u->2,v->2,w->1}}];

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],StreamPlot[{xVel[x,y],yVel[x,y]},{x,-2,2},{y,-2,2},RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

rmf=RegionMember[Ω];
Show[BoundaryDiscretizeRegion[Ω],ContourPlot[pressure[x,y],{x,-2,2},{y,-2,2},Contours->20,RegionFunction->Function[{x,y},rmf[{x,y}]],AspectRatio->Automatic],ImageSize->600]

??ImplicitRegion

??RegionDifference