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

fluent user defined function fot time dependent heat transfer

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By obscureed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2019, 00:43
Question fluent user defined function fot time dependent heat transfer
  #1
New Member
 
Enrique Santana
Join Date: Apr 2019
Posts: 2
Rep Power: 0
esantana is on a distinguished road
Hi!

im trying to make a transient planar model in which there is a time dependent heat flux (1.67e+17 W/m^2) during a period of time (60ns). The geometry is a rectangle and only one side has this condition. I need to study the phase change that happens to the fluid inside the domain and the effects of such. To define the heat flux I'm trying to use a user defined function but I'm not skilled at C therefore I've been reading threads for a while and have come up with what I tough was the function I needed. Fluent interprets it without errors but I a message during simulation that says:


chip-exec: heat_flux: argument 1: incorrect type (38): int expectedchip-exec: heat_flux: argument 2: incorrect type (5): pointer expectedchip-exec: heat_flux: argument 3: incorrect type (0)


(every iteration with the same and different numbers for argument and type())



and when the simulation ends if I see the results they are as if there was no heat flux at all. (The geometry is really small 5e-11m^2 so there's supposed to at least be a rise in temperature but there isn't). The code I'm using is the following:


/************************************************** *********************
heatflux.c
UDF for specyjfuing a transient heat flux boundary condition
************************************************** *********************/

#include "udf.h"
DEFINE_PROFILE(heat_flux, thread, i)

{
face_t f;
Thread *f_thread;
real t=CURRENT_TIME;
if (t<=60e-9)
{real a=1.67e+17;}
else
{real a=0;}

}



Any help would be very appreciated.
esantana is offline   Reply With Quote

Old   April 12, 2019, 11:19
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Enrique,

The short answer: follow the examples in the manual.

If your DEFINE_PROFILE does not contain begin_f_loop ... end_f_loop (or, much less typically, the equivalent cell loop), then you are probably doing it wrong. The manual is very clear on this.

It is better (and sometimes essential) to define all your variables at the start -- the freedom to write "real a = 0.0;" in the middle of a function is not standard C. To be clear: write "real a;" near the start, and just "a = 0.0;" later.

I don't understand the error message. If you've checked the syntax of DEFINE_PROFILE for the version you're using, then it's time to be paranoid: delete the blank line between DEFINE_PROFILE and {.

Good luck!
Ed
esantana likes this.
obscureed is offline   Reply With Quote

Old   April 15, 2019, 12:35
Default
  #3
New Member
 
Enrique Santana
Join Date: Apr 2019
Posts: 2
Rep Power: 0
esantana is on a distinguished road
Hi!


I've changed the code, now it looks like this:


/************************************************** *********************
heatflux.c
UDF for specyjfuing a transient heat flux boundary condition
************************************************** *********************/

#include "udf.h"
DEFINE_PROFILE(MP_heat_flux, thread, i);
{
real a;
real b;
b = CURRENT_TIME;
face_t f;
begin_f_loop(f, t)
{
if (b <= 60e-9)
{a=1.67e+17;}
else
{a = 0;}
F_PROFILE(f,thread,i) = a;
}
end_f_loop(f,t)
}


Now I'm getting a parse error in line 8. I know this must be a sintax error but I don't find where is it. I've tried changing the first curly braquet position to after the line that states: b = CURRENT_TIME; and the parse error moves to line 10. the same occurs if I move the braquet to after the line : face_t f;. But this time the error stays on line 10. Sorry to keep asking for help and thanks to anyone that helps.
esantana is offline   Reply With Quote

Old   April 17, 2019, 02:37
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
remove ;
Code:
DEFINE_PROFILE(MP_heat_flux, thread, i);
should be
Code:
DEFINE_PROFILE(MP_heat_flux, thread, i)
best regards
AlexanderZ is offline   Reply With Quote

Reply

Tags
fluent - udf, user defined functions


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
bash script for pseudo-parallel usage of reconstructPar kwardle OpenFOAM Post-Processing 42 May 8, 2024 00:17
Setting up Lid driven Cavity Benchmark with 1M cells for multiple cores puneet336 OpenFOAM Running, Solving & CFD 11 April 7, 2019 01:58
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 03:50
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 01:01
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42


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