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

UDF to modify inlet fluid temperature

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2016, 21:11
Question UDF to modify inlet fluid temperature
  #1
New Member
 
Vipul Patel
Join Date: Apr 2013
Location: New Delhi
Posts: 2
Rep Power: 0
Vipul_Patel is on a distinguished road
Dear all,
In my simulation, I want to modify my inlet boundary condition according to the temperature obtained at the outlet boundary.
Inlet temperature = Outlet temperature - 5.0
I am trying to write a UDF for this purpose. I am able to compile the UDF but I am not able to assign it to the inlet boundary. When I am trying to assign it to the inlet boundary, fluent automatically terminates.

My UDF is as follows:


#include "udf.h"
real Tout[100];
FILE *fid;
FILE *fid1;

DEFINE_ADJUST(Out_temp, domain)
{
face_t f;
int i=1;
int ID = 6;
Thread *thread = Lookup_Thread(domain, ID);
fid=fopen("T_out", "w");

begin_f_loop(f, thread)
{
Tout[i]=C_T(f,thread);
}

fprintf(fid,"%f\n", Tout[i]);
i++;

end_f_loop(f,thread)
fclose(fid);
}

DEFINE_PROFILE(Inlet_Temp, thread6, position)
{
face_t f;
cell_t c;
int i,j;
i=1;

fid1=fopen("T_in", "w");

begin_f_loop(f,thread6)
{
F_PROFILE(f,thread6,position)=Tout[i]-5.0;
fscanf(fid,"\n");
fprintf(fid1, "%f\n", Tout[i]-5.0);
i=i+1;
}

end_f_loop(f,thread6);
fclose(fid1);
fclose(fid);
}


Please let me know if the present methodology is correct or not. Is it possible to update the inlet boundary temperature according to the outlet boundary temperature by any other means??

Thanks,
Vipul_Patel is offline   Reply With Quote

Reply

Tags
boundary condition, udf code


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
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion faizan_habib7 CFX 4 February 1, 2016 17:00
Error in Two phase (condensation) modeling adilsyyed CFX 15 June 24, 2015 19:42
Setting Inlet as Wall until flow occurs via UDF emmkell Fluent UDF and Scheme Programming 0 May 1, 2012 12:05
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 07:01.