-
Notifications
You must be signed in to change notification settings - Fork 124
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
Use 'quantities' library to handle conversions between simulation units and actual units #34
Comments
Hi @aizvorski ,
|
Hi @flaport - Thanks, that's really helpful! I'm still slightly confused by "simulation units" :) There may be two different interpretations (which may be equivalent, maybe) (a) the equations are changed to (b) the equations are not changed, but E is expressed in units of 3.36e+5 volts/meter, and H is expressed in units of 8.92e+2 amperes/meter, where these are just the original quantity multiplied by a dimensionless scaling factor, ie when you say sqrt(epsilon0) you don't mean the sqrt of the physical quantity with units but rather sqrt(epsilon0 / (1 farad/meter)) which is dimensionless. All the scaled values still have the same dimensions, and the equations are the same, but are in units chosen so that the numerical values of epsilon0 and mu0 (both expressed in those units) happen to be equal to each other? (*and I think the only unit that is being scaled is current, everything else can stay in SI units) Which of these two is more correct? Are they equivalent? Also is the main advantage of this to make sure both equations can use the same Courant number? |
@flaport "instead of power we should just define a electric field amplitude" - I like this, it's intuitive. It seems that the point/line sources convert power to amplitude and then just use amplitude internally, might as well specify amplitude as input. Looking at the code, amplitude is distributed proportionally to inv(epsilon) along lines? (and maybe planes?) That may produce unexpected results if a source is inside an object :) I'd like to set up a simulation which has a point dipole (short line) with a given amplitude in V/m and measure power density in the far field in W/m^2, and make sure it matches the analytical values and all the units and conversions are as expected. If I wanted to try that with the current definition of line sources, what are the power units now - are they essentially |
Hi @aizvorski, (a) is correct. Just be know that in simulation units
This means that the unit of E and H is The advantage of this convention is that E and H will be of comparable magnitude, which should make the FDTD algorithm numerically more stable. Working back from the source value being added to the grid, we have that
Which means that the unit for
This of course makes no sense. I am going to change this. The idea behind scaling the amplitude of the source with n=sqrt(ε^{-1}) is that I wanted people to specify the free-space amplitude/power for the source, but it might indeed might be counterintuitive (and maybe even wrong)... I am going to change this too. |
Ok, the power keyword issue was solved in 1c3b98d (fdtd version 0.2.0). From now on, you need to specify the field amplitude in simulation units. |
Hi, From what I'm understanding by reading this, I'm assuming one can convert E from simulation units to V/m by simply dividing the simulation units by √ε0 and H_sim to A/m by dividing by √μ0? Thanks! |
@flaport Thanks, very cool! I'm going to try specifying a point dipole with known amplitude and see if the detected power vs distance in the far field matches the expected value. Would you like to have an example like that in the standard examples?
|
@flaport Thanks for explaining, good to know that these are new quantities with new units. I think I'm getting close to actually understanding this :)
I see the formula but I admit I don't understand why that means the units are as described. Going from the So where does the |
@pingpongballz I think that's correct, as long as ε0 is in farads/meter and μ0 is in henry/meter. The simulation units for both E and H should be However @flaport said it should be meter^(+1/2), so I may be totally wrong about that (and the du value may be needed as well). I asked for clarification, so please stay tuned :) |
@aizvorski thanks so much! My initial doubt was also in the metre^0.5 issue. But ill just bite the bullet and go ahead and multiply my poynting vectors by 3e8 m/s. Again, thanks for your help! 😃 |
Hi @aizvorski , @pingpongballz , Indeed, I seem to have made a mistake when I was quickly double checking the units...
My apologies for the confusion. Closing this issue as I think this has been resolved. But feel free to continue the discussion if you want any of this changed. |
@flaport Thank you for the excellent explanation - I hope this is useful to anyone who has the same questions in the future. Indeed mostly resolved. How do you feel about using a package like quantities to allow passing in values (eg amplitude, conductivity) and retrieving values (eg field strength from detectors) with proper units? It could be an optional dependency - if not installed (of if passing just floats or numpy arrays) assume simulation units, but if passing in a value with units then do the conversion to/from simulation units as needed. |
That's indeed a good idea! I will look into this. I'm reopening the issue to track progress on this issue. |
I'm wondering what the units used for each quantity are, both for parameters which are passed in and for values stored internally or produced by the calculation.
A lot of things seem to be unitless, but other things seem to have assumed units. A quick list:
It would be great to track all quantities with units and add this to the documentation. I can try to write that up as long as someone can help answer questions.
The text was updated successfully, but these errors were encountered: