Utilities
Prepared by Ivan Batistić, with additions by Philip Cardiff
Section Aims
- This document describes the solids4foamutilities located inapplications/utilities;
- Utilities are executables that provide various pre and post-processing functionalities;
- These solids4foamutilities provide functionalities not available in the standardOpenFOAMutilities (OpenFOAM-wiki).
abaqusMeshToFoam
 - Utility purpose Mesh converter: converts Abaqus mesh (in *.inpformat) into the FOAM mesh format. Currently, this utility only supports 3-D hexahedral cells/elements. Note that each distribution ofOpenFOAMcomes with a set of mesh converters (but not for Abaqus), see the available one here.
-  Arguments - <mesh.inp>name of the Abaqus mesh file.
 
-  Options/parameters None 
-  Example of usage abaqusMeshToFoam mesh.inpNote- Only the following Abaqus element types are supported: C3D8 and C3D8R.
- Only the first PART is used and the rest are ignored.
- Node sets, element sets and surfaces are not converted.
 
addTinyPatch
 -  Utility purpose For a chosen patch, find the closest face to the specified location and separate it into a new patch. The utility can be used, for example, to create patches for specifying point loads. 
-  Arguments - <currentPatchName>chosen patch name;
- <newTinyPatchName>name of the one-face patch to be created;
- "(x y z)"location vector.
 
-  Options/parameters None 
-  Example of usage addTinyPatch Top TopNew "(30 30 0)"
 
 addTinyPatch: top patch before and after adding one-face patch
When using addTinyPatch the original mesh is overwritten!
foamMeshToAbaqus
 - Utility purpose Mesh converter: converts FOAM mesh into Abaqus mesh (*.inpformat). Currently, this utility only supports 3-D hexahedral cells/elements.
-  Arguments None 
-  Options/parameters None 
-  Example of usage foamMeshToAbaqusConverted mesh is written to the abaqusMesh.inpfile. Creates a node set and and element set and a surface for each boundary patch. Also creates a element set for each material in the materials file (if it is exists).Note- Only works for hexahedral cells as yet.
- Created for Abaqus-6.9-2, but should work for new versions too.
 
perturbMeshPoints
 -  Utility purpose Add a random perturbation to each mesh points. The perturbation of a point is calculated as a scale factor times the local minimum edge length. By default, boundary points are slide along the patch. Patches which should not move can be defined via the fixedPatches entry. In OpenFOAM.com, points on feature edges are not moved, where feature edges are defined by the minimum cosine angle (minCos). This feature is not currently implemented with OpenFOAM.org and foam-extend. The inputs are defined in $FOAM_CASE/system/perturbMeshPointsDict, and consist of a seed (for the random number generator) and a scaling factor to scale the perturbations relative to the local minimum edge length. The scaling factor is a vector to allow different scalings in different directions; for example, for 2-D, the Z component should be set to 0.0.If there are negative or small cell volumes after moving the points, the local motion is reduced by the factor beta (defaults to 0.8) and the motion is performed again. The maximum number of corrections iterations is set with maxIter (defaults to 1000). A small volume is defined as the factor minCellVol (defaults to 0.1) times the original cel volume. This utility is useful for creating distorted grids for testing discretisations. 
-  Arguments None 
-  Options/parameters None 
-  Dictionary Inputs are defined in dictionary named perturbMeshPointsDictand located insystemdirectory:// Perturn by 30% of the local minimum edge length in the X, Y and Z directions scaleFactor (0.3 0.3 0.3); // Gaussian or uniform random distribution Gaussian no; // Seed for random number generator seed 1; // Minimum cosine to find feature edges // Points on feature edges are not moved minCos 0.7; // Names of patches which should not be perturbed fixedPatches ( // Add patch names here ); // Optional: maximum number of corrections iterations // Defaults to 1000 //maxIter 1000; // Optional: local motion rescale factor for applying corrections // Defaults to 0.8 //beta 0.8; // Optional: local minimum allow cell volume relative to the initial volume // Defaults to 0.1 //minCellVol 0.1;The Gaussiandistribution can only be used in combination with OpenFOAM.com.
-  Example of usage perturbMeshPointsThe figure below shows mesh before and after using perturbMeshPointsutility.
 
 perturbMeshPoints: mesh before and after point perturbation
Perturbed mesh (polyMesh) is stored in the 0 directory and needs to be movedto constant before running the simulation!
splitPatch
 -  Utility purpose Splits a patch into two patches by putting faces in the given bounding box in a new patch. 
-  Arguments None 
-  Options/parameters -overwriteoverwrite the original mesh when storing mesh after patch splitting.
-  Dictionary patchToSplitName Top; newPatchName TopNew; boundBoxes ( (0 0 0.01) (1 1 1) );- patchToSplitNameis a name of the patch to be split;
- newPatchNameis the name of the splitted patch part;
- boundBoxesis list of bounding boxes; each defined with two vectors:- (xmin ymin zmin)and- (xmax ymax zmax). Boundary patch faces inside this bounding box will be put in a new patch. Note: The face's centre point is tested to see if it is inside the bounding boxes!
 
-  Example of usage splitPatch
 splitPatch: top patch before and after split
 splitPatch: top patch before and after split
The mesh with the new patch is stored in a new time-step directory (1 for  example) and should be moved to the constant before running the simulation.  Alternatively, the -overwrite option can be used to overwrite the original  mesh.