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

Parallelizing UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2021, 04:55
Default Parallelizing UDF
  #1
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 10
ebrahem is on a distinguished road
Can Someone Help me Paralleizing this UDF


DEFINE_SDOF_PROPERTIES(stage, prop, dt, time, dtime)
{
Thread *t;
Domain *d = Get_Domain(12);

real cg_y; /*centre of gravity position y*/
real cg_x; /*centre of gravity position x*/
real vel_y; /*cylinder velocity y*/
real vel_x; /*cylinder velocity x*/
real Fy; /*Lift force*/
real Fx; /*Drag force*/

real mr = 10; /*cylinder mass ratio*/
real rho = 998.2; /*Fluid Density*/
real fn = 4.1302676; /*system frequency*/
real dia = 0.002; /*cylinder diameter*/
real z = 0; /*Damping coefficient*/
real cm = 1; /*added mass coefficient*/

real mass = (mr*rho*dia*dia*M_PI)/4; /*Cylinder mass*/
real wn = 2*M_PI*fn; /*system angular velocity*/
real ky = mass*wn*wn; /*System stiffness y*/
real kx = mass*wn*wn; /*System stiffness x*/
real cy = 2*mass*wn*z; /*System damping y*/
real cx = 2*mass*wn*z; /*System damping*/

/*get the thread pointer for which this motion is defined*/
t = DT_THREAD(dt);
if(it == 0)
{
f1=fopen("force.txt","w");
fprintf(f1,"Time \t y \t X-POS \t Y-POS \t X-VEL \t Y-VEL\n");
it=1;
}

prop[SDOF_MASS] = mass; /*system mass of the 6 dof*/
prop[SDOF_IXX] = (mass*dia*dia)/16;
prop[SDOF_IYY] = (mass*dia*dia)/16;
prop[SDOF_IZZ] = (mass*dia*dia)/8;

/*limit 4 dofs from 6 dof macro*/
prop[SDOF_ZERO_TRANS_X] = FALSE;
prop[SDOF_ZERO_TRANS_Y] = FALSE;
prop[SDOF_ZERO_TRANS_Z] = TRUE;
prop[SDOF_ZERO_ROT_X] = TRUE;
prop[SDOF_ZERO_ROT_Y] = TRUE;
prop[SDOF_ZERO_ROT_Z] = TRUE;

cg_y = DT_CG(dt)[1];
cg_x = DT_CG(dt)[0];
vel_y = DT_VEL_CG(dt)[1];
vel_x = DT_VEL_CG(dt)[0];
Fy = -ky*cg_y - vel_y*cy;
Fx = -kx*cg_x - vel_x*cx;

prop[SDOF_LOAD_F_Y] = Fy;
prop[SDOF_LOAD_F_X] = Fx;

Message ("y_vel = %f, x_vel = %f, y_pos = %f, x_pos = %f, \n", vel_y, vel_x, cg_y, cg_x);

if ((time - time_prev) > 0.0)
{
fprintf(f1,"%g \t %g \t %g \t %g \t %g \t \n",time,cg_x,cg_y,vel_x,vel_y);
time_prev = time;
}
}


DEFINE_ON_DEMAND(CLOSE_FILE)
{
fclose(f1);
}
ebrahem is offline   Reply With Quote

Old   February 24, 2021, 04:40
Default
  #2
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 10
ebrahem is on a distinguished road
any help please
ebrahem is offline   Reply With Quote

Old   February 24, 2021, 14:48
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Which part in the manual don't you understand?

(not saying that the manual is easy to follow for parallelisation, but you don't give any clue about which steps you had problems with, not what you tried already, and not which errors/warnings you got, which makes it very hard to help you)
pakk 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
Fluent Radiation/porous media Schmitt pierre-Louis FLUENT 26 September 1, 2016 11:29
Parallelizing a udf coolengineer Fluent UDF and Scheme Programming 4 February 27, 2013 06:15
automatic parallelizing udf chaos FLUENT 2 August 1, 2011 02:51
multi-core processor about parallelizing udf dasah Fluent UDF and Scheme Programming 0 June 23, 2011 11:50
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 18:35.