CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [blockMesh] Parametric blockMeshDict #calc (https://www.cfd-online.com/Forums/openfoam-meshing/220608-parametric-blockmeshdict-calc.html)

Carlo_P September 13, 2019 09:34

Parametric blockMeshDict #calc
 
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


All times are GMT -4. The time now is 20:05.