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

[blockMesh] Parametric blockMeshDict #calc

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 13, 2019, 09:34
Default Parametric blockMeshDict #calc
  #1
Senior Member
 
Carlo_P
Join Date: May 2019
Location: Italy
Posts: 176
Rep Power: 8
Carlo_P is on a distinguished road
Hey,

I'm trying to write a parametric blockMeshDict file.
I'm using lots of operation with #calc, but I can determin the minimum of some values.
Do you know how #calc can be used?


Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  6                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
|*---------------------------------------------------------------------------*|
|           File created by Carlo Pasquinucci  for Tecnohit S.r.l             |
|           www.tecnohit.it                   info@tecnohit.it                  |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}

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

convertToMeters 1; //(-0.02445 -0.006 -0.006) (0.026 0.0361157 0.006)

expBox 10;

xMinGeo     #calc "xmin*$expBox";
xMaxGeo     #calc "xmax*$expBox";
yMinGeo     #calc "ymin*$expBox";
yMaxGeo     #calc "ymax*$expBox";
zMinGeo     #calc "zmin*$expBox";
zMaxGeo     #calc "zmax*$expBox";

xMin    $xMinGeo;
xMax    $xMaxGeo;
yMin    $yMinGeo;
yMax    $yMaxGeo;
zMin    $zMinGeo;
zMax    $zMaxGeo;

Ncelle 100;

lx #calc "$xMax - $xMin";
ly #calc "$yMax - $yMin";
lz #calc "$zMax - $zMin";

delta1x #calc "$lx/$Ncelle";
delta1y #calc "$lx/$Ncelle";
delta1z #calc "$lx/$Ncelle";

//------------------------------------------------------
deltatot #calc "min($delta1x,$delta1y,$delta1z";  // THIS LINE DOESN'T WORK AS EXPECTED
//------------------------------------------------------
xcells #calc "round($lx/$deltatot)";
ycells #calc "round($ly/$deltatot)";
zcells #calc "round($lz/$deltatot)";

vertices
(
    ($xMin $yMin $zMin) // 0
    ($xMax $yMin $zMin) // 1
    ($xMax $yMax $zMin) // 2
    ($xMin $yMax $zMin) // 3

    ($xMin $yMin $zMax) // 4
    ($xMax $yMin $zMax) // 5
    ($xMax $yMax $zMax) // 6
    ($xMin $yMax $zMax) // 7
);

blocks(    hex (0 1 2 3 4 5 6 7) ($Ncelle $Ncelle $Ncelle) simpleGrading (1 1 1) );

edges
(
);
Thanks a lot,
Carlo
Carlo_P is offline   Reply With Quote

Old   April 25, 2022, 15:44
Default
  #2
Senior Member
 
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12
ancolli is on a distinguished road
You can use min twice:

Code:
deltatot #calc "min($delta1x,min($delta1y,$delta1z))";
ancolli 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
wrong token type - expected word, found on line 80 the punctuation token '(' hasha OpenFOAM Pre-Processing 5 March 31, 2022 07:53
[blockMesh] Creating an axisymmetric piston cylinder in blockMeshDict foadsf OpenFOAM Meshing & Mesh Conversion 9 August 23, 2018 08:54
[blockMesh] blockMesh with parametric mesh. Unusual and unseen problem 13msmemusman OpenFOAM Meshing & Mesh Conversion 1 June 13, 2016 03:25
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
cannot converge a pimpleFoam simulation iper88 OpenFOAM Running, Solving & CFD 1 November 26, 2015 09:04


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