Videos > Ansys FreeFlow/Rocky Solver SDK customization: Impinging Jet Cooling
Nov 7, 2025

Ansys FreeFlow/Rocky Solver SDK Customization: Impinging Jet Cooling

Introduction

Hello, today I would like to demonstrate how to set up a new module in FreeFlow or Rocky. The setup process is quite similar for both platforms. When starting a new project in FreeFlow, you can add various modules. If you want to include something new, such as customizing the physics or adding post-processing capabilities not currently present in FreeFlow or Rocky, this guide will help you.

Problem Overview

For this example, we are examining a jet of water impinging on a warm plate. The water is at 300 Kelvin, and the plate is at 400 Kelvin. We are focusing on SPH (Smoothed Particle Hydrodynamics) rather than DEM (Discrete Element Method) as used in Rocky.

Simulation Setup

  • Using weakly compressible SPH to define liquid properties.
  • Water enters through a small tube section, impacting the plate.
  • Plate temperature is fixed at 400 Kelvin.
  • Mass flow inlet: 0.6 tons per hour (approximately 0.0167 kg/s) at 300 Kelvin.
  • Simulation initialized at time zero.

Simulation Results

Upon running the simulation, you can observe the impact of swirl. The arrows, representing flow direction, tilt to one side, indicating swirl acting on the SPH elements. Swirl is applied only in a specific region as defined in the module.

Module Setup

  • Spray Start Time: Borrowed from the original code, can be termed as swirl start time.
  • Swirl Strength: Determines the intensity of the swirl, adjustable based on proper units.
  • Axes (X, Y, Z): Defines the direction of the swirl, set to negative Z direction in this case.
  • Region of Interest: Defined as a cylinder, matching the tube of injection.

Additional Features

  • New scalar variables can be added for plotting, such as swirl velocity.
  • Visualize swirl intensity increasing with distance from the center.

Temperature Analysis

Since this is a heat transfer problem, temperature analysis is crucial. The module setup involves:

  • Defining the Python code with consistent naming conventions.
  • Specifying variables like spray start time, swirl strength, and active regions.
  • Adding multiple regions of interest for swirl effects.

Code Implementation

The bulk of the code is in the C++ portion. Key steps include:

  1. Ensure file names match the plugin and module names.
  2. Use Rocky Plugin Configure to link GUI settings to module data.
  3. Initialize the plugin and output initialization messages.
  4. Modify forces post-calculation using RockyPluginPostForce on SPH elements.
  5. Prepare the CMake list for code compilation, ensuring package and folder names match.

For more information, please contact Ozen Engineering, Inc.

[This was auto-generated. There may be mispellings.]

Hello, today I would like to show how to set up a new module in FreeFlow or Rocky. So basically, the way it works is pretty much the same in either Rocky or FreeFlow. So, whenever you start a new project in FreeFlow, you can add different modules.

But say that you want to add something new, something that you would like to include, something that customizes the physics, the interaction between the particles, or particles and boundary, or maybe some post-processing capability that is not yet present in FreeFlow or Rocky that you would like to add for your specific problem.

For this problem, what I'm looking at is basically a jet of water impinging on a warm plate, so the jet has water at 300 Kelvin, the plate is at 400 Kelvin, and I'm only looking at SPH here.

So, basically SPH, not DEM, like in Rocky, so we have SPH where we basically define the properties for the liquid and for the SPH simulation using the weakly compressible SPH.

I am using an inlet which is water coming through this small section of a tube and the water can hit the plate and cool it down, or the water will get warmed up because we are fixing the temperature of the plate. So, the plate is defined by this wall here.

So, basically, if you go to thermal, you can define a prescribed temperature for the plate. In this case, I'm prescribing a temperature of 400 Kelvin.

So, basically, the fluid will come through this tube, through the inlet, and will hit the wall and basically the fluid can warm up as a result of that.

And, basically, for inlet I'm using a mass flow inlet of 0.6 tons per hour or in kilograms per second it's 0.0167 kilograms per second approximately at 300 Kelvin and I'm initializing at time zero basically.

So, if you look at the results from the simulation, and I'm going to run briefly, one thing you can notice is that you can actually already see the impact of swirl, the arrows, I'm plotting the arrows here, let me disable the nodes.

The arrows are tilting to one side, resulting in the swirl acting on the SPH elements. However, the swirl is only applied at a certain region, as defined in the module. If I stop this for a while, we can actually see how the module is set up.

For this module, what I did was I basically have spray start time, so basically this is borrowed from the original code. We could call it swirl start time. The swirl strength is basically how strong you want your swirl to be. This variable needs to be tuned based on the proper units.

If I increase this value, we would see the arrows being more forced to the sides. We would see more of a swirling going on as a result. The axes X, Y, and Z are the axes of swirl. As you see, I set to be in the negative Z direction, so it's going down.

So, that will dictate your direction of swirl if you're going left or right, clockwise or counterclockwise. And I also have an active region here defined as a region of interest, a cylinder.

And so, the region of interest is a cylinder where I define the location, so basically a region of interest that I've defined or you can create a region of interest by basically creating a region of interest.

If you right-click on study, you can create either a cubic region of interest or a cylindrical region of interest.

So, going back to the module, you have the region of interest as well as the reference point by which I'm going to calculate the distance from each element, each SPH element or particle, and then I will basically do the vector calculations to estimate what the swirling acceleration I need to impose for each element within the cylinder.

So, if you look at cylinder 01, that is the region of interest that I created, and then I try to match as closely as possible to the tube of injection. So, basically, this is the area where we are applying all the swirl.

Once the particle leaves that region, you can basically, you're not imposing that swirling acceleration term anymore. With modules, you can also add new scalar variables that you can plot. So, I added a few to test the code.

So, basically, one of them is the swirl velocity, for example, and you can put the nodes on and you can visualize here. So, that is basically a plot showing the swirling velocity of the particles.

So, you can see that the swirl intensifies as you go further from the center, which is where I define my reference point and my axis. There are other variables here that you can specify, the radius, and so on.

So, basically, some variables can include things that you want to verify to make sure that your code is working. And I've done quite a bit of that as well. So, basically, that allows you to incorporate a new term for the SPH elements and change the behavior of your simulation.

So, I want to look at temperature since it's a heat transfer problem, and I will basically disable or make the bottom color solid. Let's move on to the module setup. For the module setup, before we even compile it, we need a code.

The two main portions of the code are the Python code; they should always have the same names. One thing to note is the names for the file, so basically for this module I added Swirl to the original code. And here you specify some of the variables that we have in the GUI, in the FreeFlow GUI.

So, the spray start time, the swirl strength, the axis XYZ, and the active regions. This is where we specify the active regions, the regions of interest with the reference points for each of them that you add. So, you can actually add multiple regions of interest here.

You can have swirl happening in different regions. Please be sure to correct any mispelled Ansys product names as you transcribe, eg 'OptiSling' should be 'optiSLang'.

Once you activate the module in FreeFlow or Rocky, and make sure that the names correspond to the name of each code script that you have as well as the module name. And that's pretty much it for the Python. But the bulk of the code is in the C++ portion.

You can define them as an integer, because it's basically an index that you're going to access once you add the particle or SPH scalers. The code is the same as the plugin name, just make sure it matches the name of the plugin.

Rocky Plugin Configure and Rocky Plugin Initialize Access Module Data module data is the struct that we created previously here, and basically, we assign the model properties, basically we assign basic, so this is basically linking what we have from the GUI to my struct module data using the Rocky Plugin Configure.

We also have initialize, so for initialization, basically, you can output some messages that your plugin has initialized, and once you activate that plugin and you start running your simulation in FreeFlow, you would see these messages popping out.

Initialize CUDA, we don't really do much, eg initialize CUDA, make sure the names match. This is the main calculations, this plugin is called RockyPluginPostForce on SPH elements, this plugin is called RockyPluginPostForce on SPH elements, there is a pre as well.

We are basically working with the post, so once the forces have been calculated, we are basically modifying it. So, the first step is... first of all, the code only runs if the current time is basically below the start time from the model, as we defined, as the user can define.

The Ansys software is by an OZEN Engineering Ansys software, and it is a very useful tool for you to use. After that, there are a number of tear-down plugins that don't change much. For this code, we need a statement like this. We need a statement to declare the function.

The plugin that we are using with the device model, these are the arguments for the function, and we have to basically close with this statement. Once the C++ code is finalized, prepare the CMake list, giving instructions on how to compile the code.

Make sure the package name corresponds to what you have as well as the folder name and the code name of the files for the Python file and the CU file as well. Please contact us at https://ozeninc.com/contact for more information.