-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Construct medium from a transfer function #1974
Conversation
ab7b508
to
857b25a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment about scipy. otherwise looks good!
oh yea, and reminder to add changelog item for it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! My one suggestion would be that the name from_transfer_function
is a bit ambiguous, I might think that a
and b
are just the numerator and denominator coeffs of eps(s)
unless I read carefully. Maybe from_admittance_coeffs
or something to make it clear that there is an additional step before partial fraction decomposition?
Actually, along those lines, maybe we can also split this function into two functions. One from_admittance_coeffs
or something, and the other one can just be _real_partial_fraction_decomposition
which does partial fraction decomposition using scipy and then takes only one representative of each complex conjugate pair.
Nice work!
I also feel it's better to split this function, so that one can apply it directly in other cases when it's not from a transfer function. E.g. it can be applied #1479 and partially (though not the best practice) #1240 |
857b25a
to
d4d43bf
Compare
d4d43bf
to
cf89d31
Compare
cf89d31
to
4223a93
Compare
@weiliangjin2021 @dmarek-flex |
4223a93
to
7f237e8
Compare
I assume that is a possibility, I was going to try and give a better answer, but could not find one! Instead I at least added more tests and validation to this convenience function to ensure that the supplied admittance transfer function is realizable from passive components. But it doesn't guarantee that the final computed PoleResidue medium will be passive over all frequencies if there is some kind of numerical error when computing residues and poles. |
91bfbab
to
e5ff855
Compare
Maybe you can check PoleResidue._imag_eps_extrema_with_samples to warn the user if the resulting model is not passive? |
e5ff855
to
abd9bb9
Compare
@caseyflex Good idea, I added the test you suggested and at very high frequencies one of the admittance functions I was testing does show slight gain, although it is very small ~-1e-22. In fact, in this case I think it is numerical error when computing the complex permittivity that is causing a small negative part to appear. So I added a warning to the log when a gain term larger than machine precision is detected. |
Sounds good, thanks!
…On Fri, Sep 27, 2024 at 4:41 PM dmarek-flex ***@***.***> wrote:
@caseyflex <https://github.com/caseyflex> Good idea, I added the test you
suggested and at very high frequencies one of the admittance functions I
was testing does show slight gain, although it is very small ~-1e-22. In
fact, in this case I think it is numerical error when computing the complex
permittivity that is causing a small negative part to appear. So I added a
warning to the log when a gain term larger than machine precision is
detected.
—
Reply to this email directly, view it on GitHub
<#1974 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3KLECP5HP7DG2CJD2TGU3TZYV4D5AVCNFSM6AAAAABOWZZSOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZZGU3TGMJSGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
… equation relating polarization current density to electric field
abd9bb9
to
2e2ca56
Compare
I'm gonna merge this unless you have any final comments @tylerflex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go for it!
Not sure if this is of interest to others, but when working on lumped elements I found that I needed to construct a
PoleResidue
medium given an admittance function in the Laplace domain, which is most commonly written as a rational expression. This might be useful in other cases where you would like to model a material that is not easily converted toPoleResidue
format, but the differential equation governing the polarization current is available.More precisely, given$\epsilon_\infty$ and an admittance relationship between electric field and a polarization current density
where
we can find an equivalent complex permittivity (assuming$Y(s)$ is causal, substitute $s = j \omega$ )
Finally, we compute the poles and residues of$\frac{1}{\epsilon_0 j \omega}Y(j \omega)$ to convert it into a
PoleResidue
medium.At this point I am just curious if this would be useful outside of lumped elements.