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

UDF library is not compiled for 2d on the current platform(win64).

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2016, 02:40
Question UDF library is not compiled for 2d on the current platform(win64).
  #1
Member
 
Nate Lau
Join Date: Mar 2016
Posts: 33
Rep Power: 10
SNeCu is on a distinguished road
I am new to UDF. I want to write an UDF to solve the mass flux at inlet, but there is an error when compiling:
The UDF library you are trying to load is not compiled for 2d on the current platform(win64).
I do not know how can I revise the code?
#include "udf.h"
#define rvol1_ID 5 //inlet ID
DEFINE_EXECUTE_AT_END(mfinlet)
{
real massflux=0;
Domain *d;
Thread *thread, *t0, *t1;
cell_t c0, c1;
face_t f;
real NV_VEC(psi_vec), NV_VEC(A);
d= Get_Domain(1); /* returns fluid domain pointer*/
thread=Lookup_Thread(d, rvol1_ID);
begin_f_loop(f,thread)
{
t0=THREAD_T0(f,thread); c0=F_C0(f,thread);
NV_D(psi_vec,=,C_U(c0,t0),C_V(c0,t0));
F_AREA(A,f,thread);
massflux+=NV_DOT(psi_vec,A);
}
end_f_loop(f,thread)
massflux*=1.225;
}
SNeCu is offline   Reply With Quote

Old   March 20, 2016, 02:49
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Ensure your workflow is correct by checking my compiling process for Fluent UDFs with an existing library loaded.
`e` is offline   Reply With Quote

Old   March 20, 2016, 02:55
Default
  #3
Member
 
Nate Lau
Join Date: Mar 2016
Posts: 33
Rep Power: 10
SNeCu is on a distinguished road
Hi, 'e', many thanks for your suggestion. I have followed your step, however, it still doesn't work.
In addition, I found errors when I build the library:
..\..\src\mfinlet.c(5) : error C2018: unknown character '0x7f'
..\..\src\mfinlet.c(12) : error C2018: unknown character '0x7f'
..\..\src\mfinlet.c(15) : warning C4002: too many actual parameters for macro 'THREAD_T0'
..\..\src\mfinlet.c(15) : error C2223: left of '->t0' must point to struct/union
..\..\src\mfinlet.c(16) : warning C4003: not enough actual parameters for macro 'NV_D'

So I think there must be something wrong with my code itself.
Thank you again.
SNeCu is offline   Reply With Quote

Old   March 20, 2016, 21:58
Default
  #4
Member
 
Nate Lau
Join Date: Mar 2016
Posts: 33
Rep Power: 10
SNeCu is on a distinguished road
It works after some revises:
#include "udf.h"
#define rvol1_ID 15 //face ID
DEFINE_EXECUTE_AT_END(mfinlet)
{
FILE *fp1;
real massflux=0.0;
real time1=CURRENT_TIME;
Domain *d;
Thread *thread, *t0, *t1;
cell_t c0, c1;
face_t f;
real psi_vec[ND_ND],A[ND_ND];
d= Get_Domain(1); /* returns fluid domain pointer*/
thread=Lookup_Thread(d, rvol1_ID);
begin_f_loop(f,thread)
{
t0=THREAD_T0(thread); c0=F_C0(f,thread);
NV_D(psi_vec,=,C_U(c0,t0),C_V(c0,t0));
F_AREA(A,f,thread);
massflux+=NV_DOT(psi_vec,A);
}
end_f_loop(f,thread)
massflux*=1.225;
fp1=fopen("ab_MF.txt","a";
fprintf(fp1,"%g %g\n",time1,massflux);
fclose(fp1);

}
SNeCu is offline   Reply With Quote

Old   March 21, 2016, 00:01
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Copying your UDF to a text editor showed an extra (invalid) character on lines 5 and 12 as indicated with your error messages. The other three errors are self-explanatory. It's good to hear the UDF is working now.
`e` is offline   Reply With Quote

Old   March 21, 2016, 23:36
Default
  #6
Member
 
Nate Lau
Join Date: Mar 2016
Posts: 33
Rep Power: 10
SNeCu is on a distinguished road
Thank you very much.
SNeCu is offline   Reply With Quote

Reply

Tags
fluent, udf, udf and programming, udf compile, udf eror


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
Compiled UDF on BATCH file Bionico Fluent UDF and Scheme Programming 3 June 4, 2018 17:44
calling result of a UDF into current time step Komon Fluent UDF and Scheme Programming 1 April 1, 2012 20:53
cannot load UDF library jayilosa Fluent UDF and Scheme Programming 3 November 16, 2011 13:44
Help! Compiled UDF problem 4 Wave tank tutorial Shane FLUENT 1 September 3, 2010 03:32
building compiled udf s in windows sourav FLUENT 8 August 18, 2005 02:46


All times are GMT -4. The time now is 17:20.