Skip to content

change normalization of eigenmode sources to yield unit input power#507

Closed
HomerReid wants to merge 1 commit intoNanoComp:masterfrom
homerredux:normalize_eigsrc_to_unit_power
Closed

change normalization of eigenmode sources to yield unit input power#507
HomerReid wants to merge 1 commit intoNanoComp:masterfrom
homerredux:normalize_eigsrc_to_unit_power

Conversation

@HomerReid
Copy link
Contributor

@HomerReid HomerReid commented Sep 13, 2018

Fixes #470. Renormalize the amplitude of eigenmode sources to yield unit power flux.

The power flux depends on the frequency width of the source. I added a width parameter to fields::get_eigenmode with a default value of 0. (If width==0 the amplitude renormalization is skipped.) This requires updating calling conventions in a couple of other places:

(1) Within add_eigenmode_source, the frequency width can in principle be fetched from the existing src input parameter, so the calling convention doesn't need to change. However, the frequency width is a private data field in gaussian_src_time and continuous_src_time, and there were no getter functions. I added a virtual getter routine get_width() to the parent src_time class, which returns 0 by default and is overridden by gaussian_src_time and continuous_src_time.

(2) I updated the _get_eigenmode python routine to accept a new optional width=0.0 argument. (Again, passing width=0.0 to get_eigenmode yields behavior unchanged from before this PR.) If a user calls get_eigenmode directly from python and wants the amplitude renormalizationthe user must specify a nonzero value forwidth`.

(3) No modification is needed for get_eigenmode_coefficients. The overall normalization of the eigenmodes cancels out of this calculation anyway, so it suffices to pass width=0.0 yielding behavior equivalent to before.

@stevengj
Copy link
Collaborator

I think the mode normalization should not depend upon the time profile. You need to know the whole time-profile Fourier transform anyway to use this, so you might as well include the time-profile normalization there too.

In particular, the source current looks like mode(x)*p(t), where p(t) is the time profile. My suggestion is:

  • Normalize mode(x) to be unit power, just like in the mode-coefficient code. This is independent of p(t), whether it is Gaussian or whatever.

  • If you have a CW source, then it should result in unit power.

  • If you have a Gaussian or some other source, you take this unit power and multiply by |p̂(ω)|² to get the expected spectrum (modulo the discretization error), where p̂(ω) is a Fourier transform of p(t) with an appropriate normalization. We will update the manual to provide p̂(ω) for the Gaussian source (and maybe have a Python method for this).

@stevengj
Copy link
Collaborator

I just merged a PR #662 that reformats everything with clang-format, which creates lots of conflicts.

To rebase this PR onto master without having to deal manually with these formatting conflicts, follow the exact procedure given in the instructions of #662.

@stevengj stevengj closed this Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants