From 101e55202df8fd3ad61799ebff5f873f0cd8fcdc Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Fri, 9 Apr 2010 21:15:44 +0200 Subject: [PATCH] fix: current dump timestamp --- FDTD/engine_cylinder.cpp | 1 - FDTD/processcurrent.cpp | 3 ++- matlab/examples/Coax_partial_CylinderCoords.m | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FDTD/engine_cylinder.cpp b/FDTD/engine_cylinder.cpp index 2ccf96b..9f979f3 100644 --- a/FDTD/engine_cylinder.cpp +++ b/FDTD/engine_cylinder.cpp @@ -34,7 +34,6 @@ Engine_Cylinder::~Engine_Cylinder() void Engine_Cylinder::Init() { - cerr << "Engine_Cylinder::Init()" << endl; Engine::Init(); } diff --git a/FDTD/processcurrent.cpp b/FDTD/processcurrent.cpp index c951fd4..60891f8 100644 --- a/FDTD/processcurrent.cpp +++ b/FDTD/processcurrent.cpp @@ -95,6 +95,7 @@ int ProcessCurrent::Process() // cerr << "ts: " << Eng->numTS << " i: " << current << endl; v_current.push_back(current); - file << (double)Eng->GetNumberOfTimesteps()*Op->GetTimestep() << "\t" << current << endl; + //current is sampled half a timestep later then the voltages + file << (0.5 + (double)Eng->GetNumberOfTimesteps())*Op->GetTimestep() << "\t" << current << endl; return GetNextInterval(); } diff --git a/matlab/examples/Coax_partial_CylinderCoords.m b/matlab/examples/Coax_partial_CylinderCoords.m index 66b7833..c169558 100644 --- a/matlab/examples/Coax_partial_CylinderCoords.m +++ b/matlab/examples/Coax_partial_CylinderCoords.m @@ -101,11 +101,11 @@ system(command) cd(savePath); UI = ReadUI({'ut1_1','ut1_2','it1'},'tmp/'); -u_f = (UI.FD{1}.val + UI.FD{2}.val)/2; %averaging voltages to fit current +u_f = (UI.FD{1}.val + UI.FD{2}.val)/2; %averaging voltages to fit current i_f = UI.FD{3}.val / partial; -delta_t = 1.35929e-11; % time-step (s) FIXME will change, if mesh is changed! -i_f2 = i_f .* exp(-1i*2*pi*UI.FD{1}.f*delta_t/2); % compensate half time-step advance of H-field +delta_t = UI.TD{3}.t(1) - UI.TD{1}.t(1); % half time-step (s) +i_f2 = i_f .* exp(-1i*2*pi*UI.FD{1}.f*delta_t); % compensate half time-step advance of H-field Z = u_f./i_f2; plot(UI.FD{1}.f,real(Z),'Linewidth',2);