FieldsCalculator#

class ansys.aedt.core.visualization.post.fields_calculator.FieldsCalculator(app)#

Provides the Advanced fields calculator methods.

Provide methods to add, load and delete named expressions on top of the already existing ones in AEDT Fields calculator.

Parameters:
app

Inherited parent object.

Examples

Custom expressions can be added as dictionary on-the-fly:

>>> from ansys.aedt.core import Hfss
>>> hfss = Hfss()
>>> poly = hfss.modeler.create_polyline([[0, 0, 0], [1, 0, 1]], name="Polyline1")
>>> my_expression = {
...                     "name": "test",
...                     "description": "Voltage drop along a line",
...                     "design_type": ["HFSS", "Q3D Extractor"],
...                     "fields_type": ["Fields", "CG Fields"],
...                     "solution_type": "",
...                     "primary_sweep": "Freq",
...                     "assignment": "",
...                     "assignment_type": ["Line"],
...                     "operations": ["Fundamental_Quantity('E')",
...                     "Operation('Real')",
...                     "Operation('Tangent')",
...                     "Operation('Dot')",
...                     "EnterLine('assignment')",
...                     "Operation('LineValue')",
...                     "Operation('Integrate')",
...                     "Operation('CmplxR')"],
...                     "report": ["Data Table", "Rectangular Plot"],
...                 }
>>> expr_name = hfss.post.fields_calculator.add_expression(my_expression, "Polyline1")
>>> hfss.release_desktop(False, False)

or they can be added from the expression_catalog.toml:

>>> from ansys.aedt.core import Hfss
>>> hfss = Hfss()
>>> poly = hfss.modeler.create_polyline([[0, 0, 0], [1, 0, 1]], name="Polyline1")
>>> expr_name = hfss.post.fields_calculator.add_expression("voltage_line", "Polyline1")
>>> hfss.release_desktop(False, False)

Methods

FieldsCalculator.add_expression(calculation, ...)

Add named expression.

FieldsCalculator.calculator_write(...[, ...])

Save the content of the stack register for future reuse in a later Field Calculator session.

FieldsCalculator.create_expression_file(...)

Create a calculator expression file.

FieldsCalculator.delete_expression([name])

Delete a named expression.

FieldsCalculator.export(quantity[, ...])

Export the field quantity at the top of the register to a file, mapping it to a grid of points.

FieldsCalculator.expression_plot(...[, setup])

Create plots defined in the expression catalog.

FieldsCalculator.is_expression_defined(name)

Check if a named expression exists.

FieldsCalculator.is_general_expression(name)

Check if a named expression is general.

FieldsCalculator.load_expression_file(input_file)

Load expressions from an external TOML file.

FieldsCalculator.validate_expression(expression)

Validate expression file against the schema.

FieldsCalculator.write(expression, output_file)

Save the content of the stack register for future reuse in a later Field Calculator session.

Attributes

FieldsCalculator.expression_names

List of available expressions.