From 816553fc34215efc5ac8584221cdc04ae14b92a4 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 27 Mar 2013 11:58:24 +0100 Subject: [PATCH] Operator: allow to choose time stepping method Signed-off-by: Thorsten Liebig --- FDTD/operator.h | 3 +++ matlab/InitFDTD.m | 1 + openems.cpp | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/FDTD/operator.h b/FDTD/operator.h index 396db84..bf6c845 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -81,6 +81,9 @@ public: virtual void SetTimestepFactor(double factor); bool GetTimestepValid() const {return !m_InvaildTimestep;} + //! Choose a time step method (0=auto, 1=CFL, 3=Rennings) + void SetTimeStepMethod(int var) {m_TimeStepVar=var;} + //! Set operator to assume a constant material inside a cell (material probing in the cell center) void SetCellConstantMaterial() {m_MatCellShiftFaktor=0.5;} diff --git a/matlab/InitFDTD.m b/matlab/InitFDTD.m index 6d88951..bef593f 100644 --- a/matlab/InitFDTD.m +++ b/matlab/InitFDTD.m @@ -12,6 +12,7 @@ function FDTD = InitFDTD(varargin) % CoordSystem: choose coordinate system (0 Cartesian, 1 Cylindrical) % TimeStep: force to use a given timestep (dangerous!) % TimeStepFactor: reduce the timestep by a given factor (>0 to <=1) +% TimeStepMethod: 1 or 3 chose timestep method (1=CFL, 3=Rennigs (default)) % CellConstantMaterial: set to 1 to assume a material is constant inside % a cell (material probing in cell center) % diff --git a/openems.cpp b/openems.cpp index 75ec38d..9f1539b 100644 --- a/openems.cpp +++ b/openems.cpp @@ -666,6 +666,10 @@ int openEMS::SetupFDTD(const char* file) SetupBoundaryConditions(BC); + int TS_method=0; + if (FDTD_Opts->QueryIntAttribute("TimeStepMethod",&TS_method)==TIXML_SUCCESS) + FDTD_Op->SetTimeStepMethod(TS_method); + double timestep=0; FDTD_Opts->QueryDoubleAttribute("TimeStep",×tep); if (timestep)