{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CFD Simulation Case Setup\n", "\n", "** The created CFD domain is now read into the CFD package of interest to setup the CFD simulation. It should be noted that the current tutorial has a significant difference compared to other available CFD tutorials online! This tutorial is structured and developed based on a generic and methodological approach to set up a CFD simulation. The first principals and reasonings for each setting is discussed at each step. Potential alterations and modifications to perform similar analysis for different flow conditions are also addressed and discussed. Hence, in the end user will have the capability of applying potential modifications, improvements or extending the application of the current CFD simulation to a more complex problem of interest, rather than having a one time successful run of a specific simulation with specific and strictly pre-defined boundary conditions. **\n", "\n", "> **_In simple words: Current tutorial teaches users to fish, rather than giving them a fish._**\n", "\n", "# General Recommended Structure for Writing Domain File\n", "\n", "\n", "## Setting up a CFD simulation has following four steps:\n", "\n", "1. ###### Setup Model/s: \n", "According to the physics of the flow field user will select required model/s to simulate the flow.\n", "\n", "2. ###### Setup Working Fluid/s & Solid/s: \n", "User will define the physical and thermodynamical properties of the working fluid/s and solid/s in the problem. \n", "\n", "3. ###### Setup Boundary & Zone Conditions: \n", "Solving the governing equations of the flow (i.e. system of partial differential equations) requires well-defined boundary conditions within the CFD domain. These conditions are selected and defined in this step.\n", "\n", "4. ###### Setup Solution Methods: \n", "In CFD simulations the governing equations of the flow are solve numerically. Based on the physics of the problem appropriate numerical schemes and solution methods are selected at this step.\n", "\n", "In the following section the details for the above four steps for the CFD simulation setup for laminar flow in a channel with backward facing step are explained in great details. It should be noted that the path for defining conditions and other settings are provided in `command line` format. Users can access exact same settings and options by following the provided path via the tree of progress or pull down menu in ANSYS FLUENT. The summary of the steps to take for CFD simulation setup for problem of 2D laminar flow in a channel with backward facing step are as follows:\n", "\n", "1- `/define/models/steady` \n", "2- `/define/models/solver/pressure-based` \n", "3- `/define/models/viscous/laminar` \n", "4- `/define/material/change-create` \n", "5- `/define/boundary-conditions/fluid` \n", "6- `/define/boundary-conditions/velocity-inlet` \n", "7- `/define/boundary-conditions/pressure-outlet` \n", "8- `/define/boundary-conditions/wall` \n", "9- `/define/boundary-conditions/wall` \n", "10- `/define/boundary-conditions/wall` \n", "11- `/solve/set/discretization-scheme` \n", "12- `/solve/set/under-relaxation` \n", "13- `/solve/initialize/compute-defaults/velocity-inlet` \n", "14- `/solve/iterate`\n", "\n", "Following is the step-by-step explanation for each of the above command/setting procedure:\n", "\n", "**1. Setup Model/s:**\n", "* The current flow field of interest in majority of applications is steady. Meaning that an almost constant and uniform flow will enter the channel and evolves along it. Therefore, the `steady` model is chosen: `/define/models/steady`. If the flow rapidly evolves with respect to time the `Transient` model should be chosen in this step. \n", "\n", "* In majority of industrial applications the flow speed inside a channel is defined in subsonic region. Therefore, variation of density with respect to the pressure can be neglected. As a result of this assumption one can define the working fluid to be incompressible by choosing pressure-based governing equations to be solved: /define/models/solver/pressure-based. In cases that the speed of the flow enters sonic and supersonic regions, the changes in density (i.e. compressibility) of the flow will be an important factor and the solver must be defined as density-based.\n", "\n", "* In the current problem the flow is viscous and value of Reynold number, based on the hydraulic diameter of the channel, is approximated to be less than 400. Therefore, the flow regime is laminar and the appropriate model for that is selected via :/define/models/viscous/laminar. It is important to note that the critical Reynolds number, based on the paper by [Armaly et. al.](http://journals.cambridge.org/action/displayAbstract?fromPage=online&aid=380534&fileId=S0022112083002839) is 1200, when the regime of the flow transitions from laminar to turbulent. In case studies with Reynolds number higher than the corresponding critical values the chosen model will still be viscous, however the appropriate turbulence model should be selected at this step.\n", "\n", "**2. Setup Working Fluid/s & Solid/s:**\n", "* The choice of working fluid is problem dependent. In the absence of obligations to define a specific working fluid such as air or water, it is suggested that the users define the working fluid such that the important non-dimensional groups of interest, such as Reynolds number in this problem, is matched the desired flow physics and conditions. This strategy removes the uncertainty in the choice of the working fluid and solidifies the bases for the expected physical observations. That being pointed out, in this problem, to have an accurate comparison against [Armaly et. al.](http://journals.cambridge.org/action/displayAbstract?fromPage=online&aid=380534&fileId=S0022112083002839) experimental data, the working fluid is set as Air using /define/material/change-create command. Then the Reynolds number of the flow is set by setting values of flow inlet velocity according to the following formulation: The Reynolds number of the flow is defined as $Re = \\frac{\\rho U D_h}{\\mu}$, where $D_h$ is the hydraulic diameter of the channel and is estimated to be $2h$, $h$ being the height of channel's entrance region equal to 0.0052 [m] matching the experimental setup. Inserting the thermodynamic properties of Air at standard conditions into the equation of flow field Reynolds number, users will have $Re = 711.97 * U$. To match the desired Reynolds number within the flow, users can calculate the corresponding velocity $U$, which will be the streamwise velocity of the flow at the inlet.\n", "\n", "**3. Setup Boundary and Zone Conditions:**\n", "* In this problem the entire CFD domain is filled with the working fluid, which is air. This working fluid is selected form the defined material/s in the previous step:/define/boundary-conditions/fluid. Select \"Air\" from the available lists of materials.\n", "\n", "* The flow enters from the inlet face of the CFD domain with constant velocity with a set value to match the desired Reynolds number in x-direction. User sets the inlet face to a velocity-inlet condition by defining the direction and magnitude of the velocity: /define/boundary-conditions/velocity-inlet. In cases where the incoming velocity into the CFD domain is not uniform one can define the incoming velocity with the pre-defined directions or generate a User Define Function (UDF) to describe the velocity profile of interest.\n", "\n", "* The flow exits the channel from the outlet face and it's pressure will be equal to atmospheric pressure. /define/boundary-conditions/pressure-outlet. It is assumed that gauge pressure at this face is equal to 0. If in the problem of interest, there exist a specific pressure difference between the inlet and outlet, that magnitude can be defined in inlet and the outlet of the pipe.\n", "\n", "* The flow inside the channel is bounded by channel's walls and interact with them based on the no-slip boundary condition. User assign the no-slip boundary condition to the top wall and two bottom walls faces of the CFD domain using /define/boundary-conditions/wall command. It should be pointed out that at the step of CFD domain creation channel's bottom wall was split into two faces, bottom wall connected to inlet and bottom wall connected to outlet for future post-processing purposes. Despite this splitting step, the imposed wall boundary condition on both faces are identical. If the shear forces and formed boundary layer becomes important in these regions user should either provide required mesh resolution to capture the phenomena or set this boundary to free slip condition such that fluid elements would not interact with wall region.\n", "\n", "**4. Setup Solution methods:** \n", "* In this step, it is highly recommended to use the default options and settings, unless based on physics of the problem the user is aware of any specific choices. Upon non-smooth convergence and potential divergence of the CFD simulation user can modify and examine various solution methods. To modify the solution methods and controls use the following commands respectively:\n", "\n", "solve/set/discretization-schem\n", "\n", "solve/set/under-relaxation\n", "\n", "Now all boundary conditions and settings for the CFD simulation are defined. User can **initialize** the solution through an educated guess to start the iteration process: /solve/initialize/compute-defaults/velocity-inlet\n", "Solution initialization would incept the flow field variables, such as velocity and pressure, based on the defined values by user. For the current problem the CFD domain is recommended to be initialize by values of velocity and pressure at the pipe's inlet.\n", "\n", "Iteration process for solving the flow field governing equation now shall start till converged solution is obtained:solve/iterate. A general rule of thumb for converged solution is to have continuity residuals of 10-3. More details about commenting on validity of solution and convergence criteria will be discussed in next section.\n", "Now that all boundary conditions and settings for the CFD simulation are defined. User can **initialize** the solution through an educated guess to start the iteration process: `/solve/initialize/compute-defaults/velocity-inlet`\n", "Solution initialization would incept the flow field variables, such as velocity and pressure, based on the defined values by user. For the current problem the CFD domain is recommended to be initialize using values of velocity and pressure at the inlet.\n", "\n", "Iteration process for solving the flow field governing equation now shall start till converged solution is obtained:`solve/iterate`. A general rule of thumb for converged solution is to have continuity residuals of 10E-3. More details about commenting on validity of solution and convergence criteria will be discussed in next section." ] } ], "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 }