LECTURE-V PRACTICE SESSION: UNSTEADY COMPRESSIBLE FLOW-MODELLING In this tutorial you will learn how to: Calculate a steady-state solution (using the coupled implicit solver) as an initial condition for a transient flow prediction Define an unsteady boundary condition using a user-defined function (UDF) Calculate a transient solution using the second-order implicit unsteady formulation and the coupled implicit solver Create an animation of the unsteady flow using FLUENT's unsteady solution animation feature The geometry to be considered in this tutorial is shown in Figure. Flow through a simple nozzle is simulated as a 2D planar model. The nozzle has an inlet height of 0.2 m, and the nozzle contours have a sinusoidal shape that produces a 10% reduction in flow area. Due to symmetry, only half of the nozzle is modeled. Figure: Problem Specification I have sent you a mail to your paws account. First save it to your H: drive and then start this session further. Use the 2D version of fluent. Grid 1. Read in the mesh file nozzle.msh. File Read Case... 2. Check the grid. Grid Check FLUENT will perform various checks on the mesh and will report the progress in the console window. Pay particular attention to the reported minimum volume. Make sure this is a positive number. 3. Display the grid. Display Grid... To make the view more realistic, you will need to mirror it across the centerline. 4. Mirror the view across the centerline. Display Views... (a) Select symmetry under Mirror Planes. (b) Click Apply. The grid for the nozzle is shown in Figure Figure: 2D Nozzle Mesh Display Units 1. For convenience, define new units for pressure. The pressure for this problem is specified in atm, which is not the default unit. You will need to redefine the pressure unit as atm. Define Units... (a) Select pressure under Quantities, and atm under Units. Hint: Use the scroll bar to access pressure, which is not initially visible in the list. (b) Close the panel. Models 1. Select the coupled implicit solver. The coupled implicit solver is the solver of choice for compressible, transonic flows. Define Models Solver... Note: Initially, you will solve for the steady flow through the nozzle. Later, after obtaining the steady flow as a starting point, you will revisit this panel to enable an unsteady calculation. 2. Enable the Spalart-Allmaras turbulence model. Define Models Viscous... The Spalart-Allmaras model is a relatively simple one-equation model that solves a modeled transport equation for the kinematic eddy (turbulent) viscosity. This embodies a class of one-equation models in which it is not necessary to calculate a length scale related to the local shear layer thickness. The Spalart-Allmaras model was designed specifically for aerospace applications involving wallbounded flows and has been shown to give good results for boundary layers subjected to adverse pressure gradients. Materials 1. Set the properties for air, the default fluid material. Define Materials... (a) Select the ideal-gas law to compute Density. Note: FLUENT will automatically enable solution of the energy equation when the ideal gas law is used. You do not need to visit the Energy panel to turn it on. (b) Retain the default values for all other properties. Then click change/create button. Operating Conditions 1. Set the operating pressure to 0 atm. Define Operating Conditions... Here, the operating pressure is set to zero and boundary condition inputs for pressure will be defined in terms of absolute pressures. Boundary condition inputs should always be relative to the value used for operating pressure. Boundary Conditions Define Boundary Conditions... 1. Set the conditions for the nozzle inlet ( inlet). (a) Set the Gauge Total Pressure to 0.9 atm. (b) Set the Supersonic/Initial Gauge Pressure to 0.7369 atm. The inlet static pressure estimate is the mean pressure at the nozzle exit. This value will be used during the solution initialization phase to provide a guess for the nozzle velocity. (c) In the Turbulence Specification Method drop-down list, select Turbulent Viscosity Ratio. (d) Set the Turbulent Viscosity Ratio to 1. For low to moderate inlet turbulence, a viscosity ratio of 1 is recommended. 2. Set the conditions for the nozzle exit ( outlet). (a) Set the Gauge Pressure to 0.7369 atm. (b) In the Turbulence Specification Method drop-down list, select Turbulent Viscosity Ratio. (c) Accept the default value of 10 for Backflow Turbulent Viscosity Ratio. If substantial backflow occurs at the outlet, you may need to adjust the backflow values to levels close to the actual exit conditions. Solution: Steady Flow 1. Initialize the solution. Solve Initialize Initialize... (a) Select inlet in the Compute From drop-down list. (b) Click Init, and Close the panel. 2. Set the solution parameters. Solve Controls Solution... (a) Under Discretization, select Second Order Upwind for Turbulent Viscosity. Second-order discretization provides optimum accuracy. 3. Enable the plotting of residuals. Solve Monitors Residual... (a) Under Options, select Plot. (b) Click OK. 4. Enable the plotting of mass flow rate at the flow exit. Solve Monitors Surface... (a) Increase the number of Surface Monitors to 1. (b) Turn on the Plot and Write options for monitor-1. Note: When the Write option is selected in the Surface Monitors panel, the mass flow rate history will be written to a file. If you do not select the write option, the history information will be lost when you exit FLUENT. (c) Click on Define... to specify the surface monitor parameters in the Define Surface Monitor panel. i. Select Mass Flow Rate in the Report Type drop-down list. ii. Select outlet in the Surfaces list. iii.In the File Name field, enter the name noz_ss.out. iv. Click on OK to define the monitor. (d) Click on OK in the Surface Monitors panel to enable the monitor. 5. Save the case file ( noz_ss.cas). File Write Case... 6. Start the calculation by requesting 800 iterations. Solve Iterate... The solution will converge after about 600 iterations. However, the residual history plot is only one indication of solution convergence. Notice that the mass flow rate has not reached a constant value. To remedy this, you will reduce the convergence criterion for the continuity equation and iterate until the mass flow rate reaches a constant value. 7. Reduce the convergence criterion for the continuity equation. Solve Monitors Residual... (a) Set the Convergence Criterion for continuity to 1e-04. (b) Click OK. Note: To obtain better convergence of the mass flow rate, only the convergence tolerance for the continuity equation is adjusted. In general, the convergence behavior of the continuity equation is a good indicator of the overall convergence of the solution. 8. Request 500 more iterations. Solve Iterate... After about 400 iterations (1000 total), the mass flow rate has leveled off and the solution has converged. The mass flow rate history is shown in Figure Figure: Mass Flow Rate History 9. Save the data file ( noz_ss.dat). File Write Data... 10. Check the mass flux balance. Report Fluxes... (a) Keep the default Mass Flow Rate option. (b) Select inlet and outlet in the Boundaries list. (c) Click Compute. The net mass imbalance should be a small fraction (say, 0.5%) of the total flux through the system. If a significant imbalance occurs, you should decrease your residual tolerances by at least an order of magnitude and continue iterating. 11. Display the steady-flow velocity vectors. Display Vectors... (a) Select arrow in the Style drop-down list. (b) Change the Scale to 10. (c) Click Display. The steady flow prediction shows the expected form, with peak velocity of about 326 m/s through the nozzle. Figure: Velocity Vectors (Steady Flow) 12. Display the steady flow contours of static pressure (Figure). Display Contours... (a) Under Options, select Filled. (b) Click Display. The steady flow prediction shows the expected pressure distribution, with low pressure near the nozzle throat. Figure: Contours of Static Pressure (Steady Flow) Enable Time Dependence and Set Unsteady Conditions In this step you will define a transient flow by specifying an unsteady pressure condition for the nozzle. 1. Enable a time-dependent flow calculation. Define Models Solver... (a) Under Time, select Unsteady. (b) Under Unsteady Formulation, select 2nd-Order Implicit. Implicit (dual) time-stepping allows you to set the physical time step used for the transient flow prediction (while FLUENT continues to determine the time step used for inner iterations based on a Courant condition). Here, second-order implicit time-stepping is enabled: this provides higher accuracy in time than the first-order option. 2. Define the unsteady condition for the nozzle exit ( outlet). The pressure at the outlet is defined as a wave-shaped profile , and is described by the following equation: (1) where = circular frequency of unsteady pressure (rad/s) = mean exit pressure (atm) In this case, rad/s, and 0.7369 atm. Note: To input the value of Equation 1 in the correct units, the function pexit.c has been multiplied by a factor of 101325 to convert from the chosen pressure unit (atm) to the SI unit required by FLUENT (Pa). This will not affect the displayed results (a) Read in the user-defined function. Define User-Defined Functions Interpreted... i. Enter pexit.c as the Source File Name. ii. Click Compile. The user-defined function has already been defined, but it needs to be compiled within FLUENT before it can be used in the solver. iii. Close the Interpreted UDFs panel. (b) Set the unsteady boundary conditions at the exit. i. Select udf unsteady_pressure (the user-defined function) in the Gauge Pressure drop-down list. Solution: Unsteady Flow 1. Set the time step parameters. The selection of the time step is critical for accurate time-dependent flow predictions. Using a time step of seconds, 50 time steps are required for one pressure cycle. The pressure cycle begins and ends with the initial pressure at the nozzle exit. Solve Iterate... (a) Set the Time Step Size to 7.1857e-05 s. (b) Set the Number of Time Steps to 300. (c) Set the Max Iterations per Time Step to 30. (d) Click Apply. 2. Modify the plotting of the mass flow rate at the nozzle exit. Because each time step requires 30 iterations, a smoother plot will be generated by plotting at every time step. Solve Monitors Surface... (a) For monitor-1, select Time Step in the drop-down list under Every. (b) Click Define... to modify the surface monitor parameters. i. In the Define Surface Monitor panel, change the File Name to noz_uns.out. ii. In the X Axis drop-down list, select Time Step. iii. Click OK. (c) Click OK in the Surface Monitors panel. 3. Save the transient solution case file ( noz_uns.cas). File Write Case... 4. Start the transient calculation. Solve Iterate... Calculation of 300 time steps will require significant CPU resources. Instead of calculating, you can read the data file saved after the iterations have been completed: noz_uns.dat (The data file is available in the same directory where you found the mesh and UDF files.) By requesting 300 time steps, you are asking FLUENT to compute six pressure cycles. Figure: Mass Flow Rate History (Unsteady Flow) 5. Save the transient solution data file ( noz_uns.dat). File Write Data... In this tutorial, you modeled the transient flow of air through a nozzle. You learned how to generate a steady-state solution as an initial condition for the unsteady case, and how to set solution parameters for implicit time-stepping.