Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/ansys/aedt/core/visualization/post/post_maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

from ansys.aedt.core.base import PyAedtBase
from ansys.aedt.core.generic.general_methods import pyaedt_function_handler
from ansys.aedt.core.internal.checks import min_aedt_version
from ansys.aedt.core.internal.errors import AEDTRuntimeError
from ansys.aedt.core.visualization.post.field_data import FieldPlot
from ansys.aedt.core.visualization.post.post_3dlayout import PostProcessor3DLayout
from ansys.aedt.core.visualization.post.post_common_3d import PostProcessor3D
Expand Down Expand Up @@ -348,3 +350,59 @@ def create_fieldplot_layers_nets(
return self.post_3dlayout.create_fieldplot_layers_nets(
layers_nets, quantity, setup, intrinsics, plot_on_surface, plot_name
)

@pyaedt_function_handler()
@min_aedt_version("2026.1")
def evaluate_inception_voltage(self, plot_name, field_line_number=None):
"""Perform Inception voltage evaluation on selected filed line traces.

.. note::
This method required field line traces to computed beforehand.

Parameters
----------
field_line_plot_name : str
Name of the Field Line trace plot as it appears on the GUI project manager tree.
field_line_number: list of int, optional
List of the lines for which the evaluation will be performed, generated by a previous call to
m2d.post.create_fieldplot_line_traces.
If None is passed, the inception voltage evaluation is performed for all the created field line traces

Returns
-------
Bool

References
----------
>>> oModule.EvaluateInceptionVoltage

Examples
--------
Create an instance of Maxwell and link to a project named
``projectname``. If this project does not exist, create one with
this name.

>>> from ansys.aedt.core import Maxwell2d
>>> m2d = Maxwell2d(project_name)

Create a field line traces plot in the Region from seeding faces (insulator faces).
>>> plot = m2d.post.create_fieldplot_line_traces(
>>> seeding_faces = (["Ground", "Electrode", "Region"],)
>>> in_volume_tracing_objs = (["Region"],)
>>> plot_name="LineTracesTest")

Now you can perform the inception voltage evaluation on all (or a subset of) the created field line traces.
>>> m2d.post.evaluate_inception_voltage(plot_name=plot.name, field_line_number=[1, 2, 4])
>>> m2d.desktop_class.release_desktop()

"""
if self._app.solution_type != "Electrostatic":
raise AEDTRuntimeError("Field line traces is valid only for electrostatic solution")
if plot_name not in (self.field_plot_names):
raise AEDTRuntimeError("The Field Line Tracing Plot needs to be generated.")
if not field_line_number:
self.ofieldsreporter.EvaluateInceptionVoltage(plot_name)
return True
else:
self.ofieldsreporter.EvaluateInceptionVoltage(plot_name, field_line_number)
return True
12 changes: 12 additions & 0 deletions tests/system/visualization/test_12_PostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from ansys.aedt.core import TwinBuilder
from ansys.aedt.core.generic.general_methods import is_linux
from ansys.aedt.core.generic.settings import settings
from ansys.aedt.core.internal.errors import AEDTRuntimeError
from ansys.aedt.core.visualization.plot.pyvista import _parse_aedtplt
from ansys.aedt.core.visualization.plot.pyvista import _parse_streamline
from tests import TESTS_VISUALIZATION_PATH
Expand Down Expand Up @@ -795,3 +796,14 @@ def test_twinbuilder_spectral(self, tb_app):
new_report.time_start = "0ns"
new_report.time_stop = "40ms"
assert new_report.create()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here add the decorator skipif

def test_m2d_evaluate_inception_voltage(self, m2dtest):
m2dtest.set_active_design("field_line_trace")
with pytest.raises(AEDTRuntimeError):
m2dtest.post.evaluate_inception_voltage("my_plot", [1, 2, 4])
plot = m2dtest.post.create_fieldplot_line_traces(["Ground", "Electrode"], "Region")
assert m2dtest.post.evaluate_inception_voltage(plot.name)
assert m2dtest.post.evaluate_inception_voltage(plot.name, [1, 2, 4])
m2dtest.solution_type = "Magnetostatic"
with pytest.raises(AEDTRuntimeError):
m2dtest.post.evaluate_inception_voltage("my_plot", [1, 2, 4])
Loading