GenerateMesh failing for some specific STEP files
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi,
I am using the PDE toolbox to do some parameter sweeps of geometries that I create using python. The issue is that when I try and mesh the geometry using generateMesh, some of the geometries cannot be meshed, while others work fine.
For example, I have attached two seperate .STEP files that I generated, and the only difference between the two is the distance between the cuts.
The code I use to import the files is shown here:
disp('importing geometry')
%create the model structure for static analysis
model = createpde('structural','static-solid');
%read in the tube step.
gm = importGeometry(model, 'discrete_work.step');
%gm = importGeometry(model, 'discrete_fail.step');
pdegplot(gm,"FaceAlpha",0.3)
structuralProperties(model,'YoungsModulus',60e3,'PoissonsRatio',0.3);
ModelVertices=model.Geometry.Vertices;
figure
pdegplot(model);%,'FaceLabels','on','FaceAlpha',0.5)
hold on
plot3(ModelVertices(:,1),ModelVertices(:,2),ModelVertices(:,3),'o')
disp('meshing geometry')
try
generateMesh(model,'Hmax',0.1*10^-3);
catch
disp("Mesh Failed with Hmax of 0.1*10^-3, retry with Hmax of 0.12*10^-3")
try
generateMesh(model,'Hmax',0.12*10^-3);
catch
disp("Mesh Failed with Hmax of 0.12*10^-3, retry with no parameter input")
generateMesh(model)
end
end
figure
pdeplot3D(model)
For one of them, the mesh is generated without issue, but for discrete_failed.step, the mesh fails and displays
Meshing failed for Hmax of 0.000256972 and Hmin of 7.43554e-05. Try adjusting Hmax and Hmin.
I was wondering if anyone has had this issue before or knows what the issue is and how to fix it.
Thanks in advance
Stephen
댓글 수: 1
Christopher Poletto
2023년 8월 16일
I had a similar issue. My solution was to reduce Hmin by an order of magnitude for the part with the finer detail. This worked for me. Good luck!
답변 (1개)
akshatsood
2023년 9월 6일
편집: akshatsood
2023년 9월 6일
Hi Stephen,
I understand that you are encountering a problem while using the generateMesh function and it is failing for some specific STEP files. I went through the attached files and tried reproducing the issue you are facing on my end. I got an error message while working with discrete_fail.step file which suggests adjusting the parameters Hmax and Hmin.
It is evident that Hmax and Hmin represent an approximate upper and lower bound on mesh edge lengths, respectively. What value you assign to them, affects the mesh resolution, and assists in estimating the computational requirements. Based on the comment received on the question and going through some discussions attached below, I would prefer the following workarounds which might help in mitigating the issue
- Try modifying either Hmax or Hmin at once. Playing with both the parameters simultaneously may distance you from resolving the error. Ensure that the ratio Hmax/Hmin does not become too large.
- One of the discussions attached below suggest changing the GeometricOrder to 'linear'.
If the issue persists, I believe that the problem lies in the certain characteristics of the geometry making it challenging to mesh. It is advisable to have a look at the below parameters and perform any corrective measures wherever possible.
- Geometric Complexity: complex geometries with intricate details, sharp corners, or self-intersections can be difficult to process. If possible, try simplifying the geometry by removing unnecessary details.
- Geometry Features: presence of thin features in geometry such as narrow gaps or thin slices can trouble the meshing algorithm in adequately resolving these features leading to meshing failures or poor-quality meshes.
- Aspect Ratio: remarkably high aspect ratio (the ratio of the longest side to the shortest side of an element) can render poorly shaped elements and increase difficulties during mesh generation.
- Mesh Resolution: specifying an exceptionally fine mesh resolution imposes a requirement of high number of elements while generating a valid mesh.
If that does not work, could you share the description of your geometry for a better view on the case.
Have a look at below discussions which address the same issue.
I hope this helps.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!