Skip to content

Commit 87887c3

Browse files
committed
implement general orientations of excitations
1 parent 9d48a08 commit 87887c3

22 files changed

+704
-285
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SphericalScattering"
22
uuid = "1a9ea918-b599-4f1f-bd9a-d681e8bb5b3e"
33
authors = ["Bernd Hofmann <Bernd.Hofmann@tum.de> and contributors"]
4-
version = "0.4.0"
4+
version = "0.5.0"
55

66
[deps]
77
LegendrePolynomials = "3db4a2ba-fc88-11e8-3e01-49c72059a882"

docs/src/details.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

22
# Further Details
33

4+
---
5+
## Units
6+
7+
SI units are employed everywhere.
8+
9+
410
---
511
## [Duality Relations](@id dualityRelations)
612

@@ -17,6 +23,50 @@ are employed in order to compute, e.g., the field of the magnetic current counte
1723

1824

1925
---
20-
## Units
26+
## [Rotations](@id rotationDetails)
27+
28+
Due to the rotational symmetry the fields for different orientations of the excitations can be computed via rotations.
29+
30+
#### Plane Wave
31+
32+
A plane wave excitation with arbitrary direction ``\hat{\bm k}`` and polarization ``\hat{\bm p}`` (forming a valid combination)
33+
can be related to the case ``\hat{\bm k} = \hat{\bm e}_z`` and polarization ``\hat{\bm p} = \hat{\bm e}_x`` by a rotation matrix
34+
```math
35+
\bm R = \begin{bmatrix} \hat{\bm p} & \hat{\bm k} \times \hat{\bm p} & \hat{\bm k} \end{bmatrix} \,.
36+
```
37+
It constitutes a change from one right-handed orthogonal basis ``(\hat{\bm e}_x^\prime , \hat{\bm e}_y^\prime, \hat{\bm e}_z^\prime )`` to another right-handed orthogonal basis ``(\hat{\bm e}_x = \hat{\bm p}, \hat{\bm e}_y = \hat{\bm k} \times \hat{\bm p}, \hat{\bm e}_z = \hat{\bm k}``.
38+
Hence, ``\bm R`` relates vectors (and points) ``\bm v'`` in the primed coordinate system ``(x',y',z')`` to vectors (and points) ``\bm v`` in the unprimed one ``(x,y,z)`` by
39+
```math
40+
\bm v = \bm R \bm v' \qquad \text{and} \qquad \bm v' = \bm R^\mathrm{T} \bm v
41+
```
42+
leveraging that ``\bm R^{-1} = \bm R^\mathrm{T}``.
43+
```@raw html
44+
<br/>
45+
```
46+
47+
#### Ring-Currents and Dipoles
2148

22-
SI units are employed everywhere.
49+
Ring-currents and dipoles are characterized by only one vector ``\hat{\bm p}`` (defining the orientation).
50+
An arbitrary ``\hat{\bm p}`` can be related to an initial one ``\hat{\bm p}_0`` (e.g., ``\hat{\bm p}_0 = \hat{\bm e}_z^\prime``) by a
51+
right-handed rotation around a rotation axis ``\hat{\bm a} = (a_x, a_y, a_z)`` by an angle ``\alpha``.
52+
The rotation axis is given by
53+
```math
54+
\hat{\bm a} = \cfrac{\hat{\bm p}_0 \times \hat{\bm p}}{|\hat{\bm p}_0 \times \hat{\bm p}|}
55+
```
56+
and the angle ``\alpha`` is encoded in
57+
```math
58+
\cos(\alpha) = \hat{\bm p}_0 \cdot \hat{\bm p} \qquad \text{and} \qquad \sin(\alpha) = |\hat{\bm p}_0 \times \hat{\bm p}|\,.
59+
```
60+
The rotation matrix is then found by the [Rodrigues' rotation formula](https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula) as
61+
```math
62+
\bm R = \mathbf{I} + \sin(\alpha)\bm{K} + (1 - \cos(\alpha)) \bm{K}^2
63+
```
64+
with
65+
```math
66+
\bm K = \begin{bmatrix} 0 & -a_z & a_y \\ a_z & 0 & -a_x \\ -a_y & a_x & 0 \end{bmatrix} \,.
67+
```
68+
Vectors (and points) ``\bm v'`` in the initial coordinate system ``(x',y',z')`` (with, e.g., ``\hat{\bm e}_z^\prime = \hat{\bm p}_0``) are then related to vectors (and points) ``\bm v`` in the unprimed one ``(x,y,z)`` by
69+
```math
70+
\bm v = \bm R \bm v' \qquad \text{and} \qquad \bm v' = \bm R^\mathrm{T} \bm v
71+
```
72+
leveraging that ``\bm R^{-1} = \bm R^\mathrm{T}``.

docs/src/dipoles.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ HertzianDipole
4444
FitzgeraldDipole
4545
```
4646

47-
!!! note
48-
The `orientation` is automatically normalized.
47+
!!! tip
48+
The `orientation` vector is automatically normalized to a unit vector during the initialization.
4949

5050

5151
---
@@ -64,7 +64,7 @@ where
6464
\hat{\bm n} = \cfrac{\bm r - \bm r_0}{|\bm r - \bm r_0|}\,.
6565
```
6666
!!! note
67-
The fields of the Fitzgerald dipole are computed via [duality relations](@ref dualityRelations).
67+
The fields of the Fitzgerald dipole follow from the [duality relations](@ref dualityRelations).
6868

6969

7070
#### API
@@ -81,15 +81,22 @@ FF = field(ex, FarField(point_cart))
8181
---
8282
## Scattered Field
8383

84-
The scattered field computation is a generalization of the analysis in [[1, pp. 374ff]](@ref refs). For the magnetic ring current [duality relations](@ref dualityRelations) are employed.
84+
The scattered field computation is a generalization of the analysis in [[1, pp. 374ff]](@ref refs). For the magnetic dipole [duality relations](@ref dualityRelations) are employed.
8585

86-
!!! note
87-
Orientation and location of the dipole are restricted for the scattered field computation!
86+
!!! tip
87+
For the scattered field computation the orientation of the dipole is restricted: the dipole has to be perpendicular to the surface of the sphere.
8888

89-
The dipole has to be oriented such that it is normal to the sphere surface and located outside of the sphere.
89+
This can be achieved, e.g., by defining the orientation first
90+
```julia
91+
orientation = normalize(SVector(0.0,1.0,1.0))
92+
```
93+
and then setting the position as a multiple of the orientaion:
94+
```julia
95+
position = 2.0 * orientation
96+
```
9097

91-
!!! warning
92-
So far the dipole is assumed to be along the ``z``-axis! This is planned to be generalized.
98+
!!! note
99+
Internal details of the computations: Following [[1, pp. 347ff]](@ref refs) the dipoles are initially assumed to be aligned with the ``z``-axis. Arbitrary positions and orientations (forming a valid pair) are obtained via [rotations](@ref rotationDetails).
93100

94101
#### API
95102

docs/src/manual.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The basic building blocks are introduced in the following simple example; more d
1111
```julia
1212
using SphericalScattering, StaticArrays
1313

14-
# define excitation: plane wave travelling in negative z-direction with x-polarization
14+
# define excitation: plane wave travelling in positive z-direction with x-polarization
1515
ex = planeWave(frequency=10e6) # Hz
1616

1717
# define scatterer: PEC sphere
@@ -24,7 +24,6 @@ point_cart = [SVector(2.0, 2.0, 3.2)]
2424
E = scatteredfield(sp, ex, ElectricField(point_cart))
2525
H = scatteredfield(sp, ex, MagneticField(point_cart))
2626
FF = scatteredfield(sp, ex, FarField(point_cart))
27-
2827
```
2928

3029
---
@@ -54,7 +53,7 @@ For all available excitations a simple constructor with keyword arguments and de
5453
- [Dipoles](@ref dipolesAPI)
5554
- [Ring currents](@ref rcAPI)
5655
- [Spherical modes](@ref modesAPI)
57-
- [Uniform Static Field](@ref uniformAPI)
56+
- [Uniform static field](@ref uniformAPI)
5857

5958

6059
---

docs/src/planeWave.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
---
1919
## Definition
2020

21-
The plane wave with amplitude ``a``, wave vector ``\bm k``, and polarization ``\hat{\bm p}`` is assumed to have the field
21+
A plane wave with amplitude ``a``, wave vector ``\bm k = k \hat{\bm k}``, and polarization ``\hat{\bm p}`` (vectors with a hat denote unit vectors) is defined by the field
2222
```math
23-
\bm e_\mathrm{PW}(\bm r) = a \hat{\bm p} \, \mathrm{e}^{-\mathrm{j} \bm k \cdot \bm r} \,.
23+
\bm e_\mathrm{PW}(\bm r) = a \hat{\bm p} \, \mathrm{e}^{-\mathrm{j} \bm k \cdot \bm r} \,,
2424
```
25-
25+
where the ploarization and wave vector are orthogonal, that is,
26+
```math
27+
\bm k \cdot \hat{\bm p} = 0
28+
```
29+
holds.
2630

2731
---
2832
## [API](@id pwAPI)
@@ -33,7 +37,10 @@ planeWave
3337
```
3438

3539
!!! note
36-
The `direction` and the `polarization` are each automatically normalized.
40+
The provided `direction` and the `polarization` vectors have to be orthogonal. This is checked during initialization.
41+
42+
!!! tip
43+
The `direction` and the `polarization` vectors are each automatically normalized to unit vectors during the initialization.
3744

3845
---
3946
## Incident Field
@@ -42,7 +49,7 @@ The electric field of the plane wave is as given above. The magnetic field is gi
4249
```math
4350
\bm h_\mathrm{PW}(\bm r) = \cfrac{a}{Z_\mathrm{F}} (\hat{\bm k} \times \hat{\bm p}) \mathrm{e}^{-\mathrm{j} \bm k \cdot \bm r}
4451
```
45-
with ``Z_\mathrm{F} = \sqrt{\mu / \varepsilon}``
52+
with ``Z_\mathrm{F} = \sqrt{\mu / \varepsilon}``.
4653

4754
#### API
4855

@@ -61,8 +68,8 @@ H = field(ex, MagneticField(point_cart))
6168

6269
The scattered field computation follows [[1, pp. 347ff]](@ref refs).
6370

64-
!!! warning
65-
So far the plane wave is assumed to travel in positive ``z``-axis direction and to have a polarization along the ``x``-axis! This is planned to be generalized.
71+
!!! note
72+
Internal details of the computations: Following [[1, pp. 347ff]](@ref refs) the plane wave is initially assumed to travel in positive ``z``-axis direction and to have a polarization along the positive ``x``-axis. Arbitrary directions and orientations (forming a valid pair) are obtained via [rotations](@ref rotationDetails).
6673

6774
#### API
6875

docs/src/ringCurrents.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,24 @@ The ring currents are defined by a circular loop of radius ``a`` carrying a unif
2323

2424
#### Electric Ring Current
2525

26-
The electric ring current with amplitude ``I``, and orientation ``\hat{\bm e}_z`` at position ``\bm r_0`` is assumed to have the current density
26+
The electric ring current with amplitude ``I``, and orientation ``\hat{\bm p} = \hat{\bm e}_z`` with its center at position ``\bm r_0 = (0,0,z_0)`` is assumed to have the current density
2727
```math
2828
\bm{j}_\mathrm{rc} = I \hat{\bm e}_{\varphi'} \delta (r - R_0) \delta (\vartheta - \vartheta_0)\,,
2929
```
3030
where ``\delta`` denotes the Dirac delta distribution and ``R_0 = \sqrt{z_0^2 + a^2}``.
3131

3232
#### Magnetic Ring Current
3333

34-
The magnetic ring current with amplitude ``M``, and orientation ``\hat{\bm e}_z`` at position ``\bm r_0`` is assumed to have the current density
34+
The magnetic ring current with amplitude ``M``, and orientation ``\hat{\bm p} = \hat{\bm e}_z`` at position ``\bm r_0 = (0,0,z_0)`` is assumed to have the current density
3535
```math
3636
\bm{m}_\mathrm{rc} = M \hat{\bm e}_{\varphi'} \delta (r - R_0) \delta (\vartheta - \vartheta_0)\,.
3737
```
3838

39+
!!! note
40+
Arbitrary center positions ``\bm r_0`` and orientations ``\hat{\bm p}`` are computed by [rotations](@ref rotationDetails) and translations of the corresponding fields.
41+
42+
43+
3944
---
4045
## [API](@id rcAPI)
4146

@@ -73,13 +78,20 @@ FF = field(ex, FarField(point_cart))
7378

7479
The scattered field computation follows [[1, pp. 368ff]](@ref refs). For the magnetic ring current [duality relations](@ref dualityRelations) are employed.
7580

76-
!!! note
77-
Orientation and location of the ring currents are restricted for the scattered field computation!
81+
!!! tip
82+
For the scattered field computation the orientation of the ring current is restricted: the orientation vector has to be perpendicular to the surface of the sphere.
7883

79-
The ring current has to be oriented such that it is normal to the sphere surface and located outside of the sphere.
84+
This can be achieved, e.g., by defining the orientation first
85+
```julia
86+
orientation = normalize(SVector(0.0,1.0,1.0))
87+
```
88+
and then setting the center position as a multiple of the orientaion:
89+
```julia
90+
center = 2.0 * orientation
91+
```
8092

81-
!!! warning
82-
So far the ring current is assumed to be along the ``z``-axis! This is planned to be generalized.
93+
!!! note
94+
Internal details of the computations: Following [[1, pp. 368ff]](@ref refs) the orientation vectors of the ring currents are initially assumed to be aligned with the ``z``-axis. Arbitrary centers and orientations (forming a valid pair) are obtained via [rotations](@ref rotationDetails).
8395

8496
#### API
8597

docs/src/uniformStatic.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ The API provides the following constructor with default values:
3232
UniformField
3333
```
3434

35-
!!! note
36-
The direction is automatically normalized.
35+
!!! tip
36+
The `direction` vector is automatically normalized to a unit vector during the initialization.
3737

3838

3939
---
4040
## Incident Field
4141

42-
The electric field of the plane wave is as given above.
42+
The electric field is as given above.
4343

4444
#### API
4545

@@ -55,8 +55,6 @@ E = field(ex, ElectricField(point_cart))
5555

5656
The scattered field computation follows [[3]](@ref refs).
5757

58-
!!! warning
59-
So far the static electric field is assumed to point in ``x``-direction. This is planned to be generalized.
6058

6159
#### API
6260

src/SphericalScattering.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export field, scatteredfield
4747

4848

4949
# -------- included files
50-
include("coordinateTransforms.jl")
5150
include("dataHandling.jl")
5251
include("sphere.jl")
5352

@@ -72,4 +71,5 @@ include("UniformField/incident.jl")
7271
include("UniformField/scattered.jl")
7372

7473
include("totalFields.jl")
74+
include("coordinateTransforms.jl")
7575
end

src/UniformField/excitation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ end
1616
ex = UniformField(;
1717
embedding=Medium(ε0, μ0),
1818
amplitude=1.0,
19-
direction=SVector{3,Float64}(1.0, 0.0, 0.0)
19+
direction=SVector{3,typeof(amplitude)}(1.0, 0.0, 0.0)
2020
)
2121
"""
22-
UniformField(; embedding=Medium(ε0, μ0), amplitude=1.0, direction=SVector{3,Float64}(1.0, 0.0, 0.0)) =
22+
UniformField(; embedding=Medium(ε0, μ0), amplitude=1.0, direction=SVector{3,typeof(amplitude)}(1.0, 0.0, 0.0)) =
2323
UniformField(embedding, amplitude, direction)

0 commit comments

Comments
 (0)