|
[Sponsors] |
October 23, 2022, 14:18 |
How to write udf code in visual studio
|
#1 |
New Member
Prasidh shetty
Join Date: Oct 2022
Posts: 10
Rep Power: 3 |
I change the program for 3d.
But it's show the error msg that is udf library trying to load is not compiled for current platform. I used visual Studio 2017 for as compiler. And some time it's give error fatal error C1189. This is code. Please tell me how to avoid this error.. #include "udf.h" DEFINE_GRID_MOTION(logarithmic, domain, dt, time, dtime) { Thread *tf=DT_THREAD(dt); face_t f; Node *v; real NV_VEC(velocity),NV_VEC(axis); real NV_VEC(origin),NV_VEC(rvec); real loco; real freq; real amp; real diam; int n; SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); freq=200; amp=0.00152; diam=0.050; loco=2*3.141592654*amp*freq*cos(2*3.141592654*freq *time); Message("time=%f,omeg=%f\n",time,loco); NV_S(velocity,=,0.0); NV_D(axis,=,1.0,1.0,1.0); NV_D(origin,=,0.0,0.0,0.0); begin_f_loop(f, tf) { f_node_loop(f, tf, n) { v=F_NODE (f, tf, n); if (NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); velocity[2]=loco*(1-(4*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_Y(v)*NODE_Y(v ))))*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_Y(v)*NODE_Y (v)))))/(diam*diam)+((8*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_ Y(v)*NODE_Y(v))))*(sqrt((NODE_X(v)*NODE_X(v))+(NOD E_Y(v)*NODE_Y(v)))))/(diam*diam))*(log((2*(sqrt((NODE_X(v)*NODE_X(v))+( NODE_Y(v)*NODE_Y(v))))+0.000000000001)/diam))); NV_V_VS(rvec,=,NODE_COORD(v),+,velocity,*,dtime); NV_V(NODE_COORD(v),=,rvec); } } } end_f_loop (f, tf); } This code is for 2d analysis of synthetic jet I am using this code for 2d analysis in visual studio but it is showing many errors like- 1] cannot find the open source files. 2] identifier logarithmic undefined; identifier domain undefined; identifier dt undefined etc 3]expected an expression and there are some more ... can help me solve this issue as I am not good at coding. |
|
November 23, 2022, 19:36 |
|
#2 |
New Member
wujun
Join Date: Apr 2012
Posts: 13
Rep Power: 13 |
I just code it in fluent,it works successfully,no errors.
you'd better make some settings between the fluent and VS++. The VS++ must include the header file like the "udf.h"or others. please try it again,good luck! |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Command line for fluent to run visual studio | soankerabhinay | FLUENT | 9 | October 20, 2021 20:33 |
Help. No Nmake.exe file in my visual studio code folder | soankerabhinay | FLUENT | 2 | September 18, 2021 21:19 |
Method to set environment variables for linking ANSYS Fluent 19.1 and visual studio 1 | renrenxiong | ANSYS | 0 | November 13, 2019 07:17 |
Error code: 126 when loading parallel UDF | Coop | Fluent UDF and Scheme Programming | 0 | July 13, 2018 08:33 |
Problem in compiling UDF with ANSYS Fluent 17.1 and Visual Studio 14.0 | Spiker54321 | Fluent UDF and Scheme Programming | 2 | October 27, 2016 09:09 |