Understanding operators
What is an operator
An operator is a function that takes input data, performs a specific operation on it, and produces output data. Operators are the building blocks for all data processing in DPF. Why operators matter: Instead of writing custom code to manipulate fields, meshes, or other DPF objects, you use pre-built operators that handle common tasks efficiently. Operators are optimized, tested, and designed to work seamlessly with DPF’s data structures. Real-world analogy: Think of operators like tools in a workshop. A drill performs one specific task (making holes), a saw performs another (cutting). Each tool (operator) takes input (material), performs an operation (drilling, cutting), and produces output (modified material). You don’t build the tools yourself, you use the right tool for each job.How operators work
Every operator follows the same pattern:- Inputs: Data you provide to the operator (fields, meshes, parameters)
- Processing: The operation performed on the input data
- Outputs: Results produced by the operator
- DPF data structures (Field, FieldsContainer, MeshedRegion, Scoping, etc.)
- Standard Python types (int, float, string, list)
- Outputs from other operators (enabling operator chaining)
Types of operators by purpose
Operators are organized into categories based on what they do. Here are a few category examples:Finding operators
DPF provides hundreds of operators. You can explore them in the Operators Reference documentation. How to find the right operator:-
Search by keyword: Use the top-right search box (e.g., “average”, “displacement”, “extract”). Filter on Multiphysics, Structures, Fluids and Developer Portal as well as your installation Version.

-
Browse by category: Look through categories like “math”, “result”, “averaging”

-
Read operator descriptions: Each operator page explains inputs, outputs, and usage

Using an operator
Using an operator involves three steps:Step1: Instantiate the operator
Create an instance of the operator you want to use:Step2: Connect inputs
Provide the required input data to the operator:data_sources, time_scoping, mesh_scoping). You connect data to these pins using the inputs attribute.
The Operator API
Python makes connecting inputs simple by providing named properties likeinputs.data_sources() and inputs.time_scoping(). This is a Python-specific convenience feature.
The underlying C++ API uses a more direct approach: operator.connect(pin_number, object), where you specify the pin number (0, 1, 2, etc.) instead of a name. For example:
inputs.data_sources(), Python automatically uses the correct pin number behind the scenes.
Using raw pin numbers in Python: You can also use the pin number approach directly in Python by calling operator.connect(pin_number, object). This is useful when:
- Working with operators that don’t have a Python wrapper
- The Python wrapper hasn’t been updated to expose a new pin
- You’re porting C++ code to Python and want to match the structure
Step3: Evaluate and get outputs
Execute the operator and retrieve results:Complete operator example
Here’s a full example that uses thenorm operator to calculate displacement magnitudes:
norm operator took a vector field (3 components: X, Y, Z) and produced a scalar field (1 component: magnitude). This is a common pattern: operators transform data from one form to another.
Operator input/output patterns
Understanding common operator patterns helps you chain them together effectively:Common operators you’ll use
Here are operators you’ll encounter frequently: Result extraction:operators.result.displacement(): Get displacement resultsoperators.result.stress(): Get stress resultsoperators.result.strain(): Get strain results
operators.mesh.mesh_provider(): Get mesh dataoperators.mesh.meshes_provider(): Get mesh data as a collection
operators.math.add(): Add two fieldsoperators.math.scale(): Multiply field by scalaroperators.math.norm(): Calculate the magnitude of each entity in a single Fieldoperators.math.norm_fc(): Calculate the magnitude of each entity for all fields in a FieldsContainer
operators.min_max.min_max_fc(): Find the minimum and maximum over all fields in a FieldsContainer - exposes two Field outputs:outputs.field_minandoutputs.field_max
operators.scoping.rescope(): Changes the scoping of a Field
operators.averaging.elemental_nodal_to_nodal(): Average ElementalNodal to Nodal
operators.serializer.serialize_to_hdf5(): Export data to HDF5operators.utility.forward(): Pass data through unchanged (useful in workflows)
Understanding workflows
What is a workflow
A workflow is a collection of operators chained together to perform a multi-step data processing pipeline. Workflows automate complex analysis tasks by connecting the output of one operator to the input of another. Why workflows matter: Real-world analysis tasks rarely involve just one operation. You might need to extract results, filter specific entities, average values, and compute magnitudes—all in sequence. Workflows let you build these pipelines once and reuse them with different data sources. Real-world analogy: Think of an assembly line in a factory. Raw materials enter at one end, pass through multiple workstations (each performing a specific task), and finished products emerge at the other end. Each workstation is like an operator, and the entire assembly line is the workflow.How workflows work
Workflows are created by connecting operators together. The output of one operator becomes the input of the next:Workflow example: Total deformation
Here’s a concrete example showing how operators connect to calculate total deformation (displacement magnitude):- displacement operator: Extracts nodal displacement fields from result file (vector with X, Y, Z components)
- norm_fc operator: Calculates magnitude of displacement vector for each field (scalar representing total deformation)
Creating a workflow
You can create workflows in two ways:Method 1: Explicit workflow object
Create aWorkflow object and add operators to it:
The types module
The second argument to workflow.get_output() (and operator output evaluation) tells DPF what Python type to return. Common values:
types.fields_container: returns aFieldsContainertypes.field: returns a singleFieldtypes.meshed_region: returns aMeshedRegion
from ansys.dpf.core import types.
Method 2: Implicit chaining
Chain operators directly without creating a workflow object:Inspecting a workflow
Once you have created a workflow, you can inspect its structure using these properties:Benefits of workflows
Reusability: Build a Workflow object once, apply it to different models or time steps:When to use workflows
Use workflows when you:- Perform multi-step data processing repeatedly
- Need to apply the same analysis to different models
- Want to build reusable analysis templates
- Have complex processing pipelines with many operators
Exercises
Practice the core concepts of operators and workflows through these progressive exercises.Exercise 1: Use a single operator
Practice the basic three-step operator pattern: instantiate, connect inputs, get outputs. Extract displacement results for time step 1 from the simple bar example (examples.find_simple_bar()) using the result.displacement operator. Display the resulting FieldsContainer to verify it worked.
Exercise 2: Chain two operators
Practice operator chaining by connecting one operator’s output directly to another’s input. Extract displacement as in exercise 1, then compute its magnitude using themath.norm_fc operator. Display the magnitude field to verify it’s now scalar (1 component) instead of vector (3 components).
Exercise 3: Create a workflow
Practice creating a reusable Workflow object with named inputs and outputs. Build a workflow that computes displacement magnitude and finds its min/max values. The workflow should have:- Named inputs:
"data_sources"and"time_scoping" - Named outputs:
"min_magnitude"and"max_magnitude" - Three operators chained:
displacement→norm_fc→min_max_fc
Exercise 4: Visualize and reuse a workflow
Practice visualizing a workflow structure and reusing it with different inputs. Take the workflow from Exercise 3 and:- Print its structure using
workflow.infodictionary - Reuse it with a different time step (if you had multiple time steps)
- Show how the same workflow can be applied repeatedly
Going further
Now that you understand operators and workflows, explore these advanced topics:- Operator reference: Browse the complete Operators Reference to discover more capabilities
- Complex workflows: See the Operators Examples for advanced workflow patterns
- Custom operators: Learn how to create your own operators for specialized tasks in the Custom Operators guide