CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[blockMesh] Cylinder mesh using blockMesh with m4 macro

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Antimony

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2017, 02:30
Default Cylinder mesh using blockMesh with m4 macro
  #1
Member
 
Lewis
Join Date: Jun 2016
Posts: 34
Rep Power: 10
Lewis Liang is on a distinguished road
Currently, I am trying to mesh a vertical cylinder by using the m4 macro provides by Ehsan Madadi. The script is shown below:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     |                                                 |
|   \\  /    A nd           | Copyright (C) 2016 Ehsan Madadi-Kandjani        |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    `format'      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General macros to create cylinder mesh

changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])

define(hex2D, hex ($1b $2b $3b $4b $1t $2t $3t $4t))
define(btQuad, ($1b $2b $2t $1t))
define(topQuad, ($1t $4t $3t $2t))
define(bottomQuad, ($1b $2b $3b $4b))

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.001;

// Inner square side half
define(s, 0.35)

// Inner square side curvature
define(sc, 0.4)

// cylinder radius
define(r, 0.7)

// Height of cylinder
define(z, 20.0)

// Base z
define(Zb, 0)

// Outlet z
define(Zt, calc(Zb + z))

// Number of cells at inner square
define(Ns, 20)

// Number of cells between inner square and circle
define(Ni, 10)

// Number of cells in the cylinder height
define(Nz, 100)

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
As introduced from the http://www.ehsanmadadi.com/cylinder-mesh/ and the OpenFOAMWiki https://openfoamwiki.net/index.php/H...ckMesh_with_m4. I just can mesh a cylinder with a centre of bottom plane located in (0 0 0). It is straightforward to set up the length and original point in the Z direction. However, I am confusing to modify original point in XY plane, for example, to build a cylinder whose central point of bottom plane located in (10 10 0). Could anyone face this same problem?

Thanks in advance!

Zuodong
Attached Images
File Type: jpg example.jpg (27.2 KB, 119 views)
Lewis Liang is offline   Reply With Quote

Old   November 21, 2017, 03:15
Default
  #2
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi,

One possible solution would be to use transformPoints and translate by the vector (10 10 0) after you have created the mesh using blockMesh

Cheers,
Antimony
Lewis Liang likes this.
Antimony is offline   Reply With Quote

Old   November 21, 2017, 03:28
Default
  #3
Member
 
Lewis
Join Date: Jun 2016
Posts: 34
Rep Power: 10
Lewis Liang is on a distinguished road
Hi Antimony! It works now after typing this command:
Code:
transformPoints -translate '(10 10 0)'
Many thanks!

Zuodong
Lewis Liang is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[ICEM] How to mesh for regular pentagonal cylinder using ICEM in 2D? ranjanrk ANSYS Meshing & Geometry 0 June 18, 2016 03:10
Dynamic Structured mesh around cylinder problem!!! ludosbiz Mesh Generation & Pre-Processing 2 March 23, 2016 16:15
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 10:38
3D Hybrid Mesh Errors DarrenC ANSYS Meshing & Geometry 11 August 5, 2013 07:42
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 22:11


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