laminar flow simulation via freecad cfd workbench

9
Laminar flow simulation via freecad CFD workbench (Author: K. Indireshkumar) On Odyssey, start singularity: singularity shell /n/seas_computing/scientific_software/freecad_OpenFoam.simg Setup freecad for use of gmsh and OpenFoam source /opt/openfoam6/etc/bashrc export PATH=/opt/gmsh-3.0.6-Linux64/bin:$PATH export PATH=/opt/paraviewopenfoam54/bin:$PATH (You can put all of the above in the file ~/.bashrc) Start freecad (via command line in singularity or a desktop icon if locally installed) freecad Via Edit→ Preferences, choose CFD (Fig. 1) and click on “Run dependency checker”. If it returns CfMesh and HISA not found, it is okay. Exit by clicking ok.

Upload: others

Post on 29-Dec-2021

19 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Laminar flow simulation via freecad CFD workbench

Laminar flow simulation via freecad CFD workbench (Author: K. Indireshkumar)

● On Odyssey, start singularity: singularity shell /n/seas_computing/scientific_software/freecad_OpenFoam.simg

● Setup freecad for use of gmsh and OpenFoam source /opt/openfoam6/etc/bashrc export PATH=/opt/gmsh-3.0.6-Linux64/bin:$PATH export PATH=/opt/paraviewopenfoam54/bin:$PATH (You can put all of the above in the file ~/.bashrc)

● Start freecad (via command line in singularity or a desktop icon if locally installed) freecad

● Via Edit→ Preferences, choose CFD (Fig. 1) and click on “Run dependency checker”. If it returns CfMesh and HISA not found, it is okay. Exit by clicking ok.

Page 2: Laminar flow simulation via freecad CFD workbench

Fig. 1 ● Open a new file (arrow 1 in Fig 2) and choose “part” from the menu (arrow 2 in

Fig 2)

Fig 2

● Choose a cylinder from the geometry icons (Fig. 3, arrow 1), click on Cylinder on the side panel, and select the dimensions of the cylinder (Fig 3, arrow 2). Note: the default units are in mm and we will use the default.

● We now want to conduct simulation of flow of a high viscous fluid in the pipe we just created with the freecad CFD workbench. To get started on this, choose CfdOF in the from the menu (Fig 4). Click on CFD (letter A with CFD below) on the CFD panel. This results in a side panel of CfdAnalysis with four components as shown in Fig. 5 (may need to expand the CfdAnalysis panel to see the four components).

Page 3: Laminar flow simulation via freecad CFD workbench

Fig 3

Fig. 4

Page 4: Laminar flow simulation via freecad CFD workbench

Fig. 5

● The four components are: 1) Physics Model (laminar, turbulent, etc.), (2) Fluid Properties (density, viscosity, etc.), (3) Initialization and (4) OpenFOAM (write the prepared model and run simulation). We also need to mesh the geometry. We will work through these steps to set up the simulation.

● Double click on PhysicsModel and choose Steady, Single phase, Incompressible and Laminar Flow (Fig. 6). Click ok.

Fig. 6

Page 5: Laminar flow simulation via freecad CFD workbench

● Select FluidProperties and enter the density (850 kg/m^3) and viscosity (0.4 kg/(m.s) (Fig. 7). Click ok.

Fig. 7 ● We will now mesh the geometry. Click on the Cylinder in the side menu

(Arrow 2 in Fig.8) and click on circular mesh icon on the top panel (Arrow 1, Fig. 8).

Page 6: Laminar flow simulation via freecad CFD workbench

Fig. 8 ● Select snappyHexMesh and set meshing parameters (Base element size: 2 mm, point in

mesh: 5mm, 2mm, 2mm) as in Fig. 9 and click on Mesh. Once meshing is finished, you can load the mesh and inspect it. Click close.

Fig. 9

● Next, click on InitialiseFileds on the side panel and accept the default (potential flow). ● We will now proceed with the boundary conditions. On the top CFD panel, click on the

boundary condition icon pointed to by the arrow in Fig. 10.

Fig. 10

● We will set the wall (no-slip) boundary condition first. Choosing wall for boundary should have the no-slip condition (default). Next click on “Select from list” and choose “Cylinder” from the drop down list in front of “Select Object”. It should show three faces. You need to select one that forms the side of the cylinder. Experiment with choosing the faces till you see one that highlights the side of cylinder in the graphics window. Select “Done” and “close”. (Fig. 11)

● Inlet boundary condition: Click on the boundary condition icon again (Fig 10) and choose “Inlet” for boundary and “Static pressure” for sub-type. As for the wall, go through the same steps and select the inlet face (Fig. 12) and set the pressure as 5000 Pascals.

Page 7: Laminar flow simulation via freecad CFD workbench

● Outlet boundary condition: Click on the boundary condition icon (Fig 10) again and select “Outlet” for boundary and “Static pressure” for sub-type. Go through the same steps as before and select the face that forms the outlet of the tube (Fig 13). Leave the pressure at 0 Pascals.

Fig. 11

Fig. 12

Page 8: Laminar flow simulation via freecad CFD workbench

Fig. 13

● We are now ready to run the simulation. To do this, double click on the Openfoam icon (with green arrow in front) on the side panel. This will open a panel shown in Fig. 14. Before running the simulation, you need to write the case. For this choose a directory (folder). You can leave it at /tmp (the default) in most cases. Click on the “Write” button. After writing is completed (you will see a message to that effect on the side panel), click on “Run”. Once the simulation is complete, click on paraview to see the results (detailed on a separate post-processing pdf).

Page 9: Laminar flow simulation via freecad CFD workbench

Fig. 14