new method to dump excitation signals
This commit is contained in:
parent
0c371fb43a
commit
b73004be48
@ -52,9 +52,6 @@ void Engine::Init()
|
|||||||
volt = Create_N_3DArray<FDTD_FLOAT>(numLines);
|
volt = Create_N_3DArray<FDTD_FLOAT>(numLines);
|
||||||
curr = Create_N_3DArray<FDTD_FLOAT>(numLines);
|
curr = Create_N_3DArray<FDTD_FLOAT>(numLines);
|
||||||
|
|
||||||
file_et.open( "et" );
|
|
||||||
file_ht.open( "ht" );
|
|
||||||
|
|
||||||
InitExtensions();
|
InitExtensions();
|
||||||
SortExtensionByPriority();
|
SortExtensionByPriority();
|
||||||
}
|
}
|
||||||
@ -98,9 +95,6 @@ void Engine::Reset()
|
|||||||
Delete_N_3DArray(curr,numLines);
|
Delete_N_3DArray(curr,numLines);
|
||||||
curr=NULL;
|
curr=NULL;
|
||||||
|
|
||||||
file_et.close();
|
|
||||||
file_ht.close();
|
|
||||||
|
|
||||||
ClearExtensions();
|
ClearExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,10 +149,6 @@ void Engine::ApplyVoltageExcite()
|
|||||||
pos[2]=Op->Exc->Volt_index[2][n];
|
pos[2]=Op->Exc->Volt_index[2][n];
|
||||||
SetVolt(ny,pos, GetVolt(ny,pos) + Op->Exc->Volt_amp[n]*Op->Exc->Signal_volt[exc_pos]);
|
SetVolt(ny,pos, GetVolt(ny,pos) + Op->Exc->Volt_amp[n]*Op->Exc->Signal_volt[exc_pos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the voltage excitation function into the file "et"
|
|
||||||
if (numTS < Op->Exc->Length)
|
|
||||||
file_et << numTS * Op->GetTimestep() << "\t" << Op->Exc->Signal_volt[numTS] << "\n"; // do not use std::endl here, because it will do an implicit flush
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::UpdateCurrents(unsigned int startX, unsigned int numX)
|
void Engine::UpdateCurrents(unsigned int startX, unsigned int numX)
|
||||||
@ -206,10 +196,6 @@ void Engine::ApplyCurrentExcite()
|
|||||||
pos[2]=Op->Exc->Curr_index[2][n];
|
pos[2]=Op->Exc->Curr_index[2][n];
|
||||||
SetCurr(ny,pos, GetCurr(ny,pos) + Op->Exc->Curr_amp[n]*Op->Exc->Signal_curr[exc_pos]);
|
SetCurr(ny,pos, GetCurr(ny,pos) + Op->Exc->Curr_amp[n]*Op->Exc->Signal_curr[exc_pos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the current excitation function into the file "ht"
|
|
||||||
if (numTS < Op->Exc->Length)
|
|
||||||
file_ht << (numTS+0.5) * Op->GetTimestep() << "\t" << Op->Exc->Signal_curr[numTS] << "\n"; // do not use std::endl here, because it will do an implicit flush
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::DoPreVoltageUpdates()
|
void Engine::DoPreVoltageUpdates()
|
||||||
|
@ -93,8 +93,6 @@ protected:
|
|||||||
virtual void ClearExtensions();
|
virtual void ClearExtensions();
|
||||||
vector<Engine_Extension*> m_Eng_exts;
|
vector<Engine_Extension*> m_Eng_exts;
|
||||||
|
|
||||||
ofstream file_et, file_ht; //excite signal dump file
|
|
||||||
|
|
||||||
friend class NS_Engine_Multithread::thread; // evil hack to access numTS from multithreading context
|
friend class NS_Engine_Multithread::thread; // evil hack to access numTS from multithreading context
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include "tools/array_ops.h"
|
#include "tools/array_ops.h"
|
||||||
#include "tools/useful.h"
|
#include "tools/useful.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include "fparser.hh"
|
#include "fparser.hh"
|
||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
#include "excitation.h"
|
#include "excitation.h"
|
||||||
@ -248,6 +250,28 @@ void Excitation::CalcSinusExcitation(double f0, int nTS)
|
|||||||
SetNyquistNum( CalcNyquistNum(f0,dT) );
|
SetNyquistNum( CalcNyquistNum(f0,dT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Excitation::DumpVoltageExcite(string filename)
|
||||||
|
{
|
||||||
|
ofstream file;
|
||||||
|
file.open( filename.c_str() );
|
||||||
|
if (file.fail())
|
||||||
|
return;
|
||||||
|
for (unsigned int n=1; n<Length+1; ++n)
|
||||||
|
file << (n-1)*dT << "\t" << Signal_volt[n] << "\n";
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Excitation::DumpCurrentExcite(string filename)
|
||||||
|
{
|
||||||
|
ofstream file;
|
||||||
|
file.open( filename.c_str() );
|
||||||
|
if (file.fail())
|
||||||
|
return;
|
||||||
|
for (unsigned int n=1; n<Length+1; ++n)
|
||||||
|
file << (n-1)*dT + 0.5*dT << "\t" << Signal_curr[n] << "\n";
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
void Excitation::setupVoltageExcitation( vector<unsigned int> const volt_vIndex[3], vector<FDTD_FLOAT> const& volt_vExcit,
|
void Excitation::setupVoltageExcitation( vector<unsigned int> const volt_vIndex[3], vector<FDTD_FLOAT> const& volt_vExcit,
|
||||||
vector<unsigned int> const& volt_vDelay, vector<unsigned int> const& volt_vDir )
|
vector<unsigned int> const& volt_vDelay, vector<unsigned int> const& volt_vDir )
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,12 @@ public:
|
|||||||
void SetNyquistNum(unsigned int nyquist) {m_nyquistTS=nyquist;}
|
void SetNyquistNum(unsigned int nyquist) {m_nyquistTS=nyquist;}
|
||||||
unsigned int GetNyquistNum() const {return m_nyquistTS;}
|
unsigned int GetNyquistNum() const {return m_nyquistTS;}
|
||||||
|
|
||||||
|
//! Dump voltage excitation signal to ASCII file
|
||||||
|
void DumpVoltageExcite(string filename);
|
||||||
|
|
||||||
|
//! Dump current excitation signal to ASCII file
|
||||||
|
void DumpCurrentExcite(string filename);
|
||||||
|
|
||||||
//Excitation time-signal
|
//Excitation time-signal
|
||||||
unsigned int Length;
|
unsigned int Length;
|
||||||
FDTD_FLOAT* Signal_volt;
|
FDTD_FLOAT* Signal_volt;
|
||||||
|
@ -1128,6 +1128,12 @@ bool Operator::Calc_EffMatPos(int ny, const unsigned int* pos, double* EffMat) c
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Operator::DumpExciationSignals()
|
||||||
|
{
|
||||||
|
Exc->DumpVoltageExcite("et");
|
||||||
|
Exc->DumpCurrentExcite("ht");
|
||||||
|
}
|
||||||
|
|
||||||
void Operator::Init_EC()
|
void Operator::Init_EC()
|
||||||
{
|
{
|
||||||
for (int n=0; n<3; ++n)
|
for (int n=0; n<3; ++n)
|
||||||
|
@ -55,6 +55,8 @@ public:
|
|||||||
|
|
||||||
virtual bool SetupExcitation(TiXmlElement* Excite, unsigned int maxTS) {return Exc->setupExcitation(Excite,maxTS);};
|
virtual bool SetupExcitation(TiXmlElement* Excite, unsigned int maxTS) {return Exc->setupExcitation(Excite,maxTS);};
|
||||||
|
|
||||||
|
virtual void DumpExciationSignals();
|
||||||
|
|
||||||
// the next four functions need to be reimplemented in a derived class
|
// the next four functions need to be reimplemented in a derived class
|
||||||
inline virtual FDTD_FLOAT GetVV( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return vv[n][x][y][z]; }
|
inline virtual FDTD_FLOAT GetVV( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return vv[n][x][y][z]; }
|
||||||
inline virtual FDTD_FLOAT GetVI( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return vi[n][x][y][z]; }
|
inline virtual FDTD_FLOAT GetVI( unsigned int n, unsigned int x, unsigned int y, unsigned int z ) const { return vi[n][x][y][z]; }
|
||||||
|
@ -605,6 +605,8 @@ int openEMS::SetupFDTD(const char* file)
|
|||||||
if (!FDTD_Op->SetupExcitation( FDTD_Opts->FirstChildElement("Excitation"), NrTS ))
|
if (!FDTD_Op->SetupExcitation( FDTD_Opts->FirstChildElement("Excitation"), NrTS ))
|
||||||
exit(2);
|
exit(2);
|
||||||
|
|
||||||
|
FDTD_Op->DumpExciationSignals();
|
||||||
|
|
||||||
timeval OpDoneTime;
|
timeval OpDoneTime;
|
||||||
gettimeofday(&OpDoneTime,NULL);
|
gettimeofday(&OpDoneTime,NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user