UDF for move a wall with a hole
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 wall-bed as a User-Defined 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 wall-bed and the wall-cylinder. What do you think? In a few moments I will post our present code. |
This is the code of our UDF:
Quote:
Thanks. |
Quote:
Quote:
|
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 k-eps with all other values (coupling scheme, gradient treatment, etc.) set by default. |
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" |
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 (wall-bed). 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 non-positive volume? We also reduce the time step, but even with this action the model presents the non-positive 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. |
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. http://oi61.tinypic.com/16aphj6.jpg http://oi58.tinypic.com/8wywkz.jpg http://oi57.tinypic.com/2s7fd43.jpg |
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 k-eps model).
Our last code is the next: Quote:
Thank you. |
Scour around a bridge pier
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. |
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 k-eps 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*tau-1),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. |
All times are GMT -4. The time now is 11:59. |