The problem I am having is while constructing waveguide ports via the Python API. The waveguide height and width dimensions auto extend to the simulation boundary. Where can I find the functions to explicitly control the height and width of the waveguide port?
First please consult the python cookbook, section “Creating Waveguide Ports (FEM only)” in chapter 3, on how to define a waveguide port.
It shows a function makeWaveguide on how to make a waveguide port, but it auto extends the waveguide to the simulation boundary.
By setting the property usePaddingBox to True, it will no longer expand.
So the example could be modified as such (in bold is the addition):
Vector3d = empro.geometry.Vector3d
Expression = empro.core.Expression
activeProject = empro.activeProject
# getting a good face Id is the trickiest part.
# Here we'll create a simple sheet, since it only has one face.
sheet = empro.toolkit.geometry.plateXY(Vector3d(0, 0, 0), #* \label{WaveguidePort:sheet}
Expression("10 mm"),
Expression("20 mm"),
"waveguide geometry")
# Excluding the sheet from the mesh to make it transparent.
# first add it to project, otherwise we'll have no meshParameters
activeProject.geometry().append(sheet)
sheet.visible = False
sheet.meshParameters.includeInMesh = False
assert len(sheet.faces()) == 1, \
"assuming that a sheet only has one face!"
faceId = sheet.faces()[0] #* \label{WaveguidePort:faceId}
# Use a power feed to get modal S-parameters.
# Add copy to project, and retrieve it again.
definition = empro.components.ModalFeed("My Power Feed") #* \label{WaveguidePort:feed}
definition.sourcePower = "1 W"
ccDefinitions = activeProject.circuitComponentDefinitions()
ccDefinitions.append(definition)
definition = ccDefinitions[len(ccDefinitions)-1] #* \label{WaveguidePort:getback}
impedanceLines = [ #* \label{WaveguidePort:impedanceLines}
(Vector3d("-5 mm", 0, 0), Vector3d("5 mm", 0, 0)),
(Vector3d(0, "-10 mm", 0), Vector3d(0, "10 mm", 0)),
]
# create it and of course, add it to project
waveguide = makeWaveguide(sheet, faceId, definition, modes=impedanceLines,
autoExtend=True, name="waveguide from script")
# set usePaddingBox to avoid auto-extending the waveguide to the simulation boundary
waveguide.usePaddingBox = True
activeProject.waveGuides().append(waveguide)