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

UDF temperature profile

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree14Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   July 12, 2014, 11:24
Default
  #41
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 42
Rep Power: 6
B.Hamada is on a distinguished road
Quote:
Originally Posted by ghost82 View Post
Ok, but since we cannot read the future you can only evaluate temperatures at time t and t-deltat and not deltat+t.

Again, start writing some code, someone will help you to go through your code.

Daniele
Thank you brother, i'll try
B.Hamada is offline   Reply With Quote

Old   July 13, 2014, 21:18
Default
  #42
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 42
Rep Power: 6
B.Hamada is on a distinguished road
Hi Friends

I wrote this code, please can someone tell me if my UDF was correct, and if there are errors, you could fix it.
thank you

PHP Code:
/#include "udf.h"
DEFINE_PROFILE(heatflux_profileti)    
{              
face_t f
real It=750;                       
real H=232000;
real Tam=300;
real Tm=298.6;
real Ul=20;
real Eta=0.16;
real m=2;
real cs=1.4;
real cl=1.8;
real Tpv;
real time;
begin_f_loop(fthread)
 {   
    
Tpv C_T(c,t);
    
time RP_Get_Real("physical-time-step"); 
    if(
Tam<Tpv<Tm
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam) *time+Eta*It*Time+m*cs*(Tpv-Tam);
    else if(
Tpv=Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H;
    else(
Tpv>Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H+m*cl*(Tpv-Tm);
 }
end_f_loop(f,thread)

When I compiled my UDF, an error occurred, but I can not fix it.
help me please
error line 16: c: undeclared variable.
B.Hamada is offline   Reply With Quote

Old   July 14, 2014, 03:05
Default
  #43
New Member
 
Marco Dc
Join Date: Feb 2014
Location: Italy
Posts: 20
Rep Power: 3
I-mech is on a distinguished road
Quote:
Originally Posted by B.Hamada View Post
Hi Friends

I wrote this code, please can someone tell me if my UDF was correct, and if there are errors, you could fix it.
thank you

PHP Code:
/#include "udf.h"
DEFINE_PROFILE(heatflux_profileti)    
{              
face_t f
real It=750;                       
real H=232000;
real Tam=300;
real Tm=298.6;
real Ul=20;
real Eta=0.16;
real m=2;
real cs=1.4;
real cl=1.8;
real Tpv;
real time;
begin_f_loop(fthread)
 {   
    
Tpv C_T(c,t);
    
time RP_Get_Real("physical-time-step"); 
    if(
Tam<Tpv<Tm
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam) *time+Eta*It*Time+m*cs*(Tpv-Tam);
    else if(
Tpv=Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H;
    else(
Tpv>Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H+m*cl*(Tpv-Tm);
 }
end_f_loop(f,thread)

When I compiled my UDF, an error occurred, but I can not fix it.
help me please
error line 16: c: undeclared variable.
you have used t in your second line DEFINE_PROFILE(heatflux_profile, t, i)
and then you have used thread in begin_f_loop(f, thread) and in end_f_loop(f,thread).
You have to decide. Use t or thread in both.

Let's try as follow, it should work. I hope
PHP Code:
/#include "udf.h"
DEFINE_PROFILE(heatflux_profileti)    
{              
face_t f
real It=750;                       
real H=232000;
real Tam=300;
real Tm=298.6;
real Ul=20;
real Eta=0.16;
real m=2;
real cs=1.4;
real cl=1.8;
real Tpv;
real time;
begin_f_loop(ft)
 {   
    
Tpv C_T(c,t);
    
time RP_Get_Real("physical-time-step"); 
    if(
Tam<Tpv<Tm
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam) *time+Eta*It*Time+m*cs*(Tpv-Tam);
    else if(
Tpv=Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H;
    else(
Tpv>Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H+m*cl*(Tpv-Tm);
 }
end_f_loop(f,t)

__________________
Marco
I-mech is offline   Reply With Quote

Old   July 14, 2014, 08:02
Default
  #44
Senior Member
 
ghost82's Avatar
 
Daniele
Join Date: Oct 2010
Location: Italy
Posts: 899
Rep Power: 15
ghost82 will become famous soon enough
Quote:
Originally Posted by B.Hamada View Post
Hi Friends

I wrote this code, please can someone tell me if my UDF was correct, and if there are errors, you could fix it.
thank you

PHP Code:
/#include "udf.h"
DEFINE_PROFILE(heatflux_profileti)    
{              
face_t f
real It=750;                       
real H=232000;
real Tam=300;
real Tm=298.6;
real Ul=20;
real Eta=0.16;
real m=2;
real cs=1.4;
real cl=1.8;
real Tpv;
real time;
begin_f_loop(fthread)
 {   
    
Tpv C_T(c,t);
    
time RP_Get_Real("physical-time-step"); 
    if(
Tam<Tpv<Tm
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam) *time+Eta*It*Time+m*cs*(Tpv-Tam);
    else if(
Tpv=Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H;
    else(
Tpv>Tm)
           
F_PROFILE(f,t,i) = Ul*(Tpv*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H+m*cl*(Tpv-Tm);
 }
end_f_loop(f,thread)

When I compiled my UDF, an error occurred, but I can not fix it.
help me please
error line 16: c: undeclared variable.
Hi,
your equations look completely different in respect of what you posted before..
You are using c in the C_T(c,t) which is your cell temperature but you are not declaring what is c (as the description of error); you are using c (cell) inside and f (face) loop.
If you want the mean of the temperature of the pcm domain you have to first do a c loop over the pcm domain and calculate the mean temperature, then use the f loop to calculate the boundary profile.
Also this "if(Tam<Tpv<Tm)" should be "if (Tpv>Tam) && (Tpv<Tm)".
And also C langiage is case sensitive: time is different than Time, and you are not declaring what is Time.
"Tpv=Tm" assigns Tm to Tpv: it should be Tpv==Tm.

Daniele

PS: Condition Tam<Tpv<Tm will never be possible because you defined Tm<Tam!!

Last edited by ghost82; July 14, 2014 at 09:05.
ghost82 is offline   Reply With Quote

Old   July 14, 2014, 17:48
Default
  #45
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 42
Rep Power: 6
B.Hamada is on a distinguished road
Hi

I changed the equation for the heat flux exerted on the pvhotovoltaique PANEL, an attached image shows the equation
Attached Images
File Type: jpg equation.jpg (48.3 KB, 8 views)
B.Hamada is offline   Reply With Quote

Old   July 17, 2014, 16:55
Default
  #46
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 42
Rep Power: 6
B.Hamada is on a distinguished road
HTML Code:
#include "udf.h"
DEFINE_PROFILE(heatflux_profile, t, F, i)    
{              
face_t f; 
real It=750;                       
real H=232000;
real Tam=300;
real Tm=298.6;
real Ul=20;
real Eta=0.16;
real m=2;
real cs=1.4;
real cl=1.8;
real temp;
temp = F_T(f,t);
real Time;
Time = RP_Get_Real("physical-time-step");
begin_f_loop(f, t)
 {   
    if((temp>Tam) && (temp<Tm)
           F_PROFILE(f,t,i) = Ul*(temp*Tam) *time+Eta*It*Time+m*cs*(temp-Tam);
    else if(temp==Tm)
           F_PROFILE(f,t,i) = Ul*(temp*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H;
    else(temp>Tm)
           F_PROFILE(f,t,i) = Ul*(temp*Tam)*time+Eta*It*Time+m*cs*(Tm-Tam)+H+m*cl*(temp-Tm);
 }
end_f_loop(f,t)
}
B.Hamada is offline   Reply With Quote

Old   July 18, 2014, 07:16
Default
  #47
Member
 
David
Join Date: Aug 2012
Posts: 47
Rep Power: 4
GM_XIII is on a distinguished road
Do you keep getting the same error?
GM_XIII is offline   Reply With Quote

Old   July 18, 2014, 12:16
Default
  #48
Member
 
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 42
Rep Power: 6
B.Hamada is on a distinguished road
Quote:
Originally Posted by GM_XIII View Post
Do you keep getting the same error?
Hi

Yes the same error.
B.Hamada is offline   Reply With Quote

Old   June 21, 2015, 03:08
Default
  #49
Member
 
Shane
Join Date: Oct 2009
Posts: 50
Rep Power: 7
sircorp is on a distinguished road
Quote:
Originally Posted by flotus1 View Post
Since you refuse to be more descriptive, I have to make some assumptions
With "degrees" you mean C, so I change the temperature variation from 298K-323K.
The x-axis coincides with the axis of the cylinder and the y-axis is from "bottom" to "top".
Thus the temperature varies linearly with the y-axis, with the highest temperature at the greatest positive y-extent of the surface.

Code:
#include "udf.h"

DEFINE_PROFILE(temp_linear, thread, position) 
{
real x[ND_ND];
face_t f;
real tmin, tmax, d;

tmin = 298.0;
tmax = 323.0;
d = 0.47;

  begin_f_loop(f, thread)
    {
      F_CENTROID(x,f,thread);
      F_PROFILE(f, thread, position) = (tmin+tmax)/2.0 + (tmax-tmin)/d*x[1];
    }
  end_f_loop(f, thread)
}
Is "d" a constant or a diameter of the pipe who surface temperature we are trying to create a profile. In case irregular geometry it is better to put d = 1( i mean avoid "d" altogether ( default d= 1))

Thanks

Shane
sircorp is offline   Reply With Quote

Old   June 21, 2015, 10:47
Default
  #50
New Member
 
Ericson
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Ericson is on a distinguished road
Need help!!
i got this message when i'm trying to compile my udf
can anyone solve this error message?
Attached Images
File Type: jpg Untitled.jpg (54.6 KB, 10 views)
Ericson is offline   Reply With Quote

Old   June 22, 2015, 04:01
Default
  #51
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
Yes. Look at you code, and check lines 3, 4 and 11, something is wrong there.
pakk is offline   Reply With Quote

Old   June 22, 2015, 08:57
Default
  #52
New Member
 
Ericson
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Ericson is on a distinguished road
This is my code, i don't know what is wrong here..
can you find the mistakes sir?
Attached Files
File Type: c udf.c (298 Bytes, 5 views)
Ericson is offline   Reply With Quote

Old   June 22, 2015, 08:59
Default
  #53
New Member
 
Ericson
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Ericson is on a distinguished road
I'm trying to make code for rolling motion of ship..
Ericson is offline   Reply With Quote

Old   June 22, 2015, 09:19
Default
  #54
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
Yes I can, and I can show you how. Just read the error messages!

The first error you get says that there are not enough actual parameters in line 3.
So, go ahead, count how many parameters you have (hint: "roll" is a parameter, "dt" is a parameter, "omega" is a parameter, "time" is a parameter and "dtime" is a parameter.) Then look up in the help how many parameters there should be, and you will see something you did wrong.
pakk is offline   Reply With Quote

Old   June 22, 2015, 09:57
Default
  #55
New Member
 
Ericson
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Ericson is on a distinguished road
can you fix my code please?
i can't see what i must doing in help..
Ericson is offline   Reply With Quote

Old   June 22, 2015, 10:01
Default
  #56
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
Seriously?
Ok, you are using the macro "DEFINE_CG_MOTION". Look up in the help how many parameters that needs...
pakk is offline   Reply With Quote

Old   June 23, 2015, 01:00
Default
  #57
New Member
 
Ericson
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Ericson is on a distinguished road
i've trying to fixed my codes but when i'm compiling i have another error like this...
Attached Images
File Type: jpg Untitled2.jpg (53.0 KB, 4 views)
Ericson is offline   Reply With Quote

Old   June 23, 2015, 02:44
Default
  #58
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
I don't understand why you send me a private message telling that you use notepad.
Using notepad does not prevent you from opening the Fluent manual, and looking at how the macro "DEFINE_CG_MOTION" should be used.

Do you know how to open the Fluent manual?
Do you know how to search in the Fluent manual?
pakk is offline   Reply With Quote

Old   June 23, 2015, 08:31
Default
  #59
New Member
 
Ericson
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Ericson is on a distinguished road
yes i can,, i have seen fluent manual and i have fixed my code..
but when i'm compiling the code again, i got error messages above..
what should i do?
Ericson is offline   Reply With Quote

Old   June 23, 2015, 08:49
Default
  #60
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
I am not paranormal, so if you don't show your code I can never know what is wrong.
pakk is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 8 May 11, 2014 08:34
defining temperature profile with UDF mohammadkm Fluent UDF and Scheme Programming 11 July 3, 2013 00:15
please help UDF for velocity profile in y-directio raju FLUENT 3 September 22, 2008 16:36
UDF temp. profile BC Shashikant FLUENT 0 June 24, 2006 03:16
temperature profile on boundary sivakumar FLUENT 5 November 24, 2002 01:58


All times are GMT -4. The time now is 23:40.