Skip to content

Commit

Permalink
Merge branch 'feature/rcs'
Browse files Browse the repository at this point in the history
  • Loading branch information
HoBeZwe committed Feb 6, 2024
2 parents 070641a + 462641f commit 2c43216
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SphericalScattering"
uuid = "1a9ea918-b599-4f1f-bd9a-d681e8bb5b3e"
authors = ["Bernd Hofmann <Bernd.Hofmann@tum.de> and contributors"]
version = "0.7.0"
version = "0.7.1"

[deps]
LegendrePolynomials = "3db4a2ba-fc88-11e8-3e01-49c72059a882"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following aspects are implemented (✔) and planned (⌛):
##### Available quantities (where applicable):
- ✔ Far-fields
- ✔ Near-fields (electric & magnetic)
- Radar cross section (RCS)
- Radar cross section (RCS)
- ⌛ Surface currents
- ✔ Scalar potentials
- ✔ Displacement fields
Expand Down
74 changes: 74 additions & 0 deletions docs/src/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,80 @@ print("Far-field error: $diff_FF %\n")
[CompScienceMeshes](https://github.com/krcools/CompScienceMeshes.jl) are used to define several functional tests.


---
## [Radar Cross Section](@id rcsApplication)

The monostatic and the bistatic [radar cross section (RCS)](@ref rcsPW) can be evaluated.

### Monostatic RCS

The monostatic radar cross section as a function of the sphere radius can be computed as follows (compare also the plot in [[1, pp. 352ff]](@ref refs)):
```@example RCS
using SphericalScattering
using PlotlyJS
f = 1e8
c = 2.99792458e8 # speed of light
λ = c / f
RCS = Float64[]
aTλ = Float64[]
# --- compute RCS
for rg in 0.01:0.01:3.0
a = λ*rg
monoRCS = rcs(PECSphere(radius=a), planeWave(frequency=f))
push!(RCS, monoRCS / (π * a^2))
push!(aTλ, rg)
end
# --- plot
layout = Layout(
yaxis=attr(title_text="RCS / πa² in dB"),
xaxis=attr(title_text="a / λ")
)
plot(scatter(; x=aTλ, y=10*log10.(RCS), mode="lines+markers"), layout)
t = plot(scatter(; x=aTλ, y=10*log10.(RCS), mode="lines+markers"), layout) # hide
savefig(t, "monoRCS.html"); nothing # hide
```

```@raw html
<object data="../monoRCS.html" type="text/html" style="width:100%;height:50vh;"> </object>
```

### Bistatic RCS

The bistatic radar cross section along a ϑ-cut can be computed as follows (compare also the plot in [[1, pp. 351ff]](@ref refs)):
```@example RCS
using StaticArrays
# --- points
ϑ = [i*π/500 for i in 0:500]
φ = 0
points_cart = [SphericalScattering.sph2cart(SVector(1.0, ϑi, φ)) for ϑi in ϑ]
# --- compute RCS
biRCS = rcs(PECSphere(radius=λ), planeWave(frequency=1e8), points_cart) / λ^2
# --- plot
layout = Layout(
yaxis=attr(title_text="RCS / λ² in dB"),
xaxis=attr(title_text="ϑ in degree")
)
plot(scatter(; x=ϑ*180/π, y=10*log10.(biRCS), mode="lines+markers"), layout)
t = plot(scatter(; x=ϑ*180/π, y=10*log10.(biRCS), mode="lines+markers"), layout) # hide
savefig(t, "biRCS.html"); nothing # hide
```

```@raw html
<object data="../biRCS.html" type="text/html" style="width:100%;height:50vh;"> </object>
```



---
Expand Down
19 changes: 18 additions & 1 deletion docs/src/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,31 @@ E = field(sp, ex, ElectricField(point_cart))
H = field(sp, ex, MagneticField(point_cart))

FF = field(sp, ex, FarField(point_cart))

```
For the uniform field excitation, only the electric field as well as the scalar potential can be calculated:
```julia
Φ = field(sp, ex, ScalarPotential(point_cart))
```


---
## Radar Cross Section

To compute the bistatic [radar cross section (RCS)](@ref rcsPW), the function
```julia
σ = rcs(sp, ex, points_cart)
```
is provided. For the monostatic RCS, the function
```julia
σ = rcs(sp, ex)
```
is provided.

!!! note
The RCS is (so far) only defined for a plane wave excitation.



---
## Conversion Between Bases

Expand Down
18 changes: 18 additions & 0 deletions docs/src/planeWave.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,21 @@ H = field(sp, ex, MagneticField(point_cart))

!!! note
The total far-field is not defined (since the incident far-field is not defined).


---
## [Radar Cross Section](@id rcsPW)

To compute the bistatic radar cross section (RCS) [[1, pp. 350ff]](@ref refs)
```math
\sigma (\vartheta, \varphi) = \lim_{r\rightarrow \infty} \left( 4 \pi r^2 \frac{{|e^\mathrm{sc}|}^2}{{|e^\mathrm{sc}|}^2} \right)
```
the function
```julia
σ = rcs(sp, ex, points_cart)
```
is provided. For the monostatic RCS, the function
```julia
σ = rcs(sp, ex)
```
is provided.
2 changes: 2 additions & 0 deletions src/SphericalScattering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export SphericalMode, SphericalModeTE, SphericalModeTM
export PECSphere, DielectricSphere, LayeredSphere, LayeredSpherePEC
export DielectricSphereThinImpedanceLayer
export field, scatteredfield
export rcs
export sphericalGridPoints, phiCutPoints, thetaCutPoints


Expand Down Expand Up @@ -82,6 +83,7 @@ include("UniformField/scattered.jl")
include("totalFields.jl")
include("coordinateTransforms.jl")
include("utils.jl")
include("rcs.jl")

if !isdefined(Base, :get_extension)
include("../ext/SphericalScatteringExt.jl") # for backwards compatibility with julia versions below 1.9
Expand Down
50 changes: 50 additions & 0 deletions src/rcs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

"""
rcs(sphere::Sphere, excitation::PlaneWave, point_cart; parameter::Parameter=Parameter())
Compute the bistatic radar cross-section (RCS).
"""
function rcs(sphere::Sphere, excitation::PlaneWave, points_cart; parameter::Parameter=Parameter())

FF = scatteredfield(sphere, excitation, FarField(points_cart); parameter=parameter)

return 4π * norm.(FF) .^ 2 / abs2(excitation.amplitude)
end



"""
rcs(sphere::Sphere, excitation::PlaneWave; parameter::Parameter=Parameter())
Compute the monostatic radar cross-section (RCS): the bistatic RCS solely for the incident direction of the plane wave.
"""
function rcs(sphere::Sphere, excitation::PlaneWave; parameter::Parameter=Parameter())

point_cart = -excitation.direction

return rcs(sphere, excitation, [point_cart]; parameter=parameter)[1]
end



"""
rcs(sphere::Sphere, excitation::Excitation, point_cart; parameter::Parameter=Parameter())
RCS only defined for plane waves, so far.
"""
function rcs(sphere::Sphere, excitation::Excitation, point_cart; parameter::Parameter=Parameter())

return error("The (bistatic) RCS is only defined for a plane-wave excitation (so far).")
end



"""
rcs(sphere::Sphere, excitation::Excitation; parameter::Parameter=Parameter())
RCS only defined for plane waves, so far.
"""
function rcs(sphere::Sphere, excitation::Excitation; parameter::Parameter=Parameter())

return error("The (monostatic) RCS is only defined for a plane-wave excitation (so far).")
end
18 changes: 18 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,21 @@ end
@test_nowarn plotffcut(norm.(FF), points_sph, normalize=true, scale="log", format="rectangular")
@test_nowarn plotffcut(norm.(FF), points_sph, normalize=true, scale="linear", format="rectangular")
end

@testset "Radar cross section" begin

# --- monostatic RCS
@test_nowarn rcs(PECSphere(; radius=2.0), planeWave(; frequency=1e8))

@test_throws ErrorException("The (monostatic) RCS is only defined for a plane-wave excitation (so far).") rcs(
PECSphere(; radius=1.0), SphericalModeTE(; frequency=f)
)


# --- bistatic RCS
@test_nowarn rcs(PECSphere(; radius=2.0), planeWave(; frequency=1e8), [SVector(1.0, 0.0, 0.0)])

@test_throws ErrorException("The (bistatic) RCS is only defined for a plane-wave excitation (so far).") rcs(
PECSphere(; radius=1.0), SphericalModeTE(; frequency=f), []
)
end

2 comments on commit 2c43216

@HoBeZwe
Copy link
Owner Author

@HoBeZwe HoBeZwe commented on 2c43216 Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

New Features:

  • RCS computation interfaces are provided.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/100364

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.1 -m "<description of version>" 2c4321682bd0bf28f4667e4e3de4962aaba6a8d2
git push origin v0.7.1

Please sign in to comment.