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

[blockMesh] Writing a blockMeshDict file with variables

Register Blogs Community New Posts Updated Threads Search

Like Tree23Likes
  • 1 Post By arieljeds
  • 13 Post By alexeym
  • 2 Post By alexeym
  • 2 Post By alexeym
  • 3 Post By Antimony
  • 1 Post By LeeRuns
  • 1 Post By LeeRuns

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   December 23, 2015, 07:39
Default Writing a blockMeshDict file with variables
  #1
Senior Member
 
ArielJ
Join Date: Aug 2015
Posts: 127
Rep Power: 10
arieljeds is on a distinguished road
Hi there,
I'm trying to write a blockmesh file using variables for the vertices and the number of cells but I'm not quite sure how to do this. At the moment, I'm trying this:

Code:
convertToMeters 1;

x   20.0;	// Length of tank
y1  -3.0;	// Width of tank/2
y2   3.0;	// Width of tank/2
zf  -0.4;	// Water depth 
za   0.2;    	// Distance above free surface
L    3.6942;    // Wavelength 
n    5;	        // Number of cells per wavelength 

xn   ($x/$L)*$n;	// Calculating the number of cells
//yn    
//zn 

vertices        
(
    ( 0   $y1  $zf )	 // 0		
    ( $x  $y1  $zf )     // 1
    ( $x  $y2  $zf )	 // 2
    ( 0   $y2  $zf )	 // 3
   
    ( 0   $y1  $za )	 // 4 
    ( $x  $y1  $za )	 // 5
    ( $x  $y2  $za )	 // 6
    ( 0   $y2  $za )	 // 7    
);

blocks 
         
(
  hex (0 1 2 3 4 5 6 7) ($xn 10 10) simpleGrading (1 1 1) //(1 10 0.1)
);

edges           
(
);

boundary         
( 
   inlet
   {
       type patch;
       faces
   	(
       	 ( 0 3 7 4 )
   	);
   }
   
   outlet
   {
       type patch; 
       faces
   	(
          ( 1 2 6 5 )
   	);
   }
   
   atmosphere
   {
       type patch;
       faces
   	(
          ( 4 5 6 7 )
   	);
   }
   
   front
   {
       type symmetryPlane;
       faces
  	(
       	  ( 3 2 6 7 )
        );
   }
Perhaps unsurprisingly, I'm running into problems with the line where I am attempting to calculate xn. Does anyone know the syntax how I can do this? Or if it's possible at all to do a simple calculation in the blockMeshDict?

Thanks in advance for any advice
juandadamo likes this.
arieljeds is offline   Reply With Quote

 

Tags
blockmeshdict, variable definition


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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 06:42
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08


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