|
[Sponsors] |
[blockMesh] Is it possible to define a CONSTANT in the blockMesh file? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 18, 2010, 07:47 |
Is it possible to define a CONSTANT in the blockMesh file?
|
#1 |
New Member
Marco
Join Date: Mar 2010
Posts: 9
Rep Power: 16 |
I need to simulate several different configurations by changing a geometrical parameter, so I would like to change just the value of a constant instead of changing all the points of the mesh:
A simple example of what i need: int b; b=4; // b can vary from 2 to 6 : 2, 2.1, 2.2, 2.3, ... , 5.9, 6. vertices ( (0 -1 0) (b -1 0) (b 0 0) (0 0 0) (0 -1 1) (b -1 1) (b 0 1) (0 0 1) ); Is it possible to make that? Regards Marco |
|
March 18, 2010, 11:27 |
|
#2 |
New Member
Paul Garlick
Join Date: Mar 2009
Location: Bournemouth, UK
Posts: 27
Rep Power: 17 |
The m4 pre-processor is handy for this sort of thing. You define the constants in a separate file, blockMeshDict.m4 say, and use m4 to do any necessary calculations and write out a new blockMeshDict file.
There are some examples in the forum and also on the wiki (e.g. OSIG) |
|
March 19, 2010, 03:14 |
|
#3 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
The dictionary $variable expansions will generally not work, since the blockMeshDict entries are mostly read as straight lists. However, you don't need to look any further than some of the tutorial examples. Code:
$ git ls-files | grep m4 Code:
tutorials/compressible/rhoPimpleFoam/angledDuct/constant/polyMesh/blockMeshDict.m4 tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/polyMesh/blockMeshDict.m4 tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/polyMesh/blockMeshDict.m4 tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 tutorials/multiphase/interDyMFoam/ras/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 tutorials/multiphase/interDyMFoam/ras/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 tutorials/multiphase/interDyMFoam/ras/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 tutorials/multiphase/interDyMFoam/ras/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 tutorials/multiphase/interFoam/MRFInterFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 |
||
Tags |
constant blockmesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] Tabulated thermophysicalProperties library | chriss85 | OpenFOAM Community Contributions | 62 | October 2, 2022 04:50 |
[swak4Foam] Installation Problem with OF 6 version | Aurel | OpenFOAM Community Contributions | 14 | November 18, 2020 17:18 |
[swak4Foam] build problem swak4Foam OF 2.2.0 | mcathela | OpenFOAM Community Contributions | 14 | April 23, 2013 14:59 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |