![]() |
programmer's documentation
|
C user functions for optional modification of the mesh. These subroutines are called in all cases.
Several functions are present in the file, each specific to different modification types.
Mesh modifications not available through specialized functions should be defined in cs_user_mesh_modify.
For example, to modify coordinates, the following code can be added:
It is possible to add cells by extruding selected boundary faces. A simplified usage is available through the cs_mesh_extrude_constant, while extruding a mesh with vertex-local extrusion parameters is available through cs_mesh_extrude.
The example which follows illustrates the use of the simplified function.
The user function cs_user_mesh_input allows a detailed selection of imported meshes read, reading files multiple times, applying geometric transformations, and renaming groups.
The following code shows an example of mesh reading with no transformation.
A mesh can also be read while its groups are renamed, and its geometry transformed.
The user function cs_user_mesh_save can enable or disable mesh saving. By default, mesh is saved when modified. The following code shows an example of disabled saving.
The cs_user_mesh_warping function allows the user to cut the warped faces of his mesh using the cs_mesh_warping_set_defaults function to define the maximum warped angle.
The smoothing utilities may be useful when the calculation mesh has local defects. The principle of smoothers is to mitigate the local defects by averaging the mesh quality. This procedure can help for calculation robustness or/and results quality. The user function cs_user_mesh_smoothe allows to use different smoothing functions detailed below.
The following code shows an example of use of the cs_mesh_smoother functions, cs_mesh_smoother_fix_by_feature which fixes all boundary vertices that have one of their feature angles less than the maximum feature angle defined by the user and cs_mesh_smoother_unwarp which reduces face warping in the calculation mesh.
Bad cells of a mesh can be tagged based on user-defined geometric criteria. The following example shows how to tag cells that have a volume below a certain value and then post-process the tagged cells. This is done using the cs_user_mesh_bad_cells_tag function.
Conforming joining of possibly non-conforming meshes may be done by the cs_user_join user function. For a simple mesh joining, the cs_join_add subroutine is sufficient.
For a more complex mesh, or a mesh with thin walls which we want to avoid transforming into interior faces, the user can use the cs_join_set_advanced_param function to define a specific mesh joining.
Handling of periodicity can be performed with the cs_user_periodicity function.
The following example illustrates the periodicity of translation case using the cs_join_perio_add_translation subroutine.
The following example illustrates the periodicity of rotation case using the cs_join_perio_add_rotation subroutine.
The following example illustrates a more general case of periodicity which combines different kinds of transformation. The function cs_join_perio_add_mixed is used.
As with the Advanced mesh joining subsection, a more complex periodicity can be defined using the cs_join_set_advanced_param subroutine.
The user function cs_user_mesh_thinwall allows insertion of thin walls in the calculation mesh. Currently, this function simply transforms the selected internal faces into boundary faces, on which boundary conditions can (and must) be applied.