new dump type: total current density (rotH) field dump

pull/1/head
Thorsten Liebig 2011-01-10 11:15:22 +01:00
parent c5a689b67c
commit c0c66518c1
6 changed files with 55 additions and 5 deletions

View File

@ -52,6 +52,8 @@ public:
virtual double* GetHField(const unsigned int* pos, double* out) const =0;
//! Get the (interpolated) electric current density field at \p pos. \sa SetInterpolationType
virtual double* GetJField(const unsigned int* pos, double* out) const =0;
//! Get the total current density field by rot(H) at \p pos. \sa SetInterpolationType
virtual double* GetRotHField(const unsigned int* pos, double* out) const =0;
//! Calculate the electric field integral along a given line
virtual double CalcVoltageIntegral(const unsigned int* start, const unsigned int* stop) const =0;

View File

@ -65,6 +65,8 @@ string ProcessFields::GetFieldNameByType(DumpType type)
return "H-Field";
case J_FIELD_DUMP:
return "J-Field";
case ROTH_FIELD_DUMP:
return "RotH-Field";
}
return "unknown field";
}
@ -600,8 +602,26 @@ FDTD_FLOAT**** ProcessFields::CalcField()
}
}
return field;
}
case ROTH_FIELD_DUMP:
for (unsigned int i=0; i<numLines[0]; ++i)
{
pos[0]=posLines[0][i];
for (unsigned int j=0; j<numLines[1]; ++j)
{
pos[1]=posLines[1][j];
for (unsigned int k=0; k<numLines[2]; ++k)
{
pos[2]=posLines[2][k];
m_Eng_Interface->GetRotHField(pos,out);
field[0][i][j][k] = out[0];
field[1][i][j][k] = out[1];
field[2][i][j][k] = out[2];
}
}
}
return field;
}
cerr << "ProcessFields::CalcField(): Error, unknown dump type..." << endl;
return field;
}

View File

@ -34,9 +34,10 @@ public:
//! Dump type definitions.
/*!
Current dump types are electric field (E_FIELD_DUMP), magnetic field (H_FIELD_DUMP) and (conduction) electric current density (kappa*E) (J_FIELD_DUMP).
Current dump types are electric field (E_FIELD_DUMP), magnetic field (H_FIELD_DUMP),
(conduction) electric current density (kappa*E) (J_FIELD_DUMP) and total current density (rotH)
*/
enum DumpType { E_FIELD_DUMP, H_FIELD_DUMP, J_FIELD_DUMP};
enum DumpType { E_FIELD_DUMP, H_FIELD_DUMP, J_FIELD_DUMP, ROTH_FIELD_DUMP};
virtual void InitProcess();

View File

@ -37,6 +37,11 @@ double* Engine_Interface_FDTD::GetJField(const unsigned int* pos, double* out) c
return GetRawInterpolatedField(pos, out, 1);
}
double* Engine_Interface_FDTD::GetRotHField(const unsigned int* pos, double* out) const
{
return GetRawInterpolatedField(pos, out, 2);
}
double* Engine_Interface_FDTD::GetRawInterpolatedField(const unsigned int* pos, double* out, int type) const
{
unsigned int iPos[] = {pos[0],pos[1],pos[2]};
@ -182,6 +187,27 @@ double Engine_Interface_FDTD::GetRawField(unsigned int n, const unsigned int* po
return value/delta;
if ((type==1) && (m_Op->m_kappa) && (delta))
return value*m_Op->m_kappa[n][pos[0]][pos[1]][pos[2]]/delta;
if (type==2) //calc rot(H)
{
int nP = (n+1)%3;
int nPP = (n+2)%3;
unsigned int locPos[] = {pos[0],pos[1],pos[2]};
double area = m_Op->GetEdgeArea(n,pos);
value = m_Eng->GetCurr(nPP,pos);
value -= m_Eng->GetCurr(nP,pos);
if (pos[nPP]>0)
{
--locPos[nPP];
value += m_Eng->GetCurr(nP,locPos);
++locPos[nPP];
}
if (pos[nP]>0)
{
--locPos[nP];
value -= m_Eng->GetCurr(nPP,locPos);
}
return value/area;
}
return 0.0;
}

View File

@ -43,6 +43,7 @@ public:
virtual double* GetEField(const unsigned int* pos, double* out) const;
virtual double* GetHField(const unsigned int* pos, double* out) const;
virtual double* GetJField(const unsigned int* pos, double* out) const;
virtual double* GetRotHField(const unsigned int* pos, double* out) const;
virtual double CalcVoltageIntegral(const unsigned int* start, const unsigned int* stop) const;

View File

@ -372,9 +372,9 @@ bool openEMS::SetupProcessing(ContinuousStructure& CSX)
CSPropDumpBox* db = DumpProps.at(i)->ToDumpBox();
if (db)
{
if ((db->GetDumpType()>=0) && (db->GetDumpType()<=2))
if ((db->GetDumpType()>=0) && (db->GetDumpType()<=3))
ProcField = new ProcessFieldsTD(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng));
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=12))
else if ((db->GetDumpType()>=10) && (db->GetDumpType()<=13))
ProcField = new ProcessFieldsFD(new Engine_Interface_FDTD(FDTD_Op,FDTD_Eng));
else
cerr << "openEMS::SetupFDTD: unknown dump box type... skipping!" << endl;