CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2021, 10:45
Default Udf
  #1
New Member
 
AHMED KANDIL
Join Date: Oct 2021
Posts: 14
Rep Power: 5
Ahmed kandil is on a distinguished road
Dear ,
udf code.jpg
i need to write UDF code for changing inlet temp depending on inlet temp .

Last edited by Ahmed kandil; October 21, 2021 at 14:20.
Ahmed kandil is offline   Reply With Quote

Old   October 21, 2021, 13:52
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Homework for which course?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   October 22, 2021, 07:40
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you may find the example to start with in anays fluent customization manual
look for DEFINE_ON_DEMAND
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 22, 2021, 07:40
Default
  #4
New Member
 
AHMED KANDIL
Join Date: Oct 2021
Posts: 14
Rep Power: 5
Ahmed kandil is on a distinguished road
I don’t understand what you mean ..
Ahmed kandil is offline   Reply With Quote

Old   October 22, 2021, 15:09
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
1. Open the manual.
2. Look for DEFINE_ON_DEMAND
3. Read, and find out how close this example is to your problem.
4. Try to make the necessary changes, test your resulting UDF.
5. If it does not work like you want, show what you tried and what the outcome was.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   October 30, 2021, 10:48
Default this UDF i do it to work as the follow
  #6
New Member
 
AHMED KANDIL
Join Date: Oct 2021
Posts: 14
Rep Power: 5
Ahmed kandil is on a distinguished road
I do it to calculate inlet temp based on outlet temperature but there are a large divergence has occurred so what is the problem ?
i need from this code inlet and outlet temp for 252000 second.
the first assumption for inlet temp=288.15k and this temp will reduced as fluid pass through borhole and the outlet temp used again to calculate inlet temp from heating equation and still working to decrease error and give accurate outlet and inlet temp.
noted that ID=17 is outlet temp.

#include "udf.h"

#define Q 5600
#define m 0.248
#define Cp 4200
#define stop_time 252000

real ave_T;

DEFINE_ADJUST(temp_ave, domain)
{
int ID = 17;
int i=0;

real total_temp = 0;
real T;

Thread *thread = Lookup_Thread(domain, ID);
face_t face;

begin_f_loop(face, thread)
{
T = F_T(face, thread);
total_temp = total_temp + T;
i = i + 1;
}
end_f_loop(face, thread)

ave_T = total_temp / i ;

printf("outlet average of temp : %f\n" , ave_T);
}

DEFINE_PROFILE(Temp_inlet,t,i)
{
face_t f;

real current_time;
current_time=CURRENT_TIME;

if (current_time < stop_time)
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i)= (Q/(m*Cp)) + ave_T;
}
end_f_loop(f,t)
}
else
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i)= 288.15;
}
end_f_loop(f,t)
}
}
this the error[erature using GMRES to enhance linear solver robustness.

Divergence detected in AMG solver: temperature
turbulent viscosity limited to viscosity ratio of 1.000000e+05 in 56612 cells
outlet average of temp : -nan(ind)

Divergence detected in AMG solver: temperatureoutlet average of temp : -nan(ind)

Divergence detected in AMG solver: temperatureoutlet average of temp : 5000.000000

Divergence detected in AMG solver: temperatureoutlet average of temp : -nan(ind)

Divergence detected in AMG solver: temperatureoutlet average of temp : -nan(ind)

Divergence detected in AMG solver: temperatureoutlet average of temp : -nan(ind)

Divergence detected in AMG solver: temperature
Error at host: floating point exception
Error at Node 0: floating point exception
Error at Node 1: floating point exception
Error at Node 2: floating point exception
Error at Node 3: floating point exception
Error at Node 4: floating point exception
Error at Node 5: floating point exception
Error at Node 6: floating point exception

===============Message from the Cortex Process================================

Compute processes interrupted. Processing can be resumed.

================================================== ============================

Error: floating point exception
Error Object: #f
Registering Udf, ("F:\Eng.Ahmed Kandiel\UDF.c")

Calculation complete.]
Ahmed kandil is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 17:45.