How to make a frustum of a cone

2018-10-16 18:40:22

For finite element purposes I need a frustum of a cone with a finite wall thickness, i.e. a tapered pipe.

To make a cone is easy

Needs["NDSolve`FEM`"]

c = BoundaryDiscretizeRegion[Cone[{{0, 0, 0}, {-1, 0, 0}}, 0.12]]

mesh = ToElementMesh[c]; mesh["Wireframe"]

So my idea was to use RegionDifference to make a frustum. Here is my module.

ClearAll[coneFrustum];

coneFrustum::usage =

"coneFrustum[{pt1, pt2, },r1 ,r2 ,height] generates a frustum of \

cone with axis going from pt1 to pt2 and with radii r1, r2";

coneFrustum[{{x1_, y1_, z1_}, {x2_, y2_, z2_}}, r1_, r2_, L_] :=

Module[{cL, vec},

cL = L r1/(r1 - r2);

vec = ({x2, y2, z2} - {x1, y1, z1})/

Norm[{x2, y2, z2} - {x1, y1, z1}];

RegionDifference[

BoundaryDiscretizeRegion[

Cone[{{x1, y1, z1}, cL vec}, r1]

],

BoundaryDiscretizeRegion[

Cone[{{x2, y2, z2}, (cL - L) vec}, r2]

]

]

]

This is what I get for a solid frustum

cf1 = coneFrustum[{{-0.1, 0, 0}, {-0.3, 0, 0}}, 0.12, 0

  • You mean something like this?

    n = 36;

    rout1 = 1.;

    rout2 = 0.8;

    rin1 = .9;

    rin2 = 0.7;

    h1 = 1.;

    h2 = 0.;

    R = BoundaryMeshRegion[

    pts = Join[

    Join[CirclePoints[rout1, n], ConstantArray[h1, {n, 1}], 2],

    Join[CirclePoints[rout2, n], ConstantArray[h2, {n, 1}], 2],

    Join[CirclePoints[rin1, n], ConstantArray[h1, {n, 1}], 2],

    Join[CirclePoints[rin2, n], ConstantArray[h2, {n, 1}], 2]

    ],

    Polygon@Join[

    Join[Partition[Range[0 n + 1, 1 n], 2, 1, 1], Reverse /@ Partition[Range[1 n + 1, 2 n], 2, 1, 1], 2],

    Join[Partition[Range[2 n + 1, 3 n], 2, 1, 1], Reverse /@ Partition[Range[3 n + 1, 4 n], 2, 1, 1], 2],

    Join[Partition[Range[0 n + 1, 1 n], 2, 1, 1], Reverse /@ Partition[Range[2 n + 1, 3 n], 2, 1, 1], 2],

    Join[Partition[Range[1 n + 1, 2 n], 2, 1, 1], Reverse /@ Partition[Range[3 n + 1, 4 n], 2, 1, 1], 2]

    ]

    ]

    Needs["NDSolve`FEM`"]

    mesh = ToElementMesh[R]; mesh["Wireframe"]

    2018-10-16 19:51:20