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

Compiling Problem with DEFINE_PROFILE

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 4, 2016, 07:20
Default Compiling Problem with DEFINE_PROFILE
  #1
New Member
 
noxtul
Join Date: Mar 2016
Posts: 1
Rep Power: 0
D-Nox is on a distinguished road
Hello People,

I wanna build some custom boundary velocity profile for my Fluent case running in parallel with 2 nodes.

I wrote this c source code:

Code:
#include "udf.h"
#include "math.h"
#include "stdio.h"

#define z0 1e-2 //unit m
#define zref 6 //unit m
#define k 0.4 //cte Von Karman
#define vref 35.7632 //unit m/s

DEFINE_PROFILE(xvinlet,t,i)
{
    float X[ND_ND];
    float u,h,Vwind,Vtrain;
    int alfa;
    face_t f;
    FILE *fp;
    
    fp=fopen("inputs.txt","r");
    fscanf(fp,"%i %f",&alfa,&Vtrain);
    fclose(fp);

    u=(k*vref)/(log((zref+z0)/z0));

#if !RP_HOST /* serial or node */    
        
    begin_f_loop(f,t)
    {
        F_CENTROID(X,f,t);
        h=X[1];
        Vwind=(u/k)*log((h+z0)/z0);
        F_PROFILE(f,t,i)=-Vwind*cos(alfa)-Vtrain;
    }
    end_f_loop(f,t);
#endif
}
When i tried to compile it, Fluent brought me this log:

Quote:

Copied Z:\/x_velocity_inlet.c to libudf\src

Creating user_nt.udf file for 3ddp_host ...
(system "copy "c:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.7\sr c\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.

(chdir "libudf")(chdir "win64\3ddp_host")# Generating ud_io1.h
x_velocity_inlet.c


# Generating udf_names.c because of makefile x_velocity_inlet.obj
udf_names.c
udf_names.c(8) : warning C4113: 'void (*)()' differs in parameter list from 'void (*)(void)'

# Linking libudf.dll because of makefile user_nt.udf udf_names.obj x_velocity_inlet.obj

Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.

Creating library libudf.lib and object libudf.exp

Creating user_nt.udf file for 3ddp_node ...
(system "copy "c:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.7\sr c\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.

(chdir "libudf")(chdir "win64\3ddp_node")# Generating ud_io1.h
x_velocity_inlet.c


# Generating udf_names.c because of makefile x_velocity_inlet.obj
udf_names.c
udf_names.c(8) : warning C4113: 'void (*)()' differs in parameter list from 'void (*)(void)'

# Linking libudf.dll because of makefile user_nt.udf udf_names.obj x_velocity_inlet.obj

Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.

Creating library libudf.lib and object libudf.exp

Done.
As everybody can see, the compiler make a new source file called udf_names.c that have a fail in 8th lane (C4113). I dont know how to solve it. Please help me.

My system is:
  • win7x64 profesional
  • Fluent 15.07
  • MSVC 2012 Express
  • .Net Framework 4.5
  • Microsoft SDK 7.1
I opened Fluent with the SDK command prompt, so enviromment variables should be fine.

The udf_names.c source code that automatically created the compiler is:

Code:
/* This file generated automatically. */ 
/* Do not modify. */ 
#include "udf.h" 
#include "prop.h" 
#include "dpm.h" 
extern DEFINE_PROFILE(xvinlet,t,i);
__declspec(dllexport) UDF_Data udf_data[] = { 
{"xvinlet", (void (*)())xvinlet, UDF_TYPE_PROFILE},
}; 
__declspec(dllexport) int n_udf_data = sizeof(udf_data)/sizeof(UDF_Data); 
#include "version.h" 
__declspec(dllexport) void UDF_Inquire_Release(int *major, int *minor, int *revision) 
{ 
*major = RampantReleaseMajor; 
*minor = RampantReleaseMinor; 
*revision = RampantReleaseRevision; 
}
<edited> I solved LNK200 and LNK1120 moving the #if RP_HOST condition inside the DEFINE_PROFILE macro as we can see now, but the c4113 error still persist. The libudf.dll can be loaded but i dont know if its will work fine.

Last edited by D-Nox; March 4, 2016 at 09:55.
D-Nox is offline   Reply With Quote

Old   March 4, 2016, 09:45
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
In my experience, that error C4113 can be safely ignored, it is a mistake by the Fluent programmers that does not have any real consequences.

I would be more concerned with the two other errors that are shown: LNK2001 and LNK1120. Those are new for me.
D-Nox likes this.
pakk 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
C_T(c,t) problem while compiling (OK interpreted) crevoise Fluent UDF and Scheme Programming 6 February 4, 2014 07:16
Problem with compiling new solver palazi88 OpenFOAM Programming & Development 2 December 24, 2013 19:52
problem with compiling the source code michel1988 OpenFOAM Installation 1 April 17, 2013 17:19
COMPILING PROBLEM ammi FLUENT 1 December 7, 2006 04:07
problem in compiling UDF ammi reddy FLUENT 1 December 1, 2006 06:45


All times are GMT -4. The time now is 19:07.