## Fluids

Topics relate to Fluent, CFX, Turbogrid and more

#### A rigid body being moved by water within a dynamic mesh.

• Alassedi
Subscriber

Dear all, I have a cylinder involving a piston being moved by water, as depicted in Figure 1. The water exerts a force on the piston, pushing the water located behind the piston towards the outlet. The mesh employed has an element size of 0.15 mm. I have compiled a User-Defined Function (UDF) in ANSYS Fluent for the properties of water density, water sound speed, and the motion of the piston as a “rigid body” as in the corresponding TXT File. Most simulation settings are in figures 2 through 9. The time step is 0.001 sec.
In my attempts to solve this problem, I have explored three different solution methods: SIMPLE, PISO, and Coupled. Unfortunately, all three methods have yielded the same result – convergence has not been achieved.
I kindly request assistance from anyone who can identify the errors in my work. Furthermore, I would appreciate guidance on how to correctly implement this simulation.

=================================
TXT File
=================================
#include "udf.h"

#define Bulk_Modulus 2.2e09
#define rho_ref 997.0

DEFINE_PROPERTY(water_density, c, t)
{
real rho;
real p, dp, p_operating;

p_operating = RP_Get_Real("operating-pressure");
p = C_P(c, t);
dp = p - p_operating;
rho = rho_ref / (1.0 - dp / Bulk_Modulus);

return rho;
}

DEFINE_PROPERTY(water_speed_of_sound, c, t)
{
real a_soundspeed;
real p, dp, p_operating;
p_operating = RP_Get_Real("operating-pressure");
p = C_P(c, t);
dp = p - p_operating;
a_soundspeed = (1.0 - dp / Bulk_Modulus)*sqrt(Bulk_Modulus / rho_ref);

return a_soundspeed;
}

DEFINE_SDOF_PROPERTIES(piston_rec, prop, dt, time, dtime)
{
prop[SDOF_MASS] = 0.094488;
prop[SDOF_IXX] = 0.0000291338;
prop[SDOF_IYY] = 0.000003937;
prop[SDOF_IZZ] = 0.000031496;
prop[SDOF_ZERO_TRANS_X] = FALSE;
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;
}

• Federico Alzamora Previtali
Subscriber

Hello,

Do you get any error messages or warnings? Does it runs for any number of time steps before it diverges?

• Alassedi
Subscriber

The drawing initially was as shown in Figure 1 (note that the drawing has been reversed from right to left). After executing the program, the result after the first time step is as shown in Figure 2, and the message is as shown in Figure 3 (Update-Dynamic-Mesh failed. Negative cell volume detected). There may be several other time steps before reaching the same result when reducing the viscosity of water to a level lower than that of air.

• Alassedi
Subscriber

The water velocity at inlet = 0.06 m/s.

The element size of mesh = 0.15 mm.

The time step = 0.001 sec.

• Federico Alzamora Previtali
Subscriber

Negative volume cells is the result of collapsed cells in a dynamic mesh with excessive boundary zone movement within a time step. Looking at your figures 1 and 2, your piston appears to move several times its width in a single time step. Ideally, you would want this movement to be less than a cell width (0.15mm) for any given time step to allow the solver to remesh.

I would suggest reducing the time step by a couple of order of magnitudes. You may also set the Remeshing interval to 1.

• Alassedi
Subscriber

I have re-executed the program as you indicated, reducing the time step value to 1.0E-05 and resetting the Remeshing Interval value to 1. After the fourth time step, the result was as shown in Figure 1 & 2, and the message in Figure 3 was 'floating point exception.' The Residuals plot is shown in Figure 4.

• Federico Alzamora Previtali
Subscriber

Again, it seems like Remeshing is not behaving correctly. In the Mesh Method Settings, I would suggest enabling the Region Face remeshing, this will allow remeshing of faces adjacent to the moving boundary (piston).

Are you using Smoothing as well? Smoothing and Remeshing are typically used together.

• Alassedi
Subscriber

Thank you, Federico Alzamora Previtali! Your assistance has been very helpful to me. I have reduced the time step value to 1.0E-06, and although the program is stable, it will take a very long time to complete the execution of the work. Is there a better way? Which of the following options is the best for a triangular mesh (Spring/Laplace/Boundary Layer, Diffusion, or Linearly Elastic Solid)?

• Federico Alzamora Previtali
Subscriber

Yes, these transient simulations can take quite a long time for a relatively fine mesh. As mentioned earlier, you want to have any boundary movement to be less than a cell width at any given time step to avoid collapsing cells. Depending on the objectives of your simulation and if the physics allow it, you could try to increase the size of your mesh and use a larger time step (at least for a first iteration of your simulation).

Spring-based smoothing would be your best bet for this type of translational motion. Diffusion or Linearly Elastic will be more expensive and hence take up more CPU time.

• Alassedi
Subscriber

I think that from the point of view of CFD, when water enters from the left side, it will cause vibrations in tiny parts of second to the piston in the horizontal direction. Therefore, CFD calculations should capture these small vibrations. This leads to instability unless the time step is reduced to 1.0E-06 sec. Does ANSYS Fluent software provide another option to address this issue?

• Federico Alzamora Previtali
Subscriber

I am not convinced that you will see "vibrations" for this setup. Piston velocity may oscillate slightly but should always point to the same direction.