Skip to content

Commit ce62435

Browse files
Add files via upload
1 parent 4c93b33 commit ce62435

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+209
-44
lines changed

TMATROM_OBJECT_ORIENTED_CORE/besselhd.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%
77
% Stuart C. Hawkins - 30 November 2018
88

9-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
9+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1010
%
1111
% This file is part of TMATROM.
1212
%

TMATROM_OBJECT_ORIENTED_CORE/besseljd.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%
77
% Stuart C. Hawkins - 10 January 2023
88

9-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
9+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1010
%
1111
% This file is part of TMATROM.
1212
%
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
% Evaluate partial derivatives of wavefunction expansion series.
2+
%
3+
% [dr,dtheta,er,etheta,rad] = dsumcof(x,x0,k,c,'H') returns the [partial
4+
% derivatives dr and dtheta of the radiating wavefunction expansion with
5+
% coefficients c, centre x0 and wavenumber k at points x. The unit
6+
% vectors er and etheta associated with dr and dtheta are also computed.
7+
%
8+
% [...] = dsumcof(x,x0,k,c,'J') returns the values z of the regular
9+
% wavefunction expansion with coefficients c, centre x0 and wavenumber k
10+
% at points x.
11+
%
12+
% Note: in the above vectors in the plane are represented by
13+
% complex numbers.
14+
%
15+
% Stuart C. Hawkins - 7 May 2024
16+
17+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
18+
%
19+
% This file is part of TMATROM.
20+
%
21+
% TMATROM is free software: you can redistribute it and/or modify
22+
% it under the terms of the GNU General Public License as published by
23+
% the Free Software Foundation, either version 3 of the License, or
24+
% (at your option) any later version.
25+
%
26+
% TMATROM is distributed in the hope that it will be useful,
27+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
28+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+
% GNU General Public License for more details.
30+
%
31+
% You should have received a copy of the GNU General Public License
32+
% along with TMATROM. If not, see <http://www.gnu.org/licenses/>.
33+
34+
35+
function [dr,dtheta,er,etheta,rad] = dsumcof(points,centre,kwave,cof,type)
36+
37+
if strcmp(type,'F')
38+
error('Type F not supported')
39+
end
40+
41+
%-------------------------------------------------
42+
% setup
43+
%-------------------------------------------------
44+
45+
% make sure the coefficient vector is a column vector
46+
cof=cof(:);
47+
48+
% determine the maximum order from the length of the coefficient vector
49+
nmax=0.5*(length(cof)-1);
50+
51+
% create a vector of indexes.... helps to vectorize the computation
52+
n=-nmax:nmax;
53+
54+
%-------------------------------------------------
55+
% turn points into a vector
56+
%-------------------------------------------------
57+
58+
% get the shape of points so we can restore it later
59+
[np,mp]=size(points);
60+
61+
% reshape into a vector
62+
p=reshape(points-centre,np*mp,1);
63+
64+
%-------------------------------------------------
65+
% compute the field
66+
%-------------------------------------------------
67+
68+
% convert to polar coordinates
69+
theta=angle(p);
70+
rad=abs(p);
71+
72+
% make a matrix from n and rad
73+
[nd,rd]=meshgrid(n,kwave*rad);
74+
75+
% get Bessel/Hankel/far field values as appropriate
76+
if strcmp(type,'J')
77+
78+
bess=besselj(abs(nd),rd);
79+
bessd=kwave*besseljd(abs(nd),rd);
80+
81+
elseif strcmp(type,'H')
82+
83+
bess=besselh(abs(nd),rd);
84+
bessd=kwave*besselhd(abs(nd),rd);
85+
86+
end
87+
88+
% compute the angular part
89+
Y=exp(1i*theta*n);
90+
Yd=Y*diag(1i*n);
91+
92+
% put it together
93+
M = bess.*Y;
94+
Mdr = bessd.*Y;
95+
Mdtheta = bess.*Yd;
96+
97+
%-------------------------------------------------
98+
% make the return value the same shape as the original
99+
% array of points
100+
%-------------------------------------------------
101+
102+
% compute the sum of the wavefunctions and reshape
103+
dr=reshape(Mdr*cof,np,mp);
104+
dtheta=reshape(Mdtheta*cof,np,mp);
105+
106+
if nargout>2
107+
er = reshape(p./abs(p),np,mp);
108+
etheta = reshape(exp(1i*pi/2)*er,np,mp);
109+
rad = reshape(rad,np,mp);
110+
end

TMATROM_OBJECT_ORIENTED_CORE/getSecondOutput.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
%
1616
% Stuart C. Hawkins - 8 March 2018
1717

18-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
18+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1919
%
2020
% This file is part of TMATROM.
2121
%

TMATROM_OBJECT_ORIENTED_CORE/ghtmatrix.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
%
1313
% Stuart C. Hawkins - 6 March 2018
1414

15-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
15+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1616
%
1717
% This file is part of TMATROM.
1818
%
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
% Evaluate gradient of wavefunction expansion series.
2+
%
3+
% [dx,dy] = gradsumcof(x,x0,k,c,'H') returns the gradient (dx,dy) of the
4+
% radiating wavefunction expansion with coefficients c, centre x0 and
5+
% wavenumber k at points x.
6+
%
7+
% [dx,dy] = gradsumcof(x,x0,k,c,'J') returns the gradient (dx,dy) of the
8+
% regular wavefunction expansion with coefficients c, centre x0 and
9+
% wavenumber k at points x.
10+
%
11+
% [dx,dy] = gradsumcof(x,x0,k,c,'F') returns the gradient (dx,dy) of the
12+
% far field of the radiating wavefunction expansion with coefficients c,
13+
% centre x0 and wavenumber k at points abs(x) on the unit circle.
14+
%
15+
% Note: in the above vectors in the plane are represented by
16+
% complex numbers.
17+
%
18+
% Stuart C. Hawkins - 7 May 2024
19+
20+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
21+
%
22+
% This file is part of TMATROM.
23+
%
24+
% TMATROM is free software: you can redistribute it and/or modify
25+
% it under the terms of the GNU General Public License as published by
26+
% the Free Software Foundation, either version 3 of the License, or
27+
% (at your option) any later version.
28+
%
29+
% TMATROM is distributed in the hope that it will be useful,
30+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
31+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+
% GNU General Public License for more details.
33+
%
34+
% You should have received a copy of the GNU General Public License
35+
% along with TMATROM. If not, see <http://www.gnu.org/licenses/>.
36+
37+
38+
function [dx,dy] = gradsumcof(points,centre,kwave,cof,type)
39+
40+
% use dsumcof to evaluate the partial derivatives of the expansion with
41+
% respect to polar coordinates r and theta
42+
[dr,dtheta,er,etheta,rad] = dsumcof(points,centre,kwave,cof,type);
43+
44+
% calculate the partial derivatives with respect to x and y
45+
dx = real(er) .* dr + real(etheta)./rad .* dtheta;
46+
dy = imag(er) .* dr + imag(etheta)./rad .* dtheta;
47+

TMATROM_OBJECT_ORIENTED_CORE/incident.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
%
99
% Stuart C. Hawkins - 9 January 2023
1010

11-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
11+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1212
%
1313
% This file is part of TMATROM.
1414
%

TMATROM_OBJECT_ORIENTED_CORE/incidentminus.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%
77
% Stuart C. Hawkins - 30 November 2018
88

9-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
9+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1010
%
1111
% This file is part of TMATROM.
1212
%

TMATROM_OBJECT_ORIENTED_CORE/incidentplus.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%
77
% Stuart C. Hawkins - 30 November 2018
88

9-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
9+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1010
%
1111
% This file is part of TMATROM.
1212
%

TMATROM_OBJECT_ORIENTED_CORE/incidenttimes.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%
77
% Stuart C. Hawkins - 30 November 2018
88

9-
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023 Stuart C. Hawkins and M. Ganesh.
9+
% Copyright 2014, 2015, 2016, 2017, 2018, 2022, 2023, 2024 Stuart C. Hawkins and M. Ganesh.
1010
%
1111
% This file is part of TMATROM.
1212
%

0 commit comments

Comments
 (0)