Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

How to write a UDF for data sampling and area-weighted averaging it over a particular time interval?

    • pc_singh
      Subscriber
      Flow 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
    • Rob
      Forum Moderator
      Why 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
    • pc_singh
      Subscriber
      I have to use this average temperature before the next cycle. Please suggest me how to write a UDF for data sampling?n
    • Rob
      Forum Moderator
      I 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
    • Amine Ben Hadj Ali
      Ansys Employee
      You 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
    • pc_singh
      Subscriber
      I 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
    • YasserSelima
      Subscriber
      Use 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
    • pc_singh
      Subscriber
      Done@YesserSelima.n
    • akashdatta
      Subscriber
      how to plot time averaged quantities for transient simulation?n
    • Rob
      Forum Moderator
      Reports will produce a plot, you may need to be careful with the definition though as you're overwriting data. n
Viewing 9 reply threads
  • The topic ‘How to write a UDF for data sampling and area-weighted averaging it over a particular time interval?’ is closed to new replies.