
[Sponsors] 
July 2, 2014, 13:00 
UDF for move a wall with a hole

#1 
New Member
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 5 
Hello sirs;
Our team is developing an UDF for scour predictions. At this time we have the main code that includes the wall shear stress calculation and the velocity of deformation inside a DEFINE_GRID_MOTION macro. We have builded and loaded correctly the UDF and defined the parameters in the Dynamic Mesh menu but when we start the calculation it crashes when tries to advance one time step. In the Dynamic Mesh we have defined the wallbed as a UserDefined surface and all others boundaries as a stationary surfaces, even the wall of the pier. We use the layering approach to calculate the dynamic mesh movement. We have think that our problem could be at the junction between the wallbed and the wallcylinder. What do you think? In a few moments I will post our present code. Last edited by Entwistle; July 2, 2014 at 14:26. 

July 2, 2014, 14:34 

#2  
New Member
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 5 
This is the code of our UDF:
Quote:
Thanks. 

July 2, 2014, 14:56 

#3  
Senior Member
Join Date: Nov 2013
Posts: 1,051
Rep Power: 14 
You don't want answers from female readers?
Quote:


July 2, 2014, 15:01 

#4  
New Member
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 5 
Quote:
Fluent stop the calculations and show us an error message: Segmentation fault Thank you. Edit: FYI, our domain for the validation of the code is a rectangular flume (X (long) from 2 to +2 m, Y (width) from 0.6 to +0.6 m and Z (vertical) from 0 to 0.2 m). The pier is a cylinder with it's center at (0,0,0) and a diameter of 0.2 m. The bed (bottom boundary) is a rough wall. The surface of the cylinder is a smooth wall. X = 2 plane is the inlet BC and X = +2 plane is the outflow BC. Both lateral boundaries and the top boundary are symmetry faces. For the test case we use the realizable keps with all other values (coupling scheme, gradient treatment, etc.) set by default. 

July 3, 2014, 09:58 

#5  
Senior Member
Join Date: Nov 2013
Posts: 1,051
Rep Power: 14 
Quote:
Quote:
To solve this, you should debug your code. For example, try this one: (your version with most of it removed) Code:
#include "udf.h" DEFINE_GRID_MOTION(cambio_malla,domain,dt,time,dtime) { Thread *tf = DT_THREAD(dt); Domain *d; face_t f; Node *v; real A[ND_ND]; real NV_VEC(velocity), NV_VEC(axis); real NV_VEC(origin), NV_VEC(rvec); real vel,wss,tau,area; int n; d=Get_Domain(1); } 

July 3, 2014, 14:49 

#6  
New Member
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 5 
Quote:
Quote:
I try a code based on my first one but without the calculation of the wall shear stress. In this case, we use a formula for grid motion based on the distance to the center, something like z_movement = Constant*dtime/r, where r = (x^2+y^2)^0.5 and restricted to r >= 0.1 (so it only moves the mesh outside the cylinder in order to avoid possible errors). When we preview the movement, it seems to be correct, but when we try to iterate for some time steps, Fluent tell us that there is a negative volume. We try the smoothing method and the layering method, and we activated the implicit option in dynamic mesh menu. Our boundaries were defined as stationary (inlet, outflow and symmetries), as deforming (wall of the cylinder) and as user defined (wallbed). Our mesh is formed by only one body and uses hexaedral elements. Tomorrow I will send you a picture of our mesh for this test case. Some kind of trip in order to avoid the nonpositive volume? We also reduce the time step, but even with this action the model presents the nonpositive volume. On the other hand, it seems like the problem for the segmentation fault is in the calculation of shear stress, but it is strange because the method that we use was proposed by the Ansys Support Team (unfortunately, the can not help us more because our support does not include help about any error when we use UDFs). Thank you for your answers. Bests regards. 

July 4, 2014, 08:30 

#7  
New Member
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 5 
Hi all;
as I promised yesterday, I send you some images of my test mesh. Finally, after some code debugging, the test UDF for deform the mesh it's ok. The test function for DEFINE_GRID_MOTION is the next: Quote:
So, we think that now we only have to add the calculation of the wall shear stress in order to modify the dz[2] avobe expression. Our first idea is something like that: Quote:
One last thing is an extrange value of the velocity field that we saw in the test case for the test DEFINE_GRID_MOTION (the first one, without wall shear stress calculation). The velocity inlet is 0.3 m/s (the blue zone Thank you very much. Best regards. Last edited by Entwistle; July 4, 2014 at 08:47. Reason: add image files 

July 8, 2014, 04:08 

#8  
New Member
AFM
Join Date: Nov 2013
Posts: 14
Rep Power: 5 
Hi all, finally we got an UDF that seems correct. However, when we run it, Fluent shows a floating point exception, and divergence in all solvers (we use a Realizable keps model).
Our last code is the next: Quote:
Thank you. 

November 19, 2014, 13:34 
Scour around a bridge pier

#9 
Member
muhamed
Join Date: Jun 2013
Posts: 67
Rep Power: 5 
Hello.
Could you please help me? I want to do a simulation to study the scour around a cylindrical bridge pier inside a channel same as your model. Could you please tell me how you drew your geometry, one body? or two bodies, one for the fluid and the other for sand material? and what about Fluent setup? I will be very thankful if you can help me. 

December 15, 2014, 10:11 

#10 
New Member
hayder
Join Date: Dec 2013
Posts: 3
Rep Power: 5 
Hi all, finally we got an UDF that seems correct. However, when we run it, Fluent shows a floating point exception, and divergence in all solvers (we use a Realizable keps model).
Our last code is the next: Quote: #include "udf.h" #include "dynamesh_tools.h" static int wall_id= 9; DEFINE_EXECUTE_AT_END(tau) { Domain *domain = Get_Domain(1); Thread *ft,*ct; face_t f; cell_t c; real shear_stress; real ts_force[ND_ND]; real area[ND_ND]; ft=Lookup_Thread(domain,wall_id); begin_f_loop(f,ft) { F_AREA(area,f,ft); N3V_V(ts_force,=,F_STORAGE_R_N3V(f,ft,SV_WALL_SHEA R)); shear_stress=sqrt(ts_force[0]*ts_force[0]+ts_force[1]*ts_force[1]+ts_force[2]*ts_force[2])/sqrt(area[0]*area[0]+area[1]*area[1]+area[2]*area[2]); c=F_C0(f,ft); ct=THREAD_T0(ft); C_UDMI(c,ct,0)=shear_stress; } end_f_loop(f,ft) } DEFINE_GRID_MOTION(cambio_malla,domain,dt,time,dti me) { Thread *tf = DT_THREAD(dt); face_t f; cell_t c0; Thread *ct0; Node *v; real vel, tau; real NV_VEC(dz); /*real zprev=0.0;*/ int n; /* set deforming flag on adjacent cell zone */ SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); NV_S(dz,=,0); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); if (NODE_Z(v)<0.001 && (NODE_POS_NEED_UPDATE(v)) && (sqrt(pow(NODE_X(v),2) + pow(NODE_Y(v),2))<0.3)) { NODE_POS_UPDATED (v); c0=F_C0(f,tf); ct0=THREAD_T0(tf); tau = C_UDMI(c0,ct0,0); vel=0.0158*pow((3.584*tau1),1.5); dz[2]=vel; NV_S(dz,*=,dtime); NV_V(NODE_COORD(v), =,dz); } } end_f_loop(f,tf); } } Hi Entwistle I got the same problem in Fluent are you found the answer for the divergence solution problem? please help me if you have any idea. 

Tags 
gris motion, udf 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Enhanced Wall Treatment  paduchev  FLUENT  19  April 10, 2016 09:57 
UDF for slip and moving wall  lichun Dong  FLUENT  3  March 26, 2014 05:37 
Natural convection in a closed domain STILL NEEDING help!  Yr0gErG  FLUENT  3  June 12, 2013 02:12 
UDF hook on the WALL boundary condition  Luke  FLUENT  0  June 7, 2006 11:54 
udf: dimensionless wall coordinate  Chris  FLUENT  0  June 22, 2004 06:10 