Difference between revisions of "Contrib:BondMatt/TurbulentPipeFlow"

From CAELinuxWiki
Jump to: navigation, search
(Boundary Conditions - Code Saturn)
(Boundary Conditions - Code Saturn)
Line 85: Line 85:
  
 
The case creation wizard in CAELinux looks like this:
 
The case creation wizard in CAELinux looks like this:
 +
  
 
[[File:Code_Saturne_wizard.png]]
 
[[File:Code_Saturne_wizard.png]]
 +
  
 
Clicking 'GO' opens what I imagine is the Code Saturne GUI (or the pre-processor?) Clicking on the 'New file' icon fills in the entries on the first page automatically (which I imagine is dependent upon using the wizard which may or may not come with the files on the website just linked to).
 
Clicking 'GO' opens what I imagine is the Code Saturne GUI (or the pre-processor?) Clicking on the 'New file' icon fills in the entries on the first page automatically (which I imagine is dependent upon using the wizard which may or may not come with the files on the website just linked to).
 +
  
 
[[File:Code_Saturne_GUI.png]]
 
[[File:Code_Saturne_GUI.png]]
 +
  
 
Moving through the list of settings that can be modeled from top (Identity and paths) to bottom (Prepare batch calculation) the first critical item is under 'Mesh quality criteria'. While probably a good idea in general, the mesh quality must be checked (as far as I can tell) to read in the boundary condition grouped faces/nodes created in Salome. Clicking on Check mesh performs some sort of check of the mesh and asks the user to save a file. This file will be used later.
 
Moving through the list of settings that can be modeled from top (Identity and paths) to bottom (Prepare batch calculation) the first critical item is under 'Mesh quality criteria'. While probably a good idea in general, the mesh quality must be checked (as far as I can tell) to read in the boundary condition grouped faces/nodes created in Salome. Clicking on Check mesh performs some sort of check of the mesh and asks the user to save a file. This file will be used later.
  
 
This quality check is not so impressive having just finished the tutorial on laminar pipe flow with OpenFOAM which had much more extensive mesh checking. However, I really have no idea what I am doing so I hesitate to make these statements. I have little experience with CFD. I have actually considerably more experience with non-linear structural finite element analysis but user KeesWouters has covered related topics in CAELinux quite extensively. I doubt I could convince myself to work on this topic at my leisure anyways, with CFD I have more to learn.
 
This quality check is not so impressive having just finished the tutorial on laminar pipe flow with OpenFOAM which had much more extensive mesh checking. However, I really have no idea what I am doing so I hesitate to make these statements. I have little experience with CFD. I have actually considerably more experience with non-linear structural finite element analysis but user KeesWouters has covered related topics in CAELinux quite extensively. I doubt I could convince myself to work on this topic at my leisure anyways, with CFD I have more to learn.
 +
  
 
[[File:Code_Saturne_check_mesh.png]]
 
[[File:Code_Saturne_check_mesh.png]]
 +
  
 
The next setting that can be modified is 'Calculation features' in the 'Thermophysical models' section. I changed the flow algorithm to steady flow. This might not be necessary. An approach like that used with OpenFOAM where a termination time large enough to reach a steady state could be used. In fact it might be difficult to use a steady flow model with known turbulence. In the case of von Karmann vortex shedding I imagine a solver would have difficulty in converging to a solution without allowing dependence on time: http://www.youtube.com/watch?v=IDeGDFZSYo8
 
The next setting that can be modified is 'Calculation features' in the 'Thermophysical models' section. I changed the flow algorithm to steady flow. This might not be necessary. An approach like that used with OpenFOAM where a termination time large enough to reach a steady state could be used. In fact it might be difficult to use a steady flow model with known turbulence. In the case of von Karmann vortex shedding I imagine a solver would have difficulty in converging to a solution without allowing dependence on time: http://www.youtube.com/watch?v=IDeGDFZSYo8

Revision as of 05:06, 17 February 2013

Introduction

This tutorial will attempt to follow as closely as possible the turbulent pipe flow Fluent tutorial available on Cornell's website but will use the open source CFD solvers Code Saturne and OpenFOAM.

The model is very similar to the laminar pipe flow tutorial with the exception of the dynamic viscosity which is two orders of magnitude smaller at 2E-5kg/m/s. Therefore the Reynolds number, or ratio of inertial to viscous forces, is two order of magnitude higher with a value of 10 000. The flow will clearly be turbulent since viscous forces are minimal and damping will be essentially non existent. Laminar flow can be experimentally observed at much larger Reynolds numbers (up to approximately 100 000 if my memory serves me correctly) with very smooth pipes (I believe ceramics were used in some research) and controlled conditions. This makes sense, with no external disturbance and very low pipe roughness perturbations will be minimal.


Software Versions:

Ubuntu 8.04 LTS

Salome V4.1.4

Code Saturne V1.4.a (GUI)

OpenFOAM 2.0


Fluent Tutorial

The Cornell University Fluent tutorial can be found here [1].

Is it just me or are the variables 'd' and 'D' reversed in the figure?


Geometry/Mesh

Geometry

The geometry is identical to the previous tutorial. I was hoping to convert the OpenFOAM/snappyHexMesh coarse hexahedron mesh for use with Code Saturne but there is no direct conversion tool in OpenFOAM or that I could find online. It might be possible to manually convert the mesh if the file is ASCII text and perhaps I will try to do this and add it. For now I will create a mesh in the MED format in Salome. I may try to convert it to a format compatible with OpenFOAM. I think I still have the old Code Saturne files for the laminar tutorial but they would be on a laptop with a dead GPU.

First step was to create a quarter of a cylinder with a radius of 0.1 meters and a length of 8 meters. This was done by first creating a cylinder with the 'Create a cylinder' tool which can be accessed through a toolbar (at least in my installation) or through the 'New Entity' menu and 'Primitives'. I also created a box with dimensions of 0.1 X 0.1 X 8 meters. This was followed by a Boolean operation to extract the common or overlapping region.


Step1 geo turb.png


The next step was to 'Explode' the entity created by the Boolean operation through the 'New Entity' menu. The quarter cylinder was exploded into faces so that they could be re-named for boundary conditions. Mesh cells and/or nodes associated with these surfaces can be identified and grouped by Salome at the meshing stage for boundary conditions in the solver. Reasonable names like: wall, sym1, sym2, inlet, and outlet were used.


Mesh

Switching to the meshing interface, the procedure for creating a mesh was to first create global meshing settings by going to the Mesh menu and selecting Create Mesh. In the dialog box that pops up the Geometry entity Common_1 is selected and the 3D meshing Algorithm '3D extrusion' is selected (shown in the figure below).

Mesh 1.png

The global 2D mesh setting is (or can be) Netgen 2D with the Quadrangle Preference added hypothesis. The 1D meshing setting can be Wire Discretization with the Average Length hypothesis with the length set to 0.01.

Mesh 2.png

Mesh 3.png

The object browser should end up looking something like:

Obj browser.png

The next step I took was to create sub meshes with nice, regular quadrangle meshes. Go to the Mesh menu and select Create Sub-Mesh. Pick the mesh previously created (probably called Mesh_1) and the geometry entities that were created by exploding the solid quarter cylinder into faces. However, do not pick all of these faces. Only pick the faces that will be planes of symmetry and the wall of the pipe. I use the 2D algorithm Quadrangle Mapping with the Max Element Area hypothesis (max area of 0.01 * 0.01 meters, input 0.0001) and the Quadrangle Preference Add. Hypothesis. I used the 1D algorithm Wire Discretization with an Average Length hypothesis (set to 0.01 meters). Note I forgot the Max Element Area hypothesis and so it may not be in the figure.

Sub mesh 1.png

Sub mesh 2.png

Obj browser2.png

Finally, compute the mesh by, at least one way of doing it is, right clicking on Mesh_1 and selecting 'Compute'. It should compute successfully and there should be no tetrahedron elements. Most elements are hexahedron or elements with 6 sides where each side has 4 edges and 4 vertexes. There will likely be some 'Prisms' or 'Wedge' elements (perhaps more properly called pentahedrons?).

Meshing success.png

Mesh.png

The only step left is to create element/cell face and node groups for boundary conditions. This can be done by right clicking on the entry for the mesh in the tree (probably Mesh_1) and selecting Create Groups from Geometry. Then select the geometry faces creating by exploding the quarter cylinder and named after boundary conditions (BCs).

Create groups.png

Cell face node groups.png

The resulting mesh can be exported in the MED format for use with Code Saturn (right click on Mesh_1 and Export to MED File or in the File menu 'Export' then 'to MED File'.


Boundary Conditions - Code Saturn

I start off using the Code Saturne wizard in CAELinux. I imagine it is fairly easy to just start creating the solver input file in the Code Saturne GUI. Looking at the Code Saturne website I am quite curious about any updates and the pre-processor they refer to separately from the GUI: http://code-saturne.org/cms/download/2.0

Version 2.0 looks to be the most recent proper release but there were newer beta releases. I do not recall being able to find that website last I looked but colour me impressed!

The case creation wizard in CAELinux looks like this:


Code Saturne wizard.png


Clicking 'GO' opens what I imagine is the Code Saturne GUI (or the pre-processor?) Clicking on the 'New file' icon fills in the entries on the first page automatically (which I imagine is dependent upon using the wizard which may or may not come with the files on the website just linked to).


Code Saturne GUI.png


Moving through the list of settings that can be modeled from top (Identity and paths) to bottom (Prepare batch calculation) the first critical item is under 'Mesh quality criteria'. While probably a good idea in general, the mesh quality must be checked (as far as I can tell) to read in the boundary condition grouped faces/nodes created in Salome. Clicking on Check mesh performs some sort of check of the mesh and asks the user to save a file. This file will be used later.

This quality check is not so impressive having just finished the tutorial on laminar pipe flow with OpenFOAM which had much more extensive mesh checking. However, I really have no idea what I am doing so I hesitate to make these statements. I have little experience with CFD. I have actually considerably more experience with non-linear structural finite element analysis but user KeesWouters has covered related topics in CAELinux quite extensively. I doubt I could convince myself to work on this topic at my leisure anyways, with CFD I have more to learn.


Code Saturne check mesh.png


The next setting that can be modified is 'Calculation features' in the 'Thermophysical models' section. I changed the flow algorithm to steady flow. This might not be necessary. An approach like that used with OpenFOAM where a termination time large enough to reach a steady state could be used. In fact it might be difficult to use a steady flow model with known turbulence. In the case of von Karmann vortex shedding I imagine a solver would have difficulty in converging to a solution without allowing dependence on time: http://www.youtube.com/watch?v=IDeGDFZSYo8

Turbulence modeling is not necessary (look up direct numerical simulation: http://en.wikipedia.org/wiki/Direct_numerical_simulation). Turbulence modeling is a way of modeling the energy dissipation of eddies without modeling the eddies. Modeling the eddies could require lots of very small cells in the mesh. The smallest eddies of turbulent flow have characteristic lengths on the order of the Kolmogorov microscales: http://en.wikipedia.org/wiki/Kolmogorov_microscales Turbulent flow is a series of cascading eddies (eddies producing yet smaller eddies) down to eddies of the sizes predicted by Kolmogorov. If the model uses the un-modified Navier Stokes equations it must model all of these eddies to properly predict energy dissipation. However, if eddies smaller than a given size are not of interest (and in many cases, like flow in a pipe, they are essentially just noise in terms of the minor effect on average axial velocity fluctuation) some sort of mathematical model of how this energy is dissipated can be added.

The Navier Stokes equations essentially consist of Newton's second law applied to an element of fluid (although usually re-phrased as the flow of fluid through a volume, hence the name finite volume method for the numerical procedure used to solve the equations). These equations are also usually referred to as momentum equations as they describe the conservation of momentum (Newton's second law states that the sum of the forces on a body is equal to the derivative of the momentum with respect to time, only when the mass is constant does this simplify to mass * acceleration). This gives three similar equations for each principal direction. There is also the continuity equation which enforces the conservation of mass. Turbulence modeling adds at least one equation. In the case of temperature change an equation for the conservation of energy is added.