From 0f9f0fd83090b6998e89ab5c4bcd9961e66e305a Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Thu, 3 Sep 2015 21:25:49 +0200 Subject: [PATCH] fix: do not increase timestep to match periodic signal, only decreasing is ok! Signed-off-by: Thorsten Liebig --- FDTD/operator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index ad932ba..463a3fe 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -1001,9 +1001,9 @@ int Operator::CalcECOperator( DebugFlags debugFlags ) if (m_Exc->GetSignalPeriod()>0) { - unsigned int TS = floor(m_Exc->GetSignalPeriod()/dT); + unsigned int TS = ceil(m_Exc->GetSignalPeriod()/dT); double new_dT = m_Exc->GetSignalPeriod()/TS; - cerr << "Operartor::CalcECOperator: Increasing timestep by " << round((new_dT-dT)/dT*1000)/10.0 << "% to " << new_dT << " (" << dT << ") to match periodic signal" << endl; + cout << "Operartor::CalcECOperator: Decreasing timestep by " << round((dT-new_dT)/dT*1000)/10.0 << "% to " << new_dT << " (" << dT << ") to match periodic signal" << endl; dT = new_dT; }