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

Parallel processing for SDOF Dynamic mesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 15, 2018, 22:01
Post Parallel processing for SDOF Dynamic mesh
  #1
New Member
 
Seoul
Join Date: Jun 2017
Posts: 2
Rep Power: 0
amohizin is on a distinguished road
Dear all,

I am trying to solve a problem using SDOF Dynamic mesh technique in fluent. Since the computation time in serial processing was high I decided to shift to parallel processing. UDF is compiled successfully and iterations began, but the velocity of boundary wall that is supposed to move is still zero. am sharing the udf below.



Thank you for your time.





#define cg_x0 0.02738587

DEFINE_SDOF_PROPERTIES(piston,prop,dt,time,dtime)
{

real po,p0,F,Fu,Ff1,Ff2,Fs,FD,P1,temp,u,Fp,myuw,myua,dp ,b,h,fc,poa,Pa,T,R,ma,AD,Li,Ao,Ap,ks,di,fc1,fc2,L, m,alpha1,alpha2,alpha2_1,D,po_1,Ff2_1,x;

#if !RP_HOST
Thread*t;
face_t f;

t=DT_THREAD(dt);

#endif

prop[SDOF_MASS] = 0.11532;

prop[SDOF_ZERO_TRANS_X]=TRUE;
prop[SDOF_ZERO_TRANS_Y]=TRUE;
prop[SDOF_ZERO_TRANS_Z]=TRUE;
prop[SDOF_ZERO_ROT_X]=TRUE;
prop[SDOF_ZERO_ROT_Y]=TRUE;
prop[SDOF_ZERO_ROT_Z]=TRUE;


prop[SDOF_SYMMETRY_X] = 1;
prop[SDOF_SYMMETRY_Y] = 0;
prop[SDOF_SYMMETRY_Z] = 0;


/* add forces*/


Pa=1.013e5;
T=300;
R=287;
ma=1.2633e-4;
AD=1.256e-3;
Li=0.02;
Ao=3.1415e-8;
Ap=2.0687e-5;
ks=10000;
myuw=8.90e-4;
dp=5.1322e-3;
b=1.3741e-3;
h=0.1381e-3;
fc1=96.10;
fc2=5.24;
L=8.8395e-3;
m=0.05766;

myua=0.0000181;
alpha1=0.2;
alpha2=0.38;
alpha2_1=0.45;
D=0.02;

#if !RP_HOST

# if RP_NODE
x=fabs (cg_x0 - DT_CG(dt)[1]);
u=x/time;
P1=433000;
temp=(pow(((0.0285)/(0.0285+x)),1.4));

begin_f_loop(f,t)

if(x<=0.007)
{

prop[SDOF_ZERO_TRANS_X]=FALSE;

p0= C_P(f,t);
FD=3.14*0.020*0.020*(((P1-(Pa))*temp)-Pa);
poa=((0.5*6*myua*u*(D/2)*(1/(h*h)))+((P1)*temp));
Ff1=2*((alpha1*poa*3.14*D*b)+(poa*3.14*D*h)+(alpha 1*fc1));
po_1=(0.5*6*myua*u*(dp/2)*(1/(h*h))+p0);
po=(0.5*6*myuw*u*(dp/2)*(1/(h*h))+p0);
Ff2_1=2*((alpha2*po_1*3.14*dp*b)+(po_1*3.14*dp*h)+ (alpha2*fc2));
Ff2=2*((alpha2*po*3.14*dp*b)+(po*3.14*dp*h)+(alpha 2*fc1));
Fp=3.14*(dp/2)*(dp/2)*p0;
Fs=ks*x;
F=(FD-Fs-Ff1-Ff2-Fp);

prop[SDOF_LOAD_F_X]= F;

}
else
{
prop[SDOF_ZERO_TRANS_Y]=TRUE;
}
Message("\n 2d : Updated 6DOF prop with time = %f, distance = %f\n", time,x);
Message("\n 2d : new location = %g", DT_CG(dt)[1]);
Message("\n 2d : Force on Piston = %f, p0 = %f\n, po = %f\n", F,p0,po);

end_f_loop(f,t)

# endif
#endif
}
amohizin is offline   Reply With Quote

Old   March 19, 2018, 04:16
Default
  #2
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 12
obscureed is on a distinguished road
Hi Amohizin,

Is there any logic in where you have placed #if !RP_HOST and # if RP_NODE? It does not look right to me -- for a start, the #if RP_NODE means that this UDF will not work in serial. I would be tempted to remove them all -- on the RP_HOST process in parallel, the begin_f_loop...end_f_loop will do nothing (because there are no faces on the host), so it should be safe.

Did the UDF work (but work slowly) in serial? From what I can see, apart from the previous paragraph, I cannot see why it would be any different.

So you might want to start debugging your detailed calculations. Use Message0, so that you get information only from node0, for example:
Code:
Message0("x = %g\n",x);
If the mesh is large, you don't want to look at every face, so I sometimes just select faces at random, using something like this:
Code:
if(f%10000 == 777) {
  Message0("f = %9d:  x = %g\n",f,x);
}
To understand the detailed calculations would require knowledge of the geometry, so I could easily be wrong, but I suspect that the following line should use [0] rather than [1]:
Code:
x=fabs (cg_x0 - DT_CG(dt)[1]);
Good luck!
Ed
obscureed is offline   Reply With Quote

Old   March 20, 2018, 02:33
Default
  #3
New Member
 
Seoul
Join Date: Jun 2017
Posts: 2
Rep Power: 0
amohizin is on a distinguished road
Hi obscureed.

Thank you for the response.

I didn't use #if !RP_HOST and # if RP_NODE lines in UDF I used for serial computing. and it was x=fabs (cg_x0 - DT_CG(dt)[1]); in original code. Apologies for that, it was a typo.

Initially, I was working on axisymmetric geometry and Serial computing was fine. But now I had to work with 3D geometry and had to consider parallel processing to reduce the computation time.

Once again thank you for pointing out the error. I am new to parallel processing. If possible could you guide me in converting the UDF to parallel processing? This is the UDF I used for serial processing.

DEFINE_SDOF_PROPERTIES(piston,prop,dt,time,dtime)
{

real po,p0,F,Ff1,Ff2,Fs,FD,Fb,P1,temp,u,Fp,myuw,myua,dp ,b,h,fc,poa,Pa,T,R,ma,AD,Li,Ao,Ap,ks,di,fc1,fc2,L, m,alpha1,alpha2,D,po_1,Ff2_1,x;


Thread*t;
face_t f;

t=DT_THREAD(dt);



prop[SDOF_MASS] = 0.05766;

prop[SDOF_ZERO_TRANS_X]=TRUE;
prop[SDOF_ZERO_TRANS_Y]=TRUE;
prop[SDOF_ZERO_TRANS_Z]=TRUE;
prop[SDOF_ZERO_ROT_X]=TRUE;
prop[SDOF_ZERO_ROT_Y]=TRUE;
prop[SDOF_ZERO_ROT_Z]=TRUE;


prop[SDOF_SYMMETRY_X] = 0;
prop[SDOF_SYMMETRY_Y] = -1;
prop[SDOF_SYMMETRY_Z] = 0;


/* add forces*/


Pa=1.013e5;
T=300;
R=287;
ma=1.2633e-4;
AD=1.256e-3;
Li=0.02;
Ao=3.1415e-8;
Ap=2.0687e-5;
ks=4500;
myuw=8.90e-4;
dp=5.1322e-3;
b=1.3741e-3;
h=0.1381e-3;
fc1=96.10;
fc2=5.24;
L=8.8395e-3;
m=0.05766;

myua=0.0000181;
alpha1=0.2;
alpha2=0.38;
D=0.02;


x=fabs (cg_x0 - DT_CG(dt)[0]);
u=x/time;
P1=433000;;
temp=(pow(((0.0285)/(0.0285+x)),1.4));

begin_f_loop(f,t)

if(x<=0.007)
{

prop[SDOF_ZERO_TRANS_X]=FALSE;

p0= C_P(f,t);
FD=3.14*0.020*0.020*(((P1-(Pa))*temp)-Pa);
poa=((0.5*6*myua*u*(D/2)*(1/(h*h)))+((P1)*temp));
Ff1=2*((alpha1*poa*3.14*D*b)+(poa*3.14*D*h)+(alpha 1*fc1));
po_1=(0.5*6*myua*u*(dp/2)*(1/(h*h))+p0);
po=(0.5*6*myuw*u*(dp/2)*(1/(h*h))+p0);
Ff2_1=2*((alpha2*po_1*3.14*dp*b)+(po_1*3.14*dp*h)+ (alpha2*fc2));
Ff2=2*((alpha2*po*3.14*dp*b)+(po*3.14*dp*h)+(alpha 2*fc1));
Fp=3.14*(dp/2)*(dp/2)*p0;
Fs=ks*x;
F=(FD-Fs-Ff1-Ff2-Fp);

prop[SDOF_LOAD_F_X]= F;

}
else
{
prop[SDOF_ZERO_TRANS_X]=TRUE;
}
Message("\n 2d : Updated 6DOF prop with time = %f, distance = %f\n", time,x);
Message("\n 2d : new location = %g", DT_CG(dt)[0]);
Message("\n 2d : Force on Piston = %f, p0 = %f\n, po = %f\n", F,p0,po);

end_f_loop(f,t)

}
amohizin is offline   Reply With Quote

Reply

Tags
dynamic mesh, parallel processing, sdof


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
Reconstruction of the parallel case with dynamic mesh makaveli_lcf OpenFOAM Post-Processing 7 October 18, 2023 11:28
Dynamic mesh in parallel udf rsarma Fluent UDF and Scheme Programming 3 August 2, 2018 07:02
Interesting problem: Parallel Processor VOF Fluent + Dynamic Mesh + System Coupling spaceprop FLUENT 5 September 2, 2014 09:43
[blockMesh] is parallel processing available for mesh generation? sachinlb OpenFOAM Meshing & Mesh Conversion 4 August 18, 2012 04:11
Dynamic Mesh moving interface help akash.iitb FLUENT 0 August 23, 2010 23:53


All times are GMT -4. The time now is 03:14.