CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: blockMesh (
-   -   M4 / blockMesh (

pythag0ra5 November 23, 2012 10:01

M4 / blockMesh
Hi there,

can someone tell me if it is possible to calculate the arctan of some value in the M4 Preproccesor?


define(height_step, 1.5)
define(length_step, 3)
define(alpha, calc(atan(height_step/length_step)))

If i compile my m4-file with


m4 blockMeshDict.m4 > blockMeshDict
an error occurs:


Undefined subroutine &main::atan called at -e line 1.
In the final blockmeshdict nothing is calculated.

Can someone help?

Thanks a lot in advance!

pythag0ra5 November 23, 2012 10:24

Thanks a lot to startingwithCFD who gave the right hint, some perl-information was missing in the header:


define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl>

All times are GMT -4. The time now is 02:02.