Skip to content
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

Unit conversion inaccuracies; convert everything to atomic units #24

Open
jagot opened this issue Mar 27, 2023 · 0 comments
Open

Unit conversion inaccuracies; convert everything to atomic units #24

jagot opened this issue Mar 27, 2023 · 0 comments

Comments

@jagot
Copy link
Owner

jagot commented Mar 27, 2023

Due to the unit conversions that go on under the hood, we get issues such as the following:

julia> @field(F) do
           I₀ = 1.0
           T = 1.0
           τ = 8.0
           σmax = 6.0
       end
Linearly polarized field with
  - I₀ = 1.0000e+00 au = 3.5094452e16 W cm^-2 =>
    - E₀ = 1.0000e+00 au = 514.2207 GV m^-1
    - A₀ = 0.1592 au
  – a Fixed carrier @ λ = 7.2516 nm (T = 24.1888 as, ω = 6.2832 Ha = 170.9742 eV, f = 41.3414 PHz)
  – and a Gaussian envelope of duration 193.5107 as (intensity FWHM; ±6.18σ)
  – and a bandwidth of 0.3466 Ha = 9.4307 eV  2.2803 PHz  7.5588 Bohr = 399.9921 pm
  – Uₚ = 0.0063 Ha = 172.3181 meV => α = 0.0253 Bohr = 1.3404 pm

julia> F.I₀
1.0

julia> F.E₀
0.9999999540483009

The last should obviously be exactly unity.

The problem arises because I₀ is first converted into SI units, then E₀ is computed using

E₀ = (2I₀/(u"ε0"*u"c"))

and then subsequently converted back to atomic units. This is silly, and the detour via SI units should be avoided.

jagot added a commit that referenced this issue Mar 28, 2023
* Analytic computation of spectra of some fields

* Analytic spectra for arithmetic fields

* Fixed normalization of convolution

* Implemented (normalized) FFTs of fields

* WIP Analytic spectrum for ConstantField

* Spectra for transverse fields

* Better test of FWHM in view of unit conversion inaccuracy (#24)

* Added test of analytic and numeric field spectra

* Bump version to 0.2.0 since new Gaussian exponents can lead to different results

* Increased test coverage

* Removed unused methods

* Fixed sign of spectrum

* Some more tests

* Fix for PrettyTables < 2

* Update compat for Documenter

* Drop Julia < 1.6

* Fix doctests

* Some docstrings

* Preview PR docs

* Added spectrum example plot

* Missing plot and imports

* Missing import

* Increase test coverage

* Fixed file name

* Improved plot
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

No branches or pull requests

1 participant