Skip to content

Commit 4042798

Browse files
committed
include max_mode and fixed error due to NaN of model system
2 parents 0f81ef3 + 05aa027 commit 4042798

File tree

11 files changed

+804
-184
lines changed

11 files changed

+804
-184
lines changed

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "EffectiveWaves"
22
uuid = "37e8709b-1ed2-53db-b26a-3571262b3cb4"
33
authors = ["Artur L. Gower <[email protected]>"]
4-
version = "0.3.5"
4+
version = "0.3.6"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
@@ -30,7 +30,7 @@ HCubature = "1"
3030
Interpolations = "0.12, ^0.13"
3131
IterTools = "1"
3232
MDBM = "0.1"
33-
MultipleScattering = "^0.1.17"
33+
MultipleScattering = "^0.1.21"
3434
OffsetArrays = "^0.23, 1"
3535
Optim = "0.22, 1"
3636
ParticleCorrelations = "^0.0.1"

docs/src/theory/reflection_transmission_low_freq.nb

+106-35
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010
NotebookFileLineBreakTest
1111
NotebookFileLineBreakTest
1212
NotebookDataPosition[ 158, 7]
13+
<<<<<<< HEAD
1314
NotebookDataLength[ 46591, 1235]
1415
NotebookOptionsPosition[ 43605, 1177]
1516
NotebookOutlinePosition[ 43993, 1193]
1617
CellTagsIndexPosition[ 43950, 1190]
18+
=======
19+
NotebookDataLength[ 37111, 1018]
20+
NotebookOptionsPosition[ 34220, 961]
21+
NotebookOutlinePosition[ 34615, 977]
22+
CellTagsIndexPosition[ 34572, 974]
23+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
1724
WindowFrame->Normal*)
1825

1926
(* Beginning of Notebook Content *)
@@ -86,7 +93,7 @@ Cell[BoxData[{
8693
RowBox[{
8794
RowBox[{"X0", " ", "=", " ",
8895
RowBox[{"{",
89-
RowBox[{"0", ",", "y"}], "}"}]}], ";"}], "\[IndentingNewLine]",
96+
RowBox[{"x0", ",", "y"}], "}"}]}], ";"}], "\[IndentingNewLine]",
9097
RowBox[{"X", " ", "=", " ",
9198
RowBox[{"{",
9299
RowBox[{"x", ",", "y"}], "}"}]}], "\[IndentingNewLine]",
@@ -104,12 +111,9 @@ Cell[BoxData[{
104111
FractionBox["1", "\[Rho]1"], " ",
105112
RowBox[{"D", "[",
106113
RowBox[{
107-
RowBox[{"uin", "[", "X", "]"}], ",", "x"}], "]"}]}], " ", "+",
108-
RowBox[{
109-
FractionBox["1", "\[Rho]1"],
110-
RowBox[{"D", "[", " ",
111-
RowBox[{
112-
RowBox[{"uR", "[", "X", "]"}], ",", "x"}], "]"}]}], " ", "-",
114+
RowBox[{
115+
RowBox[{"uin", "[", "X", "]"}], "+", " ",
116+
RowBox[{"uR", "[", "X", "]"}]}], ",", "x"}], "]"}]}], " ", "-",
113117
RowBox[{
114118
FractionBox["1", "\[Rho]2"],
115119
RowBox[{"D", "[",
@@ -139,43 +143,61 @@ Cell[BoxData[{
139143
RowBox[{"Thread", "[",
140144
RowBox[{"eqs", "==", " ", "0"}], "]"}], "/.", "subSnells"}], ",",
141145
RowBox[{"{",
142-
RowBox[{"R", ",", "T"}], "}"}]}], "]"}]}], "/.", " ",
143-
RowBox[{"k1", " ", "->", " ",
146+
RowBox[{"R", ",", "T"}], "}"}]}], "]"}]}], "/.", " ",
147+
RowBox[{"\[Rho]2", "->", " ",
144148
RowBox[{"Q", " ", "k2", " ",
145-
RowBox[{"\[Rho]1", "/", "\[Rho]2"}]}]}]}], " ", "//",
149+
RowBox[{"\[Rho]1", "/", "k1"}]}]}]}], " ", "//",
146150
"Simplify"}]}]}], "Input",
147151
CellChangeTimes->{{3.906541843416709*^9, 3.906542195715724*^9}, {
148152
3.906542229477569*^9, 3.906542268783965*^9}, {3.906542314159116*^9,
149153
3.906542336427779*^9}, {3.906542451667676*^9, 3.9065424769550533`*^9}, {
150154
3.906542728456843*^9, 3.906542728602861*^9}, {3.906542769766479*^9,
151-
3.906542771001995*^9}, {3.9163110611893473`*^9, 3.916311101609243*^9}},
152-
CellLabel->"In[54]:=",ExpressionUUID->"505ed892-b0ee-4b93-bf20-789175b2a272"],
155+
3.906542771001995*^9}, {3.9163110611893473`*^9, 3.916311101609243*^9}, {
156+
3.916390798484353*^9, 3.9163907988358917`*^9}, {3.916391202260542*^9,
157+
3.916391250295336*^9}},
158+
CellLabel->"In[68]:=",ExpressionUUID->"505ed892-b0ee-4b93-bf20-789175b2a272"],
153159

154160
Cell[BoxData[
155161
RowBox[{"{",
156162
RowBox[{"x", ",", "y"}], "}"}]], "Output",
157163
CellChangeTimes->{{3.9065420170841618`*^9, 3.906542045835774*^9}, {
158164
3.906542135646899*^9, 3.906542196986534*^9}, 3.906542269001123*^9,
159165
3.906542336756316*^9, 3.906542477180331*^9, 3.906542729035215*^9,
160-
3.906542772845778*^9, {3.916311047778927*^9, 3.916311102578001*^9}},
161-
CellLabel->"Out[62]=",ExpressionUUID->"fc2f5679-1c2b-49fa-882b-1731f835a4da"],
166+
3.906542772845778*^9, {3.916311047778927*^9, 3.916311102578001*^9},
167+
3.916390630140895*^9, 3.916390802680944*^9, {3.91639120552874*^9,
168+
3.9163912508145723`*^9}},
169+
CellLabel->"Out[76]=",ExpressionUUID->"335fb237-18c0-43d1-ad5d-de3928c8561a"],
162170

163171
Cell[BoxData[
164172
RowBox[{"{",
165173
RowBox[{
166174
RowBox[{"R", "\[Rule]",
167175
FractionBox[
168176
RowBox[{
169-
RowBox[{"Q", " ",
170-
RowBox[{"Cos", "[", "\[Theta]1", "]"}]}], "-",
171-
RowBox[{"Cos", "[", "\[Theta]2", "]"}]}],
177+
SuperscriptBox["\[ExponentialE]",
178+
RowBox[{"2", " ", "\[ImaginaryI]", " ", "k1", " ", "x0", " ",
179+
RowBox[{"Cos", "[", "\[Theta]1", "]"}]}]], " ",
180+
RowBox[{"(",
181+
RowBox[{
182+
RowBox[{"Q", " ",
183+
RowBox[{"Cos", "[", "\[Theta]1", "]"}]}], "-",
184+
RowBox[{"Cos", "[", "\[Theta]2", "]"}]}], ")"}]}],
172185
RowBox[{
173186
RowBox[{"Q", " ",
174187
RowBox[{"Cos", "[", "\[Theta]1", "]"}]}], "+",
175188
RowBox[{"Cos", "[", "\[Theta]2", "]"}]}]]}], ",",
176189
RowBox[{"T", "\[Rule]",
177190
FractionBox[
178-
RowBox[{"2", " ", "Q", " ",
191+
RowBox[{"2", " ",
192+
SuperscriptBox["\[ExponentialE]",
193+
RowBox[{"\[ImaginaryI]", " ", "x0", " ",
194+
RowBox[{"(",
195+
RowBox[{
196+
RowBox[{"k1", " ",
197+
RowBox[{"Cos", "[", "\[Theta]1", "]"}]}], "-",
198+
RowBox[{"k2", " ",
199+
RowBox[{"Cos", "[", "\[Theta]2", "]"}]}]}], ")"}]}]], " ", "Q",
200+
" ",
179201
RowBox[{"Cos", "[", "\[Theta]1", "]"}]}],
180202
RowBox[{
181203
RowBox[{"Q", " ",
@@ -184,8 +206,10 @@ Cell[BoxData[
184206
CellChangeTimes->{{3.9065420170841618`*^9, 3.906542045835774*^9}, {
185207
3.906542135646899*^9, 3.906542196986534*^9}, 3.906542269001123*^9,
186208
3.906542336756316*^9, 3.906542477180331*^9, 3.906542729035215*^9,
187-
3.906542772845778*^9, {3.916311047778927*^9, 3.916311102600688*^9}},
188-
CellLabel->"Out[65]=",ExpressionUUID->"fbf24fc6-1eef-40cf-8680-2c99a27abd01"]
209+
3.906542772845778*^9, {3.916311047778927*^9, 3.916311102578001*^9},
210+
3.916390630140895*^9, 3.916390802680944*^9, {3.91639120552874*^9,
211+
3.9163912508973093`*^9}},
212+
CellLabel->"Out[79]=",ExpressionUUID->"e5079cb5-0728-4534-9e5c-542711c2dcc0"]
189213
}, Open ]],
190214

191215
Cell[CellGroupData[{
@@ -544,13 +568,19 @@ Cell[BoxData[{
544568
3.916311027162562*^9}, {3.916311115609462*^9, 3.916311284904895*^9}, {
545569
3.9163113799386*^9, 3.916311394482524*^9}, {3.916311426640787*^9,
546570
3.9163114270258093`*^9}, 3.916311474276861*^9, {3.916382402189849*^9,
571+
<<<<<<< HEAD
547572
3.9163824234690104`*^9}, 3.9169793377431507`*^9},
548573
CellLabel->"In[23]:=",ExpressionUUID->"55751fef-0974-4177-ba5a-bc71fb3567d7"],
574+
=======
575+
3.9163824234690104`*^9}},
576+
CellLabel->"In[1]:=",ExpressionUUID->"55751fef-0974-4177-ba5a-bc71fb3567d7"],
577+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
549578

550579
Cell[BoxData[
551580
RowBox[{"{",
552581
RowBox[{"x", ",", "y"}], "}"}]], "Output",
553582
CellChangeTimes->{3.9163114748345833`*^9, 3.916311852898614*^9,
583+
<<<<<<< HEAD
554584
3.9163824296590137`*^9, 3.916979292269546*^9, 3.916979338036211*^9},
555585
CellLabel->"Out[36]=",ExpressionUUID->"d23a16fe-8428-427c-93eb-78158897f762"],
556586

@@ -803,6 +833,10 @@ Cell[BoxData[
803833
CellChangeTimes->{3.9163114748345833`*^9, 3.916311852898614*^9,
804834
3.9163824296590137`*^9, 3.916979292269546*^9, 3.9169793380771847`*^9},
805835
CellLabel->"Out[39]=",ExpressionUUID->"92b5dd1d-1291-41b8-b15d-6eada467d5ca"]
836+
=======
837+
3.9163824296590137`*^9, 3.916390196741238*^9},
838+
CellLabel->"Out[14]=",ExpressionUUID->"3563e61b-7090-41c9-a6f5-d334eb325176"]
839+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
806840
}, Open ]],
807841

808842
Cell[CellGroupData[{
@@ -841,7 +875,11 @@ Cell[BoxData[
841875
CellChangeTimes->{{3.9163115735325537`*^9, 3.916311684079542*^9}, {
842876
3.9163819903119593`*^9, 3.9163820323579607`*^9}, {3.916382138712728*^9,
843877
3.916382178342121*^9}, {3.916382455244184*^9, 3.916382455708098*^9}},
878+
<<<<<<< HEAD
844879
CellLabel->"In[40]:=",ExpressionUUID->"fa57b4ab-8700-426a-812d-7d22e665f9e6"],
880+
=======
881+
CellLabel->"In[18]:=",ExpressionUUID->"fa57b4ab-8700-426a-812d-7d22e665f9e6"],
882+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
845883

846884
Cell[BoxData[
847885
FractionBox[
@@ -891,8 +929,13 @@ Cell[BoxData[
891929
CellChangeTimes->{{3.916311625302472*^9, 3.916311687922065*^9},
892930
3.91631186514664*^9, {3.9163820128719797`*^9, 3.916382032936818*^9}, {
893931
3.916382172674266*^9, 3.9163821786813383`*^9}, {3.9163824325172873`*^9,
932+
<<<<<<< HEAD
894933
3.916382455928849*^9}, 3.9169792945538483`*^9, 3.916979359088944*^9},
895934
CellLabel->"Out[40]=",ExpressionUUID->"a40f6309-5623-4495-a241-bc245d1675eb"],
935+
=======
936+
3.916382455928849*^9}, 3.916390201114299*^9},
937+
CellLabel->"Out[18]=",ExpressionUUID->"18a0d1d7-f308-4a70-bb31-950eaec89494"],
938+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
896939

897940
Cell[BoxData[
898941
FractionBox[
@@ -918,8 +961,13 @@ Cell[BoxData[
918961
CellChangeTimes->{{3.916311625302472*^9, 3.916311687922065*^9},
919962
3.91631186514664*^9, {3.9163820128719797`*^9, 3.916382032936818*^9}, {
920963
3.916382172674266*^9, 3.9163821786813383`*^9}, {3.9163824325172873`*^9,
964+
<<<<<<< HEAD
921965
3.916382455928849*^9}, 3.9169792945538483`*^9, 3.916979359090062*^9},
922966
CellLabel->"Out[41]=",ExpressionUUID->"dcbc02b8-c450-447c-88f1-42d77fdfeb7d"]
967+
=======
968+
3.916382455928849*^9}, 3.916390201290867*^9},
969+
CellLabel->"Out[19]=",ExpressionUUID->"5f51da47-faef-4571-a812-984913826dbe"]
970+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
923971
}, Open ]],
924972

925973
Cell[CellGroupData[{
@@ -1175,9 +1223,9 @@ Cell[BoxData[
11751223
}, Open ]]
11761224
}, Open ]]
11771225
},
1178-
WindowSize->{1440, 762},
1179-
WindowMargins->{{0, Automatic}, {0, Automatic}},
1180-
FrontEndVersion->"13.3 for Linux x86 (64-bit) (June 3, 2023)",
1226+
WindowSize->{1152., 605.4},
1227+
WindowMargins->{{0, Automatic}, {Automatic, 0}},
1228+
FrontEndVersion->"13.2 for Linux x86 (64-bit) (December 7, 2022)",
11811229
StyleDefinitions->"Default.nb",
11821230
ExpressionUUID->"ec8f41f7-53e2-40ba-8f40-226433cfd18b"
11831231
]
@@ -1193,26 +1241,27 @@ CellTagsIndex->{}
11931241
(*NotebookFileOutline
11941242
Notebook[{
11951243
Cell[CellGroupData[{
1196-
Cell[580, 22, 189, 3, 54, "Subsection",ExpressionUUID->"fc2d53ca-f1df-4305-9756-5a2ef579fb84"],
1244+
Cell[580, 22, 189, 3, 64, "Subsection",ExpressionUUID->"fc2d53ca-f1df-4305-9756-5a2ef579fb84"],
11971245
Cell[CellGroupData[{
1198-
Cell[794, 29, 4141, 122, 362, "Input",ExpressionUUID->"505ed892-b0ee-4b93-bf20-789175b2a272"],
1199-
Cell[4938, 153, 434, 7, 33, "Output",ExpressionUUID->"fc2f5679-1c2b-49fa-882b-1731f835a4da"],
1200-
Cell[5375, 162, 1032, 25, 58, "Output",ExpressionUUID->"fbf24fc6-1eef-40cf-8680-2c99a27abd01"]
1246+
Cell[794, 29, 4136, 121, 457, "Input",ExpressionUUID->"505ed892-b0ee-4b93-bf20-789175b2a272"],
1247+
Cell[4933, 152, 533, 9, 40, "Output",ExpressionUUID->"335fb237-18c0-43d1-ad5d-de3928c8561a"],
1248+
Cell[5469, 163, 1677, 41, 73, "Output",ExpressionUUID->"e5079cb5-0728-4534-9e5c-542711c2dcc0"]
12011249
}, Open ]],
12021250
Cell[CellGroupData[{
1203-
Cell[6444, 192, 1162, 30, 92, "Input",ExpressionUUID->"5fa6d3ee-515e-4d4f-b620-3b3d999753b5"],
1204-
Cell[7609, 224, 279, 4, 33, "Output",ExpressionUUID->"3cb4d945-6e85-4b2c-9d5a-f43d2f9542d4"],
1205-
Cell[7891, 230, 277, 4, 33, "Output",ExpressionUUID->"3bb59479-0d48-4621-9aaa-1626fcf721a3"]
1251+
Cell[7183, 209, 1162, 30, 117, "Input",ExpressionUUID->"5fa6d3ee-515e-4d4f-b620-3b3d999753b5"],
1252+
Cell[8348, 241, 279, 4, 40, "Output",ExpressionUUID->"3cb4d945-6e85-4b2c-9d5a-f43d2f9542d4"],
1253+
Cell[8630, 247, 277, 4, 40, "Output",ExpressionUUID->"3bb59479-0d48-4621-9aaa-1626fcf721a3"]
12061254
}, Open ]],
12071255
Cell[CellGroupData[{
1208-
Cell[8205, 239, 297, 7, 71, "Subsubsection",ExpressionUUID->"d1cb2ce3-807f-4d39-b7c9-8c9054dbea11"],
1256+
Cell[8944, 256, 297, 7, 85, "Subsubsection",ExpressionUUID->"d1cb2ce3-807f-4d39-b7c9-8c9054dbea11"],
12091257
Cell[CellGroupData[{
1210-
Cell[8527, 250, 1504, 43, 78, "Input",ExpressionUUID->"54e62f58-fdf6-4b56-9122-ce13eef202da"],
1211-
Cell[10034, 295, 683, 18, 64, "Output",ExpressionUUID->"76976d20-2cfb-47b0-b25a-51817d64923f"]
1258+
Cell[9266, 267, 1504, 43, 118, "Input",ExpressionUUID->"54e62f58-fdf6-4b56-9122-ce13eef202da"],
1259+
Cell[10773, 312, 683, 18, 79, "Output",ExpressionUUID->"76976d20-2cfb-47b0-b25a-51817d64923f"]
12121260
}, Open ]],
1213-
Cell[10732, 316, 384, 9, 58, "Input",ExpressionUUID->"0028ab2b-a57b-4f16-ae70-6bbe3d5fc8e7"],
1214-
Cell[11119, 327, 1202, 30, 70, "Input",ExpressionUUID->"f518e691-2764-48d5-93d6-9b4a69e0aebd"],
1261+
Cell[11471, 333, 384, 9, 72, "Input",ExpressionUUID->"0028ab2b-a57b-4f16-ae70-6bbe3d5fc8e7"],
1262+
Cell[11858, 344, 1202, 30, 117, "Input",ExpressionUUID->"f518e691-2764-48d5-93d6-9b4a69e0aebd"],
12151263
Cell[CellGroupData[{
1264+
<<<<<<< HEAD
12161265
Cell[12346, 361, 6335, 186, 621, "Input",ExpressionUUID->"55751fef-0974-4177-ba5a-bc71fb3567d7"],
12171266
Cell[18684, 549, 289, 5, 33, "Output",ExpressionUUID->"d23a16fe-8428-427c-93eb-78158897f762"],
12181267
Cell[18976, 556, 10858, 248, 248, "Output",ExpressionUUID->"92b5dd1d-1291-41b8-b15d-6eada467d5ca"]
@@ -1234,6 +1283,28 @@ Cell[39041, 1054, 1465, 35, 60, "Output",ExpressionUUID->"faf97621-e52d-46d6-8ec
12341283
Cell[CellGroupData[{
12351284
Cell[40543, 1094, 1837, 48, 121, "Input",ExpressionUUID->"1e0f5f1e-e6b5-4cb1-8547-d22264967da6"],
12361285
Cell[42383, 1144, 1182, 28, 61, "Output",ExpressionUUID->"e811459d-cd1f-4826-97ac-1c2cb268777d"]
1286+
=======
1287+
Cell[13085, 378, 6343, 187, 784, "Input",ExpressionUUID->"55751fef-0974-4177-ba5a-bc71fb3567d7"],
1288+
Cell[19431, 567, 267, 5, 40, "Output",ExpressionUUID->"3563e61b-7090-41c9-a6f5-d334eb325176"]
1289+
}, Open ]],
1290+
Cell[CellGroupData[{
1291+
Cell[19735, 577, 1289, 34, 95, "Input",ExpressionUUID->"fa57b4ab-8700-426a-812d-7d22e665f9e6"],
1292+
Cell[21027, 613, 2136, 49, 78, "Output",ExpressionUUID->"18a0d1d7-f308-4a70-bb31-950eaec89494"],
1293+
Cell[23166, 664, 1018, 25, 94, "Output",ExpressionUUID->"5f51da47-faef-4571-a812-984913826dbe"]
1294+
}, Open ]],
1295+
Cell[CellGroupData[{
1296+
Cell[24221, 694, 1275, 34, 71, "Input",ExpressionUUID->"ddfbfa82-f116-4c7e-a778-31889c380ac4"],
1297+
Cell[25499, 730, 765, 23, 73, "Output",ExpressionUUID->"7fac7d07-c1fd-48bf-8214-dd25ff83690b"]
1298+
}, Open ]],
1299+
Cell[CellGroupData[{
1300+
Cell[26301, 758, 875, 19, 66, "Input",ExpressionUUID->"2f57086d-3898-4086-82cd-a2df5438364d"],
1301+
Cell[27179, 779, 2891, 68, 84, "Output",ExpressionUUID->"bc59f864-54e0-4a98-88f3-f19ae677cbc5"],
1302+
Cell[30073, 849, 1048, 24, 71, "Output",ExpressionUUID->"6f3a18d5-a39c-450e-9089-7df0e80659f1"]
1303+
}, Open ]],
1304+
Cell[CellGroupData[{
1305+
Cell[31158, 878, 1837, 48, 153, "Input",ExpressionUUID->"1e0f5f1e-e6b5-4cb1-8547-d22264967da6"],
1306+
Cell[32998, 928, 1182, 28, 61, "Output",ExpressionUUID->"e811459d-cd1f-4826-97ac-1c2cb268777d"]
1307+
>>>>>>> 05aa02771abe37e27e9b199224b40ee7f45810f4
12371308
}, Open ]]
12381309
}, Open ]]
12391310
}, Open ]]

src/EffectiveWaves.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export match_error, x_mesh_match
2222
## effective waves
2323
export wavenumbers, wavenumber, asymptotic_monopole_wavenumbers, eigenvectors, convert_eigenvector_basis, eigenvector_length
2424
export WaveModes, WaveMode, wavemode_wienerhopf
25-
export solve_boundary_condition, scattering_field, material_scattering_coefficients, material_scattered_waves
25+
export solve_boundary_condition, scattering_field, material_scattering_coefficients, material_scattered_waves, material_effective_tmatrix
2626

2727
export dispersion_equation, dispersion_complex, eigensystem # supplies a matrix used for the disperision equation and effective eignvectors
2828

src/acoustics/discrete_wave/regular/material_scattering_coefficients.jl

+67
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,70 @@ function material_scattering_coefficients(scat_field::ScatteringCoefficientsFiel
7474
return [v]
7575

7676
end
77+
78+
function material_effective_tmatrix::T, material::Material{Sphere{T,2}};
79+
basis_order::Int = 2,
80+
basis_order_contraction::Int = basis_order,
81+
monopole_approximation::Bool = false
82+
) where T
83+
84+
# Extracting important parameters
85+
medium = material.microstructure.medium
86+
k = ω / medium.c
87+
R = outer_radius(material.shape)
88+
species = material.microstructure.species
89+
Rtildas = R .- outer_radius.(species)
90+
91+
# Computing effective wavenumber
92+
if basis_order_contraction < 2
93+
k_eff = wavenumbers(ω, medium, species; basis_order = 2)[1]
94+
else
95+
k_eff = wavenumbers(ω, medium, species; basis_order = basis_order_contraction)[1]
96+
end
97+
98+
# Solving artificial eigensystem
99+
F = eigenvectors(ω, k_eff, material.microstructure, PlanarSymmetry{2}(); basis_order = basis_order_contraction)
100+
101+
_, n_λ, ps = size(F)
102+
103+
if ps > 1 @error "More than one eigenvector was found for a planar system! Using first eigenvector dfor calculations." end
104+
105+
L = basis_order_contraction+basis_order
106+
107+
n_densities = [number_density(sp) for sp in species]
108+
109+
J = [besselj(n,k*Rtildas[λ])
110+
for n = -L-1:L, λ in 1:n_λ]
111+
112+
Jstar = [besselj(n,k_eff*Rtildas[λ])*n_densities[λ]
113+
for n = -L-1:L, λ in 1:n_λ]
114+
115+
H = [hankelh1(n,k*Rtildas[λ])
116+
for n = -L-1:L, λ in 1:n_λ]
117+
118+
pre_num = k*J[1:1+2*L,:].*Jstar[2:2*(1+L),:] - k_eff*J[2:2*(1+L),:].*Jstar[1:1+2*L,:]
119+
pre_denom = k*H[1:1+2*L,:].*Jstar[2:2*(1+L),:] - k_eff*H[2:2*(1+L),:].*Jstar[1:1+2*L,:]
120+
121+
Matrix_Num = complex(zeros(2*basis_order_contraction+1,2*basis_order+1))
122+
Matrix_Denom = complex(zeros(2*basis_order_contraction+1,2*basis_order+1))
123+
for n = 1:1+2*basis_order
124+
Matrix_Num[:,n] = vec(sum(pre_num[n+2*basis_order_contraction:-1:n,:].*F[:,:,1],dims=2))
125+
Matrix_Denom[:,n] = vec(sum(pre_denom[n+2*basis_order_contraction:-1:n,:].*F[:,:,1],dims=2))
126+
end
127+
128+
Tmats = - vec(sum(Matrix_Num,dims=1)./sum(Matrix_Denom,dims=1))
129+
130+
if monopole_approximation
131+
132+
TmatMs = complex(zeros(2basis_order+1))
133+
for i in eachindex(TmatMs)
134+
TmatMs[i] = -sum(pre_num[i+L-basis_order,:] .* F[basis_order_contraction+1,:,1])/sum(pre_denom[i+L-basis_order,:] .* F[basis_order_contraction+1,:,1])
135+
end
136+
137+
return [Tmats, TmatMs]
138+
139+
else
140+
return Tmats
141+
end
142+
143+
end

0 commit comments

Comments
 (0)