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

Help whit this UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 15, 2016, 17:06
Default Help whit this UDF
  #1
New Member
 
Julio Herrera Venegas
Join Date: Jun 2015
Posts: 3
Rep Power: 11
Culio is on a distinguished road
hi guys, i am trying compiling this udf, but i get this error:

kernel32.lib(KERNEL32.dll) : error LNK2005Copied C:\Users\Dell\Desktop\memoria_ canal_austral\datos_experimentales\perfiles_salini dad/C:\Users\Dell\Desktop\memoria_ canal_austral\datos_experimentales\perfiles_salini dad\uuuu.c to libudf\src
udf_names.c and user_nt.udf files in 3ddp_host are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v160\fluent"\fluent16.0.0\sr c\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 archivo(s) copiado(s).
(chdir "libudf")(chdir "win64\3ddp_host")# Linking libudf.dll because of makefile user_nt.udf udf_names.obj uuuu.obj
Microsoft (R) Incremental Linker Version 12.00.40629.0
Copyright (C) Microsoft Corporation. All rights reserved.

kernel32.lib(KERNEL32.dll) : error LNK2005: ya se definió ReadFile en uuuu.obj
Creando biblioteca libudf.lib y objeto libudf.exp
libudf.dll : fatal error LNK1169: se encontraron uno o más símbolos definidos simultáneamente
udf_names.c and user_nt.udf files in 3ddp_node are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v160\fluent"\fluent16.0.0\sr c\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 archivo(s) copiado(s).
(chdir "libudf")(chdir "win64\3ddp_node")# Linking libudf.dll because of makefile user_nt.udf udf_names.obj uuuu.obj
Microsoft (R) Incremental Linker Version 12.00.40629.0
Copyright (C) Microsoft Corporation. All rights reserved.

kernel32.lib(KERNEL32.dll) : error LNK2005: ya se definió ReadFile en uuuu.obj
Creando biblioteca libudf.lib y objeto libudf.exp
libudf.dll : fatal error LNK1169: se encontraron uno o más símbolos definidos simultáneamente

Done.

Any clue?

this is the udf:

#include "udf.h"

int NPtsTm,NPtsData;
int DataIsRead = 0;
float *tmarr,*xarr,*yarr,*zarr,**Tarr;

DEFINE_ON_DEMAND(ReadFile)
{
int n,i;
float data;
FILE* fp;

fp = fopen("DataFile","r");
if ( fp!=NULL )
Message("Reading file n");
else
Message("Error in opening file n");

fscanf(fp,"%d %dn",&NPtsTm,&NPtsData);
Message("n");
Message("There are %d time entries and %d spatial entriesn",NPtsTm,NPtsData);

/* Dynamic allocation for 1D array */

tmarr = (float *) malloc(NPtsTm*sizeof(float));
xarr = (float *) malloc(NPtsData*sizeof(float));
yarr = (float *) malloc(NPtsData*sizeof(float));
zarr = (float *) malloc(NPtsData*sizeof(float));

/* Dynamic allocation for 2D array */
{
float *temp;
temp = (float * ) malloc(NPtsTm*NPtsData*sizeof(float));
Tarr = (float **) malloc(NPtsTm*sizeof(float *));

for(n=0;n<NPtsTm;n++)
Tarr[n] = temp + n*NPtsData;
}

if ( (tmarr==NULL)||(xarr==NULL)||(yarr==NULL)||(zarr== NULL)||(Tarr==NULL) )
Message("Memory allocation error n");

fscanf(fp,"n");
Message("n");
Message("The following is the %d time entriesn",NPtsTm);
for ( n=0;n<NPtsTm;n++ )
{
fscanf(fp,"%f n",&data);
tmarr[n] = data;
Message(" %fn",data);
}

fscanf(fp,"n");
for ( i=0;i<NPtsData;i++ )
{
fscanf(fp,"%f n",&data);
xarr[i] = data;
}

fscanf(fp,"n");
for ( i=0;i<NPtsData;i++ )
{
fscanf(fp,"%f n",&data);
yarr[i] = data;
}

fscanf(fp,"n");
for ( i=0;i<NPtsData;i++ )
{
fscanf(fp,"%f n",&data);
zarr[i] = data;
}

for ( n=0;n<NPtsTm;n++ )
{
fscanf(fp,"n");
for ( i=0;i<NPtsData;i++ )
{
fscanf(fp,"%f n",&data);
Tarr[n][i] = data;
}
}

DataIsRead = 1;
fclose(fp);

/* Output check */

Message("n");
Message("The following is the %d coordinate entriesn",NPtsData);
for ( i=0;i<NPtsData;i++ )
{
Message(" %f %f %fn",xarr[i],yarr[i],zarr[i]);
}

for ( n=0;n<NPtsTm;n++ )
{
Message("n");
Message("The following is scalar data for time entry # %dn",n);
for ( i=0;i<NPtsData;i++ )
{
Message(" %fn",Tarr[n][i]);
}
}
}

/*----------------------------------------------------------------------------*/

float GetData(float xf, float yf, float zf, float tm)
{
int n,nL,nU,i;
float tmL,tmU,data,dataL,dataU,sf,smin;

tm += 1.0e-7;

/* Find the time bracket */

nL = 0;
nU = 1;
tmL = tmarr[nL];
tmU = tmarr[nU];

for ( n=0;n<NPtsTm;n++ )
{
if ( (tm>=tmarr[n])&&(tm<=tmarr[n+1]) )
{
nL = n;
nU = n+1;
tmL = tmarr[nL];
tmU = tmarr[nU];
break;
}
}

/* Find data at the lower and upper time bound */

smin = 1.0e30;
dataL = 0.0;
dataU = 0.0;

for ( i=0;i<NPtsData;i++ )
{
sf = sqrt( pow((xarr[i]-xf),2) + pow((yarr[i]-yf),2) + pow((zarr[i]-zf),2) );
if ( sf<=smin )
{
smin = sf;
dataL = Tarr[nL][i];
dataU = Tarr[nU][i];
}
}

/* Interpolate between lower and upper time values */

data = dataL + ( tm - tmL )/( tmU - tmL )*( dataU - dataL );

return data;
}

/*----------------------------------------------------------------------------*/

DEFINE_PROFILE(Tspec,tf,pos)
{
face_t f;
float tm,xf[ND_ND];

tm = RP_Get_Real("flow-time");

begin_f_loop(f,tf)
{
F_CENTROID(xf,f,tf);
F_PROFILE(f,tf,pos) = GetData(xf[0],xf[1],xf[2],tm);
}
end_f_loop(f,tf)
}
Culio is offline   Reply With Quote

Old   June 16, 2016, 08:34
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
kernel32.lib(KERNEL32.dll) : error LNK2005: ReadFile already defined in temp.obj
The name ReadFile is already used in another function. Rename your DEFINE_ON_DEMAND macro to a unique name:

Code:
DEFINE_ON_DEMAND(myReadFile)
`e` is offline   Reply With Quote

Reply

Tags
profile data, udf


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 Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
Parallelize UDF? Which kind of UDF? Lilly FLUENT 5 March 25, 2014 03:05
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 10:01
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 19:11.