5
$\begingroup$

I'm trying to compue a mesh of full 2D region delimited by the a circle transformed with a Complex map.

{g, Ω} = 
 Module[{R = 1., a = 0.2, b = 0.3, JMC, JM, z0, r},
  JMC = R \[Function] (z \[Function] z + R^2/z);
  JM = JMC[R];
  z0 = a + I b;
  r = Abs[R - z0];
  {ParametricPlot[{Re[#], Im[#]} &@
     With[{z = z0 + r E^(I θ)}, JM[z]], {θ, 0, 2 π},
     PlotRange -> All, Frame -> True],
   ParametricRegion[{Re[#], Im[#]} &@
     With[{z = z0 + r E^(I θ)}, JM[z]], {{θ, 0, 
      2 π}}]}
  ]

Mathematica graphics

But I get some errors with differents methods:

Needs["NDSolve`FEM`"]
BoundaryDiscretizeRegion[Ω]
ToBoundaryMesh[Ω]

Mathematica graphics

There is any way to accomplish this task or to handle such problematic regions?

$\endgroup$
7
$\begingroup$

Let plot be the output of ParametricPlot.

{poly} = Cases[Normal@plot, _Line, Infinity] /. Line -> Polygon;
BoundaryDiscretizeRegion[poly]

Mathematica graphics

(Since you're discretizing the region anyway, the symbolic parametric description must not be needed.)

$\endgroup$
7
$\begingroup$

You can use this:

NDSolve`FEM`ToElementMesh[
  DiscretizeGraphics[g, PlotRange -> All][
   "MakeRepresentation"["ElementMesh"]]]["Wireframe"]

enter image description here

$\endgroup$
6
$\begingroup$

@Michael E2 wrote one kind of answer I was expecting. I would eventually like to understand why things behave this way and how to get discretized regions of different "quality". So I wait some time to accept the previous answer.

For those interested, I'll add some background information and a way to discretize a "complement" of the previous region. This can be interesting to represent the region occupied by a fluid around an idealized, simple, parametrically described, wing.

This wing is built with the family (depending on parameter R) of the Joukowsky maps of the complex plane:

JoukowskiMapComplex = R \[Function] (z \[Function] z + R^2/z);

which in polar and cartesian coordinates become:

JoukowskiMapPolar = 
  R \[Function] ({ρ, θ} \[Function] {(ρ + 
         R^2/ρ) Cos[θ], (ρ - 
         R^2/ρ) Sin[θ]});
JoukowskiMapCartesian = 
  R \[Function] ({x, y} \[Function] 
     With[{q = R^2/(x^2 + y^2)}, {x + q x, y - q y}]);

For some good choice of the parameters, a circle centered in $X_0 + i Y_0$ and passing through $R + i0$ is mapped to a "wing" and a circle centered in $0+i0$ with radius $\rho$ is mapped to an ellipsis around the wing, with the distance between the two increasing as $\rho$ approaches to $0$.

Manipulate[
 Module[{JMPC = JoukowskiMapPolar[R], JMCC = JoukowskiMapCartesian[R],
    r = Abs[X0 + I Y0 - R]},
  GraphicsRow[{
    ParametricPlot[{Through[{Re, Im}[ρ E^(I θ)]], 
      Through[{Re, Im}[X0 + I Y0 + r E^(I θ)]]}, {θ, 0, 
      2 π}, Frame -> True, AspectRatio -> Automatic, 
     AxesStyle -> Dashed],
    ParametricPlot[{JMPC[ρ, θ], 
      JMCC @@ Through[{Re, Im}[
         X0 + I Y0 + r E^(I θ)]]}, {θ, 0, 2 π}, 
     Frame -> True, AspectRatio -> Automatic, AxesStyle -> Dashed]
    }, ImageSize -> Large]
  ],

 Row[{Control[{{X0, 0.2, "\!\(\*SubscriptBox[\(X\), \(0\)]\)"}, 0, 1, 
     0.05, Appearance -> "Labeled"}], 
   Control[{{Y0, 0.3, "\!\(\*SubscriptBox[\(Y\), \(0\)]\)"}, -2, 2, 
     0.05, Appearance -> "Labeled"}]}],
 Row[{Control[{{R, 1}, 0, 2, 0.05, Appearance -> "Labeled"}], 
   Control[{{ρ, 0.05}, 0, 1.5, 0.01, Appearance -> "Labeled"}]}],
 ControlPlacement -> Bottom
 ]

Mathematica graphics

With this in mind the fluid around this wing can be meshed by first meshing the the anular region between the two circles and then transforming the coordinates of the incidents.

Options[JoukowskiMesh] = Options[DiscretizeRegion];
JoukowskiMesh[R_, {X0_, Y0_}, ρ_, opts : OptionsPattern[]] := 
 Module[{r, Ω, mesh},
  r = Abs[X0 + I Y0 - R];
  Ω = 
   RegionDifference[Disk[{X0, Y0}, r], Disk[{0, 0}, ρ]];
  mesh = DiscretizeRegion[Ω, opts];
  MeshRegion[JoukowskiMapCartesian[R] @@@ MeshCoordinates[mesh], 
   Join @@ MeshCells[mesh, All]]
  ]

mesh = JoukowskiMesh[1, {0.1, 0.05}, 0.05, 
  MaxCellMeasure -> {1 -> 0.02, 2 -> 0.02}]

Mathematica graphics

As desired, the mesh refines near the wing. Because the Joukowsky map in the complex plane has very interesting properties, the mesh obtained with this method is of high quality, as a close-up can show.

$\endgroup$
3
  • $\begingroup$ Do you have 10.0.2? (My employer's IT dept. is very slow to make upgrades available, and I have only 10.0.1.) The region functionality is still under development, and one might expect the situation to improve. $\endgroup$ – Michael E2 Dec 22 '14 at 1:59
  • $\begingroup$ @MichaelE2 yes, I have 10.0.2, with an academic site licensing. I understand Region are both "first class Citizen in the WL" and "actively developed". Hope they become better documented and supported soon. $\endgroup$ – unlikely Dec 22 '14 at 8:26
  • $\begingroup$ Well, it seems to be a bug to me. Perhaps you should report it to WRI. $\endgroup$ – Michael E2 Dec 22 '14 at 14:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.