The following section describes the process to generate a tet-mesh with cgx based on a cad model:
- Install and use the propper interface program to convert the cad format to fbd format (You find example data (vda,iges,step) in CalculiX/cgx_x.x/examples/cad)
(ie: vda2fbd halter.vda > halter.fbd).
- Remark regarding vda2fbd: In some cases the header of the vda file causes trouble and must be modified to make the program run.
- Remark regarding cad2fbd: The cgx can not deal with surfaces which use the same line on two sides (a cylinder made of just one surface). Please use the parameter -sa with cad2fbd. It splits such surfaces in two (cad2fbd -sa cadfile). If problems occur call cad2fbd without arguments and play along with the listed parameters.
- Start cgx with that file (cgx -a halter.fbd). Usually some warnings appear on the screen but the program will fix that automatically (triggered by the parameter -a). After all geometry has been read the program will merge points and lines to close the volume (body). WARNING: If no body exists the user has to manually merge all line end-points individually for all parts. Otherwhise intentionally unconnected parts could be merged at some locations. If the model consists of only one part a 'merg p all' should work if no geometry changes are planned. To be on the save side the user should prefer to use the following commands to merge only line endpoints:
seta b1 l <set>
comp b1 e
merg p b1
Finally the line divisions are determined based on default values. Use “plot lc all r 3“ to see the lines in red 3 digit whide with node spacing as defined by the line divisions. The current default values lead to approximatelly 200 elements over the length of the model. The default values are defined in cgx.h, see GTOL_NODE_DIST and GTOL. You may use now the command div in the 'auto' mode to change the element sizes to your needs individually in each relevant region.
- If problems occur the user might start the program with option -b instead of -a (cgx -b halter.fbd). Then no automatic pre-processing is done and the user has to prepare the geometry manually. This commands are executed when starting with -a:
# merge only points which are referenced by lines
seta LBUF l all
comp LBUF e
merg p LBUF
# delete zero length lines
del l0 all
# set the line divisions
div all auto
The user may use this command sequence when he reads a cad fbd file during run time (“read cadfile.fbd”). See the commands merg, div, qdiv, qlin, comp and rep.
- A default element type was assigned to all surfaces (tr6u) if you had started cgx with parameter -a. You may change the element type with elty. In most cases it is advisable to use this triangles first (tr6u) and not directly tetraeders (te10) because a surface mesh can be interactively improved before the tets are generated. Remark: You can assign tets only to a set holding one or more bodies. The body related surfaces get a preliminary triangle element type assigned as a basis for the tets. If no body exists you may create one with “body ! all”. You assign the tet element type with the “elty” command (elty setname te10).
- All surfaces should be shaded and filled with triangles. This has to be done manually by typing “mesh all” (see mesh) or “rep all” which just calculates the interior shape of the surfaces. In most cases “mesh” is preferable since it does both at the same time. Since the surface meshing of a CAD geometry can be very time consuming a default number of threads is used when the model is opened in the auto mode (cgx -a file). The actual number of threads will be listed when using the command “prnt info”. The user might change this value with the command asgn before he starts meshing. The default is set in cgx.h, see NTHREADS.
- Use then “plus si all” to display the shaded surfaces. If a surface points inwards it is not illuminated and appears only dark grey. Flip the surfaces in a way that its normal direction points outwards. Use ”qflp” abd press the ”a” key to swith to the “auto” mode and then select a correctly oriented surface by pressing key ”s”, all other surfaces will immediatelly use the same orientation (if it's a closed volume). Add now the element faces with ”plus f all“.
- If some surfaces could not be meshed then modify the divisions of the lines of this surfaces (see ”qmsh”, key 'l') and/or chose the structured element type tr6 for this surfaces (see ”qmsh”, key 'x'). Or change the element-size (see ”qmsh”, key 'h' or 't') inside the surfaces. The command ”qmsh” fixes parts of the surface-mesh in a convenient way since this command combines several other ones. For convenient usage of “qmsh” display the surfaces “plot si all“ together with faces “plus f all“ and add the lines with “plus lc all r 3“).
Remark: In some cases surfaces are not meshable when you had combined two surfaces before with “qmsh”. The referenced NURBS might be too small to cover the whole new surface. Without such a related nurbs no unstructured mesh can be created. If structured elements are no solution you may delete the related NURBS from the surface definition with ”qsur” using key 'b'. Then store the surface in a set and create a new NURBS with “nurs ! setname”. The surfaces stored in the set will produce NURBS based on the Coons algorithm [14]. If the surface shape matches a primitive shape you may also use the ”qshp” or ”shpe” command to generate such a shape and assign it to the surface.
- Check the mesh. If the command ”prnt info” lists ”ed:0” then no model edges exist and the mesh is closed and ready to be used for tet meshing. If edges exist then the surface mesh is not closed which means that not all shells have exactly one neighbor at each edge. This free edges exist usually at the location of lines and the problem can often be solved by changing the divsion of the underlying lines. The edges are displayed by default but might be hidden by other entities. To increase the size of the representation up to 10 pixels use ”view ed 10”. This can be seen on figure 15. Then chose the line under one edge with “qmsh” and change the line division to a higher or lower number until the edge disapears. Actually cgx detects this edges after meshing and tries to solve the problem by increasing the division of the related lines incrementally, but only a few times. The remaining lines are stored in set “-EDGE” and can be displayed as well for manual adjustments.
Figure 15:
Visible (black) edge over lines and faces. Such edges exists if the surface mesh is not closed and not meshable with tets. Here two elements meet just one element at the black edge.
 |
- Generate the tet mesh (“mesh all tet“). A target-size for the tet-elements can be specified if “ng_vol” from the cgx distribution was installed (for example “mesh all tet 2.5“ will define a maximum element-size of “2.5”). If the model consists of several unconnected parts separate them in single sets and mesh one after the other (see seta, qadd, qrem, comp). Check the mesh and correct bad elements:
prnt eq all
mids -BJBY force
prnt eq all
(repeat that procedere until no elements are stored in -BJBY any more)
- Create sets of nodes, faces or elements to create boundary conditions (if you had not created them already based on the geometry) and export them with ”send”.
- Create the input deck for ccx with an editor and start the calculation.
- Look at the results with cgx (cgx results.frd).