From 1b52834e8989699c2513981a2665f197fefb0218 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Fri, 21 May 2010 16:55:04 +0200 Subject: [PATCH] Define a max FDTD simulated time, maybe useful for e.g. sinusoidal excitations matlab example: simulate 1us in the time domain: FDTD = InitFDTD(5e5,1e-5,'MaxTime',1e-6) --- openems.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openems.cpp b/openems.cpp index a66d9db..720149e 100644 --- a/openems.cpp +++ b/openems.cpp @@ -188,6 +188,10 @@ int openEMS::SetupFDTD(const char* file) if (m_OverSampling<2) m_OverSampling=2; + double maxTime=0; + FDTD_Opts->QueryDoubleAttribute("MaxTime",&maxTime); + + TiXmlElement* BC = FDTD_Opts->FirstChildElement("BoundaryCond"); if (BC==NULL) { @@ -250,6 +254,10 @@ int openEMS::SetupFDTD(const char* file) } FDTD_Op->CalcECOperator(); + + unsigned int maxTime_TS = (unsigned int)(maxTime/FDTD_Op->GetTimestep()); + if ((maxTime_TS>0) && (maxTime_TSExc->setupExcitation( FDTD_Opts->FirstChildElement("Excitation"), NrTS )) exit(2);