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

Problem in DEFINE_GEOM Macro

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2015, 16:50
Default Problem in DEFINE_GEOM Macro
  #1
New Member
 
mohsen
Join Date: Jun 2015
Posts: 25
Rep Power: 11
moabdi is on a distinguished road
Hi every body
I wrote an UDF to describe the geometry of a RING TORUS.
NOTE:
as you know a torus is a surface of revolution generated by revolving a circle in three-dimensional space about an axis coplanar with the circle. If the axis of revolution does not touch the circle, the surface has a ring shape and is called a Ring Torus.
220px-Torus.png

but I think some thing is wrong about it, because when I try to see preview mesh motion, a small window is opened and show this message: "Resetting" and nothing happens.
the UDF is:

#include "udf.h"
#include "math.h"
#include "sg_udms.h"
#include "sg.h"
#include "stdio.h"
#include "mem.h"
#include "dpm.h"
#include "surf.h"
#define PI 3.14286

DEFINE_GEOM(torus, domain, dt, position)

{

int i, j, n = 360;
real xx[129600], yy[129600], zz[129600];
xx[129600]=0;
yy[129600]=0;
zz[129600]=0;
for (i = 1 ; i <= n ; i++)
{
for (j = 1 ; j <= n ; j++)
{
xx[0]=(50+3*cos (j*PI/180))*cos(i*PI/180);
yy[1]=(50+3*cos (j*PI/180))*sin(i*PI/180);
zz[2]=3*sin(j*PI/180);
}
}
position[0]=xx[129600];
position[1]=yy[129600];
position[2]=zz[129600];
}
DEFINE_CG_MOTION(CUTTING,dt,vel,omega,time,dtime)
{



/* reset velocities */

NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);

omega[2]=0.3;
}

it's my pleasure if any body could help me.
thanks
moabdi is offline   Reply With Quote

Old   November 23, 2015, 09:21
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Code:
for (i = 1 ; i <= n ; i++) 
{ 
for (j = 1 ; j <= n ; j++)
{
xx[0]=(50+3*cos (j*PI/180))*cos(i*PI/180);
yy[1]=(50+3*cos (j*PI/180))*sin(i*PI/180);
zz[2]=3*sin(j*PI/180); 
} 
}
What is this supposed to do? You are redefining xx[0], yy[1] and zz[2] many (n^2) times, without ever using the value in between... It would be equivalent to

Code:
xx[0]=(50+3*cos (n*PI/180))*cos(n*PI/180);
yy[1]=(50+3*cos (n*PI/180))*sin(n*PI/180);
zz[2]=3*sin(n*PI/180);
And after that, you never use xx[0], yy[1] nor zz[2] again... I can't follow what you think the parts of your code are doing...
pakk is offline   Reply With Quote

Old   November 23, 2015, 12:35
Default
  #3
New Member
 
mohsen
Join Date: Jun 2015
Posts: 25
Rep Power: 11
moabdi is on a distinguished road
Hi PAKK

you are right, there are many problems in that UDF, so what's your opinion on how to define a TORUS equation in FLUENT by use of DEFINE_GEOM macro?
moabdi is offline   Reply With Quote

Old   November 24, 2015, 11:09
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I have no opinion, I have never worked with DEFINE_GEOM. But you already wrote a code, so you must have had something in mind when you wrote it...
pakk is offline   Reply With Quote

Reply

Tags
udf


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
DEFINE_HET_RXN_RATE macro problem zzt_1234 Fluent UDF and Scheme Programming 0 December 6, 2010 04:16
problem in UDF shen FLUENT 1 November 20, 2007 08:56
Problem with FLUID_THREAD_P(t) macro Sciaco FLUENT 0 November 18, 2007 03:23
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 07:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13


All times are GMT -4. The time now is 20:53.