Home
  • Products
  • Solutions
  • Support
  • Company
  • Products
  • Solutions
  • Support
  • Company
Community Computational Fluid Dynamics Boost Your CFD Workflow Productivity with Fidelity Python…

Author

Veena Parthan
Veena Parthan

Community Member

Blog Activity
Options
  • Subscriptions

    Never miss a story from Computational Fluid Dynamics. Subscribe for in-depth analysis and articles.

    Subscribe by email
  • More
  • Cancel
webinars
Computational Fluid Dynamics
Python API
Fidelity CFD
engineering
simulation software
Cadence CFD

Boost Your CFD Workflow Productivity with Fidelity Python API – Part II

26 Jun 2023 • 3 minute read

Get ready to take your CFD workflow to the next level!

In this blog series, we're diving deep into the world of automation and Python scripting for Fidelity. In Part 1, we discussed why Python is the go-to language for CFD workflows and showed you three methods for executing Python scripts using the API. Today, we're taking it up a notch by giving you the lowdown on writing Python scripts for Fidelity. We'll cover everything from API descriptions and different sets of packages to accessing entities in the geometry tree, preparing you to become a pro at scripting using Fidelity Python API!

How to write Python Scripts for Fidelity

Packages and Modules

The Fidelity Python API relies on a set of packages, the principal ones are listed below, and the full list is shown in the image to the right. A package consists of various modules as files, and the appropriate one is selected per the scripting requirements.

  • project: project management
  • geometry: CAD input and manipulations
  • domain: domain manipulations
  • meshing: mesh setup, generation, and analysis
  • simulation: simulation setup and run
  • analysis: post-processing of a simulation

Functions

Each package or module has a list of actions that can be performed, called functions. For instance, “project” contains several functions to create, open or save a project. A list of these functions is illustrated below:

To access these functions while scripting, the module should be called at the beginning of the script:

To call a function from a module, the syntax is module.function(arguments). Example:

Accessing an Entity in the Geometry Tree

After importing a geometry file, a hierarchical tree is created. Three main types of entities exist:

  • Surfaces: low levels CAD or .stl surfaces making up the geometry
  • Boundaries: grouping of surfaces containing the notion of boundary condition
  • Assemblies: correspond to a container of other Assemblies or Boundaries (see below)

A typical tree structure might look like this:

Since a geometry hierarchy may contain many levels, using a compact notation to access specific entities in the tree is convenient. For this purpose, composite names can be used. The composite name of an entity is basically the concatenation of its parent assemblies and boundary + the entity's name, separated by the "|" character.

  • Assembly1|SubAssembly1|Boundary1: allows to access the entity "Boundary1" in the tree
  • Assembly1|SubAssembly1|Boundary2|SurfaceX: allows access to the surface "SurfaceX" in the tree

The below example shows how to define a uniform refinement on “Boundary 1”:

Benefit From Our Resources and Offerings

Cadence HTML documentation interface for Fidelity scripting includes a list of all the macros, classes, and modules. It also includes step-by-step tutorials that cover complete CFD workflow using Python scripts for 3 sample cases – Volute, Intake Manifold, and Conjugate heat transfer (CHT) in a water-cooling jacket. We expect our tutorials to provide insights into automating your CFD workflows!

 User interface with Sphinx documentation (left) and Doxygen documentation (right).

The current HTML documentation extracts information from comments within a code. The soon-to-release Python API documentation 2023.1 is expected to have for higher readability and navigation through the different modules.. , scripts are published on the COS platform to make it easier for the user. For instance, a script to automatically create a mesh setup based on a selected geometry is available, as shown below. In addition to all these offerings, Cadence also delivers training on Python and automation targeting Fidelity scripting.

 Readily available script for creating a domain and mesh setup using Hexpress.


Watch the Cadence TECHTALK on 'Boost Your CFD Simulation Productivity with Python' to learn more about Fidelity Python API.


© 2023 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information