Fluids

Fluids

udfs for combined motions

    • tahar
      Subscriber
    • YasserSelima
      Subscriber
      I would try using CG_MOTION with GRID_MOTIONn
    • YasserSelima
      Subscriber
      You might need to add this line at the end of your functions. BOTH OF THEM to avoid having different nodes working on both functions at the same time which would screw your geometrynPRF_GSYNC();n
    • tahar
      Subscriber
      tank you very much Mr YasserSelima for your help whene i use CG_MOTION i alway have a negative cell volume even with small time step. and where i should put nPRF_GSYNC()nmy udfs are below and i use another udfs for data acquisition nDEFINE_GRID_MOTION(deflection,domain,dt,time,dtime) n{ n Thread *tf = DT_THREAD(dt); n face_t f; n Node *v; n real NV_VEC (velocity), NV_VEC (axis);n real NV_VEC (origin), NV_VEC (rvec);nn real x,y; n real c =0.05;n real freq = 4;n real alpha;n int n; n /* set deforming flag on adjacent cell zone */ n SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); n NV_S (velocity, =, 0.0);n NV_D (axis, =, 0.0,0.0, 1.0);n begin_f_loop(f,tf) n { n f_node_loop(f,tf,n) n { n v = F_NODE(f,tf,n); if ( NODE_POS_NEED_UPDATE (v)) NODE_POS_UPDATED(v); alpha = 0.1; NODE_X (v)= NODE_X (v); n NODE_Y (v) = NODE_Y (v)- alpha*sin(2*M_PI*freq*time+M_PI/2);nn } n } end_f_loop(f,tf); n}nDEFINE_CG_MOTION(trans, dt, cg_vel, cg_omega, time, dtime)n{n Thread *t = DT_THREAD (dt);n face_t f;nn/*****************************************************/ n real corde = 0.1;n // real freq = 0.224;n real freq = 4;n real ho = 1;n real ao = 0.84811*(M_PI/2); /*76.33?*/n real phy = M_PI/2;n/*****************************************************/n cg_vel[0] = 0.0;n cg_vel[1] = (ho*corde*cos(2*M_PI*freq*(time+dtime)) - ho*corde*cos(2*M_PI*freq*time))/dtime; cg_omega[0] = 0.0;n cg_omega[1] = 0.0;}nn
    • YasserSelima
      Subscriber
      For the CG_MOTION, nDo you have rotation or translational motion? nAnd why are you dividing by dtime? (Most probably you will get negative cell volume because this makes your velocity too large)nAlso you don't need to declare face_t f herenFor GRID_MOTIONnThe function gives the same NODE_X and NODE_Y formula for all points. This will result in pure translation of the airfoil, up and dowI recommend you apply one function and see the motion, then apply the second and see the motion .. then combine themnnThis line nPRF_GSYNC();nis basically asking all nodes to wait until the work of all nodes is complete before proceeding to the next line. I want you to add it at the end of both functions, so the solver does not start the second function until all nodes complete the work in the first function ... So, it is basically I am asking the solver to apply one function after the other and not to do them at the same timenn
    • tahar
      Subscriber
      Tank you very much Mr YasserSelima for your helpnthe udfs work well in CG_MOTION UDF, The term cg_vel[1]= x-x0/dt it represent numerical velocity and it is OKnby using udf ZONE MOTION for translation the airfoil translate and deflect and evey think is fine but with Unphysical results.nby using GRID _MOTION without translation the airfoil deflectes only so it is OKnthe translation by CG MOTION is failed due to negative cell i no know why ???n
    • YasserSelima
      Subscriber
      I recommend you differentiate the equation instead of dividing by dt ... Sine / Cosine are not linear functions and approximating the derivatives like this may result in large numerical error and Large velocity which would cause negative cell volume.nnNegative cell volume might appear because of using large timestep , or because of the remesh settings.n
Viewing 6 reply threads
  • You must be logged in to reply to this topic.