OpenFoam Workflow (1): Create a Geometry in FreeCAD

Please like, comment and share, if you enjoyed this video :-)

0:00 Intro
0:38 Draw Sketch 1 (pipe-spline)
5:37 Draw Sketch 2 (radius)
7:07 Sweep radius along pipe-line
9:09 Export geometry as STEP file

Transcript

Welcome to the first part of our open-form tutorial, where we will guide you through creating a case from start to finish. We'll use a simple pipe as an example, generating the geometry in FreeCAD, creating the mesh in Salome, performing the calculations in OpenFOAM, and visualizing the results in ParaView.

In this initial part, we'll begin with FreeCAD for geometry creation. When you open a new file, start by entering the Sketcher. Please note that the menus should be in English, not German. In the Sketcher, we'll be working with two-dimensional sketches only.

To start a new sketch, click the red button and choose the plane you want to draw on. In this first step, we'll create the lines that define the path of the pipe. We'll begin by selecting the side view, which corresponds to the XZ axis in this example. Click OK to confirm. You'll see a coordinate system where you can draw your lines.

We'll start with a simple line originating from the center. Starting from the center simplifies the process because we'll later create a circle representing the pipe's diameter, which will revolve around these lines. Although it's not mandatory, starting from the center makes things easier.

Draw the first line, ensuring it is perfectly straight for good mesh quality. In FreeCAD, you cannot use the Shift key for this purpose, so manually adjust it to 90 degrees with your mouse. Next, draw a horizontal line, setting it to 0 degrees since it's horizontal.

Now that we have our two lines for the mesh, we need to add a radius between them. Use the radius tool and select the first and second lines to generate the radius. Depending on your desired pipe diameter, adjust the radius accordingly. For example, if you want a 20mm diameter, set the radius to 30mm to accommodate flow later on.

Each line needs to be defined, indicated by turning them from white to green in FreeCAD. For the vertical line, use the "Define length" button, setting it to 100 millimeters. Do the same for the horizontal line, also specifying a length of 100 millimeters. Once everything is green, you can close the first sketch.

In the 3D view, you'll see that it currently looks like a single line. We'll need a second sketch to define the diameter. Create a new sketch but ensure it's separate from the first one. This time, choose the X-Y axis and look from the top, as we want to create the pipe's opening.

In this 2D view, you can see the different parts, including the elbow and the pipe's end. Start by creating a circle in the center, as we did before. This circle needs a defined radius. For a 20mm diameter, set the radius to 10mm. Once the circle is defined, it will turn green, and you can close this second sketch.

Now, we move on to the next step: creating the part. Navigate to the "Part" area in FreeCAD and use the "Sweep" tool. Sweeping involves revolving the circle around the previously created path (line).

Select both sketches and click on the "Sweep" tool. Specify that sketch one (the path) should be swept. Define the sweeping path by selecting the necessary lines. Once done, click "Ready" and "OK." You'll now have a three-dimensional pipe with a defined diameter.

However, it's currently an open pipe, which isn't suitable for OpenFOAM. To close it, go to "Solid" settings and set it to "True." This will create openings at both ends of the pipe, which we'll later label as "Inlet" and "Outlet." These openings will become the walls.

Now, you need to export this geometry. The preferred format is STEP. This format works well in Salome, which we'll use in the next part of this tutorial. Save the STEP file in your case folder, overwriting if necessary.

This concludes the first part of the tutorial. Stay tuned for part two, where we will continue the process in Salome.