Data Loading...
Fluent_UDF_2019R3_WS03.2-Sinu Flipbook PDF
Fluent_UDF_2019R3_WS03.2-Sinu
290 Views
178 Downloads
FLIP PDF 472.26KB
Workshop 3.2: Sinusoidal Wall Temperature Variation
Workshop 3.2: Sinusoidal Wall Temperature Variation ANSYS Fluent UDF Release 2019 R3
11
© 2019 ANSYS, Inc.
Introduction • This tutorial examines fluid flow through a two-dimensional channel, where one wall of the channel has user-defined temperature profile applied to it. The purpose of this tutorial is to demonstrate the ability of ANSYS Fluent to use user-defined functions (UDFs) to specify a position-dependent variable on the wall boundary condition. • This tutorial demonstrates how to do the following: ‒ Interpret the UDF. ‒ Use UDF for specifying the profiles on boundaries. ‒ Postprocess the resulting data.
2
© 2019 ANSYS, Inc.
Prerequisites • This tutorial is written with the assumption that you have completed Tutorial 1 from ANSYS Fluent Tutorial Guide, and that you are familiar with the ANSYS Fluent tree and ribbon structure. Some steps in the setup and solution procedure will not be shown explicitly. • For more details about user-defined functions (UDF) refer to the ANSYS Fluent UDF Manual.
3
© 2019 ANSYS, Inc.
Problem Description • The problem considered in this tutorial is shown schematically. Air at 300 K enters a 2D channel which has an insulated upper wall and a heated lower wall. The temperature on the lower wall varies sinusoidally with x-position according to:
• The calculation will be performed assuming steady state, incompressible, and laminar flow in the channel. 4
© 2019 ANSYS, Inc.
Preparation Copy the files channel.msh.gz and wallprof.c to the working folder. Use the Fluent Launcher to start the 2D version of ANSYS Fluent. Fluent Launcher displays your Display Options preferences from the previous session. Ensure that the Display Mesh After Reading and Workbench Color Scheme options are enabled. • Enable Double Precision • • • •
5
© 2019 ANSYS, Inc.
Setup and Solution
Setup and Solution
66
© 2019 ANSYS, Inc.
Mesh • Read the mesh file channel.msh.gz. File → Read → Mesh... Note: As the mesh file is read, ANSYS Fluent will report the progress in the console.
7
© 2019 ANSYS, Inc.
General Settings • Retain the default solver settings. Physics → Solver • Check the mesh. Domain → Mesh → Check Note: Fluent will perform various checks on the mesh and will report the progress in the console. Ensure that the reported minimum volume is a positive number.
• Enable Energy equation. Physics → Models → Energy Note: You will use the default fluid properties of air for this problem. Hence, you need not make any changes to the material properties.
8
© 2019 ANSYS, Inc.
User-Defined Functions Note: The UDF can be compiled as well as interpreted. In this tutorial, you will use the interpreted option.
• Interpret the UDF. User Defined → User Defined → Functions → Interpreted... • Click the Browse... button. • Select the source file (wallprof.c) in the Select File dialog box. • Specify the C preprocessor to be used in the CPP Command Name field. Note: If you want to use the C preprocessor that ANSYS Fluent. has supplied, you can enable the Use Contributed CPP option.
• Retain the default value of 10000 for Stack Size. Note: The Stack Size should be 10000 unless the number of local variables in your function causes the stack to overflow. Its value should be set to a number that is greater than the number of local variables used.
• Click Interpret and close the Interpreted UDFs dialog box. 9
© 2019 ANSYS, Inc.
Boundary Conditions (1) • • • • •
10
Set the boundary conditions for wall-1. Setup → Boundary Conditions → wall-1 → Edit... Click the Thermal tab and select Temperature from the Thermal Conditions list. Select udf temperature_profile from the Temperature drop-down list. Retain the default values for the other parameters. Click OK to close the Wall dialog box.
© 2019 ANSYS, Inc.
Boundary Conditions (2) • Set the boundary conditions for velocity-inlet-1. Setup → Boundary Conditions → velocity-inlet-1 → Edit... • Select Components from the Velocity Specification Method drop-down list. • Enter 1 m/s for X-Velocity. • Click OK to close the Velocity Inlet dialog box.
11
© 2019 ANSYS, Inc.
Solution (1) • Change the Absolute Criteria for continuity to 0.0001. Solution → Reports → Residuals...
• Initialize the solution. Solution → Initialization → Initialize Note: Hybrid Initialization is the default Initialization Method in ANSYS Fluent. Refer to the section 28.11 Hybrid Initialization, in the ANSYS Fluent User's Guide. 12
© 2019 ANSYS, Inc.
Solution (2) • Save the initial case file channel.cas.gz. File → Write → Case... • Start the calculation for 100 iterations. Solution → Run Calculation → Calculate... Note: The solution converges in approximately 47 iterations.
• Save the data file channel.dat.gz. File → Write → Data...
13
© 2019 ANSYS, Inc.
Postprocessing • Display the filled contours of static temperature. Results → Graphics → Contours → Edit... • Enable Filled in the Options list. • Select Temperature... and Static Temperature from Contours of drop-down list. • Click Display and close the Contours dialog box.
Figure 4: Contours of Static Temperature
14
© 2019 ANSYS, Inc.
Appendix • The contents of the UDF source code are as follows:
15
© 2019 ANSYS, Inc.
Results • The contour plot in Figure 4: Contours of Static Temperature shows that the temperature on the wall and in the fluid reaches a peak at the center of the channel due to the peak in the prescribed wall temperature.
16
© 2019 ANSYS, Inc.
Summary • This tutorial demonstrated the use of UDF for specifying profiles on boundaries. You can apply this approach to the other boundary condition types such as pressure and velocity inlets, and pressure outlets. • When you are comfortable with this problem, try modifying the UDF to specify heat flux rather than temperature. • Replace the following line in the udf code with a different expression for the specified heat flux. temp = 300. + 100. * sin(pi * x/0.005) • Change the thermal boundary condition type. • Hook the new profile to the wall boundary before running the new case.
17
© 2019 ANSYS, Inc.