Message Boards Message Boards


Plot a function within a circle, e.g. stresses within a loaded disk?

Posted 1 year ago
6 Replies
1 Total Likes

I wonder if anyone knows how to plot results within a circle, e.g. stresses and strains within a loaded disc?

6 Replies

You might look at ContourPlot with the RegionFunction Option.

Posted 1 year ago

Thank you, it was helpfull

You can use anything which represents a geometric region, e.g. Disk[], Ellipsoid[] or Polygon[]:

pts0 = {#1 - .5, #2 + Sqrt[3.]/2} & @@@ First[KochCurve[4]];
pts1 = DeleteDuplicates[Chop@Flatten[NestList[RotationTransform[-Pi/3], pts0, 5], 1]];
Plot3D[Sin[10 x] Cos[10 y] Exp[-4 (x^2 + y^2)], {x, y} \[Element] Polygon[pts1], PlotRange -> All, ColorFunction -> "Rainbow", Mesh -> None, ImageSize -> Large, PlotPoints -> 50, Boxed -> False, Axes -> False]


enter image description here

Regards -- Henrik

Posted 1 year ago

Thanks, however what I am seeking for is a contour plot function in a circle. I have a solution function in polar coordinates for a loaded cylinders and want to plot the stress/strain distribution in the plane of the circular cross section of the cylinder. So I am not interested in 3D plots with out of plane displacements.

Well, sorry, I was assuming a little bit of creativity ... How about this:

f[r_, \[Phi]_] := Sin[10 r] Cos[\[Phi]]

ContourPlot[f[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, y} \[Element] Disk[]]

By "... in a circle" I guess you mean inside a circle, i.e. on a Disk[]; this I had mentioned above.

Can be used

\[ScriptCapitalR] = ImplicitRegion[x^2 + y^2 <= a^2, {x, y}];
 TransformedField["Cylindrical" -> "Cartesian", 
   f, {r, \[Theta], \[Zeta]} -> {x, y, z}] /. 
  z -> z0, {x, y} \[Element] \[ScriptCapitalR]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract