How to Create Cyclical Property Inputs in Flownex

Categories:

In some circumstances, the system you would like to simulate in Flownex may have cyclical properties that you would like to implement.  Some examples of this need could be a cyclical inlet pressure (such as water hammer), thermal boundary condition (such as a day to night thermal cycle), or even a geometric specification (such as valve chatter).

These cyclical properties are supported in Flownex through the “Actions Setup” workflow and can be implemented using multiple methods, such as sinusoidal, tabular, or scripted inputs.  If you would like to learn more about the prerequisite Actions Setup process and transient simulations generally in Flownex, please review the following Flownex blog post under the section “Setting up the Transient Scenario”.

Blog: Using a Table for Transient Actions in Flownex: https://www.padtinc.com/2022/01/07/using-a-table-for-transient-actions-in-flownex/

The following sections will discuss how to implement each of these cyclical methods, as well as their associated benefits and drawbacks.

Sinusoidal Cyclical Properties

When considering a cyclical input, a sinusoidal input may be appropriate in scenarios where you can easily define your cycle by varying sinusoidal coefficients, as seen in the image below:

Picture1

This approach can be very simple to configure if your cycle conforms to a sinusoidal behavior.  If your cycle cannot be easily defined with a sinusoidal waveform, other cyclical specification methods are likely more suitable to fit your needs.

Tabular Cyclical Properties

A tabular specification can also be used for a cyclical property, but you will need to manually create the cyclical table until the end time step of your simulation.  This can often be accomplished in Microsoft Excel or a similar tool, and then you can copy the full duration table into the Flownex actions setup when “TABLE” is selected as your action type. 

Picture2 1

You can see an example of implementing a trapezoidal waveform using a table in the image below.  If we would like to extend the physical simulation time, we would need to manually add additional rows of tabular data.

Picture3 2

A drawback of this approach is that if you increase your simulation run time, you will need to manually add additional cycles directly into your table specification.  Another drawback is if your cyclical pattern behavior changes, you will need to manually change your table to match the new pattern as well.  Tabular inputs are highly flexible, but they will typically require some manual effort to configure or modify.

Scripted Cyclical Properties

If neither a sinusoidal nor tabular cycle specification seems suitable for your modeling needs, then the scripted cyclical property can be a highly flexible and automated solution.  Some of these flexible benefits include simply modifying your script’s input parameters to automatically propagate the new behavior through the full simulation duration, as well as being able to modify your total physical simulation time without needing to modify the script again.  Tabular specifications would require more invasive manual modifications in each of these circumstances.

A prerequisite for using a script for your cyclical property is that you will need a cycle that can be defined with a combination of conditional, mathematical, or other definitions that can be interpreted in a script.

In the example below, we will explore implementing the same basic cyclical trapezoidal mass flow rate discussed in the tabular method section, but this time using a scripted approach instead. 

Picture4

First, when you open the script editor by clicking on the “…” button at the right-hand side of the “Value” field in the popup script editor, you will see that there are some pre-existing Inputs and Results on the left-hand side.  These will be used for the basic calling of time (t) or delta time (DeltaT) as inputs, and “value” as the output of the script that will be used in your simulation.

The script seen in the image below will also be included as text at the end of this blog post.

Picture5

In this circumstance, we will be using C# as our coding language for defining the script.  You will see in the image above that the following key steps have been taken:

  1. We initialize variables of interest with the “double” class.  Many of these are optional, but can be helpful to specify to avoid manual errors during future parameter modifications.
  2. We specify the quantities associated with these initialized variables.
  3. Flownex scripting supports the creation of loops, but it also can make use of the “modulus” operator, seen as the “%” operator on line 9.  The modulus operator can be used to identify a particular instant in time as a function of cycle duration without needing to create a more complex looping syntax.  This will be helpful further in the script when we create conditional statements to understand how to treat the output behavior as a function of location within the cycle.
  4. Conditional statements then permit the script to interpret at which phase of the cycle the current time step is located.  In the trapezoidal example, we have conditional statements for the increasing ramp, the maximum plateau, and the decreasing ramp values.

The following animation shows the real-time speed of the solution processing of this simple scripted cyclical example:

Transient Cyclical 1

While a drawback of using the scripting method is that it takes some additional initial effort to create the script, a benefit is that it becomes significantly simpler to modify parameters in the future and automatically propagate your new cycle into your simulation.  If you have a workflow that you will be repeating with different conditions many times, and you can define your cyclical condition within a script, then the scripting method can save a lot of time and effort to modify your properties.

Conclusion

In Flownex, there are a variety of capabilities to implement cyclical properties into your simulation.  The correct choice often depends on your modeling needs, and the scripted approach can offer a highly flexible and robust capability to implement cyclical conditions.

If you would like to review the example script-based approach directly in the Flownex model, please feel free to reach out to flownexsupport@padtinc.com, and we would be happy to discuss how we may provide this file to you.

Selected References

  1. Actions Setup: Flownex User Guide, Section 2.3.4. Configuration > Actions Setup
  2. Scripting: Flownex User Guide, Section 4.14. Scripting

Appendix: Example Script Full Text

double currentCycleTime;
double cycleTime;
double increasingRampCycleTime;
double decreasingRampCycleTime;
double slope;
double maxPlateau;

cycleTime = 2;
currentCycleTime = t%cycleTime;
increasingRampCycleTime = 0.5;
decreasingRampCycleTime = 1.5;
slope = 1;
maxPlateau = 0.5;
 
//the following math used for the “value” output make use of linear regression
//y=m*x+b equations as appropriate to form a trapezoidal waveform
if(currentCycleTime < increasingRampCycleTime)
{
value = currentCycleTime*slope;
}

else if(currentCycleTime < decreasingRampCycleTime && currentCycleTime >= increasingRampCycleTime)
{
value = maxPlateau;
}
else
{
value = cycleTime – currentCycleTime*slope;
}
return;

Get Your Ansys Products & Support from the Engineers who Contribute to this Blog.

Technical Expertise to Enable your Additive Manufacturing Success.

Share this post:

Upcoming Events

Nov 18
, 2026
2026 Governor’s Celebration of Innovation
Nov 20
, 2026
AZBio Winter Reception 2026
Dec 02
, 2026
2026 Tech The Halls Holiday Mixer
Jan 27
- Jan 29
, 2027
Arizona Photonics Days 2027
Feb 09
- Feb 11
, 2027
MD&M West 2027

Contact Us

Most of our customers receive their support over the phone or via email. Customers who are close by can also set up a face-to-face appointment with one of our engineers.

For most locations, simply contact us: