nf2ff: added direction support & reduced memory consumption

pull/1/head
Thorsten Liebig 2011-11-28 13:13:57 +01:00
parent aaeb103c57
commit eb4c271980
2 changed files with 53 additions and 20 deletions

View File

@ -1,5 +1,5 @@
function [E_theta,E_phi,Prad,Dmax] = AnalyzeNFFF2( Sim_Path, nf2ff, f, theta, phi, r )
% [E_theta,E_phi,Prad,Dmax] = AnalyzeNFFF2( Sim_Path, filenames_E, filenames_H, f, theta, phi, r )
function [E_theta,E_phi,Prad,Dmax] = AnalyzeNF2FF( Sim_Path, nf2ff, f, theta, phi, r )
% [E_theta,E_phi,Prad,Dmax] = AnalyzeNF2FF( Sim_Path, filenames_E, filenames_H, f, theta, phi, r )
%
% calculates the farfield via a near field to far field transformation
%
@ -23,6 +23,7 @@ function [E_theta,E_phi,Prad,Dmax] = AnalyzeNFFF2( Sim_Path, nf2ff, f, theta, ph
% See also CreateNF2FFBox
%
% (C) 2010 Sebastian Held <sebastian.held@gmx.de>
% (C) 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
% check arguments
error( nargchk(6,6,nargin) );
@ -33,10 +34,19 @@ end
filenames_E = nf2ff.filenames_E;
filenames_H = nf2ff.filenames_H;
if (~isrow(nf2ff.directions))
nf2ff.directions = nf2ff.directions';
end
% read time domain field data and transform into frequency domain
for n=1:numel(filenames_E)
for n=find(nf2ff.directions==1)
[Ef{n}, E_mesh{n}] = ReadHDF5Dump( [Sim_Path '/' filenames_E{n}], 'Frequency', f );
%clear out time domain data
Ef{n} = rmfield(Ef{n},'TD');
[Hf{n}, H_mesh{n}] = ReadHDF5Dump( [Sim_Path '/' filenames_H{n}], 'Frequency', f );
%clear out time domain data
Hf{n} = rmfield(Hf{n},'TD');
% reshape mesh into row vector
mesh{n}.x = reshape( E_mesh{n}.lines{1}, 1, [] );
@ -73,7 +83,7 @@ for phi_deg_aufpunkt = phi
N_phi = 0;
L_theta = 0;
L_phi = 0;
for a=1:6
for a=find(nf2ff.directions==1)
[N_theta_,N_phi_,L_theta_,L_phi_] = process_plane( k, n{a}, center, mesh{a}, Ef{a}.FD.values{1}, Hf{a}.FD.values{1}, theta_rad_aufpunkt, phi_rad_aufpunkt );
N_theta = N_theta + N_theta_; N_phi = N_phi + N_phi_;
L_theta = L_theta + L_theta_; L_phi = L_phi + L_phi_;
@ -95,7 +105,7 @@ end
% power
Prad = 0;
for a=1:6
for a=find(nf2ff.directions==1)
[~,~,~,~,P] = process_plane( k, n{a}, center, mesh{a}, Ef{a}.FD.values{1}, Hf{a}.FD.values{1}, theta_rad_aufpunkt, phi_rad_aufpunkt );
Prad = Prad + P;
end

View File

@ -1,5 +1,5 @@
function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop)
% function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop)
function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, directions)
% function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, directions)
%
% create the dump boxes needed for the near field to far field transformation
%
@ -13,20 +13,43 @@ function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop)
%
% See also AnalyzeNF2FF
%
% (C) 2010 Thoorsten Liebig <thorsten.liebig@gmx.de>
% (C) 2010 Sebastian Held <sebastian.held@gmx.de>
% (C) 2010, 2011 Thorsten Liebig <thorsten.liebig@gmx.de>
if (nargin<5)
directions = ones(6,1);
end
nf2ff.filenames_E = {[name '_Et_xn'],[name '_Et_xp'],[name '_Et_yn'],[name '_Et_yp'],[name '_Et_zn'],[name '_Et_zp']};
nf2ff.filenames_H = {[name '_Ht_xn'],[name '_Ht_xp'],[name '_Ht_yn'],[name '_Ht_yp'],[name '_Ht_zn'],[name '_Ht_zp']};
nf2ff.directions = directions;
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{1},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{1}, 0, start, [start(1) stop(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{2},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{2}, 0, [stop(1) start(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{3},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{3}, 0, start, [stop(1) start(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{4},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{4}, 0, [start(1) stop(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{5},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{5}, 0, start, [stop(1) stop(2) start(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{6},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{6}, 0, [start(1) start(2) stop(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{1},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{1}, 0, start, [start(1) stop(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{2},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{2}, 0, [stop(1) start(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{3},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{3}, 0, start, [stop(1) start(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{4},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{4}, 0, [start(1) stop(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{5},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{5}, 0, start, [stop(1) stop(2) start(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{6},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{6}, 0, [start(1) start(2) stop(3)], stop );
if (directions(1))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{1},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{1}, 0, start, [start(1) stop(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{1},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{1}, 0, start, [start(1) stop(2) stop(3)] );
end
if (directions(2))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{2},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{2}, 0, [stop(1) start(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{2},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{2}, 0, [stop(1) start(2) start(3)], stop );
end
if (directions(3))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{3},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{3}, 0, start, [stop(1) start(2) stop(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{3},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{3}, 0, start, [stop(1) start(2) stop(3)] );
end
if (directions(4))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{4},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{4}, 0, [start(1) stop(2) start(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{4},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{4}, 0, [start(1) stop(2) start(3)], stop );
end
if (directions(5))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{5},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{5}, 0, start, [stop(1) stop(2) start(3)] );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{5},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{5}, 0, start, [stop(1) stop(2) start(3)] );
end
if (directions(6))
CSX = AddBox( AddDump(CSX,nf2ff.filenames_E{6},'DumpType',0,'DumpMode',2,'FileType',1), nf2ff.filenames_E{6}, 0, [start(1) start(2) stop(3)], stop );
CSX = AddBox( AddDump(CSX,nf2ff.filenames_H{6},'DumpType',1,'DumpMode',2,'FileType',1), nf2ff.filenames_H{6}, 0, [start(1) start(2) stop(3)], stop );
end