Dynamic Mesh Motion in Ansys Fluent - Part 1
Hello everyone, this is Mohsen Seraj from Ozen Engineering, Inc. Today, I want to talk a little bit about dynamic mesh motion in Ansys Fluent. Whenever we have any moving boundary in the domain, sometimes we call it deforming mesh or moving wall mesh, depending on how we treat the changing shape of the mesh. This could involve adding or removing the mesh, and we refer to all of this as dynamic mesh motion in Ansys Fluent.
General Steps for Dynamic Mesh Motion Process
- Read the initial mesh.
- Set the solver to transient.
- Activate the dynamic mesh.
- Choose the meshing method:
- Smoothing
- Layering
- Remeshing
- Add global settings and options for the dynamic mesh method.
- Assign the mesh motion to the zones, usually using a profile or UDF.
- Check the mesh motion by displaying the moving zone.
- Preview the mesh motion to see changes from the initial mesh.
Activating Dynamic Mesh Motion
To activate dynamic mesh motion:
- Start from the slide bar in the outline view, click on Dynamic Mesh, and check the task page.
- Alternatively, use the toolbar on top in the mesh model section and click on Dynamic Mesh Motion.
Choosing Mesh Methods
Choose one or more mesh methods:
- Smoothing: Applied to any type of mesh elements, including 2D (tri or quad) and 3D (tetrahedral, hexahedral, prism, or polyhedral).
- Layering: Used for structured mesh, applicable to quad elements in 2D and wedge, prism, and hexahedral elements in 3D.
- Remeshing: Suitable for large relative motion of the boundaries, works well with tetrahedral and polyhedral cells in 3D.
Mesh Motion Assignment
Assign motion or conditions to zones, boundaries, and walls:
- Types of conditions:
- Stationary Zone
- Rigid Body
- Deforming Zone
- User-Defined Function (UDF)
- Fluid-Structure Interaction (FSI)
- Display the motion on the screen to detect any problems.
- Preview mesh motion and assign time step size and number of time steps.
Dynamic Mesh Methods
Smoothing
Used for mesh deforming with moving nodes. It can be applied to any mesh type and element shape.
Layering
Used for structured mesh with linear motion, adding or removing cell layers. Faster and more accurate than unstructured remeshing.
Remeshing
Works with large relative motion by splitting or collapsing elements. Often used with smoothing for better performance.
Global Settings
- Smoothing: Options include spring, boundary layer diffusion, linear elastic solid, and radial basis function.
- Layering: Options include height-based and ratio-based, with spillage or collapse factors.
- Remeshing: Typically uses unified remeshing, with options for local cells, local phase, region phase, or 2.5D remeshing.
Additional Options
- In-cylinder: Defines motion based on the correct angle for a cylinder in a reciprocal engine.
- Six Degrees of Freedom: Relates motion to force and moment balance.
- Implicit Updates: Enhances stability by allowing multiple mesh updates during each time step.
- Contact Detection: Ensures walls do not collide undesirably.
Defining Motion of Zones
When defining the motion of zones:
- Use different types of assignments for the moving zone:
- Stationary
- Rigid Body Motion
- Deforming Zone
- UDF or System Coupling
- Prepare profiles for motion using a text file with extensions .txt or .prof.
Examples
Here are some examples of dynamic mesh motion methods:
Smoothing Method
Using the spring Laplace boundary layer, the mesh compresses and expands as the domain moves.
Layering Method
Using ratio-based split and collapse factors, layers of cells are added or removed as the mesh deforms.
Remeshing Method
Using unified remeshing, the mesh refines around a moving object, like a ball moving horizontally.
Conclusion
Setting up dynamic mesh motion in Ansys Fluent involves careful planning and execution. Ensure that all settings are correct, preview the mesh motion, and choose appropriate time steps. Remember, initialization does not reset the mesh to its original shape; you must exit and relaunch Fluent to do so.
Thank you very much for watching this video.
Hello everyone, this is Mohsen Seraj from Ozen Engineering team. Today I want to talk a little bit about dynamic mesh motion in Ansys Fluent.
So, whenever we have any moving boundary in the domain, sometimes we call it deforming mesh, sometimes we call it moving wall mesh, depending on the way that we want to treat the changing shape of the mesh, it could be, for example, adding or removing the mesh.
So, all of this we call it dynamic mesh motion in Ansys Fluent. Today I want to talk about this; please watch this video. So, the general steps for the dynamic mesh motion process are that first of all, we need to read the mesh, the initial mesh, and we have to set the solver to transient.
Activating the dynamic mesh, I'll show you how, and we have to choose the meshing method that could be smoothing, layering, or remeshing. Also, we can add global settings and also options for the dynamic mesh method. And then we need to assign the mesh motion to the zones, so the moving zones.
That usually we use a profile or UDF. After setting up the moving zones, it is always recommended to check the mesh motion. So, specifically, we can display the moving zone. In this way, we are still in the initial shape for the mesh.
But if we preview the mesh motion, then the shape of the mesh changes and it is different from the initial mesh. This is the way we can work on the dynamic mesh motion in Fluent. To be fluent, after reading the mesh, we have to start the transient solver.
To activate the dynamic mesh motion, I can start from the slide bar that is the outline view, click here on the dynamic mesh, and then check mark here for the task page.
Another way is that on the toolbar on top, ribbon on top, in the domain, in the mesh model section, you have to click on dynamic mesh motion. Then we need to choose what mesh method we want to use.
It could be not only one, it could be every one of them or it could be all of them or just some of them together. This is a simple method of smoothing, layering, and remeshing. Then you click in the setting if you want to do some adjustment and changes to the setup.
For each method, it depends on the method - smoothing, layering, and remeshing. And if you need specific options, we can also activate them for, in cylinder, six degrees of freedom input, explicit update, and also contact detection.
And then we come here, click here to create and edit, and in this way, we can start assigning the motion or some conditions to the zones, to the boundaries, to the walls.
The types of conditions that we have could be a stationary zone, could be rigid body, could be deforming zone, or if we can use UDF as a user-defined, or if it is FSI, which is Fluid-Structure Interaction, that they have.
Before finishing the setup, you can display the motion on the screen and the window, you can see how the moving zone behaves.
If there is any problem, you can detect that, and also you can click on preview mesh motion and then assign the time step size and number of time steps, and then you can see how the mesh moves. For dynamic mesh methods, we have three main methods.
For smoothing, it is usually when we have mesh deforming that comes by moving nodes. It could be something moving inside the domain or it could be one of the external walls or boundaries moving.
The good thing about the smoothing method is that it can be applied to any type of mesh, any type of elements. In 2D, it could be tri or quad mesh element shape, and in 3D, it could be whatever - tetrahedral, hexahedral, prism, or polyhedral element.
Next method is layering, and it is used when we have first of all structured mesh. So, it only applies to quad elements in 2D and to wedge, prism, and hexahedral elements for three-dimensional simulation.
When we have linear motion, and this linear motion could be translation, could be rotation, whatever that here we have. And the way it is working is that we just add or remove cell layers because it is a structured mesh, so we can work on the adding or deleting cell layers.
The good thing about the layering method is that it is faster and more accurate compared to the unstructured remeshing method.
And it is straightforward, okay, that we can use it; the only thing is that if the time that we is better to not use layering method is that if we are moving walls, maybe it has an effect on the turbulence and pressure fluctuations in the whole domain, so it is something that we need to take care about that.
Last method is remeshing, and basically, it works with large relative motion of the boundaries and inside the domain by splitting or collapsing the elements that we have. It works well with tetrahedral and polyhedral cells in 3D, and also when we have 2.5D remeshing, it is a good method.
So, it is available only when we have mostly when we have tri or tetrahedral elements, and most of the time, we use this method, remeshing method with smoothing together. That can increase the performance and feature better the dynamic mesh motion.
So, if we have short motion distances, then specifically compared to the cell size, then we can use smoothing only, and if we have long motion distances, then it is better to use smoothing and remeshing together.
For global setting up for smoothing method, we have four different options here available, which is spring or boundary layer diffusion, which is the default method for smoothing, and two more, which is linear elastic solid and radial basis function. For layering, we have two options.
For global options, it is height-based to adding or removing layers or ratio-based. And we have to assign spillage factor or collapse factors. About what is the best suited for your application, you can try different values.
But this split factor means that it is when we have, for example, 40% increase in the height of the layer, then it will be split into two layers; I will add new layers, and if it collapses to 20, then it is just removing the layer.
The next method, which is remeshing, is that we usually use unified remeshing. If we want to go to another option, which is method-based remeshing, it could be in terms of the setting the sizing that it could be in terms of local cells, local phase, region phase, or 2.5D remeshing.
So, it depends on what way we want to work on that, but usually, unified meshing works for most of the cases.
Besides global setting, we have options; start with in-cylinder, it is when we want to define the motion based on the correct angle, when we want to consider the motion of a cylinder in a reciprocal engine.
Next option is six degrees of freedom, it is when we relate the motion to the force and moment balance. Implicit updates, it is when we need multiple mesh updates during each time step to have better stability of the solution.
We have two time steps when we run transient simulation with dynamic mesh. One time step is for dynamic mesh that it depends on the size of the smaller cell mesh element that we have, and the maximum expected velocity for the motion for the mesh motion.
Another one is the time step for simulation, and we have to be sure that the smallest time step should be chosen when we are running the transient simulation with dynamic mesh motion. Implicit updates help in this way to increase the stability of the solver.
If you have contact, we need special treatment to be sure that before walls collide together, when they come together closer and closer, that it can be detected.
And if we have periodic boundary conditions, so it is something that also, for example, for blade flutter analysis, that we can use that option. To define the motion of the zone when it comes to the moving zone, this is something that we also need to be careful about.
We have different types of assignments for the moving zone. The first one is stationary, the next one is rigid body motion, the deforming zone, when also define the motion based on the UDF or if we have system coupling.
For stationary, when we choose stationary for a zone, when we have from the list of the zone names, for example, for bottom here, some things that we need to know about that is that for meshing, the meshing option that we have, we have to choose a number for this cell height.
It is based on the size for the first cell layer adjacent to the condition that we apply. It could be based on the local remeshing, for dynamic layering, or it could be for some things that depend on the method that we are using.
Generally, it is the size that we enter here for cell height, it is close to what we have in the initial size for the mesh. Next one is rigid body motion. So, for stationary motion, it is the one that basically that zone is not supposed to have any motion, it is like a static mesh.
The next step is the dynamic mesh setup. In dynamic mesh setup, every zone is stationary unless the parent zone is moving, then the zones inside this parent zone are also moving. Next is Rigid Body Motion.
For Rigid Body Motion, it means that the shape of the mesh is not deformed, but it is more, for example, considered translational motion up and down, or to the left and right. So, the shape of the mesh is not deformed, but the position is changing.
It could be applied to whatever boundaries or zones that we have. Mesh attributes could be in terms of profile or UDF. I will talk about this a little bit.
And motion options, this is similar to this case that we have; again, we have to define the cell height, which is respect to the initial mesh cells, and it is to specify the size of the first cell layer, which is in the neighborhood of the condition. So, rigid body motion needs profile or UDF.
Next is deforming mesh. Some things that you have to know that when we are moving nodes, okay, Fluent doesn't know what's going on to the geometry. It just has the current node position.
So, if the boundaries adjacent to the moving wall that we need the mesh slides along this boundary, consider a piston in the cylinder moving up and down. At the moving boundary, which is the top face of the piston, we know that we have prescribed motion, for example, say that vertical motion.
On the cylinder side, we have to define that deforming mesh, that then we know that the elements can slide along these walls, cylindrical walls.
So, we need to define where we have the forming mesh, the forming wall, or the forming zone, and here for motion attributes, we have a list; we usually go with face-setting, that we don't need to define anything, but if we go with plane, then we need to define at least one point on the plane.
For example, the region that we have for deforming, and also the normal to that wall. Meshing options, another tab here that we need to set it up. Usually, we have remeshing and smoothing together. We can have global setting, that it is by default populated.
Please be sure to correct any misspelled Ansys product names as you transcribe. So, we can have a minimum, maximum, length scale, and skewness, specifically about that region. Using a user-defined UDF to define the motion of the boundaries or of the zone.
Here again, in the mesh attributes, we need to load; before that, we need to load the UDF. If you have interpreted that, be sure that it is working well with no error, and then you can see that here, for example, yeah, here, let me show you.
Here, for example, when it is user-similar to rigid body motion, we have the UDF here loaded already that it is ready to use for dynamic mesh motion, and this cell height again, it is for the first row adjacent to the condition, and usually, we go with the initial mesh size.
If we have FSI, then we need to relate the moving boundaries in Fluent to what we have from Ansys Mechanical, and it is something that we have the workflow for that, and can have a workflow for that in Workbench.
In almost all of these types of motions, we have an item that says exclude mesh motion in boundary conditions. It means that when we have the moving mesh, for example, adjacent to the inlet or outlet or a wall or whatever, we can exclude that mesh motion from the boundary condition.
Specifically, at the very beginning, at the initial time when we start the dynamic mesh motion, we may see some undesired effect for the stationary zones. Regarding, for example, for the velocity field or pressure field.
We need to prepare profiles for the motion when it comes to the rigid body motion, for example, or UDF. We need to define the motion, prescribe motion for that if it is, for example, sinusoidal motion or whatever. After preparing that, I'll show you the format. We need to read it.
We need to load that profile before using that in dynamic mesh motion. So, you come to the physics tab, and on the sections here that we have for the zones, you click here for the profile, and you can read the profile here.
The text file is a text file; I will show you the format, what the format is; the extension could be .txt or we can have it as .prof.
So, it is when it is read; if it is successful, it will show you the parameters that here, one of them for sure is time, and another one for this case, for example, it is vertical motion; it is y component. Click OK.
Then, when you want to use a profile for rigid body motion or whatever in defining the moving zone in dynamic mesh setup, you can see that it is readily there. The format for that, either you can write down in vertical in column format or arrange them in the horizontal array.
First one is time; if it is y motion, then you have y component; if you have horizontal motion, you have x component; if you have general motion x and y, then you have x component and y components.
The number of the data point that we have for the time and for the position should be the same, and mentioned here, it says that data point; it is 11, or for example, for this one, which is the velocity, it is 5 points. So, we have five data points for the time and five data points for the velocity.
And I'm going to show you some examples about each of these methods. Okay, I already read the case file. I choose transient solver. Or you can check the mesh and display the mesh here.
Either from on the sidebar, I can come here to go for the dynamic mesh, or when we are on the domain, I can click here, and I will show this task page in the middle. Click here; I can see the dynamic mesh; these are the different methods that we have, depending on what we have.
I have the global setting for that; for example, smoothing, I have four options; remeshing, two options; layering, two options. And on some of them, we have advanced global setup; for example, for diffusion, diffusion is the default setup for smoothing.
Or for remeshing, for example, if we want to adjust something here. If I want to define in-cylinder or six degrees of freedom or whatever, I can click here. So, after defining the mesh method, setting, and options, then I will come to create and edit moving zone.
Here, in the list, I have all zones available in this model. I can choose one zone, for example, here, and define the stationary. Here, you can see that we have mesh options that I already showed you. And here, for solver options, usually, we have only just solution stabilization.
For rigid body motion, we have motion attributes. Here, I already read the profile, so I have here a profile, but if I had a UDF, also I have UDF here. I need to define the center of gravity location for that.
And if it is relative motion, like, for example, solar gears, gear terrain that we have for the gears, we can use that. If you need to set it up, then it is the first cell size row in the domain regarding the conditions that we have. The forming motion attribute, I will talk about that.
Let me talk about when we have this option that excludes mesh motion in boundary conditions; it means that the mesh is moving, but not exactly at where we have the boundary conditions.
It is to just avoid some undesirable effect that we don't like to see, specifically, it is like a shock at the very beginning when we start the solution. We need to define geometric definition.
The forming mesh is that we allow sliding of the mesh along the boundaries due to the moving of other boundaries.
For example, a piston that is moving up, then the mesh is just collapsing, compressing the mesh elements, and the elements that are in contact with the cylinder wall can move and slide along that wall. Phase Setted is the one that we don't need any setup; everything is done by follow-up.
If we choose Plane, then we need to choose a point on the plane and the normal of the plane. Also, to moving in-cylinder or use UDF. Mesh options are already talked about; it is for global setting, minimum length scale, maximum length scale, and skewness.
You can click here to give the information that here you have for that specific button. It is that specific mesh zone. Solver, we can set the stabilization, and be sure that usually we click here to exclude the mesh motion from boundary condition.
UDF, if you have a UDF here, is already loaded, and we can use it. Again, the cell height, same as before. And system coupling, it is when we have; we use FSI when we have the flow-structure interaction, coupling that between Fluent and Mechanical using the workflow that we have in Workbench.
So, after that, we can display the moving mesh that shows we have the moving boundary wall at the bottom, and we need to set the time step size. This time step size could be different from what we use in the transient simulation. And we can see the preview of the mesh motion.
We need to do this; it is highly recommended to be sure that the dynamic mesh motion is correctly set up. You can see that. Okay, if we go, this is for moving up, and this is for moving down. We can also check the time. Another cycle of moving up and moving down.
You can see that when it is going up, the cells compress, and when it is moving down, the cells are stretched, and we have adding of the layers of the cells because we have only layering mesh motion method.
Suppose that I have the mesh deformed like this, so, as you can see, that the time is 2.5 to the minus 1 second, and the mesh is deformed, which is quite different from the initial shape that we had for the mesh. Now, if I initialize it, it doesn't mean that the mesh back to the original shape.
So, we have to exit Fluent, relaunch Fluent, read the mesh again in the initial form, and initialize the model. After being sure about that everything is correctly set up for dynamic mesh motion, read the mesh in initial form, initial shape, and then start the simulation.
Okay, let's look at some examples here. I start with a smoothing method, and the setting is based on the spring Laplace boundary layer. This is the domain; this is the mesh that we have, and we choose to include all element types, try and quad cores.
As you can see, the moving domain is at the bottom, and let's see. So, as you can see, the bottom mesh will start moving, moving upward and downward. It starts, so we see that the mesh at first compresses, both quads and triangulated, and then going down.
Now it is expanding, and you see that the size of quads and tetrahedral, triangular elements increasing. Okay, this is for the next example; it is for layering. We are going to use ratio-based, and this is the split factors, split and collapsing factors. This is the mesh for this example.
You see that it is structured mesh, quad elements that we have, and the moving bottom is moving upward and downward. Remember that in this method, when the mesh deformed, then we have removing or adding the layers of the cells.
So, when it's going up, the layers of the cells removing, and now going down, then the layers added layer by layer. The last example is about remeshing. As I said, usually, we use remeshing and smoothing together. For the remeshing, I use unified remeshing option here.
The problem is that in this domain, the ball is moving horizontally from left to the right, and you see that wherever we have the mesh, we have refinement around the mesh, and as the mesh is moving toward the right, then we see that the refinement also is moving forward.
And you can see the result is the same. Let's see; let's start dynamic mesh motion and look at the way that the mesh refinement moving with the ball, and after that, we can have at the same time coarsening of the mesh.
You can see that I have to mesh refine, and this is for tetrahedral performed TETS element. So, in all these three examples, we have moving walls, and also, we have some other boundaries that we have stationary or deforming zones.
For example, in this example, if you look at the mesh, the mesh is sliding along this wall and this wall, so this wall and this wall should be deforming zones, and the next step is to define the vertical motion of the moving wall.
At the bottom of the moving wall, it should be a rigid body motion, so we need either a profile or a UDF to define this vertical motion for the moving wall. Again, we have a stationary on top, a stationary wall.
Here, also, as you can see, here, as the wall is moving, the mesh is sliding along this wall and this wall, and also maybe here and here, and also this curve and the other curve.
So, we need again deforming boundary conditions, deforming moving zones, and for defining the motion definition, horizontal motion definition, again, we have to use profile or UDF. So, hopefully, all these examples are taken from the Ansys training materials.
Hopefully, I could show you what the main steps are for setting up dynamic mesh motion. You need to think ahead about the moving walls, about where the moving mesh are in contact with the other boundaries or other zones, and if these zones are deforming or can be stationary type.
And for the definition of the rigid body motion, also, we need either to have a profile or a UDF, so we also need to prepare this for the motion definition.
Don't forget to always preview the mesh before really running the simulation, and also, you need to also find a good and appropriate size for the time step, and then comparing that with the time step for the simulation.
The smallest will be the one that should be used when you start running the Fluent model with dynamic mesh motion. Don't forget that initialization does not return the deformed mesh to the original shape.
You need to exit Fluent, relaunch Fluent, read the mesh again in the initial form, initial shape, and then, by initialization, you can start the simulation. But again, by previewing the mesh, be sure that the mesh is correctly set up for dynamic mesh motion.
Thank you very much for watching this video.