Mur_ABC: start after wall-excitation

This commit is contained in:
Thorsten Liebig 2010-04-28 18:21:02 +02:00
parent 8c8d7e992a
commit 3c3edd32e0
4 changed files with 26 additions and 1 deletions

View File

@ -35,6 +35,23 @@ Engine_Ext_Mur_ABC::Engine_Ext_Mur_ABC(Operator_Ext_Mur_ABC* op_ext) : Engine_Ex
m_volt_nyP = Create2DArray(m_numLines); m_volt_nyP = Create2DArray(m_numLines);
m_volt_nyPP = Create2DArray(m_numLines); m_volt_nyPP = Create2DArray(m_numLines);
//find if some excitation is on this mur-abc and find the max length of this excite, so that the abc can start after the excitation is done...
int maxDelay=-1;
for (unsigned int n=0;n<m_Op_mur->m_Op->E_Exc_Count;++n)
{
if ( ((m_Op_mur->m_Op->E_Exc_dir[n]==m_nyP) || (m_Op_mur->m_Op->E_Exc_dir[n]==m_nyPP)) && (m_Op_mur->m_Op->E_Exc_index[m_ny][n]==m_LineNr) )
{
if ((int)m_Op_mur->m_Op->E_Exc_delay[n]>maxDelay)
maxDelay = (int)m_Op_mur->m_Op->E_Exc_delay[n];
}
}
m_start_TS = 0;
if (maxDelay>=0)
{
m_start_TS = maxDelay + m_Op_mur->m_Op->ExciteLength + 10; //give it some extra timesteps, for the excitation to travel at least one cell away
cerr << "Engine_Ext_Mur_ABC::Engine_Ext_Mur_ABC: Warning: Excitation inside the Mur-ABC #" << m_ny << "-" << (int)(m_LineNr>0) << " found!!!! Mur-ABC will be switched on after excitation is done at " << m_start_TS << " timesteps!!! " << endl;
}
} }
Engine_Ext_Mur_ABC::~Engine_Ext_Mur_ABC() Engine_Ext_Mur_ABC::~Engine_Ext_Mur_ABC()
@ -47,6 +64,7 @@ Engine_Ext_Mur_ABC::~Engine_Ext_Mur_ABC()
void Engine_Ext_Mur_ABC::DoPreVoltageUpdates() void Engine_Ext_Mur_ABC::DoPreVoltageUpdates()
{ {
if (IsActive()==false) return;
if (m_Eng==NULL) return; if (m_Eng==NULL) return;
if (m_Mur_Coeff==0) return; if (m_Mur_Coeff==0) return;
unsigned int pos[] = {0,0,0}; unsigned int pos[] = {0,0,0};
@ -68,6 +86,7 @@ void Engine_Ext_Mur_ABC::DoPreVoltageUpdates()
void Engine_Ext_Mur_ABC::DoPostVoltageUpdates() void Engine_Ext_Mur_ABC::DoPostVoltageUpdates()
{ {
if (IsActive()==false) return;
if (m_Eng==NULL) return; if (m_Eng==NULL) return;
if (m_Mur_Coeff==0) return; if (m_Mur_Coeff==0) return;
unsigned int pos[] = {0,0,0}; unsigned int pos[] = {0,0,0};
@ -89,6 +108,7 @@ void Engine_Ext_Mur_ABC::DoPostVoltageUpdates()
void Engine_Ext_Mur_ABC::Apply2Voltages() void Engine_Ext_Mur_ABC::Apply2Voltages()
{ {
if (IsActive()==false) return;
if (m_Eng==NULL) return; if (m_Eng==NULL) return;
if (m_Mur_Coeff==0) return; if (m_Mur_Coeff==0) return;
unsigned int pos[] = {0,0,0}; unsigned int pos[] = {0,0,0};

View File

@ -19,6 +19,7 @@
#define ENGINE_EXT_MUR_ABC_H #define ENGINE_EXT_MUR_ABC_H
#include "engine_extension.h" #include "engine_extension.h"
#include "engine.h"
#include "operator.h" #include "operator.h"
class Operator_Ext_Mur_ABC; class Operator_Ext_Mur_ABC;
@ -36,6 +37,9 @@ public:
protected: protected:
Operator_Ext_Mur_ABC* m_Op_mur; Operator_Ext_Mur_ABC* m_Op_mur;
inline bool IsActive() {if (m_Eng->GetNumberOfTimesteps()<m_start_TS) return false; return true;}
unsigned int m_start_TS;
int m_ny; int m_ny;
int m_nyP,m_nyPP; int m_nyP,m_nyPP;
unsigned int m_LineNr; unsigned int m_LineNr;

View File

@ -69,7 +69,7 @@ bool Operator_Ext_Mur_ABC::BuildExtension()
pos[m_ny] = m_LineNr; pos[m_ny] = m_LineNr;
double delta = fabs(m_Op->GetMeshDelta(m_ny,pos)); double delta = fabs(m_Op->GetMeshDelta(m_ny,pos));
m_Mur_Coeff = (__C0__ * dT - delta) / (__C0__ * dT + delta); m_Mur_Coeff = (__C0__ * dT - delta) / (__C0__ * dT + delta);
// cerr << "Operator_Ext_Mur_ABC::BuildExtension(): " << m_Mur_Coeff << endl; // cerr << "Operator_Ext_Mur_ABC::BuildExtension(): " << m_ny << " @ " << m_LineNr << " = "<< m_Mur_Coeff << endl;
return true; return true;
} }

View File

@ -24,6 +24,7 @@ class Engine_Extension;
//! Abstract base-class for all operator extensions //! Abstract base-class for all operator extensions
class Operator_Extension class Operator_Extension
{ {
friend class Engine_Extension;
public: public:
virtual bool BuildExtension() {return true;} virtual bool BuildExtension() {return true;}