Tagged: ansys-cfx, expressions
-
-
June 6, 2022 at 8:33 am
FAQ
ParticipantIn CFX Expression language, the procedure is as shown below, but the logic would apply in any code.
LIBRARY:
CEL:
&replace EXPRESSIONS:
customtime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time)
cycleno = int(Time/0.03 [s])+1
dt = if(cycletime <= 0.01[s] ,0.001[s], 0 [s])+ if(cycletime>0.01[s] && cycletime <= 0.02[s], 0.002[s], 0[s]) + if(cycletime >0.02[s] &&
cycletime<= 0.03[s], 0.003[s], 0.0[s])
END
END
END
Since we have a repeating cycle of 0.03 [s], we need something to let us know what cycle we are in, so that we can make a custom time counter that will reset at the beginning of each cycle. This makes use of the int() function, which rounds UP to the closest integer.
cycleno = int(Time/0.03 [s])+1
Next we can make a time counter that goes from 0-0.03 [s][ repeatedly. This makes use of the conditional if() function:
cycletime = if(cycleno>1,Time-0.03[s]*(cycleno-1),Time)
Now, we create a series of additive if() statements to cover each portion of the cycle. each one is only active inside its cycletime range
dt = if(cycletime <= 0.01[s] ,0.001[s], 0 [s])+ if(cycletime>0.01[s] && cycletime <= 0.02[s], 0.002[s], 0[s]) + if(cycletime >0.02[s] && cycletime<= 0.03[s], 0.003[s], 0.0[s])
If the list is very long, create a separate if expression for each portion and then add these expressions for a tidier timestep expression that is easier to debug.
-

Introducing Ansys Electronics Desktop on Ansys Cloud
The Watch & Learn video article provides an overview of cloud computing from Electronics Desktop and details the product licenses and subscriptions to ANSYS Cloud Service that are...

How to Create a Reflector for a Center High-Mounted Stop Lamp (CHMSL)
This video article demonstrates how to create a reflector for a center high-mounted stop lamp. Optical Part design in Ansys SPEOS enables the design and validation of multiple...

Introducing the GEKO Turbulence Model in Ansys Fluent
The GEKO (GEneralized K-Omega) turbulence model offers a flexible, robust, general-purpose approach to RANS turbulence modeling. Introducing 2 videos: Part 1Â provides background information on the model and a...

Postprocessing on Ansys EnSight
This video demonstrates exporting data from Fluent in EnSight Case Gold format, and it reviews the basic postprocessing capabilities of EnSight.
- How to overcome the model information incompatible with incoming mesh error?
- What are the requirements for an axisymmetric analysis?
- How to create and execute a FLUENT journal file?
- Skewness in ANSYS Meshing
- What is a .wbpz file and how can I use it?
- How can I Export and import boxes / Systems from one Workbench Project to another?
- How can I select interior faces and other entities that are inside the model?
- What are pressure-based solver vs. density-based solver in FLUENT?
- Error: Update failed for the Mesh component in Fluid Flow (Fluent). Error updating cell Mesh in system Fluid Flow (Fluent). View the messages in the Meshing editor for more details.
- How to get information about mesh cell count and cell types in Fluent?
© 2025 Copyright ANSYS, Inc. All rights reserved.