How to write udf code in visual studio
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. |
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! |
All times are GMT -4. The time now is 00:41. |