1
$\begingroup$

Please run the following code. The density plot has some artifacts on it (The light blue parts around the circle) Is there a way to resolve this issue. The density plot is showing velocity of a liquid passing through the channel. Regards.

Ω = ImplicitRegion[
   0 <= x <= 2. && 0 <= y <= 0.48208 &&
    !(x >= 1. && y <= 0.19) &&
    !(x >= 1. && y >= 0.31) &&
    !(x - 0.76)^2 + (y - 0.24104)^2 <= 0.238125^2,
   {x, y}];

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

stokesFlowOperator = {
 Div[{{-1, 0}, {0, -1}}.Grad[u[x, y], {x, y}], {x, y}] + Derivative[1, 0][w][x, y], 
 Div[{{-1, 0}, {0, -1}}.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, v[x, y] == 0}, x == 0],
   DirichletCondition[{u[x, y] == 1., v[x, y] == 0}, 0 < x < 2],
   DirichletCondition[w[x, y] == 0.1, x == 2]};

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

rmf = RegionMember[Ω];

Show[
 BoundaryDiscretizeRegion[Ω],
 DensityPlot[
  {xVel[x, y], yVel[x, y]}, {x, 0, 2.}, {y, 0, 0.48208}, 
  RegionFunction -> Function[{x, y}, rmf[{x, y}]],
  AspectRatio -> Automatic, PlotLegends -> Automatic, 
  ColorFunction -> ColorData["BlueGreenYellow"], PlotPoints -> 20
 ], ImageSize -> 1000
]
$\endgroup$
  • 2
    $\begingroup$ You should increase the PlotPoints to 50-100. Then it will draw your plot normally. At least it works good in my MMA 11.3 with PlotPoints->51 $\endgroup$ – Rom38 Jun 5 '18 at 5:58
  • $\begingroup$ You may also want to add PlotRange -> All. With PlotRange -> Automatic MMA chooses a range that highlights the variation of the function. The blue parts are outside of the range and thus clipped. $\endgroup$ – Matthias Bernien Jun 10 '18 at 18:59

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.