CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

UDF code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 30, 2021, 11:31
Default UDF code
  #1
New Member
 
AHMED KANDIL
Join Date: Oct 2021
Posts: 14
Rep Power: 5
Ahmed kandil is on a distinguished road
Hello every one ,
This code 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
Parse error in UDF Code Sharey FLUENT 3 July 23, 2020 12:47
UDF warning C4027- CG motion code Me_1989 Fluent UDF and Scheme Programming 11 May 29, 2020 15:56
UDF code help solve reaction rate equation palm oil zirkov Fluent UDF and Scheme Programming 0 February 13, 2017 11:34
write code UDF Fluent solve kinetic reaction rate equation palm oil zirkov FLUENT 0 February 13, 2017 11:16
How to transfer a 2D UDF code into 3D? Jo_vivian_lee Fluent UDF and Scheme Programming 0 August 26, 2012 04:36


All times are GMT -4. The time now is 16:29.