In[]:=
Needs["NDSolve`FEM`"]Needs["OpenCascadeLink`"]
Step - file geoemtry
Step - file geoemtry
In[]:=
path=FileNameJoin[{NotebookDirectory[],"test.step"}];(*wheretestistheoneexportedasshowninthepreviouscommentseehttps://community.wolfram.com/groups/-/m/t/3557255*)
In[]:=
(*oramoregeneralusecase,Itestwithseveralstepfile.Forinstance,https://www.printables.com/model/1065543-strongest-wall-hook-collection-6-variations-parame/files*)filename="WallHook_30mm.stp";path=FileNameJoin[{NotebookDirectory[],filename}];
In[]:=
shapeIn=OpenCascadeShapeImport[path]
Out[]=
OpenCascadeShapeExpression[1]
In[]:=
bmesh=OpenCascadeShapeSurfaceMeshToBoundaryMesh[shapeIn];
In[]:=
bmesh["Wireframe"]
Out[]=
In[]:=
bmesh["Wireframe"["MeshElementStyle"->FaceForm[Gray]]]
Out[]=
In[]:=
bmesh["Coordinates"][[1;;2]]
Out[]=
{{-20.,17.,29.},{-20.,17.,0.}}
In[]:=
bmesh["BoundaryElements"][[1;;2]]
Out[]=
{TriangleElement[{{1,10,9},{6,1,9},{5,6,9},{4,5,9},{3,9,8},{3,4,9},{7,3,8},{2,11,10},{2,10,1}},{1,1,1,1,1,1,1,1,1}],TriangleElement[{{14,15,16},{14,16,17},{13,14,17},{21,18,19},{21,19,20},{24,17,18},{24,21,22},{24,22,23},{24,13,17},{24,18,21},{59,58,13},{12,58,57},{12,13,58},{60,59,13},{56,12,57},{61,13,24},{61,60,13},{55,41,12},{55,12,56},{62,61,24},{54,41,55},{40,41,54},{63,62,24},{53,40,54},{64,63,24},{39,40,53},{52,39,53},{65,64,24},{38,39,52},{51,38,52},{37,38,51},{37,51,50},{36,37,50},{36,50,49},{35,48,47},{35,49,48},{35,36,49},{46,35,47},{25,65,24},{25,43,42},{25,66,65},{25,67,66},{25,42,67},{34,35,46},{34,44,43},{34,45,44},{34,46,45},{34,43,25},{27,25,26},{27,34,25},{32,33,34},{32,34,27},{29,27,28},{30,31,32},{30,32,27},{30,27,29}},{2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}]}
In[]:=
bmesh["Properties"]
Out[]=
{BoundaryConnectivity,BoundaryElementMarkerUnion,BoundaryElements,BoundaryNormals,Bounds,ContinuousElementConnectivity,Coordinates,ElementConnectivity,EmbeddingDimension,HangingNodes,LengthUnit,MeshElementMarkerUnion,MeshElements,MeshOrder,NumberOfBoundaryElements,NumberOfCoordinates,NumberOfMeshElements,NumberOfPointElements,PointElementMarkerUnion,PointElements,Properties,Quality,RegionHoles,VertexBoundaryConnectivity,VertexElementConnectivity}
In[]:=
mesh=ToElementMesh[bmesh];
In[]:=
Show[mesh["Wireframe"],Axes->True,AxesLabel->{"X","Y","Z"}]
Out[]=
FEM
FEM
In[]:=
vars={{u[x,y,z],v[x,y,z],w[x,y,z]},{x,y,z}};pars=<|"YoungModulus"->,"PoissonRatio"->0.33|>;
9
10
In[]:=
op=SolidMechanicsPDEComponent[vars,pars]
Out[]=
·{{-1.48165×,0.,0.},{0.,-3.7594×,0.},{0.,0.,-3.7594×}}.u[x,y,z]+·{{0.,-7.29766×,0.},{-3.7594×,0.,0.},{0.,0.,0.}}.v[x,y,z]+·{{0.,0.,-7.29766×},{0.,0.,0.},{-3.7594×,0.,0.}}.w[x,y,z],·{{-3.7594×,0.,0.},{0.,-1.48165×,0.},{0.,0.,-3.7594×}}.v[x,y,z]+·{{0.,-3.7594×,0.},{-7.29766×,0.,0.},{0.,0.,0.}}.u[x,y,z]+·{{0.,0.,0.},{0.,0.,-7.29766×},{0.,-3.7594×,0.}}.w[x,y,z],·{{-3.7594×,0.,0.},{0.,-3.7594×,0.},{0.,0.,-1.48165×}}.w[x,y,z]+·{{0.,0.,-3.7594×},{0.,0.,0.},{-7.29766×,0.,0.}}.u[x,y,z]+·{{0.,0.,0.},{0.,0.,-3.7594×},{0.,-7.29766×,0.}}.v[x,y,z]
∇
{x,y,z}
9
10
8
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
9
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
9
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
∇
{x,y,z}
∇
{x,y,z}
8
10
8
10
∇
{x,y,z}
extract the coordinates:
In[]:=
nodes=mesh["Coordinates"]
Out[]=
Note the for the loaded geometry the vertical axis is Y.
In[]:=
loadedPointsPos=y==Max[nodes[[All,2]]]
Out[]=
y30.
And apply a vertical load
In[]:=
force={0,-,0};
9
10
the final boundary condition for the load is:
In[]:=
bv=SolidBoundaryLoadValue[loadedPointsPos,vars,pars,<|"Force"->force|>]
Similarly the fixed constraint.
Position:
Position:
And boundary condition:
Now you assemble the equations set:
And you solve it:
And you can visualize the displacement:
or:
Mesh and nodes visualization
Mesh and nodes visualization
You can extract the nodal coordinates
The shape is an hook-like structure, we may want to have a side fixed and load the other one.
Note that the vertical axis in this geoemtry is Y, and the fixed one may be the one with the smaller z coordinates.
And you can visualize it:
As we as the loaded one, the one with the the greater Y.
And visualize it in blue: