1
$\begingroup$

I have used the ParametricPlot to plot the sector of the disk and use Show to combine them in one picture, however it cannot be converted to the region and cannot use the RegionUnite, and cannot be meshed by ToElementMesh, **so how to convert the plot to region and get the mesh later for FEM and boundary conditions indication?

The code and its results are as follows:

R1 = 4/100;
R2 = 7/100;
R3 = 8/100;


ToothNumber = 8;
SlotNumber = ToothNumber;
RectangleNumber = ToothNumber + SlotNumber;

betaSlot = Pi/8;
betaPole = 2*Pi/(ToothNumber) - betaSlot;

thetaInitial = Pi/12;

regionR2R3 = 
  ParametricPlot[{r Cos[theta], r Sin[theta]}, {theta, 0, 2 Pi}, {r, 
    R2, R3}];
region[n_] := 
  ParametricPlot[{r Cos[theta], r Sin[theta]}, {theta, 
    thetaInitial + betaPole + (n - 1)*(betaPole + betaSlot), 
    thetaInitial + betaPole + 
     betaSlot + (n - 1)*(betaPole + betaSlot)}, {r, R1, R2}];
regionR1R2 = 
  Show[Table[region[n], {n, 1, ToothNumber}], PlotRange -> All];
regionAll = Show[{regionR1R2, regionR2R3}, PlotRange -> All]

The above code can plot the right region (But it is not in region format) and the output figure is as this:

enter image description here

The following code doesn't work:

RegionUnion[regionR1R2, regionR2R3]
\[CapitalOmega] = regionAll;
bounds = {{-R3, R3}, {-R3, R3}};
meshAll = ToElementMesh[\[CapitalOmega], bounds]
$\endgroup$
2
  • $\begingroup$ mesh = ToElementMesh[regionAll // BoundaryDiscretizeGraphics]; mesh["Wireframe"] $\endgroup$
    – cvgmt
    Mar 22, 2023 at 3:55
  • $\begingroup$ @cvgmt, excellent and thank you very much! $\endgroup$
    – fhrl
    Mar 22, 2023 at 5:57

1 Answer 1

2
$\begingroup$

Another way maybe replace all the ParametricPlot to ParametricRegion and use RegionUnion.

Clear["Global`*"];
Needs["NDSolve`FEM`"];
R1 = 4/100;
R2 = 7/100;
R3 = 8/100;


ToothNumber = 8;
SlotNumber = ToothNumber;
RectangleNumber = ToothNumber + SlotNumber;

betaSlot = Pi/8;
betaPole = 2*Pi/(ToothNumber) - betaSlot;

thetaInitial = Pi/12;

regionR2R3 = 
  ParametricRegion[{r Cos[theta], 
    r Sin[theta]}, {{theta, 0, 2 Pi}, {r, R2, R3}}];
region[n_] := 
  ParametricRegion[{r Cos[theta], 
    r Sin[theta]}, {{theta, 
     thetaInitial + betaPole + (n - 1)*(betaPole + betaSlot), 
     thetaInitial + betaPole + 
      betaSlot + (n - 1)*(betaPole + betaSlot)}, {r, R1, R2}}];

regionR1R2 = RegionUnion[Table[region[n], {n, 1, ToothNumber}]];
regionAll = RegionUnion[regionR1R2, regionR2R3];
mesh = RegionPlot[regionAll] // BoundaryDiscretizeGraphics // 
  ToBoundaryMesh
mesh["Wireframe"]

enter image description here

$\endgroup$
3
  • $\begingroup$ Great answer and thank you very much! However what is the difference of Region and RegionPlot,as I cannot get the mesh for your code. $\endgroup$
    – fhrl
    Mar 22, 2023 at 5:59
  • $\begingroup$ @fhrl Needs["NDSolveFEM"]; I am using version 13.2.1 ,the code work for me. If we want to use Region, we can using mesh = Region[regionAll] // Show // BoundaryDiscretizeGraphics // ToBoundaryMesh $\endgroup$
    – cvgmt
    Mar 22, 2023 at 7:58
  • $\begingroup$ Well received and thank you! $\endgroup$
    – fhrl
    Mar 22, 2023 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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