From 865e817de7f9e7d33e535562af0b2fea34e99f5e Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Tue, 8 Apr 2014 21:32:18 +0200 Subject: [PATCH] bug fix: get max freq from xml to setup conducting sheet model Signed-off-by: Thorsten Liebig --- matlab/examples/transmission_lines/MSL_Losses.m | 9 ++++----- openems.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/matlab/examples/transmission_lines/MSL_Losses.m b/matlab/examples/transmission_lines/MSL_Losses.m index a33cbc9..0319c91 100644 --- a/matlab/examples/transmission_lines/MSL_Losses.m +++ b/matlab/examples/transmission_lines/MSL_Losses.m @@ -31,7 +31,7 @@ f_stop = 25e9; lambda = c0/f_stop; %% setup FDTD parameters & excitation function %%%%%%%%%%%%%%%%%%%%%%%%%%%% -FDTD = InitFDTD(1e6,1e-4); +FDTD = InitFDTD('endCriteria',1e-4); FDTD = SetGaussExcite(FDTD,0.5*(f_start+f_stop),0.5*(f_stop-f_start)); BC = {'PML_8' 'PML_8' 'PML_8' 'PML_8' 'PEC' 'PML_8'}; FDTD = SetBoundaryCond( FDTD, BC ); @@ -56,11 +56,11 @@ CSX = AddBox( CSX, 'RO4350B', 0, start, stop ); CSX = AddConductingSheet( CSX, 'gold', MSL.conductivity, MSL.thickness ); portstart = [ mesh.x(1), -MSL.width/2, substrate.thickness]; portstop = [ mesh.x(1)+MSL.port_dist, MSL.width/2, 0]; -[CSX,portstruct{1}] = AddMSLPort( CSX, 999, 1, 'gold', portstart, portstop, 0, [0 0 -1], 'ExcitePort', 'excite', 'FeedShift', 10*resolution, 'MeasPlaneShift', MSL.port_dist); +[CSX, port{1}] = AddMSLPort( CSX, 999, 1, 'gold', portstart, portstop, 0, [0 0 -1], 'ExcitePort', 'excite', 'FeedShift', 10*resolution, 'MeasPlaneShift', MSL.port_dist); portstart = [mesh.x(end), -MSL.width/2, substrate.thickness]; portstop = [mesh.x(end)-MSL.port_dist, MSL.width/2, 0]; -[CSX,portstruct{2}] = AddMSLPort( CSX, 999, 2, 'gold', portstart, portstop, 0, [0 0 -1], 'MeasPlaneShift', MSL.port_dist ); +[CSX, port{2}] = AddMSLPort( CSX, 999, 2, 'gold', portstart, portstop, 0, [0 0 -1], 'MeasPlaneShift', MSL.port_dist ); start = [mesh.x(1)+MSL.port_dist, -MSL.width/2, substrate.thickness]; stop = [mesh.x(end)-MSL.port_dist, MSL.width/2, substrate.thickness]; @@ -80,8 +80,7 @@ RunOpenEMS( Sim_Path, Sim_CSX ,''); %% post-processing close all f = linspace( f_start, f_stop, 1601 ); -port{1} = calcPort( portstruct{1}, Sim_Path, f, 'RefImpedance', 50); -port{2} = calcPort( portstruct{2}, Sim_Path, f, 'RefImpedance', 50); +port = calcPort(port, Sim_Path, f, 'RefImpedance', 50); s11 = port{1}.uf.ref./ port{1}.uf.inc; s21 = port{2}.uf.ref./ port{1}.uf.inc; diff --git a/openems.cpp b/openems.cpp index 3e408f3..4013134 100644 --- a/openems.cpp +++ b/openems.cpp @@ -712,7 +712,14 @@ int openEMS::SetupFDTD(const char* file) if ((m_CSX->GetQtyPropertyType(CSProperties::LORENTZMATERIAL)>0) || (m_CSX->GetQtyPropertyType(CSProperties::DEBYEMATERIAL)>0)) FDTD_Op->AddExtension(new Operator_Ext_LorentzMaterial(FDTD_Op)); if (m_CSX->GetQtyPropertyType(CSProperties::CONDUCTINGSHEET)>0) - FDTD_Op->AddExtension(new Operator_Ext_ConductingSheet(FDTD_Op,m_Exc->GetMaxFrequency())); + { + double f_max=0; + FDTD_Opts->QueryDoubleAttribute("f_max",&f_max); + if (f_max>0) + FDTD_Op->AddExtension(new Operator_Ext_ConductingSheet(FDTD_Op,f_max)); + else + cerr << __func__ << ": Error, max. frequency is <=0, disabling conducting sheet material..." << endl; + } //check all properties to request material storage during operator creation... SetupMaterialStorages();