How to create valid UDF for specific heat if formula depends on whether it’s melting or solidifying?
TAGGED: hysteresis, udf-fluent, user-defined-functions
-
-
November 10, 2020 at 2:24 pm
Leona
SubscriberI would like to use the technique of assigning a certain function for the specific heat, dependent on whether the fluid is melting, T(t-1) < T(t), or solidifying, T(t-1) > T(t). This is known as hysteresis. I try to obtain T(t-1) via C_T_M1(c,t). However, the function DEFINE_SPECIFIC_HEAT(name, T, Tref, h, yi) only takes these five limited inputs, which does not include (c,t).nHow to solve this? Somewhere I saw a suggestion to a similar type of problem using 'domain *domain = Get_Domain(1); Thread *t; cell_t c;', but it is not sure if this works.nA piece of example code (NOT working yet) illustrating what I would like to do:n#include udf.hnnDEFINE_SPECIFIC_HEAT(name, T, Tref, h, yi, c, t)n{n real cp;n real Tprev = C_T_M1(c,t);n if (T => 300 && T=< 400 && Tprev < T)n cp = certain formula for melting;n if (T => 310 && T=< 390 && Tprev > T)n cp = certain formula for solidifying;n elsen cp = 2000;n *h = cp*(T-Tref);n return cp;nnAny suggestions would be amazing!nBests,nLeona -
November 11, 2020 at 8:04 pm
Surya Deb
Ansys EmployeeHello, nYes. you will need to fetch the domain using domain *domain =Get_Domain(1). nThis will provide the Mixture Domain that you can then use.nThen you will need to loop over the threads and then cells within those threads if you do not have any specific zone id.nthread_loop_c is the macro that can be used to loop over all existing threads . [you can also use a check to make sure it is a fluid thread]nCheck this link for further information on this. https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v195/flu_udf/flu_udf_sec_thread_loop_c.htmlnInside the loop for threads, you will need to loop for cells. Check the link below for that.nLookup_Thread(domain, zone id) can be used if you know your specific zone id which might not be the case for you as you want to implement this throughout the domain I believe.nI hope this helps.nRegards,nSuryann
-
- 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.
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Difference between K-epsilon and K-omega Turbulence Model
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- Suppress Fluent to open with GUI while performing in journal file
- error: Received signal SIGSEGV
- Using GPU in FLUENT
-
8800
-
4658
-
3151
-
1680
-
1470
© 2023 Copyright ANSYS, Inc. All rights reserved.