## General

#### How can I calculate the average and difference between two data files using CFD-Post?

• FAQ
Participant

This solution is applicable to both Fluent and CFX files. 1. Load two files in CFD-Post 2. Go to Tools > Compare Case, then turn on Case Comparison Active and click Apply. In the Variables tab, you will now see a folder called Difference which contains all difference variables. Note that the differences are always calculated as Case 1 minus Case 2. (More on Case Comparison can be found in section 12.8 Case Comparison of the CFD-Post Userâ€™s Guide.) 3. The *.Difference variable will be used to calculate the average. To demonstrate this algebraically, Temp1 will be the temperature variable for Case 1 and Temp2 will be the temperature variable for Case 2. The *.Difference variables are always calculated as Case 1 minus Case 2. Therefore, Temperature.Difference = Temp1 â€“ Temp2 Note that the average temperature can be written as either: TemperatureAverage = (Temp1 + Temp2)/2 or TemperatureAverage = ((Temp1 â€“ Temp2) + 2*Temp2)/2 Therefore: TemperatureAverage = (Temperature.Difference + 2*Temp2) 4. Create an User Defined variable which will represent the average temperature. To do this, right click under the Variable tab, then select New. Set the variable Method = Expression and the Expression = (Temperature.Difference + 2*Temperature). It is important to note that this variable will only be valid when plotted on Case 2. If this variable is plotted on Case 1, the expression will be equal to (Temperature.Difference + 2*Temp1) = (3Temp1 â€“ Temp2)/2, which is incorrect. 5. To use this average temperature variable in an expression, the case and locator must be specified, for example: areaAve(TemperatureAverage)@CASE:2.Locator 6. The *.Difference variables are only created when CFD-Post is open and will not be saved to the data files. For CFX users, the *.Difference variables can be written to the .res file. To do this, in the Solver Manager, go to Tools > Interpolate Results and turn on Calculate Differences. The *.Difference variables will be written to the Modified Results .res file. These *.Difference variables will be equal to Modified Results â€“ Original Results.