CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Using Dynamic Mesh with UDF (http://www.cfd-online.com/Forums/fluent-udf/106049-using-dynamic-mesh-udf.html)

abhinavgupta88 August 16, 2012 13:44

Using Dynamic Mesh with UDF
 
I have a 2D Geometry which has Piston on two sides and Top and Bottom are walls. I wanna move the Two Pistons Simultaneously using the UDF. For motion I am using Sine Function. I am using Fluent. Please Help

syavash August 16, 2012 23:24

Quote:

Originally Posted by abhinavgupta88 (Post 377396)
I have a 2D Geometry which has Piston on two sides and Top and Bottom are walls. I wanna move the Two Pistons Simultaneously using the UDF. For motion I am using Sine Function. I am using Fluent. Please Help

Hi,
If you are newbie in udf, take a deep look at fluent udf manual. It can help you more than anyone else. (search for define_cg_motion)
Good luck.

abhinavgupta88 August 22, 2012 14:14

Dynamic Wall UDF
 
I have gone through the Manual. I am able to compile my UDF and Hook it to the walls. But I can see both the walls moving in the same direction. I am using the following UDF:
#include "udf.h"
#include "dynamesh_tools.h"

/************************************************** ********************/
/***** UDF for displacer motiion *****/
/************************************************** ********************/

DEFINE_CG_MOTION(displacer_func, dt, vel, omega, time, dtime)

{

Thread *t;
face_t f;
real a = 1.58712757;
real pai = 3.141592654;

/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);

if (!Data_Valid_P ())
return;

t=DT_THREAD (dt);

if(time<=8.0)



vel[0] = ( a * ( cos(2*pai*75*time)) ) ;
else


vel[0] = -( a * ( cos(2*pai*75*time)) ) ;

}

I appreciate if anyone can help.

syavash August 22, 2012 15:07

Quote:

Originally Posted by abhinavgupta88 (Post 378219)
I have gone through the Manual. I am able to compile my UDF and Hook it to the walls. But I can see both the walls moving in the same direction. I am using the following UDF:
#include "udf.h"
#include "dynamesh_tools.h"

/************************************************** ********************/
/***** UDF for displacer motiion *****/
/************************************************** ********************/

DEFINE_CG_MOTION(displacer_func, dt, vel, omega, time, dtime)

{



Thread *t;
face_t f;
real a = 1.58712757;
real pai = 3.141592654;

/* reset velocities */
NV_S (vel, =, 0.0);
NV_S (omega, =, 0.0);

if (!Data_Valid_P ())
return;

t=DT_THREAD (dt);

if(time<=8.0)



vel[0] = ( a * ( cos(2*pai*75*time)) ) ;
else


vel[0] = -( a * ( cos(2*pai*75*time)) ) ;


}

I appreciate if anyone can help.

well, you should make two further steps.
1.separate two pistons in two distinct zones (if not already.)
2.make a copy of your define cg motion with a different name and a minus sign in velocity. Now assign each cg motion into one of pistons.
Good luck.

abhinavgupta88 August 22, 2012 15:21

Quote:

Originally Posted by syavash (Post 378226)
well, you should make two further steps.
1.separate two pistons in two distinct zones (if not already.)
2.make a copy of your define cg motion with a different name and a minus sign in velocity. Now assign each cg motion into one of pistons.
Good luck.

Thank You for the Reply. You mean to say Separate Two pistons in two distinct zones, in Gambit. I understand what you wrote but I am little confused with first step.

syavash August 22, 2012 21:13

Quote:

Originally Posted by abhinavgupta88 (Post 378227)
Thank You for the Reply. You mean to say Separate Two pistons in two distinct zones, in Gambit. I understand what you wrote but I am little confused with first step.

You should refer to BC panel in Fluent. If there are two walls with different name, It's OK. Otherwise, you may have two options.
1-Return to Gambit and separate two walls as you know.
2-Do this in Fluent at Grid-->Separate by region.


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