header udf.h无法为fluent创建udf

时间:2015-03-22 14:39:21

标签: c++ nhibernate fluent-nhibernate header-files fluent

我正在尝试创建一个用户定义的函数udf,以便在流畅的ansys中使用。 涉及物理 - 我想获得UDF用户定义的功能,以便在ANSYS流体中获得以下速度曲线 - 与活塞运动物相同的速度 - 用于流畅的ANSYS软件中的燃烧测试。 以下是我的代码:

    #include <stdafx.h>
//#include <iostream.h>
#include <C:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\udf.h>
//#include <C:\winapps\FEniCS\lib\gcc\mingw32\4.6.1\include\ssp\stdio.h>
//#include <C:\winapps\FEniCS\lib\gcc\mingw32\4.6.1\include\c++\tr1\stdlib.h>
//#include "time.h"
 //#include "math.h"
int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}
DEFINE_PROFILE(inlet_x_velocity, thread, position)
{
    // declaring variables
    real  x[ND_ND]; //this will hold the position vector 
    face_t f;
    begin_f_loop(f, thread);
    {
        F_CENTROID(x, f, thread);
#if (dt) < 0.006)
        F_PROFILE(for, thread, postion) = 1000 * dt;
#else if ( 0.006 < (dt) < 0.014)
        F_PROFILE(for, thread, postion) = 0.5*dt;
#else if ( 0.01401 < (dt) < 0.028)
        F_PROFILE(for, thread, postion) = 9.25;
#endif ( 0.02801 < (dt))
        F_PROFILE(for, thread, postion) = 9.25 - (9.25 / 3)*(dt - 30);
        return F_PROFILE;
    }
    end_f_loop(f, thread)
}

上面的代码显示了与udf.h相关的错误,您可以建议在任一代码中进行可能的更改。由于我是机械背景,我不是C ++编码专家。 以下是错误shos- udf.h有问题:

Error   1   error C1083: Cannot open include file: 'localize.h': No such file or directory  c:\program files\ansys inc\v150\fluent\fluent15.0.7\src\config.h    15  1   velocity2
    8   IntelliSense: cannot open source file "localize.h"  c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\config.h    15  1   velocity2
    9   IntelliSense: cannot open source file "sys_master.h"    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\config.h    17  1   velocity2
    10  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\config.h    118 2   velocity2
    11  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\config.h    118 7   velocity2
    20  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\ctype.h  387 1   velocity2
    21  IntelliSense: variable "_heapwalk" may not be initialized   c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\malloc.h 169 53  velocity2
    22  IntelliSense: identifier "_HEAPINFO" is undefined   c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\malloc.h 169 71  velocity2
    23  IntelliSense: identifier "_EntryInfo" is undefined  c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\malloc.h 169 83  velocity2
    24  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\malloc.h 289 1   velocity2
    18  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h   1008    1   velocity2
    2   IntelliSense: explicit type is missing ('int' assumed)  c:\Program Files (x86)\Windows Kits\8.1\Include\um\mpconfig.h   31  1   velocity2
    3   IntelliSense: identifier "IMixerPinConfig" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\mpconfig.h   31  20  velocity2
    4   IntelliSense: identifier "IUnknown" is undefined    c:\Program Files (x86)\Windows Kits\8.1\Include\um\mpconfig.h   31  37  velocity2
    5   IntelliSense: explicit type is missing ('int' assumed)  c:\Program Files (x86)\Windows Kits\8.1\Include\um\mpconfig.h   129 1   velocity2
    6   IntelliSense: identifier "IMixerPinConfig2" is undefined    c:\Program Files (x86)\Windows Kits\8.1\Include\um\mpconfig.h   129 20  velocity2
    7   IntelliSense: identifier "IMixerPinConfig" is undefined c:\Program Files (x86)\Windows Kits\8.1\Include\um\mpconfig.h   129 38  velocity2
    25  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\setjmp.h 178 1   velocity2
    17  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stddef.h 74  1   velocity2
    12  IntelliSense: identifier "_onexit_t" is undefined   c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdlib.h 826 9   velocity2
    13  IntelliSense: identifier "_onexit_t" is undefined   c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdlib.h 826 44  velocity2
    14  IntelliSense: identifier "_onexit_t" is undefined   c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdlib.h 947 1   velocity2
    15  IntelliSense: identifier "_onexit_t" is undefined   c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdlib.h 947 34  velocity2
    16  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdlib.h 953 1   velocity2
    19  IntelliSense: expected a declaration    c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\string.h 434 1   velocity2
    26  IntelliSense: cannot open source file "dll.h"   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   8   1   velocity2
    27  IntelliSense: variable "FLUENT_EXPORT" is not a type name   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   13  1   velocity2
    28  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   13  25  velocity2
    29  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   14  1   velocity2
    30  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   14  15  velocity2
    31  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   18  1   velocity2
    32  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   18  15  velocity2
    33  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   20  1   velocity2
    34  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   20  15  velocity2
    35  IntelliSense: variable "FLUENT_EXPORT" is not a type name   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   21  1   velocity2
    36  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   21  25  velocity2
    37  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   23  1   velocity2
    38  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   23  15  velocity2
    39  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   24  1   velocity2
    40  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   24  15  velocity2
    41  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   25  1   velocity2
    42  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   25  15  velocity2
    43  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   26  1   velocity2
    44  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   26  15  velocity2
    45  IntelliSense: variable "FLUENT_EXPORT" is not a type name   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   27  1   velocity2
    46  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   27  25  velocity2
    47  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   28  1   velocity2
    48  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   28  15  velocity2
    49  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   29  1   velocity2
    50  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   29  15  velocity2
    51  IntelliSense: variable "FLUENT_EXPORT" is not a type name   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   30  1   velocity2
    52  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   30  25  velocity2
    53  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   31  1   velocity2
    54  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   31  15  velocity2
    55  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   33  1   velocity2
    56  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   33  15  velocity2
    57  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   34  1   velocity2
    58  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   34  15  velocity2
    59  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   35  1   velocity2
    60  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   35  15  velocity2
    61  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   36  1   velocity2
    62  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   36  15  velocity2
    63  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   37  1   velocity2
    64  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   37  15  velocity2
    65  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   38  1   velocity2
    66  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   38  15  velocity2
    67  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   39  1   velocity2
    68  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   39  15  velocity2
    69  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   40  1   velocity2
    70  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   40  15  velocity2
    71  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   41  1   velocity2
    72  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   41  15  velocity2
    73  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   42  1   velocity2
    74  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   42  15  velocity2
    75  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   43  1   velocity2
    76  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   43  15  velocity2
    77  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   50  1   velocity2
    78  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   50  15  velocity2
    79  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   54  1   velocity2
    80  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   54  15  velocity2
    81  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   56  1   velocity2
    82  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   56  15  velocity2
    83  IntelliSense: variable "FLUENT_EXPORT" is not a type name   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   57  1   velocity2
    84  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   57  25  velocity2
    85  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   59  1   velocity2
    86  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   59  15  velocity2
    87  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   60  1   velocity2
    88  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   60  15  velocity2
    89  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   61  1   velocity2
    90  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   61  15  velocity2
    91  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   62  1   velocity2
    92  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   62  15  velocity2
    93  IntelliSense: variable "FLUENT_EXPORT" is not a type name   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   63  1   velocity2
    94  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   63  25  velocity2
    95  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   64  1   velocity2
    96  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   64  15  velocity2
    97  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   66  1   velocity2
    98  IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   66  15  velocity2
    99  IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   67  1   velocity2
    100 IntelliSense: expected a ';'    c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   67  15  velocity2
    101 IntelliSense: this declaration has no storage class or type specifier   c:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.7\src\var.h   68  1   velocity2

我还尝试从C:\ Program Files \ ANSYS Inc \ v150 \ fluent \ fluent15.0.7 \ src复制所有标题.h文件并将其保存在本地文件夹中,但它显示与头文件相关的错误 - 所以我我们认为我们无法从目录位置更改头文件

1 个答案:

答案 0 :(得分:0)

问题在于struct lock已声明但从未定义过。您应该添加#include <sys/lock.h>.

您可以查看 ftp.stu.edu.tw/BSD/OpenBSD/src/sys/isofs/udf/udf_vfsops.c 以获取完整示例。