CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

DEFINE_GRID_MOTION crash without any info??

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2010, 12:34
Question DEFINE_GRID_MOTION crash without any info??
  #1
New Member
 
Join Date: Apr 2009
Posts: 11
Rep Power: 17
deepinheart is on a distinguished road
This is my code to run DEFINE_GRID_MOTION. However, it crashed whenever I run "dynamic mesh preview" more than 1 time step. If I run 1 step each time I restart fluent, it works.

Maybe it is because of the stack pointer I add. But I've already free it after use. Would you please help me out?

Note: The pointer value is used to receive a udf loadinterp and it works well (I checked that inside Fluent).

BTW, how to use Macro to compile UDF step by step?

Thanks a lot!


Code:
DEFINE_GRID_MOTION(DefineGridMotionTest, domain, dt, time, dtime)
{
 
  Thread *tf = DT_THREAD (dt);
  face_t f;
  Node *v;
  float *value= (float *)malloc(3*sizeof(float));

  float NV_VEC (dx);
  int n;
  
  char str [ FILENAME_MAX ];
  sprintf_s(str,FILENAME_MAX, "c:\\BoundGrid_%d.txt", N_TIME+1);

  
  // set deforming flag on adjacent cell zone
  SET_DEFORMING_THREAD_FLAG (THREAD_T0 (tf));

  Message ("time = %f %d\n", time,N_TIME);
  
  
  
  begin_f_loop (f, tf)
    {
      f_node_loop (f, tf, n)
        {
          v = F_NODE (f, tf, n);

          // update node if x position is greater than 0.02
          // and that the current node has not been previously
          // visited when looping through previous faces
          if (NODE_POS_NEED_UPDATE (v))
            {
              // indicate that node position has been update
              // so that it's not updated more than once 
              NODE_POS_UPDATED (v);


              value = loadinterp(str, NODE_COORD (v)[0], NODE_COORD          (v)[1],NODE_COORD (v)[2]);

              NV_DS (dx, =, *value,*(value+1),*(value+2),*,dtime);
              NV_V (NODE_COORD (v), +=, dx);
            }
        }
    }

  end_f_loop (f, tf);

  free(value);

}
deepinheart is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code_Saturne info? phsieh2005 Main CFD Forum 5 November 7, 2007 07:20
mesh scale info Dave FLUENT 1 July 9, 2007 14:33
OpenFOAM with Cygwin kitchener OpenFOAM Installation 6 April 24, 2006 23:09
Where to get these info.. Jas Phoenics 2 January 15, 2004 06:02
Accessing Neighbouring Cell info Murali Siemens 1 December 9, 2002 06:10


All times are GMT -4. The time now is 04:02.