# Circuit Model

The Circuit model is used to compute the S matrix of a component based on a composition of the S matrices of its subcomponents.

The Circuit model will only work when all subcomponents are properly connected between each other and to the external component ports. Interconnection between subcomponents is automatically detected from overlapping ports with the same specifications and opposite directions, such that the output modes from one port are the input modes of the other. The external port connection is also automatically detected: each port of the main component must overlap a subcomponent port with the same specification and direction. Subcomponents can also be connected with virtual connections that can be created by dragging a connection line between 2 subcomponent ports in the Schematic View. Any missing connections will results in a warning before the model is run.

Because only subcomponent matrices are used, any geometry placed directly on the main component will have no effect on the calculation. Furthermore, subcomponents disconnected (directly or indirectly) from the main component's external ports will not contribute to the final S matrix and will not be computed.

The type of model run for each subcomponent has no impact on the main Circuit model. That means that Circuit models can also be cascaded, i.e., subcomponents can also have a Circuit Model as their active model to drive the execution of their subcomponents.

# Mesh refinement

The Circuit model can reuse the results for subcomponents that are referenced multiple times within the main component, even in the presence of transformations (translations and rotations that are multiples of 90°). However, the port transformations may introduce phase changes due to specific mode polarization, so Mode solver runs are used to compensate for those phase changes, which means that several mode solver tasks may be used within a Circuit model computation. The mesh refinement parameter defines the refinement level of the mesh on these mode solver runs.