{"id":171118,"date":"2023-06-05T07:05:47","date_gmt":"2023-06-05T07:05:47","guid":{"rendered":"\/knowledge\/forums\/topic\/how-can-i-calculate-the-average-and-difference-between-two-data-files-using-cfd-post\/"},"modified":"2023-07-31T12:30:05","modified_gmt":"2023-07-31T12:30:05","slug":"how-can-i-calculate-the-average-and-difference-between-two-data-files-using-cfd-post","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/knowledge\/forums\/topic\/how-can-i-calculate-the-average-and-difference-between-two-data-files-using-cfd-post\/","title":{"rendered":"How can I calculate the average and difference between two data files using CFD-Post?"},"content":{"rendered":"<p>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&#8217;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 &#8211; Temp2  Note that the average temperature can be written as either:  TemperatureAverage = (Temp1 + Temp2)\/2    or  TemperatureAverage = ((Temp1 &#8211; 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 &#8211; 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 &#8211; Original Results.<\/p>\n","protected":false},"template":"","class_list":["post-171118","topic","type-topic","status-publish","hentry","topic-tag-18-2","topic-tag-cfd-post","topic-tag-fluid-dynamics","topic-tag-general"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_wp_page_template":["default"],"_bbp_last_active_time":["2\/6\/2023 20:20"],"_bbp_forum_id":["27796"],"_bbp_author_ip":["209.182.204.162"],"_btv_view_count":["3787"],"siebel_km_number":["2051422"],"product_version":["18.2"],"km_published_date":["2017-09-27T00:00:00.000Z"],"family":["Fluid Dynamics"],"application_name":["CFD-Post"],"_edit_lock":["1705046600:2"]},"test":"articlesansys-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/171118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/topics\/171118\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/knowledge\/wp-json\/wp\/v2\/media?parent=171118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}