CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   wrong transient solution in different time steps of Dynamic mesh (

esicia December 29, 2011 10:00

wrong transient solution in different time steps of Dynamic mesh
Recently, I have tried to solve the dynamic mesh problem of a 2d moving object with the drag force of the fluid in one direction(x). I used the following UDF and after the steady simulation (for initial condition of transient) when i change the solver to unsteady (PISO) the direction of the x-force change after each time step. After 3 or 4 time steps, It reciprocate and lead to negative cells error. I have tried different boundary conditions, time steps, lower residual, different transient solver model, higher number of cells but still the contours of pressure totally change after each time step. Can any body tell me why this is happening?

#include "udf.h"
static real v_prev = 0.0;

Thread *t;
face_t f;
real NV_VEC(A);
real force, dv;
/* reset velocities */
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0);
if (!Data_Valid_P())
/* get the thread pointer for which this motion is defined */
t = DT_THREAD(dt);
/* compute pressure force on body by looping through all faces */
force = 0.0;
force += F_P(f,t) * A[0];
/* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */
dv = dtime * force / 0.0005;
v_prev += dv;
Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev,
/* set x-component of velocity */
vel[0] = v_prev;

esicia January 29, 2012 14:00

Hey Guys,

Could you please look at my .cas and .dat files and also the UDF file, here

with different time steps, after several iterations it leads to Update-Dynamic-Mesh failed. Negative cell volume detected.


tony25800 February 11, 2012 23:37

Hi Esicia

According to my experience, merely smoothing should be able to complete the task if the parameters are set properly.(The spring constant should be around 0.1) However, this may cause degradation of the mesh. Then add 'resmeshing', check info. for parameters setting. Everything should be fine.


esicia February 12, 2012 10:39

Dear tony thanks for your response

I already checked both of 'smoothing' and 'remeshing' in dynamic mesh setting but it still lead to negative cells after 4 iterations. I can not see why it is not working. The problem is so simple. Could please download the .cas, .dat and udf file which uploaded here

and try it.

Best Regards,

delaneyluke February 18, 2012 09:45

Hi Essi,
Sorry cannot view your files right now. But hav you tried a preview mesh before running your simulation

esicia February 18, 2012 11:33

Thanks Luke, for the response
In this problem the body move by drag force of the surrounding fluid and the preview mesh tools does not make sense here. This UDF works with constant velocity or time dependent velocity. Could you take a minute and run the simulation by yourself?

delaneyluke February 24, 2012 07:37

I would suggest that you, give a translational velocity (instead of your drag UDF) to move the mesh and preview it. If all works ok then move on to the drag UDF for movement.
Post some pics of your case and dynamic mesh settings.


esicia February 26, 2012 14:27

3 Attachment(s)
Thanks Luke, for the response
When I change the UDF to constant velocity of the body or time dependent velocity, It pretty works. However, for the drag force movement of the body, It leads to negative cells. Here I uploaded some pictures.

link of .cas and udf file.

All times are GMT -4. The time now is 04:08.