You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CAD/OnshapeTutorial/README.md
+41-3Lines changed: 41 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
# Meshing a CAD Geometry with Gmsh
2
-
Tested with CGX/CCX 2.10, Gmsh 2.12
2
+
Tested with CGX/CCX 2.10, Gmsh 2.13.1
3
3
4
4
This demonstrates a possible workflow for a CalculiX analysis of a CAD
5
5
generated part.
@@ -9,6 +9,9 @@ generated part.
9
9
* Import and meshing in gmsh, export as .inp file with volume and surface meshes.
10
10
In gmsh, define physical surfaces for boundary conditions and export the mesh
11
11
with appropriate settings (to ensure that node sets are written)
12
+
* There are two versions for gmsh pre-processing:
13
+
*`part.geo`: mesh the geometry as it is, leading to small elements at short edges and narrow surfaces
14
+
*`partVT.geo`: Compounding lines and geometry before meshing.
12
15
* Open the inp file in cgx and remove all surface elements. Eventually extend node sets to
13
16
face sets for surface definition or pressure application.
14
17
* Write the mesh and required set definitions
@@ -21,6 +24,9 @@ generated part.
21
24
|[part.step](part.step)| STEP geometry exported from Onshape |
22
25
|[part.geo](part.geo)| Gmsh control file for meshing and model display |
23
26
|[run.fbd](run.fbd)| CGX control file for preprocessing, solving and postprocessing |
27
+
|[partVT.geo](partVT.geo)| Gmsh control file with geometry cleaning (virtual topology)|
28
+
|[runVT.fbd](runVT.fbd)| CGX control file for the VT version|
29
+
|[VTdemo.fbd](VTdemo.fbd)| CGX file for the mesh plots (original and VT version) |
24
30
|[solve.inp](solve.inp)| CCX input file |
25
31
26
32
# Run the analysis
@@ -53,6 +59,37 @@ The gmsh geo file can be executed separately if you want to play around with the
53
59
> gmsh part.geo
54
60
```
55
61
The result of the meshing is the file `gmsh.inp`
62
+
63
+
## Virtual Topology
64
+
65
+
The CAD model contains short edges and narrow faces, which locally enforce small elements.
66
+
67
+
Spurious edges and points can be removed by joining and re-parametrization of adjacent lines or surfaces using the commands
68
+
```
69
+
Compound Line(new#) = {old#1,old#2};
70
+
Compound Surface(new#) = {old#1,old#2};
71
+
72
+
```
73
+
The Gmsh command file `partVT.geo` uses these commands to produce a mesh without spurious refinement spots.
74
+
75
+
There is one limitation: The midside nodes of second order elements don't follow the geometry, the edges of such elements are always straight except at boundaries. In Gmsh 3.0 this is announced to be fixed.
76
+
77
+
Execute
78
+
```
79
+
> cgx -b VTdemo.fbd
80
+
```
81
+
to produce images for comparison of the meshes produced with the original geometry or with the cleaned geometry (virtual topology).
82
+
83
+
Original geometry (1856 nodes, 998 elements)
84
+
85
+
<imgsrc="mesh.png"width="400"title="Mesh based on the original geometry">
86
+
<imgsrc="mesh1.png"width="400"title="Mesh based on the original geometry">
87
+
88
+
Virtual topology (1425 nodes, 665 elements):
89
+
90
+
<imgsrc="VTmesh.png"width="400"title="Mesh based on the modified geometry, no local refinement spot any more">
91
+
<imgsrc="VTmesh1.png"width="400"title="Mesh based on the modified geometry, note the straight element edges on the arched surface.">
92
+
56
93
# Application of Boundary Conditions
57
94
After closing the gmsh window, CGX takes over control again and reads `gmsh.inp`.
58
95
@@ -67,12 +104,12 @@ Some cleanup is required, because gmsh writes 2D elements for the physical surfa
67
104
68
105
Remove the 2D elements (we address them by type here):
69
106
```
70
-
zap +CPS6
107
+
(cgx window) zap +CPS6
71
108
```
72
109
Extend node sets to face sets if required (here we need the set `load` for
73
110
pressure application)
74
111
```
75
-
comp load do
112
+
(cgx window) comp load do
76
113
```
77
114
The following image shows the nodes of the support surface and the faces of the pressure
78
115
application surface.
@@ -81,6 +118,7 @@ application surface.
81
118
82
119
Once the sets are defined, there is no particular challenge any more with setting up the simulation.
0 commit comments