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

How to access all nodes and pressures.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 14, 2011, 05:51
Default How to access all nodes and pressures.
  #1
New Member
 
sutthinan
Join Date: Feb 2011
Posts: 9
Rep Power: 15
sutthinan is on a distinguished road
Hi everyone;

I need to calculate the deformation of geometry. The pressure will effect on the geometry, deform=(xx[j+1]-xx[j])*presur[j]*log(fabs((xx[ii+1]+xx[ii])/2.-xx[j])*fabs((xx[ii-1]+xx[ii])/2.-xx[j])) ,so I need to access all nodes and keep the pressure and x-coordinates in P[] , x[] for calculatiog the deformation equation.

This is my UDF ( it is not working, when i run, it will show the message "fetal error"


#include "udf.h"
DEFINE_GEOM(deform_ball, domain, dt, position)
{
Thread *t;
face_t f;
/*real xx[1000];
real yy[1000];
real presur[1000]; */
real x[ND_ND];
real NV_VEC (A);
real ho=0.01, hc, def,e=345230000000.0, wref, deform,n;
real r=10.0,b=0.00039,ap=800000000.0, vb=1.0, vp=0.3;
int max,i,j,ii,size;
node *n;
n=F_NODE(face, thread, n);
real *px=NULL;
real *xx=NULL;
real *yy=NULL;
px=(real*)malloc(n*sizeof(real));
xx=(real *)malloc(n*sizeof(real));
yy=(real *)malloc(n*sizeof(real));

i=0.;
begin_f_loop (f, t)
{
F_CENTROID(x,f,t);
xx[i]=x[0];
yy[i]=x[1];
presur[i]=F_P(f, t);
max=i;
i=i+1;
}
end_f_loop (f, t);
i=0.;
j=0.;
ii=0.;
for(j=0;j<max;j++)
{
if (position[0]==xx[j]) goto start;
}
start:
for(i=0;i< max;i++)
{
ii=i;
if (i==max)
{
ii=max-1;
}
if (i==0.)
{
ii=1;
}
if (j==max)
{
j=max-1;
}

deform=(xx[j+1]-xx[j])*presur[j]*log(fabs((xx[ii+1]+xx[ii])/2.-xx[j])*fabs((xx[ii-1]+xx[ii])/2.-xx[j]));
}
hc=-2*(vb-vp)*deform/(e*3.14);
position[1]=position[1]*0.9+0.1*(ho+sqrt(fabs(yy[j]*yy[j]-r))+(hc));
position[1]=position[1];
free(xx);
free(yy);
free(presur);
Message ("x = %f, y= %f, deform=%f",position[0],position[1]),deform;
return position[1];
}







Thanks you
sutthinan 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
Pressure on mesh nodes data mattyg88 CFX 2 December 1, 2009 08:45


All times are GMT -4. The time now is 23:41.