Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

Query related to UDF

    • srivastavatanuj
      Subscriber
      Hello Sir,nBelow I am attaching a thread which I found in cfd-online discussion forum and that point out the explanation of term N3V_D etc. My query is at the bottom.n--------------------------------------------------------------------------------------------------------------------------------------------nIf you are working in 3D, then N3V_D means the same as NV_D. If you are working in 2D, then N3V_D is not defined. So you can ignore the 3.nnIn general, these definitions are hidden in C:\Program Files\ANSYS Inc\v???\fluent\fluent??.?.?\srcnIn mem.h and global.h, I found:NV_D(a,EQ,x0,x1,x2)=ND_D((a)[0],(a)[1],(a)[2],EQ,x0,x1,x2)nND_D(a0,a1,a2,EQ,x0,x1,x2)=ND_VEC((a0)EQ(x0),(a1)E Q(x1),(a2)EQ(x2))nNV_S(a,EQ,s)=ND_VEC((a)[0]EQ(s),(a)[1]EQ(s),(a)[2]EQ(s))nND_VEC(x,y,z)=x,y,znnSo, expanding your first expression, assuming 3D:nN3V_D (velocity,=,1.0,0.0,0.0);nbecomesnNV_D (velocity,=,1.0,0.0,0.0);nbecomesnND_D(velocity[0],velocity[1],velocity[2],=,1.0,0.0,0.0)nbecomesnND_VEC(velocity[0]=1.0,velocity[1]=0.0,velocity[2]=0.0)nbecomesnvelocity[0]=1.0,velocity[1]=0.0,velocity[2]=0.0nnSimilarly, with your second expression:nN3V_S(origin,=,0.0); becomesnNV_S(origin,=,0.0);nbecomesnND_VEC(origin[0]=0.0,origin[1]=0.0,origin[2]=0.0);nbecomesnorigin[0]=0.0,origin[1]=0.0,origin[2]=0.0;nnSo with N3V_S you give every component the same value.n--------------------------------------------------------------------------------------------------------------------------------------------nNow query is that, if I want my 2-D system (simple box, nothing is outside the box) to do SHM about the origin. For that I will provide angular velocity about the origin. I am setting N3V_D(velocity, = , 0.0, 0.0, 0.0); in my UDF so that there will be 0 velocity. In the discussion posted above, it is mentioned that, for 2-D N3V_D is not defined then what should be done for 2-D case .I am also giving angular velocity like *omega = tetmax*angular_freq*cos(angular_freq*time); and putting this in cell zone condition----> frame motion. Is it ok to do that? System is transient and takes time to complete.n
    • Rob
      Forum Moderator
      You can do that, but as I have no idea what you're trying to do I can't say it'll solve your problem. If you're using frame motion you don't need a UDF, just use an expression. n
    • srivastavatanuj
      Subscriber
      I am trying to give SHM to a 2D square box having fluid inside about the origin. origin is the center of the box. I guess it is SRF problem as there is nothing outside the box.nI want the box to have some amplitide and time period, it is not complete revolution, So UDF might be needed. nusing frame motion, When I see the animation, even after giving UDF for SHM, frame does not seem to rotate in animation. I am using the above expressions. Is there is any problem is UDF or in SRF, when we see animation, motion does not seem to occur?nCode for SHM is just below-nn#include udf.hn#define Freq 0.125n#define angular_freq 2.0*M_PI*Freqn#define tetmax 5.0*M_PI/180nDEFINE_ZONE_MOTION(UCTP8AMP05, omega, axis, origin, velocity, time, dtime)n{nreal t = CURRENT_TIME;nN3V_D(velocity, = , 0.0, 0.0, 0.0);n*omega = tetmax*angular_freq*cos(angular_freq*t);n}nnnMoreover, do I need to give expression for coriolis acceleration and centripetel accelerations as well? But I saw in the ansys manual that when we call frame motion, respective equations are enabled having all the accelerations. See thelink.nnThere is no mesh interface, can I use mesh motion instead of frame motion?n
    • DrAmine
      Ansys Employee
      You might have a look into dynamic mesh and rigid body motion. There a profile file or UDF is required to provide the motion of the rigid body.n
Viewing 3 reply threads
  • The topic ‘Query related to UDF’ is closed to new replies.