Spin It to Win It: Dynamic Meshes and Transient Turbine Simulation in OpenFOAM
For simulating turbomachinery like Pelton turbines, a stationary mesh just won’t cut it. We need to account for the actual rotation of the rotor to accurately capture the fluid dynamics. That’s where dynamicMeshDict
in OpenFOAM comes into play! This powerful tool allows us to define and control the motion of our mesh over time, enabling transient simulations where the mesh itself is moving.
In this blog post, we’ll explore how to use dynamicMeshDict
for simulating a rotating Pelton turbine, covering the key concepts and providing a practical example based on a tutorial I’ve prepared.
Why Dynamic Meshes for Turbomachinery?
Imagine trying to simulate a Pelton turbine with a static mesh. You’d have to resort to tricks like rotating frames of reference, which can introduce inaccuracies and complexity. A dynamic mesh offers a more direct and intuitive approach:
- Accurate Representation: The rotating mesh faithfully represents the movement of the turbine rotor, capturing the transient interaction between the water jet and the buckets.
- Improved Convergence: By moving the mesh with the rotor, we avoid large relative velocities between the fluid and the mesh near the rotor surface, leading to better convergence and stability.
- Realistic Simulation: A dynamic mesh allows us to capture phenomena like unsteady flow patterns, turbulence, and vortex shedding that are crucial for understanding turbine performance.
dynamicMeshDict
: The Control Center for Mesh Motion
The dynamicMeshDict
file, located in the system
directory of your OpenFOAM case, is the heart of dynamic mesh simulations. It defines how the mesh will move and deform over time. Here’s a breakdown of the key elements:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");
dynamicMotionSolverCoeffs
{
type rotatingMotionSolver; // This defines the type of motion
rotatingMotionSolverCoeffs
{
origin (0 0 0); // Center of rotation
axis (0 0 1); // Rotation axis (z-axis in this example)
omega table // Time-dependent rotation speed (rad/s)
(
(0 0); // Time = 0s, omega = 0 rad/s
(0.01 10); // Time = 0.01s, omega = 10 rad/s
(10 10); // Time = 10s, omega = 10 rad/s (constant speed)
);
}
}
// ************************************************************************* //
Let’s break down this dynamicMeshDict
:
dynamicFvMesh dynamicMotionSolverFvMesh;
: This line specifies that we’re using a dynamic mesh solver.motionSolverLibs ("libfvMotionSolvers.so");
: This loads the library containing the motion solvers.dynamicMotionSolverCoeffs
: This block defines the parameters of the motion solver.type rotatingMotionSolver;
: This tells OpenFOAM that we’re using a solver for rotating motion.rotatingMotionSolverCoeffs
: Here’s where we specify the rotation details:origin (0 0 0);
: The coordinates of the center of rotation. Adjust this based on your turbine’s geometry.axis (0 0 1);
: The axis of rotation. In this case, it’s the Z-axis.omega table (...)
: This is the most crucial part. It defines the angular velocity (omega
) of the rotor as a function of time. We use atable
to specify discrete points in time. You can define a constant speed, an acceleration profile, or even a complex, time-varying rotation. In this example, the turbine accelerates from 0 to 10 rad/s within 0.01 seconds and maintains that speed.
Pelton Turbine Tutorial: A Step-by-Step Guide
Let’s walk through a simplified Pelton turbine tutorial using dynamicMeshDict
:
1. Mesh Generation:
- Create a mesh for your Pelton turbine geometry. This will typically involve CAD software and a meshing tool like
blockMesh
,snappyHexMesh
, or a third-party tool. - Ensure your mesh is suitable for dynamic motion, meaning it has a good distribution of cells and avoids highly skewed or distorted elements, especially near the rotating parts. Consider using a sliding mesh interface (AMI) to connect the rotating and stationary regions.
2. Case Setup:
- Create a standard OpenFOAM case directory structure.
- Copy the initial conditions (
0
directory), transport properties (constant/transportProperties
), and turbulence model settings (constant/turbulenceProperties
) files to your case. - Place the
dynamicMeshDict
file (as described above) in thesystem
directory. Remember to adjust theorigin
,axis
, andomega
values to match your specific turbine design and operating conditions.
3. Solver Selection:
- Choose an appropriate solver for your simulation. For incompressible flow,
pimpleDyMFoam
orpisoFoam
are common choices. For compressible flow, considerrhoPimpleDyMFoam
. The “DyM” suffix indicates the solver is designed for dynamic meshes.
4. Control Dictionary (system/controlDict
):
- Set the simulation parameters in the
controlDict
file:startTime
: The initial time of the simulation (usually 0).stopTime
: The end time of the simulation. Set this long enough to capture the desired transient behavior.deltaT
: The time step size. Choose a small enough time step to ensure numerical stability and accuracy. A Courant number (Co) less than 1 is often recommended.writeInterval
: The frequency at which results are saved.functions
: (Optional) Use functions to calculate forces, torques, or other quantities of interest on the turbine rotor.
5. Running the Simulation:
- Execute the solver in the terminal:
pimpleDyMFoam -case <your_case_directory>
6. Post-Processing:
- Visualize the results using ParaView. You’ll see the mesh moving and deforming along with the fluid flow.
- Analyze the flow patterns, pressure distributions, and forces acting on the turbine rotor. Calculate the turbine’s efficiency and performance characteristics.
Important Considerations:
- Mesh Quality: The quality of your mesh is critical for dynamic mesh simulations. Poor mesh quality can lead to numerical instability and inaccurate results. Pay close attention to cell skewness, aspect ratio, and non-orthogonality.
- Time Step Size: A smaller time step generally leads to more accurate results but also increases computational cost. Experiment with different time step sizes to find a balance between accuracy and efficiency. Monitor the Courant number to ensure stability.
- Sliding Mesh Interface (AMI): For complex geometries with large relative motions, consider using AMI. This interface allows for non-conformal meshes at the interface between the rotating and stationary parts, simplifying mesh generation.
- Solver Stability: Dynamic mesh simulations can be more challenging to converge than static mesh simulations. Use appropriate turbulence models and numerical schemes to improve stability.
Example: Accelerating Pelton Runner
In the provided dynamicMeshDict
example, the omega
table defines an acceleration profile. The turbine rotor starts from rest and accelerates to 10 rad/s within 0.01 seconds. This allows you to simulate the start-up phase of the turbine and observe the transient effects of the accelerating rotor on the water jet.
Functions for Performance Analysis
OpenFOAM offers powerful function objects that can be embedded within the controlDict
to calculate key performance indicators during the simulation. For a Pelton turbine, you might use:
forces
: To calculate the force and torque on the turbine runner.fieldAverage
: To calculate time-averaged values of pressure, velocity, or other fields.
By integrating these functions, you can automatically track the turbine’s performance throughout the simulation, eliminating the need for manual post-processing.
Conclusion
Dynamic meshes are essential for accurately simulating turbomachinery like Pelton turbines in OpenFOAM. By using the dynamicMeshDict
and choosing the right solver, you can create transient simulations that capture the complex fluid dynamics associated with rotating components. This tutorial provides a foundation for understanding and implementing dynamic mesh simulations for your own turbine designs. Remember to focus on mesh quality, time step size, and solver stability to achieve accurate and reliable results. So, spin up your simulations and unlock the power of dynamic meshes!
CloudHPC is a HPC provider to run engineering simulations on the cloud. CloudHPC provides from 1 to 224 vCPUs for each process in several configuration of HPC infrastructure - both multi-thread and multi-core. Current software ranges includes several CAE, CFD, FEA, FEM software among which OpenFOAM, FDS, Blender and several others.
New users benefit of a FREE trial of 300 vCPU/Hours to be used on the platform in order to test the platform, all each features and verify if it is suitable for their needs
0 Comments