Rick's Blog

A Basic Wind Tunnel

openFOAMCategory

The Short Version... 

I've attempted to get started with OpenFOAM before.  I generally get bored with the building-block approach to learning it, jump in too deep and quickly get discouraged.  I added an OpenFOAM category to this blog in an attempt to motivate me to take smaller steps and to remain committed for a bit longer.

This project was a simple process run-through.  I began by copying the openFOAM 2D airfoil tutorial files (located in the tutorials folder/incompressible/simpleFoam/airFoil2D) into a new folder.  Within Blender, I created a basic wind tunnel shape (blend file linked at the end of the article) and exported the mesh using the SwiftBlock addon from nogenmyr.  This exported mesh replaced the blockMeshDict in the tutorial files.  I then adjusted the timestep, ran blockMesh and simpleFoam.  Results were visible using openFoam's built-in paraView.

The Details... 

​Please refer to the OpenFOAM web site for any questions regarding downloading and installing.

Create a new folder within your OpenFOAM run folder.  In my case, 'windTunnel'.  From the OpenFOAM tutorials directory, copy the airFoil2D contents (/tutorials/incompressible/simpleFoam/airFoil2d).

In the constant/plyMesh/boundary file, you can see how the tutorial named the boundaries.  If you use the same names in Blender, it will simplify things.  In this case, there is an inlet cleverly named 'inlet'  and and outlet named 'outlet'.  Both the inlet and outlet are of type 'patch'.

The front and back walls are of type 'empty' because this is a 2D solution.  They are named 'frontAndBack'.  The only remaining surfaces will be the top and bottom.  These will be lumped into the 'walls' name, which are of type 'wall'.

With the surface names previewed, open Blender.  Create a default cube at the center.  I generally work in Imperial units, but to stay consistent with OpenFOAM without messing with conversions, in the Scene panel, I changed the unit preset to Metric and changed the cube dimensions to 1 meter in each direction.  (Don't forget to apply the scale).  Since this project is a process run-through, the units shouldn't matter.

The 1-meter cube will be the central section. Extrude the inlet and outlet sections 3 meters in the appropriate direction and scale the openings by a factor of 2 in the vertical direction.  My result is a single cube 7-meters x 1-meter x 2-meters

​If you haven't already, install the SwiftBlock addon. 

With the wind tunnel selected, in Edit and Face-Select mode, select the face you will use as the inlet (I chose the left, most negative X face).  In the Properties Panel, Object tab, click 'Enable SwiftBlock'.  When the SwiftBlock options appear, in the Patch Settings section, enter 'inlet' as the Patch name, 'patch' as the Patch type.  Ensuring you have the correct face selected, click the 'Set name' button.  This should add your name and type ('inlet' and 'patch') to the list of patches below the button, assign a color to the patch and color the face in the 3D view.  



Select the outlet face, create an outlet of type patch and add that type.

Select all the top and bottom faces, create a patch named 'walls' of type 'wall.

Finally, select all the front and back faces, create a patch named 'frontAndBack' of type 'empty'.

You should have all the faces of your windTunnel colored now.  

Setting up the number of divisions in each face is not entirely intuitive;this is my workflow, YMMV.  You will notice that if you select different patch names, the corresponding faces on the wind tunnel object will select.  Select the frontAndBack patch, ensuring the faces select correctly.  Click on the 'Edge settings' button.  I want 10 divisions per face, so in the '# cells:' block, enter '10' and then click 'Force resolution'.  Select the 'walls' patch, select 'Edge settings', enter '1' and click 'Force resolution', since we don't want openFOAM to calculate any changes in the +/- Y direction.  (ADD moment - I don't know if selecting 'Edge settings' each time is required, but that works for me, so I continue to do it. )

Repeat this procedure for the inlet and outlet, setting 10 divisions each.

Once the resolution is set for each face, select all the faces and click 'Preview'.


If that all worked, you can click the 'Delete preview mesh' button and select the 'Write' button.  This will allow you to save the blockMeshDict inside the 'system' folder you copied from the tutorials earlier.

From the command line, start OpenFOAM and change to your windTunnel directory.

Enter 'blockMesh'.  This should create the polyMesh folder and files.

If you would like to preview the mesh, enter 'paraFoam'.

Enter the solver.  In this case, 'simpleFoam'.

Finally, enter 'paraFoam' to view the results.

Assuming the names were all exactly correct and the preset values all work, everything should work.   In my case, I had to adjust the time step and the write interval in the system/controlDict file.  Fortunately, openFoam errors give quite a few hints about what the problems are and the documentation on the OpenFOAM web site is very good.  

I intend to explore additional capabilities in SwiftBlock and (SwiftSnap) in future posts, so if you have a critique, suggestion or question, please leave them in the comments!

File Name: basicWindTunnel.blend
File Size: 74 kb
Download File
Groovy Grading
Time For a New Look!

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Guest
Thursday, 02 July 2020

Captcha Image

Rick's Blog

A Basic Wind Tunnel

openFOAMCategory

The Short Version... 

I've attempted to get started with OpenFOAM before.  I generally get bored with the building-block approach to learning it, jump in too deep and quickly get discouraged.  I added an OpenFOAM category to this blog in an attempt to motivate me to take smaller steps and to remain committed for a bit longer.

This project was a simple process run-through.  I began by copying the openFOAM 2D airfoil tutorial files (located in the tutorials folder/incompressible/simpleFoam/airFoil2D) into a new folder.  Within Blender, I created a basic wind tunnel shape (blend file linked at the end of the article) and exported the mesh using the SwiftBlock addon from nogenmyr.  This exported mesh replaced the blockMeshDict in the tutorial files.  I then adjusted the timestep, ran blockMesh and simpleFoam.  Results were visible using openFoam's built-in paraView.

The Details... 

​Please refer to the OpenFOAM web site for any questions regarding downloading and installing.

Create a new folder within your OpenFOAM run folder.  In my case, 'windTunnel'.  From the OpenFOAM tutorials directory, copy the airFoil2D contents (/tutorials/incompressible/simpleFoam/airFoil2d).

In the constant/plyMesh/boundary file, you can see how the tutorial named the boundaries.  If you use the same names in Blender, it will simplify things.  In this case, there is an inlet cleverly named 'inlet'  and and outlet named 'outlet'.  Both the inlet and outlet are of type 'patch'.

The front and back walls are of type 'empty' because this is a 2D solution.  They are named 'frontAndBack'.  The only remaining surfaces will be the top and bottom.  These will be lumped into the 'walls' name, which are of type 'wall'.

With the surface names previewed, open Blender.  Create a default cube at the center.  I generally work in Imperial units, but to stay consistent with OpenFOAM without messing with conversions, in the Scene panel, I changed the unit preset to Metric and changed the cube dimensions to 1 meter in each direction.  (Don't forget to apply the scale).  Since this project is a process run-through, the units shouldn't matter.

The 1-meter cube will be the central section. Extrude the inlet and outlet sections 3 meters in the appropriate direction and scale the openings by a factor of 2 in the vertical direction.  My result is a single cube 7-meters x 1-meter x 2-meters

​If you haven't already, install the SwiftBlock addon. 

With the wind tunnel selected, in Edit and Face-Select mode, select the face you will use as the inlet (I chose the left, most negative X face).  In the Properties Panel, Object tab, click 'Enable SwiftBlock'.  When the SwiftBlock options appear, in the Patch Settings section, enter 'inlet' as the Patch name, 'patch' as the Patch type.  Ensuring you have the correct face selected, click the 'Set name' button.  This should add your name and type ('inlet' and 'patch') to the list of patches below the button, assign a color to the patch and color the face in the 3D view.  



Select the outlet face, create an outlet of type patch and add that type.

Select all the top and bottom faces, create a patch named 'walls' of type 'wall.

Finally, select all the front and back faces, create a patch named 'frontAndBack' of type 'empty'.

You should have all the faces of your windTunnel colored now.  

Setting up the number of divisions in each face is not entirely intuitive;this is my workflow, YMMV.  You will notice that if you select different patch names, the corresponding faces on the wind tunnel object will select.  Select the frontAndBack patch, ensuring the faces select correctly.  Click on the 'Edge settings' button.  I want 10 divisions per face, so in the '# cells:' block, enter '10' and then click 'Force resolution'.  Select the 'walls' patch, select 'Edge settings', enter '1' and click 'Force resolution', since we don't want openFOAM to calculate any changes in the +/- Y direction.  (ADD moment - I don't know if selecting 'Edge settings' each time is required, but that works for me, so I continue to do it. )

Repeat this procedure for the inlet and outlet, setting 10 divisions each.

Once the resolution is set for each face, select all the faces and click 'Preview'.


If that all worked, you can click the 'Delete preview mesh' button and select the 'Write' button.  This will allow you to save the blockMeshDict inside the 'system' folder you copied from the tutorials earlier.

From the command line, start OpenFOAM and change to your windTunnel directory.

Enter 'blockMesh'.  This should create the polyMesh folder and files.

If you would like to preview the mesh, enter 'paraFoam'.

Enter the solver.  In this case, 'simpleFoam'.

Finally, enter 'paraFoam' to view the results.

Assuming the names were all exactly correct and the preset values all work, everything should work.   In my case, I had to adjust the time step and the write interval in the system/controlDict file.  Fortunately, openFoam errors give quite a few hints about what the problems are and the documentation on the OpenFOAM web site is very good.  

I intend to explore additional capabilities in SwiftBlock and (SwiftSnap) in future posts, so if you have a critique, suggestion or question, please leave them in the comments!

File Name: basicWindTunnel.blend
File Size: 74 kb
Download File
Groovy Grading
Time For a New Look!

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Guest
Thursday, 02 July 2020

Captcha Image