assign_voltage#

Maxwell3d.assign_voltage(assignment: list, amplitude: float | None = 1, name: str | None = None, excitation_model: str = 'Single Potential', initial_current: float | None = 0, swap_direction: bool | None = False, phase: float | None = 0, has_initial_current: bool | None = False) BoundaryObject#

Assign a voltage excitation to a list of faces or edges in Maxwell 2D or a list of objects in Maxwell 2D.

Parameters:
assignmentlist

List of faces, objects or edges to assign a voltage excitation to.

amplitudefloat, optional

Voltage amplitude in mV. The default is 1.

namestr, optional

Name of the excitation. If not provided, a random name with prefix Voltage will be generated.

excitation_modelstr, optional

The excitation model to apply for this current excitation. Valid only A-Phi solvers. Possible choices are "Single Potential", "Double Potentials", and "Double Potentials with Ground". The default is "Single Potential".

initial_currentfloat, optional

The excitation’s initial current. Only valid for Transient A-Phi solver. The default is 0.

swap_directionbool, optional

Whether to swap the direction of the voltage drop. Valid only for A-Phi solvers. The default is False.

phasefloat, optional

The excitation phase. Only valid for AC solvers. The default is 0.

has_initial_currentbool, optional

Whether the excitation has an initial current. The default is False.

Returns:
ansys.aedt.core.modules.boundary.common.BoundaryObject

Boundary object. False when failed.

References

>>> oModule.AssignVoltage

Examples

Create a region in Maxwell 2D and assign voltage to its edges.

>>> from ansys.aedt.core import Maxwell2d
>>> m2d = Maxwell2d(version="2026.1", solution_type="ElectrostaticZ")
>>> region_id = m2d.modeler.create_region(pad_value=[500, 50, 50])
>>> voltage = m2d.assign_voltage(assignment=region_id.edges, amplitude=0, name="GRD")
>>> m2d.desktop_class.close_desktop()

Create a region in Maxwell 3D and assign voltage to its edges.

>>> from ansys.aedt.core import Maxwell3d
>>> m3d = Maxwell3d(version="2026.1", solution_type="Electrostatic")
>>> region_id = m3d.modeler.create_box([0, 0, 0], [10, 10, 10])
>>> voltage = m3d.assign_voltage(assignment=region_id.faces, amplitude=0, name="GRD")
>>> m3d.desktop_class.close_desktop()