CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Transient Temperature Profile (http://www.cfd-online.com/Forums/fluent/87329-transient-temperature-profile.html)

alven299 April 18, 2011 02:21

Transient Temperature Profile
 
Dear all,

I wish to impose a transient temperature profile to my inlet boundary condition. I have liquid entering a system at 300K and after 40s, I would like the liquid to enter at 340K, in brief:

when 0<t<40s, T=300K
when t>=40s, T=340K

I know that this is manageable by using UDF, but since I'm very new to UDF and to C programming language, I'd appreciate if anybody could provide me with a sample code to define the said profile.

many thanks.

alven299 April 18, 2011 22:18

Have figured it out. Here is the script, hope it might be of help to others:

#include "udf.h"

DEFINE_PROFILE(inlet_temperature,t,i)
{
real x[ND_ND];
real time;
face_t f;

begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
time=CURRENT_TIME;
if(time<40)
F_PROFILE(f,t,i)=300;

else

F_PROFILE(f,t,i)=340;
}
end_f_loop(f,t)
}

Bharadwaj B S February 23, 2015 06:33

Thank you.
 
Hi Alven,

Thanks a lot for your UDF. This will help me for sure.:)

Batuhan August 26, 2015 07:25

Hello Everyone;

I am using fluent and I have transient experimental temperature data for a surface in excel format. I want to import them to fluent and run. How can I do that? Is there anyone who has the code of this. The code that is written above is a good example but I have 45820 temperature datas and these datas are changing in 1 s . So I have to read the file directly and than run it . Could you help me ?

Thank you very much.

lamboram September 18, 2015 03:47

Tabular input is also possible mate!
 
Quote:

Originally Posted by Batuhan (Post 561146)
Hello Everyone;

I am using fluent and I have transient experimental temperature data for a surface in excel format. I want to import them to fluent and run. How can I do that? Is there anyone who has the code of this. The code that is written above is a good example but I have 45820 temperature datas and these datas are changing in 1 s . So I have to read the file directly and than run it . Could you help me ?

Thank you very much.

The format of the tabular transient profile file is

profile-name n_field n_data periodic?
field-name-1 field-name-2 field-name-3 .... field-name-n_field
v-1-1 v-2-1 ... ... ... ... v-n_field-1
v-1-2 v-2-2 ... ... ... ... v-n_field-2
.
.
.
.
.
v-1-n_data v-2-n_data ... ... ... ... v-n_field-n_data
One of the field-names should be used for the time field, and the time field section must be in ascending order. The periodic? entry indicates whether or not the profile is time-periodic. Set it to 1 for a time-periodic profile, or 0 if the profile is not time-periodic.

An example is shown below:

sampletabprofile 2 3 1
time u
1 10
2 20
3 30

Source : http://jullio.pe.kr/fluent6.1/help/html/ug/node174.htm

Bharadwaj B S September 18, 2015 04:23

There is a way to write and read from a text file. Using fprintf and fscanf in C language. I had seen one post on writing data to a file. You can try similarly for reading data from a text file.


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