-
-
June 18, 2021 at 8:36 pm
kuuku.botchway
SubscriberI'm currently attempting to use the following UDF I found off the CFD-Online forum.
#include "udf.h" #include "math.h" DEFINE_ADJUST(cellheatgenerate,d) { real SOC,ds,tm,Ri,tempu,volume,source,temp; Thread *t; cell_t c; tm = CURRENT_TIME; thread_loop_c(t,d) { begin_c_loop(c,t) { SOC = 1.-((90.*tm)/5400.); if ((SOC >= 0.) && (SOC <= 0.77)) ds = (99.88*SOC)-76.67; else if ((SOC > 0.77) && (SOC <= 0.87)) ds = -30.; else if ((SOC >0.87) && (SOC <=1.)) ds = -20.; volume = C_VOLUME(c,t); tempu = C_T(c,t); if (tm == 0.) temp = 291.15; else if (tm > 0.) temp = tempu; if (temp <= 298.15) Ri = 0.000002258*pow(SOC,-0.3952); else if ((temp > 298.15) && (temp <= 308.15)) Ri = 0.000001857*pow(SOC,-0.2787); else if (temp > 308.15) Ri = 0.000001659*pow(SOC,-0.1692); temp = C_T(c,t); source = ((Ri*8100.)-(90.*temp*ds/96.485))/volume; C_UDMI(c,t,0) = source; } end_c_loop(c,t) } } DEFINE_SOURCE(my_heat_source,c,t,dS,eqn) { real source; source = C_UDMI(c,t,0); dS[eqn] = 0.0; return source; }I'm currently having problems applying this UDF to my Fluent simulation. I open up Compiled Functions, add the .C file, build it, then load it without any errors showing up, but I'm unable to see where the myheatsource and cellheatgenerate is being applied.
June 21, 2021 at 12:13 pmKarthik Remella
AdministratorHello Can you post a screenshot of the output printed to the Fluent Console when you compile and load the UDF?
Karthik
June 21, 2021 at 9:15 pmkuuku.botchway
SubscriberAttached is the output from the console
June 21, 2021 at 9:16 pmkuuku.botchway
SubscriberAttached is the text log as well
June 21, 2021 at 9:22 pmKarthik Remella
AdministratorHello,
Ansys employees cannot download attachments from the forum. Please embed these as screenshots into your post (use the Image option).
Karthik
June 22, 2021 at 9:09 pmJune 22, 2021 at 9:17 pmKarthik Remella
AdministratorHello Did you hook your adjust function? Also, you should see this volumetric source under cell-zones? What do you see under 'Cell-zones' when you activate 'Sources'?
Karthik
June 23, 2021 at 12:27 amJune 23, 2021 at 10:59 amKarthik Remella
AdministratorCheck the Source term check-box. Under the Source Term tab, add a source for Energy and see if the other function 'my_heat_source' shows up there.
Karthik
June 24, 2021 at 3:54 pmkuuku.botchway
SubscriberSo I seem to have ran into another problem with this UDF. Everytime I attempt to run it Fluent seems to crash, I have setup the hook function and set the Source terms for each Solid I want the source to attach to.
this is what I'm getting when I initialize the function. Then when I run the calculation it crashes.
June 24, 2021 at 4:11 pmRob
Forum ModeratorI'd start by checking the two interface zones.
June 26, 2021 at 4:48 pmJune 29, 2021 at 7:22 pmKarthik Remella
AdministratorI'd recommend that you start writing a transcript file before you run your simulation. This will write out an output file and will help you identify the issue.
To write transcript: File -> Write -> Start Transcript. Fluent should write this file in your working directory.
Karthik
June 29, 2021 at 8:23 pmYasserSelima
SubscriberDid you allocate UDM?
December 15, 2021 at 1:47 amMaher Al.
SubscriberHi Did you figure out how to solve this issue ???
I appreciate your help
Viewing 14 reply threads- The topic ‘Using a UDF for Heat Generation’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
6395
-
1906
-
1457
-
1308
-
1022
Top Rated Tags© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.





