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

UDF for multiphase flow:error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 14, 2020, 05:27
Default UDF for multiphase flow:error
  #1
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
I have compiled the following UDF in parallel mode of v20.1 student version and receive the following error.


Creating user_nt.udf file for 2ddp_node ...
(system "copy "C:\PROGRA~1\ANSYSI~1\ANSYSS~1\v201\fluent"\fluent 20.1.0\src\udf\makefile_nt.udf "libudfM\win64\2ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudfM")(chdir "win64\2ddp_node")# Generating ud_io1.h
mass.c
..\..\src\mass.c(26): error C2109: subscript requires array or pointer type
..\..\src\mass.c(27): error C2109: subscript requires array or pointer type
..\..\src\mass.c(27): error C2198: 'sqrt': too few arguments for call


#include "udf.h"
#include "math.h"

#define M 18.015
#define hfg 2600000.0
#define R 8314.0
#define pi 3.141592
#define pref 101325
#define Tref 373.15
#define pv 15828.0
#define Tv 343.0

DEFINE_SOURCE(mass,c,t,dS,eqn)
{
real source, pv_eq, Tlv, vol, Acell ;
Thread *t_int;
face_t f_int;
real area;
Domain *domain;
domain = Get_Domain(1);
t_int = Lookup_Thread(domain,3); /*3 is the zone id for the boundary where source term is to be applied*/
begin_c_loop(c,t)
{
int i = 0;
f_int = C_FACE(c,t,i);
F_AREA(area,f_int,t_int);
Acell = NV_MAG(area);
Tlv = C_T(c,t);
vol = C_VOLUME(c,t);
pv_eq = pref * exp(((M*hfg)/R) * ((1/Tref)-(1/Tlv)));
source = - 0.857142857 * (Acell/vol) * SQRT(2*M/pi*R) * (pv_eq/SQRT(Tlv) - pv/SQRT(Tv));
dS[eqn] = 0.0;
}
end_c_loop(c,t)
return source;
}
arunraj is offline   Reply With Quote

Old   June 15, 2020, 08:20
Default Define_source
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
DEFINE_SOURCE is executed on each cell of the cell zone it is hooked to. So, do not loop over the cells again. And C_FACE is available only within a c_face_loop. I suppose you intended to use that one instead of begin_c_loop.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 03:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 13:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 09:43.