|
[Sponsors] |
February 22, 2016, 22:11 |
UDF to modify inlet fluid temperature
|
#1 |
New Member
Vipul Patel
Join Date: Apr 2013
Location: New Delhi
Posts: 2
Rep Power: 0 |
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, |
|
Tags |
boundary condition, udf code |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion | faizan_habib7 | CFX | 4 | February 1, 2016 18:00 |
Error in Two phase (condensation) modeling | adilsyyed | CFX | 15 | June 24, 2015 20:42 |
Setting Inlet as Wall until flow occurs via UDF | emmkell | Fluent UDF and Scheme Programming | 0 | May 1, 2012 13:05 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 10:11 |