@@ -46,10 +46,9 @@ function scatteredfield(sphere::Sphere, excitation::PlaneWave, point, quantity::
46
46
47
47
eps = parameter. relativeAccuracy
48
48
49
- ST = SVector{3 ,Complex{T}}
50
- F = ST (0.0 , 0.0 , 0.0 )
49
+ F = SVector {3,Complex{T}} (0.0 , 0.0 , 0.0 )
51
50
52
- A₀ = amplitude (sphere, excitation:: PlaneWave , quantity, r)
51
+ A₀ = amplitude (sphere, excitation, quantity, r)
53
52
54
53
A₀ == 0.0 && return F # Inside of PEC return zero field
55
54
@@ -84,7 +83,30 @@ function scatteredfield(sphere::Sphere, excitation::PlaneWave, point, quantity::
84
83
85
84
end
86
85
87
- return convertSpherical2Cartesian (A₀ .* F, point_sph)
86
+ Fin = inside (sphere, excitation, point, quantity; parameter= parameter)
87
+
88
+ return convertSpherical2Cartesian (A₀ .* F, point_sph) + Fin
89
+ end
90
+
91
+
92
+ function inside (sphere:: Sphere , excitation:: PlaneWave{T,R,C} , point, quantity:: Field ; parameter) where {T,R,C}
93
+
94
+ return SVector {3,Complex{R}} (0.0 , 0.0 , 0.0 ) # no correction needed
95
+ end
96
+
97
+ function inside (sphere:: DielectricSphere , excitation:: PlaneWave{T,R,C} , point, quantity:: FarField ; parameter) where {T,R,C}
98
+
99
+ return SVector {3,Complex{R}} (0.0 , 0.0 , 0.0 ) # no correction needed
100
+ end
101
+
102
+ function inside (sphere:: DielectricSphere , excitation:: PlaneWave{T,R,C} , point, quantity:: Field ; parameter) where {T,R,C}
103
+
104
+ # inside the sphere the incident field has to be substracted to get only the scattered part
105
+ if norm (point) < sphere. radius
106
+ return - field (excitation, point, quantity; parameter= parameter)
107
+ end
108
+
109
+ return SVector {3,Complex{R}} (0.0 , 0.0 , 0.0 )
88
110
end
89
111
90
112
0 commit comments