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

DEFINE_ON_DEMAND Macro

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 1, 2017, 09:01
Question DEFINE_ON_DEMAND Macro
  #1
New Member
 
Ahmad Zueter
Join Date: Jun 2017
Posts: 4
Rep Power: 8
azueter is on a distinguished road
Hello all

I am still new to DEFINE_ON_DEMAND macro and I am trying to learn it first using simple problems. I am modeling flow inside a tube exposed to heat flux. Right now, I am trying to find the average wall temperature at the outlet. Here is the code:

------------------------------------------
#include "udf.h"
DEFINE_ON_DEMAND(get_temperature)
{
Domain *d; /*Declare the fluid domain pointer*/
d = Get_Domain(1);
int IDo=9; /*Zone Number (Thread No.) of Outlet*/
Thread *to; /*Declare Outlet Thread*/
face_t f; /*Declare f as face (this will be used in looping*/
to=Lookup_Thread(d,IDo); /*Find Outlet boundary thread location*/
real Too; /*Mean Outlet T*/
real Tfo; /*To be used as below/*
/*Sum of T*/
real TfoT=0; /*Used to calculate total T*/
real A[ND_ND];
real area; /*area of each face*/
real areaT=0; /*used to calculate total area*/
begin_f_loop(f,to)
{
F_AREA(A,f,to); /*the output of this func is A (which is calculated as vector in fluent)*/
area=NV_MAG(A); /*Find the value of A*/
Tfo=F_T(f,to)*area; /*Find the weighted temperature at each face*/
areaT=areaT+area;
TfoT=TfoT+Tfo;
}
end_f_loop(f,to)
Too=TfoT/areaT;
printf("outlet_temp= %f", Too);
F_UDMI(f,to,5)=Too;
}
------------------------------------------

It is compiled successfully and I am able to see the the function under "execute demand window". However, when execute it, nothing happens and the value of F_UDMI(f,to,5) does not change.

However, I should mention that after compiling, I get this message (note the highlighted):

-----------------------------------------------
Copied C:\Users\TEMP.HW.000\Desktop\SecondNanoTrySaveLast Try.c to sdfsdfge\src
Creating user_nt.udf file for 3d ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.7\sr c\makefile_nt.udf "sdfsdfge\win64\3d\makefile" ")
1 file(s) copied.
(chdir "sdfsdfge")(chdir "win64\3d")# Generating ud_io1.h
SecondNanoTrySaveLastTry.c
# Generating udf_names.c because of makefile SecondNanoTrySaveLastTry.obj
udf_names.c
udf_names.c(9) : warning C4113: 'void (*)()' differs in parameter lists from 'void (*)(void)'
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj SecondNanoTrySaveLastTry.obj
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.

Creating library libudf.lib and object libudf.exp
Done

-----------------------------------------------------

When I try to interpret, the following errors occur:

----------------------------------------------------------

Error: C:\\Users\\TEMP.HW.000\\Desktop\\SecondNanoTrySave LastTry.c: line 6: parse error.
Error: C:\\Users\\TEMP.HW.000\\Desktop\\SecondNanoTrySave LastTry.c: line 7: parse error.
Error: C:\\Users\\TEMP.HW.000\\Desktop\\SecondNanoTrySave LastTry.c: line 8: parse error.
Error: C:\\Users\\TEMP.HW.000\\Desktop\\SecondNanoTrySave LastTry.c: line 9: to: undeclared variable

------------------------------------------------------------

Any help is really appreciated
azueter is offline   Reply With Quote

Reply


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



All times are GMT -4. The time now is 16:42.