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

udf problem

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

Like Tree27Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 19, 2018, 05:24
Default
  #21
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
Quote:
Originally Posted by Ahmed A. Serageldin View Post
I am trying to simulate closed loop U-Tube heat exchanger at which the fluid outlet is heated by electrical heater then enter again the U-Tube, So I used UDF to defined the temperature profile at outlet then using UDM to store it, and after that defining the temperature profile at inlet equal to the value stored in the UDM from previous time step.the problem is that, it works well until the time of 8400 sec then the temperature remain constant and didn't change with time, My total simulation time is 252000 sec, the time step is 60 sec.
What is the wrong and what could be the problem?
thanks in advance, the following indicate the UDF used
#include "udf.h"
/* Defining outlet temperature.*/
DEFINE_ADJUST(average_exit_temp,domain)
{
face_t f1;
face_t f2;
real tempa=0.0;
real totalarea=0.0;
real avetempa=0.0;
real A[ND_ND];
real tt=RP_Get_Real("flow-time");
int ID1 = 28; /* the outlet boundary condition identifier*/
Thread *outlet_thread = Lookup_Thread(domain,ID1);
int ID2 = 27; /* the inlet boundary condition identifier*/
Thread *inlet_thread = Lookup_Thread(domain,ID2);
//printf("average temperature1=%e\n",avetempa);
/*loop over faces in a face thread to get the information stored on faces.*/
begin_f_loop(f1,outlet_thread)
{
/* F_T gets face temperature.+=causes all faces areas/temperatures to be added together.*/
F_AREA(A,f1,outlet_thread);
totalarea +=NV_MAG(A);
tempa +=NV_MAG(A)*F_T(f1,outlet_thread);
}
end_f_loop(f1,outlet_thread)
avetempa= tempa/totalarea+ ((5989.8-0.0001*tt)/(0.285888*4182));
begin_f_loop(f2,inlet_thread)
{
F_UDMI(f2,inlet_thread,0)=avetempa;
}
end_f_loop(f2,inlet_thread)
}
DEFINE_PROFILE(Inlettemp,t,i)
{
real time=RP_Get_Real("flow-time");
face_t f;
if(time<=60)
{
begin_f_loop(f,t)
{
F_PROFILE(f,t,i)=288.15;
}
end_f_loop(f,t)
}
else
{
begin_f_loop(f,t)
{
if(F_UDMI(f,t,0)<315;
{F_PROFILE(f,t,i) = F_UDMI(f,t,0);}
else
{
break;
}
}
end_f_loop(f,t)
}
}
This code can not run.
Code:
if(F_UDMI(f,t,0)<315;
This is malformed, and should give errors. Do you interpret or compile?
pakk is offline   Reply With Quote

Old   February 19, 2018, 05:29
Default
  #22
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
Quote:
Originally Posted by pakk View Post
This code can not run.
Code:
if(F_UDMI(f,t,0)<315;
This is malformed, and should give errors. Do you interpret or compile?
I compile and it works until time 8400 sec and after than the inlet temperature didn't changed anymore, the outlet temperature was 297.15 K and inlet temperature was 302.15 K
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 05:30
Default
  #23
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
Impossible.

I believe that you clicked the 'build' button, and that you think that you compiled. But with the code above, there must have been an error showing in the text user interface.
pakk is offline   Reply With Quote

Old   February 19, 2018, 05:34
Default
  #24
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
Quote:
test.c: In function average_exit_temp:
test.c:16: error: expected expression before / token
test.c: In function Inlettemp:
test.c:49: error: expected ) before ; token
test.c:55: error: expected expression before } token
Don't you see such errors?
pakk is offline   Reply With Quote

Old   February 19, 2018, 05:37
Default
  #25
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
Quote:
Originally Posted by pakk View Post
Impossible.

I believe that you clicked the 'build' button, and that you think that you compiled. But with the code above, there must have been an error showing in the text user interface.
Yes, You are right I just click build and no error appear, what do you think about the error and how I can solve it?
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 05:40
Default
  #26
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
No error appears
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 05:43
Default
  #27
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
An error appears, I guarantee you. You are just not looking in the right place.

Look in the text zone that is normally on the bottom right of your Fluent screen. After you click 'build', text is printed there. Look at this text, this contains the errors.
pakk is offline   Reply With Quote

Old   February 19, 2018, 05:58
Default
  #28
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
these are screen shoots after build and compile respectively
Attached Images
File Type: jpg 1.jpg (173.5 KB, 13 views)
File Type: jpg 2.jpg (171.1 KB, 9 views)
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 06:09
Default
  #29
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
I got this message after 8000 sec
Attached Images
File Type: jpg 3.jpg (134.9 KB, 8 views)
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 06:16
Default
  #30
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
"build" and "compile" is the same thing.

If there is no error on your screen (which I can not see from your screen shots), then you are not compiling the code that you shared on this thread.
pakk is offline   Reply With Quote

Old   February 19, 2018, 06:17
Default
  #31
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
Quote:
Originally Posted by Ahmed A. Serageldin View Post
I got this message after 8000 sec
This definitely shows that you are using a different code than posted here. The code that you posted here does not print the averaged inlet temperature to the screen.
pakk is offline   Reply With Quote

Old   February 19, 2018, 06:20
Default
  #32
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
Quote:
Originally Posted by pakk View Post
This definitely shows that you are using a different code than posted here. The code that you posted here does not print the averaged velocity to the screen.
So, How to fix this error?
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 06:24
Default
  #33
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
"this error" is you. You use a different code in Fluent than you post on this forum.
If you want help with the code that you use in Fluent, post the code that you use in Fluent.
pakk is offline   Reply With Quote

Old   February 19, 2018, 06:40
Default
  #34
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
Quote:
Originally Posted by pakk View Post
"this error" is you. You use a different code in Fluent than you post on this forum.
If you want help with the code that you use in Fluent, post the code that you use in Fluent.
Here is the .C file I used, it is the same, and why I use different code and ask about another one, I did not want to bother you
Attached Files
File Type: c Ya-Rab.c (1.9 KB, 8 views)
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 19, 2018, 07:34
Default
  #35
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
Please look more carefully. The code that you attached is NOT the same as the code that you posted here earlier.
pakk is offline   Reply With Quote

Old   February 19, 2018, 15:09
Default
  #36
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
Quote:
Originally Posted by pakk View Post
Please look more carefully. The code that you attached is NOT the same as the code that you posted here earlier.
Thanks for your concern, you are right, iam sorry for this misunderstanding.
Regards the attached one are there any problems because the temperature didnot changes after 8000 sec.
Ahmed A. Serageldin is offline   Reply With Quote

Old   February 20, 2018, 02:34
Default
  #37
Senior Member
 
Join Date: Nov 2013
Posts: 1,913
Rep Power: 23
pakk will become famous soon enough
I am sorry but it takes too much time and energy to help you in this way. I'm out.
pakk is offline   Reply With Quote

Old   February 20, 2018, 04:17
Default
  #38
New Member
 
Ahmed Awwad
Join Date: Feb 2018
Posts: 21
Rep Power: 5
Ahmed A. Serageldin is on a distinguished road
[QUOTE=pakk;682170]I am sorry but it takes too much time and energy to help you in this way. I'm out.[/QUOT
Thanks for your much time and energy and I appreciate your help
Ahmed A. Serageldin is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 00:31
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 09:58


All times are GMT -4. The time now is 22:02.