CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

The use of #calc in blockMeshDict works for some numbers, but not for others

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By GerhardHolzinger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2023, 15:44
Default The use of #calc in blockMeshDict works for some numbers, but not for others
  #1
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 288
Rep Power: 6
boffin5 is on a distinguished road
Hi,

Following examples I've seen from others of a parametric blockMeshDict, I created one which initially worked. But when I change the domain size, it fails. Why would it work for one set of numbers, but not for another? In the attached the blockMeshDict file the numbers that work properly are commented out; the numbers that fail are not. The failure message looks in part like this:
Code:
Creating block edges
No non-planar block faces defined
Creating topology blocks


--> FOAM FATAL IO ERROR: 
wrong token type - expected int32_t, found on line 0 the doubleScalar 66.6667

file: /home/boffin5/cfdaero/tyrecase/system/blockMeshDict/blocks at line 0.

    From function Foam::Istream& Foam::operator>>(Foam::Istream&, int32_t&)
    in file primitives/ints/int32/int32IO.C at line 62.
Attached Files
File Type: txt blockMeshDict.txt (2.3 KB, 7 views)
boffin5 is offline   Reply With Quote

Old   February 15, 2023, 04:33
Default
  #2
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
In your blockMeshDict, you have code like this:
Code:
xcells #calc "round($lx)/($deltax)";

Do you see the error?
AtoHM likes this.
GerhardHolzinger is offline   Reply With Quote

Old   February 15, 2023, 04:40
Default
  #3
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,238
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello

EDIT : Gerhard answered before me and I don't want to spoil his question so I removed my message!

Yann
Yann is offline   Reply With Quote

Old   February 15, 2023, 05:56
Default
  #4
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Quote:
Originally Posted by Yann View Post
Hello

EDIT : Gerhard answered before me and I don't want to spoil his question so I removed my message!

Yann

You brought up the mismatch between the variable value of 66.6667 and the expected type, i.e., the number of cells needing to be an integer.


You highlighted the symptom, while I only pointed out the source of the error without much explanation.
GerhardHolzinger is offline   Reply With Quote

Old   February 17, 2023, 13:58
Default parametric blockMeshDict example
  #5
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 288
Rep Power: 6
boffin5 is on a distinguished road
Thank you Gerhard. The response brevity notwithstanding, I did manage to find some references to blockMeshDict.m4, which I know nothing about, and combined with a post from member bjnieuwboer, I was somehow able to create a parametric blockMeshDict.m4 file which seems to work. You just input the domain size, along with the desired cell size, and it creates the meshed domain, after entering 'm4 blockMeshDict.m4 > blockMeshDict. Then you enter 'blockMesh' to actually create the domain in polyMesh.
I have attached the blockMeshDict.m4 file in case anyone is interested.
Attached Files
File Type: txt blockMeshDict.m4.txt (3.1 KB, 15 views)
boffin5 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
crazy problem with #calc and blockMeshDict boffin5 OpenFOAM Running, Solving & CFD 2 July 14, 2023 08:00
Drag force coefficient too high for a flow past a cylinder using komega sst Scabbard OpenFOAM Running, Solving & CFD 37 March 21, 2016 17:16
[blockMesh] Cylindrical mesh with an odd number of circumferential cells Eldor OpenFOAM Meshing & Mesh Conversion 1 April 16, 2015 05:21
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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