Why does my imported geometry show only 1 face & 1 edge?

4 Ansichten (letzte 30 Tage)
Muhammad
Muhammad am 30 Jun. 2023
Beantwortet: Ravi Kumar am 5 Jul. 2023
I'm trying to do static structural fem in matlab following "deflection of bracket" example. When i import my own geometry (human femur bone) in matlab, it shows only 1 face and 1 edge for it! Whole geometry is shown when i plot it. But now i can't proceed as i will need to select faces to apply boundary conditions and that won't be possible. Is there a solution to this?
Note: My stl is ascii and i have tried with single solid (one time solid-endsolid in ascii) geometry as well as 3 solid (3 times solid-endsolid in ascii) bodies making complete geometry after splitting it in cad software. Both show 1 cell, 2 vertices, 1 face & 1 edge upon import.
  1 Kommentar
Cris LaPierre
Cris LaPierre am 30 Jun. 2023
Could you share your STL file by attaching it to your post using the paperclip icon? You many need to zip it in order to upload it.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ravi Kumar
Ravi Kumar am 5 Jul. 2023
Hi Muhammad,
As Cris noted, the lack of sharp edges in the triangulation results in a single face for the whole geometry.
Here is a workaround to update the geometry using the mesh data to create additional faces. The overall idea is to generate mesh on the single-cell geometry. Use the mesh data and create a new geometry with more than one cell by manually selecting a few elements and assigning a specific cell ID to those elements. You get a few more faces once you have more than one cell. In the script below, I have created a three-cell geometry. I also show how to collect the faces associated with the cells to assign loads/BCs.
modelGeom = createpde('structural');
modelGeom.importGeometry('ascii_femur.stl')
figure
pdegplot(modelGeom)
% Generate mesh and use the mesh data to create additional cells and hence
% faces.
generateMesh(modelGeom)
% Find elements near top and bottom using a box search method
elemTop = findElements(modelGeom.Mesh,'box',[-300,300],[-300,300],[750,900]);
elemBottom = findElements(modelGeom.Mesh,'box',[-300,300],[-300,300],[0,450]);
% Create elements to region mapping
elemToRegion = ones(1,size(modelGeom.Mesh.Elements,2));
% Assign cell #2 to top elements
elemToRegion(elemTop) = 2;
% Assign cell #3 to bottom elements
elemToRegion(elemBottom) = 3;
% all other elements remain in cell 1.
% Create a new geometry containing three cells.
model = createpde('structural');
gm = geometryFromMesh(model,modelGeom.Mesh.Nodes,modelGeom.Mesh.Elements,elemToRegion);
figure
pdegplot(model,'CellLabels','on','FaceLabels','on','FaceAlpha',0.4)
% Find face IDs to apply BCs.
cell2Faces = cellFaces(model.Geometry,2,'external')
cell3Faces = cellFaces(model.Geometry,3,'external')

Weitere Antworten (1)

Cris LaPierre
Cris LaPierre am 2 Jul. 2023
Bearbeitet: Cris LaPierre am 2 Jul. 2023
Found an explanation. From the Tip on the importGeometry page:
  • Reconstruction from STL data is not precise and can result in a loss of edges and, therefore, the merging of adjacent faces. Typically, lost edges are the edges between two adjacent faces meeting at a small angle, or smooth edges bounding blend surfaces. Usually, the loss of such edges does not affect the analysis workflow.
unzip('femur.zip')
model = createpde;
importGeometry(model,"ascii_femur_cut.stl")
ans =
DiscreteGeometry with properties: NumCells: 1 NumFaces: 1 NumEdges: 1 NumVertices: 2 Vertices: [2×3 double]
pdegplot(model)
You can then add a mesu using the generateMesh function, but I don't think this helps solve your original issue of setting boundary conditions.
generateMesh(model)
ans =
FEMesh with properties: Nodes: [3×3031 double] Elements: [10×1590 double] MaxElementSize: 19.3950 MinElementSize: 9.6975 MeshGradation: 1.5000 GeometricOrder: 'quadratic'
pdeplot3D(model)
  1 Kommentar
Muhammad
Muhammad am 2 Jul. 2023
structuralModel = createpde('structural','static-solid')
structuralModel =
StructuralModel with properties: AnalysisType: "static-solid" Geometry: [] MaterialProperties: [] BodyLoads: [] BoundaryConditions: [] ReferenceTemperature: [] SuperelementInterfaces: [] Mesh: [] SolverOptions: [1×1 pde.PDESolverOptions]
Although generateMesh successfully populates structuralModel.Mesh property, I was aiming to populate structuralModel.BoundaryConditions and structuralModel.BodyLoads properties by fixing the issue of only having 1 face and 1 edge in DiscreteGeometry of structuralModel.Geometry property, it still shows only 1 face and 1 edge while mesh is present in respective property.
As the limitation lies in not accurately importing model, well i made the stl (using stlwrite) from points and connectivityList which i still have (for ascii_femur, only one 'solid-endsolid' in stl). So can that issue now be avoided?
(If a better approach exists, that is also welcome! Is it possible to ask matlab to use 'solid-endsolid' segments of stl and apply bondary conditions to those whole segments, instead of face by face?)
(Mathworks, please make importGeometry more precise for stl now that it is needed practically as well).

Melden Sie sich an, um zu kommentieren.

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by