tidy3d icon indicating copy to clipboard operation
tidy3d copied to clipboard

add WavePorts

Open dmarek-flex opened this issue 1 year ago • 8 comments

add a new type of port to the TerminalComponentModeler. WavePorts are the optimal port for exciting transmission lines, and they function like a hybrid between LumpedPorts and the modal-based Port.

Still a work in progress.

Here are some thoughts:

  • Not sure the best way to make the computed port impedances available to users. Computing the port impedances requires mode solving which is launched through ModeSolverMonitors along with the tidy3d simulations. However, some users might want to know the impedances beforehand or inspect modes before launching the simulations.
  • I have changed some of the naming to reflect that the ports of the TerminalComponentModeler are based on pairs of terminals ( a positive and negative connection or node in the circuit). LumpedPorts and WavePort are then both TerminalPorts
  • I realized it is helpful to add names and possibly attrs to DataArrays that I am creating. Maybe I should put all of these DataArrays into the microwave plugin or the Tidy3D files.

dmarek-flex avatar Jun 05 '24 16:06 dmarek-flex

@weiliangjin2021 @QimingFlex Still a bit rough at the moment in terms of docstrings and other details. But if you want to take a look over the next week while I am validating the accuracy, I am ready for feedback.

dmarek-flex avatar Jun 13 '24 21:06 dmarek-flex

One main question is if we should support multiple ways of computing impedance: using any two quantities of V, I, P.

Yeah, it is all hidden away in the ImpedanceCalculator. User can provide any definition of voltage they want (by defining the associated voltage path integral). Same goes for current computation. If both integrals are provided, the impedance is computed as expected V/I. If only one is provided, the ImpedanceCalculator will revert to using the total flux the indirectly compute the other quantity. If none are provided, a ValidationError gets raised.

dmarek-flex avatar Jun 18 '24 18:06 dmarek-flex

1st pass through the code. I'll definitely need to take several more rounds to have a better understanding. Very cool to see all components stick together! One main question is if we should support multiple ways of computing impedance: using any two quantities of V, I, P.

Might help for your review to check out this notebook.

dmarek-flex avatar Jun 18 '24 20:06 dmarek-flex

  • On the modal plane (let's assume it to be xy-plane), compute J at every grid point through J = Curl H. Next we integrate Jz over the entire modal plane. During the integration, we integrate only positive or negatie Jz, as otherwise the current cancels out. So it's int dS Heaviside(J_Z) J_z. Does it agree with the contour path approach for TEM mode?

That could work, and it seems like a discrete version of Stoke's theorem, so should be equivalent. It is also probably an easier way to implement the computation on the Yee grid when the conductors are complicated shapes. I don't think that I could use that method for computing currents at the ports though, because we do not know whether the current is flowing into or out of the port before computing. Could be used for compute Z0 when we can assume the propagation direction.

However, since it seems possible to apply this to more complex shapes more easily, I think I will try. We could still make the user define a path around the conductor of interest. Instead of computing the line integral though, we compute the current inside the contour using curl H.

  • It'll be very helpful to also visualize voltage/current integration path in the plot.

Yes, good idea! I'll experiment.

  • For voltage integration path, in many cases, it is an straight line. When it's axis-aligned, it'll be more convenient to allow the definition through 2 endpoints?

So do you mean an option to create path integrals given P1(x1,y1,z1) and P2(x2,y2,z2) and just ensure that that it is axis aligned with a validator? If so I can do that!

dmarek-flex avatar Jun 25 '24 13:06 dmarek-flex

So do you mean an option to create path integrals given P1(x1,y1,z1) and P2(x2,y2,z2) and just ensure that that it is axis aligned with a validator? If so I can do that!

Hopefully we can also support axis-unaligned straight path. But you mentioned there is complication for that

weiliangjin2021 avatar Jun 25 '24 18:06 weiliangjin2021

So do you mean an option to create path integrals given P1(x1,y1,z1) and P2(x2,y2,z2) and just ensure that that it is axis aligned with a validator? If so I can do that!

Hopefully we can also support axis-unaligned straight path. But you mentioned there is complication for that

Agreed, at least we can easily swap out implementations for voltage and current integrals easily. But that is an improvement that is needed.

dmarek-flex avatar Jun 25 '24 19:06 dmarek-flex

It'll be very helpful to also visualize voltage/current integration path in the plot.

Just adding some tests, but path integrals can be plotted now. Screenshot from 2024-07-04 15-38-47

dmarek-flex avatar Jul 04 '24 19:07 dmarek-flex

It'll be very helpful to also visualize voltage/current integration path in the plot.

Just adding some tests, but path integrals can be plotted now. Screenshot from 2024-07-04 15-38-47

Nice figure!

weiliangjin2021 avatar Jul 05 '24 16:07 weiliangjin2021

@weiliangjin2021 I am ready to merge this as soon as you confirm. Tests are passing after rebase and my testing notebook is giving good results. I just changed the CHANGELOG to reflect the changes in this PR.

dmarek-flex avatar Jul 26 '24 18:07 dmarek-flex