{ "cells": [ { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# CFD Domain's Creation & Discretization\n", "\n", "**The next step for developing the CFD simulation for a case study, after the review of physics and theory behind the problem of interest, is to create the CFD/Computational domain. This CFD domain will first be created and then discretized into small finite elements (2D) or finite volumes (3D). The flow field's governing equations are then solved numerically inside these elements or volumes via an iterative process till a converged solution inside the CFD domain is obtained. This section explains the techniques and process of creation and discretization of the CFD domain for the problem of interest. It should be highlighted that this sections provides the most generic steps and techniques to create the CFD domain. Users can implement these steps/techniques in the mesher of their choice or download the pre-generated * .msh file from the \"Simulation_Src\" folder.**\n", "\n", "The CFD domain for the 2D laminar flow over a cylinder is chosen to be a finite two dimensional square with sides of 100 [m] as shown in Fig. 1. The cylinder is located in the center of the square with diameter of 1 [m]. These dimensions would result into a geometrical factor of 100 between length of the CFD domain and cylinder's diameter, which guarantees removing potential issue of blockage and inaccurate flow field estimation around the cylinder. The shape and dimensions of the domain are chosen such that the required number of mesh elements can be controlled and non-dimensional groups of variables (i.e. Reynolds number) can be estimated fast, while most of variables are set to be equal unity. The users can define the dimensions of the CFD domain according to their own problem definition.\n", "\n", "\n", "Fig.1 - The geometry of CFD domain for the two dimensional laminar flow over a cylinder, visualized using zoom-in view from the center of the channel.\n", "\n", "To create the geometry of the visualized CFD domain in Fig. 1, it is recommended to start with creating a cylinder with diameter of 1 [m] in the center of the domain, where the origin of coordinates is located. Divide the circumference of the cylinder into eight equal segments using vortices located in the start and end points of each quadrants and in their middle section around the cylinder as visualized in the zoom-in view of Fig. 1.\n", "\n", "To create the bounds of the CFD domain generate four points spaced equally with distance of 100 [m] with respect to center of the cylinder and connect them together to define a unit, closed square surface. This step can be done by creating a 100 [m] by 100 [m] square centered at the center of cylinder as well. Most of the times it is recommended to mesh the entire domain at this stage! This might result into a preliminary meshed CFD domain, however it is highly discouraged! The general recommended methodology is discretization of the raw geometry into sub-domains with smooth interface and mesh-ability potential. As it will be showed and discussed later this method would provide the users a great level of controllability on mesh resolution, whenever it is needed. To perform this discretization, the previously eight points created around the cylinder are projected on the edges of the domain and the corresponding vortices are connected to each other. This would result into four large squares and eight long and slender rectangles around the cylinder as visualized in the in Fig. 1. It will be discussed shortly how how this geometry discretization helps the meshing process.\n", "\n", "Once the raw geometry and sub-geometries of the CFD domain is created, it should be discretized into finite elements/volumes (a.k.a meshing procedure). In simple words, meshing is the process of \"chopping\" the geometry of the CFD domain into smaller finite elements and/or volumes, wherein the flow field's governing equations will be solved numerically. High quality mesh elements, with reasonable aspect ratio, would lead to a smoother and more promising numerical solution. Therefore, it is important to increase the quality and level of controllability in the CFD domain at the first step by proper meshing and topology techniques.\n", "\n", "In the current problem of interest to increase the level of controllability on mesh resolution, the vertical and horizontal edges, from previously created sub-geometries around the cylinder, are discretized into 100 mesh elements starting with a first length of 1 [cm] from the cylinder's circumference as shown in Fig. 2. The mesh element distribution along these edges follow a predefined distribution. The predefined distribution would control the mesh resolution along each edge in the domain. The rule of thumb is to have a high mesh resolution close to the cylinder circumference, where the flow field behavior is complex due to formation of boundary layer and decrease mesh resolution, where the flow field behavior is simple. For even more complex flow field such as turbulent boundary layer there are specific techniques and guidelines to set the mesh resolution around the cylinder's wall, which will be introduced in other case studies as needed. Using the current approach one created a well-defined CFD domain geometry with high mesh resolution close to cylinder's boundary, where the physics of the flow are more complex (i.e. boundary layer region) and gradually decreased it to bounds of the domain, where flow field is uniform and simple.\n", "\n", "\n", "Fig.2 - Controlling mesh element distribution along the edges connected to the cylinder's circumference.\n", "\n", "In the next step the edges of the four large squares on the corners of the CFD domain are meshed using the same mesh setting for the connected edges to the cylinder's body (i.e. 100 elements with 1 [cm] first length). At this stage all of the edges for these four large squares are meshed and user can use the surface meshing algorithm of choice to mesh all four faces as shown in Fig. 3. As visualized in the zoom-in view of Fig. 3 the mesh resolution is high close to cylinder's surface and decreases moving farther from it. \n", "\n", "\n", "Fig.3 - Surface mesh of four large squares in the CFD domain.\n", "\n", "At this stage the geometries that remained unmeshed are the eight slender rectangles around the cylinder's surface as shown in the zoom-in view of Fig. 3. In order to mesh these eight faces the created subedges of cylinder and the corresponding edges, which are the widths of the rectangles will be meshed using 50 mesh elements with uniform distribution as shown in Fig. 4. Now similar to the previous step, all of the edges for the eight long rectangular faces are meshed and they can be meshed using a proper surface mesh algorithm of choice.\n", "\n", "\n", "Fig.4 - Finalized mesh of the CFD domain.\n", "\n", "Fig. 4 shows the fully meshed CFD domain and a zoom-in view of the mesh around the cylinder. As it is shown in zoom-in view of Fig. 4 the used meshing algorithm provided a high mesh resolution around the cylinder and decreases it moving farther from it. At this stage one can see that how using a set of pre-defined sub geometry helped having a structured and well-controlled mesh. Upon requirement for increasing the mesh resolution around the cylinder user can simply redefine the value of pre-set first length or number of mesh elements along each edge and get a higher or lower mesh resolution as needed. \n", "\n", "Once the mesh is generated it's quality should be examined. This can be done using the provided features and functions defined in the meshing software. In general these functions calculate the aspect ratio of each elements and report a statistical report on them. The goal is to keep the average aspect ratio close to 1 for a very high quality mesh. In this stage the CFD domain is completely meshed and is ready to be setup for a CFD simulation.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.1" } }, "nbformat": 4, "nbformat_minor": 0 }