-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetSources.m
More file actions
26 lines (22 loc) · 913 Bytes
/
SetSources.m
File metadata and controls
26 lines (22 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function set up boundary sources for the simulations
%
% srcloc: location of sources (i.e. center)
% srcseg: which part of boundary the source is located at:
% bottom 1, right 2, top 3 and left 4
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function srcinfo=SetSources(Ns)
% The following setup is for the domain (0,1)x(0,1). This can
% be changed for other type of domains.
% Source locations
location=[0.2:0.2:1.8 2*ones(1,9) 1.8:-0.2:0.2 zeros(1,9);...
zeros(1,9) 0.2:0.2:1.8 2*ones(1,9) 1.8:-0.2:0.2];
% The side of the boundary where the each source is located
segment=[ones(1, 9) 2*ones(1,9) 3*ones(1,9) 4*ones(1,9)];
if Ns>length(segment)
disp('Error in setting # of sources!');
exit;
end
srcinfo(1:2,:)=location(:,1:Ns);
srcinfo(3,:)=segment(1:Ns);