Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4a7a89a
Added method for Inception Voltage Evaluation for electrostatic Maxwe…
tizianrot Nov 11, 2025
3adb514
CHORE: Auto fixes from pre-commit hooks
pre-commit-ci[bot] Nov 11, 2025
49b081b
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 11, 2025
3bb851d
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 11, 2025
9df171e
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 11, 2025
757f729
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 11, 2025
9200422
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 11, 2025
31ed72d
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 11, 2025
8275d5f
CHORE: Auto fixes from pre-commit hooks
pre-commit-ci[bot] Nov 11, 2025
577a536
Added method for Inception Voltage Evaluation for electrostatic Maxwe…
tizianrot Nov 11, 2025
cc58ca2
Merge remote-tracking branch 'origin/feat_inception_voltage' into fea…
tizianrot Nov 11, 2025
c8a964a
Update src/ansys/aedt/core/visualization/post/post_maxwell.py
tizianrot Nov 12, 2025
9147ca6
Apply suggestions from code review
tizianrot Nov 19, 2025
1fa2bdb
Correction accepted. for Inception Voltage Evaluation for electrostat…
tizianrot Nov 19, 2025
59e9a2a
Corrected to address alls Issue #6875
tizianrot Nov 19, 2025
e1f0ecc
Merge branch 'main' into feat_inception_voltage
tizianrot Nov 19, 2025
ca4c23f
as per last Sebastien's review
tizianrot Nov 19, 2025
a106a16
chore: adding changelog file 6869.added.md [dependabot-skip]
pyansys-ci-bot Nov 19, 2025
22c55ac
as flagged during test
tizianrot Nov 19, 2025
e798ae3
Merge remote-tracking branch 'origin/feat_inception_voltage' into fea…
tizianrot Nov 19, 2025
f49e51b
as flagged during test
tizianrot Nov 19, 2025
81b10c3
Merge branch 'main' into feat_inception_voltage
gmalinve Nov 24, 2025
f86b6b1
fix test and raise exception
gmalinve Nov 24, 2025
ca7efaf
Merge branch 'main' into feat_inception_voltage
gmalinve Nov 24, 2025
8ed8447
Merge branch 'main' into feat_inception_voltage
gmalinve Nov 25, 2025
c97d951
improve test
gmalinve Nov 25, 2025
86b05e3
Merge remote-tracking branch 'origin/feat_inception_voltage' into fea…
gmalinve Nov 25, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/6869.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added method for Inception Voltage Evaluation for electrostatic Maxwell analyses. Issue #5310
130 changes: 90 additions & 40 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 @@ -180,52 +182,41 @@ def create_fieldplot_line_traces(
if plot_name and plot_name in list(self.field_plots.keys()):
self.logger.info(f"Plot {plot_name} exists. returning the object.")
return self.field_plots[plot_name]
if not isinstance(seeding_faces, list):
seeding_faces = [seeding_faces]
seeding_faces_ids = []
for face in seeding_faces:
if self._app.modeler[face]:
seeding_faces_ids.append(self._app.modeler[face].id)
else:
self.logger.error(f"Object {face} doesn't exist in current design")
return False
in_volume_tracing_ids = []
if not in_volume_tracing_objs:
in_volume_tracing_ids.append(0)
elif not isinstance(in_volume_tracing_objs, list):
in_volume_tracing_objs = [in_volume_tracing_objs]
for obj in in_volume_tracing_objs:
if self._app.modeler[obj]:
in_volume_tracing_ids.append(self._app.modeler[obj].id)

seeding_faces_ids = [0] if seeding_faces is None else []
if seeding_faces:
faces = seeding_faces if isinstance(seeding_faces, list) else [seeding_faces]
for face in faces:
if self._app.modeler[face]:
seeding_faces_ids.append(self._app.modeler[face].id)
else:
raise AEDTRuntimeError(f"Object {face} doesn't exist in current design")

in_volume_tracing_ids = [0] if in_volume_tracing_objs is None else []
if in_volume_tracing_objs:
volumes = in_volume_tracing_objs if isinstance(in_volume_tracing_objs, list) else [in_volume_tracing_objs]
for volume in volumes:
if self._app.modeler[volume]:
in_volume_tracing_ids.append(self._app.modeler[volume].id)
else:
self.logger.error(f"Object {obj} doesn't exist in current design")
return False
elif isinstance(in_volume_tracing_objs, list):
for obj in in_volume_tracing_objs:
if not self._app.modeler[obj]:
self.logger.error(f"Object {obj} doesn't exist in current design")
return False
surface_tracing_ids = []
if not surface_tracing_objs:
surface_tracing_ids.append(0)
elif not isinstance(surface_tracing_objs, list):
surface_tracing_objs = [surface_tracing_objs]
for obj in surface_tracing_objs:
if self._app.modeler[obj]:
surface_tracing_ids.append(self._app.modeler[obj].id)
raise AEDTRuntimeError(f"Object {volume} doesn't exist in current design")

surface_tracing_ids = [0] if surface_tracing_objs is None else []
if surface_tracing_objs:
surfaces = surface_tracing_objs if isinstance(surface_tracing_objs, list) else [surface_tracing_objs]
for surface in surfaces:
if self._app.modeler[surface]:
surface_tracing_ids.append(self._app.modeler[surface].id)
else:
self.logger.error(f"Object {obj} doesn't exist in current design")
return False
elif isinstance(surface_tracing_objs, list):
for obj in surface_tracing_objs:
if not self._app.modeler[obj]:
self.logger.error(f"Object {obj} doesn't exist in current design")
return False
seeding_faces_ids.insert(0, len(seeding_faces_ids))
raise AEDTRuntimeError(f"Object {surface} doesn't exist in current design")

if seeding_faces_ids != [0]:
seeding_faces_ids.insert(0, len(seeding_faces_ids))
if in_volume_tracing_ids != [0]:
in_volume_tracing_ids.insert(0, len(in_volume_tracing_ids))
if surface_tracing_ids != [0]:
surface_tracing_ids.insert(0, len(surface_tracing_ids))

return self._create_fieldplot_line_traces(
seeding_faces_ids,
in_volume_tracing_ids,
Expand Down Expand Up @@ -348,3 +339,62 @@ 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 field line traces.

.. note::
This method requires field line traces to be computed beforehand.

Parameters
----------
plot_name : str
Name of the field fine trace plot as it appears in the AEDT GUI project manager tree.
field_line_number: list of int, optional
List of line objects on which the evaluation will be performed.
If the field line traces plot does not exist, this can be created with
``app.post.create_fieldplot_line_traces``.
The default value is ``None``, in which case the inception voltage evaluation will be
carried out for all existing field line traces.

Returns
-------
bool
``True`` when successful.

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

Examples
--------
Create an instance of Maxwell and attach it to an existing session where project name is
``project_name``.
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 = (["Region"],)
... in_volume_tracing_objs = (["Region"],)
... plot_name="LineTracesTest"
... )

Now the inception voltage evaluation can be performed 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)
else:
self.ofieldsreporter.EvaluateInceptionVoltage(plot_name, field_line_number)
return True
25 changes: 19 additions & 6 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 @@ -596,12 +597,12 @@ def test_m2d_plot_field_line_traces(self, m2dtest):
["Ground", "Electrode"], "Region", "Ground", plot_name="LineTracesTest5"
)
assert m2dtest.post.create_fieldplot_line_traces(["Ground", "Electrode"], plot_name="LineTracesTest6")
assert not m2dtest.post.create_fieldplot_line_traces(
["Ground", "Electrode"], "Region", ["Invalid"], plot_name="LineTracesTest7"
)
assert not m2dtest.post.create_fieldplot_line_traces(
["Ground", "Electrode"], ["Invalid"], plot_name="LineTracesTest8"
)
with pytest.raises(AEDTRuntimeError):
m2dtest.post.create_fieldplot_line_traces(
["Ground", "Electrode"], "Region", ["Invalid"], plot_name="LineTracesTest7"
)
with pytest.raises(AEDTRuntimeError):
m2dtest.post.create_fieldplot_line_traces(["Ground", "Electrode"], ["Invalid"], plot_name="LineTracesTest8")
plot.TraceStepLength = "0.002mm"
plot.SeedingPointsNumber = 20
plot.LineStyle = "Cylinder"
Expand Down Expand Up @@ -796,3 +797,15 @@ def test_twinbuilder_spectral(self, tb_app):
new_report.time_start = "0ns"
new_report.time_stop = "40ms"
assert new_report.create()

@pytest.mark.skipif(config["desktopVersion"] < "2026.1", reason="Method not available before 2026.1")
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