How to write a UDF for data sampling and area-weighted averaging it over a particular time interval?
-
-
February 4, 2021 at 7:40 am
pc_singh
SubscriberFlow Timen Area weighted Avg Temp(K)n 2.4n 299.881237n 2.6n 299.859884n 2.8n 299.848791n 3n 299.842712n 3.2n 299.839355n 3.4n 299.837498n 3.6n 299.836468n 3.8n 299.835896n 4n 299.835577n 4.2n 299.835399nThis is the type of data I am getting during simulation; my work is to do the avg of these data (sum of all temperatures/10) and patch it before the next cycle. nSo, I want to write a UDF which automatically do the average and patch it before the next cycle. Please suggest.n -
February 4, 2021 at 12:08 pm
Rob
Ansys EmployeeWhy do you want to average the temperature to then patch it into the model? The data sampling will handle the averaging but not sure about the patch other than to create a UDM or field function of the time averaged temperature. n -
February 4, 2021 at 1:43 pm
pc_singh
SubscriberI have to use this average temperature before the next cycle. Please suggest me how to write a UDF for data sampling?n -
February 4, 2021 at 1:53 pm
Rob
Ansys EmployeeI don't think you need one, you need a custom field function, and some execute commands to do the patch and reset the field function. Still not sure why you're doing this!n -
February 4, 2021 at 4:02 pm
DrAmine
Ansys EmployeeYou make the average in Excel or any third party program or you report in Fluent the averaged value at the location you want. Or better:try to answer to Rob and explain what you want to do? n -
February 4, 2021 at 5:40 pm
pc_singh
SubscriberI am trying to explain the whole process via the diagram shown below:nnOne cycle(4.2 sec) can be described in four steps:nStep 1: Magnetization: results in heating of Regenerators.[0.1 sec]nStep 2: Flowing the water (at ambient temperature) for through these regenerators. Due to the temperature difference between fluid and regenerators water get heated, and we reject these hot water.[2 sec]nStep 3: Demagnetization: results in cooling of plates.[0.1 sec]nStep 4: Flowing of water (at ambient temperature) through these cooled regenerators. As now the regenerators are cooled it will pass heat through the water. Due to that, the temperature of the water gets decreases. [2 sec]nIn the next cycle (cycle 2), before the 3rd step, I need to patch area-weighted average temperature. nAfter step 4 again, I have to calculate the next average temperature and patch it before the 3rd step of cycle 3. In this way, I have to run the simulation up to 120-140 cycles.nNote 1: Magnetization and Demagnetization is a physical phenomenon where heating and cooling occurs on the action of passing the magnet through some materials.nNote 2: Yes DrAmine sir, I can make the average in Excel and patch it manually but doing it for 130-140 cycles will be a tough job, that is why I am trying to use a UDF.n
-
February 5, 2021 at 3:59 am
YasserSelima
SubscriberUse an expression ... nRegister here and they will send you a link to the video. nhttps://www.ansys.com/resource-library/webinar/ansys-fluent-creating-using-expressionsn -
February 5, 2021 at 6:09 am
pc_singh
SubscriberDone@YesserSelima.n -
February 5, 2021 at 7:17 am
akashdatta
Subscriberhow to plot time averaged quantities for transient simulation?n -
February 5, 2021 at 10:54 am
Rob
Ansys EmployeeReports will produce a plot, you may need to be careful with the definition though as you're overwriting data. n
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5162
-
3251
-
2443
-
1308
-
954
© 2023 Copyright ANSYS, Inc. All rights reserved.