Utilize the CodeStream in blockMesh dictionary to dynamically compile code and calculate variables efficiently for meshing purposes

Keywords: OpenFOAM, CodeStream, CodeEntry, Calc, blockMesh, dynamic compiling

Utilizing inline calculations in blockmesh is very convenient to parameterize the blockMesh file.

For instance, to create a structured hex mesh for two concentric spheres, the $ symbol can be added to variable names (macro syntax) to associate the values to keywords such as the radii of the spheres:

CreateStructuredHexMesh

Then we can make use of CodeStream and CalcEntry, to calculate derived variables directly in the dictionary using #calc:

CodeStreamCalcEntry

C++ standard functions can be sued. The vertice coordinates defined here can be later used in projecting arcs on the sphere from the cubes.