|
[Sponsors] |
[blockMesh] Calculating mesh size, round down |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 26, 2017, 10:20 |
Calculating mesh size, round down
|
#1 |
New Member
Join Date: Oct 2017
Posts: 4
Rep Power: 8 |
Hello,
i have a small Problem to create my blockMeshDict. I use a m4 script where I calculate all elements for my blocks with one source block. But now I get a point number and an error message. Is there a possibility to round numbers in my m4 script? e.g. 71.25 => 71 thanks a lot |
|
December 5, 2017, 20:36 |
|
#2 |
Senior Member
Join Date: Aug 2013
Posts: 407
Rep Power: 15 |
Hi,
Can you not make use of the "floor" function? Cheers, Antimony |
|
April 18, 2018, 07:43 |
floor a floating point
|
#3 |
Member
Bas Nieuwboer
Join Date: Mar 2013
Posts: 32
Rep Power: 13 |
I encoutered the same problem when I tried to compute the mesh size. I looked a bit into perl and found that the printf statement can be used to print integers.
In most m4 blockmesh files the calc function is defined. I defined a second calc function: Code:
define(calc_round, [esyscmd(perl -e "printf ('%d', $1)")]) Code:
define(Nx,calc(L/dx)) Code:
define(Nx,calc_round(L/dx)) I found this solution here. It might be a good reference if you want to do some other formatting. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] dynamicTopoFVMesh and pointDisplacement | RandomUser | OpenFOAM Meshing & Mesh Conversion | 6 | April 26, 2018 07:30 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 18:57 |
[snappyHexMesh] Layers:problem with curvature | giulio.topazio | OpenFOAM Meshing & Mesh Conversion | 10 | August 22, 2012 09:03 |
critical error during installation of openfoam | Fabio88 | OpenFOAM Installation | 21 | June 2, 2010 03:01 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 17:27 |