From 8787d793aa658bfedd438dcfbc6016330f48c0b1 Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Wed, 28 Apr 2010 22:42:55 +0200 Subject: [PATCH] update to field excitation --- FDTD/operator.cpp | 32 ++++++++++++++++---------------- FDTD/operator.h | 5 ++--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/FDTD/operator.cpp b/FDTD/operator.cpp index bd3aa47..c3bd66f 100644 --- a/FDTD/operator.cpp +++ b/FDTD/operator.cpp @@ -577,7 +577,7 @@ int Operator::CalcECOperator() bool PEC[6]={1,1,1,1,1,1}; ApplyElectricBC(PEC); - if (CalcEFieldExcitation()==false) return -1; + if (CalcFieldExcitation()==false) return -1; CalcPEC(); bool PMC[6]; @@ -891,7 +891,7 @@ double Operator::CalcTimestep() return 0; } -bool Operator::CalcEFieldExcitation() +bool Operator::CalcFieldExcitation() { if (dT==0) return false; vector vIndex[3]; @@ -899,7 +899,7 @@ bool Operator::CalcEFieldExcitation() vector vDelay; vector vDir; unsigned int pos[3]; - double coord[3]; + double volt_coord[3]; double delta[3]; double amp=0; @@ -914,19 +914,19 @@ bool Operator::CalcEFieldExcitation() delta[0]=fabs(MainOp->GetIndexDelta(0,pos[0])); for (int n=0;n<3;++n) { - coord[0] = discLines[0][pos[0]]; - coord[1] = discLines[1][pos[1]]; - coord[2] = discLines[2][pos[2]]; - coord[n]+=delta[n]*0.5; - CSProperties* prop = CSX->GetPropertyByCoordPriority(coord,(CSProperties::PropertyType)(CSProperties::ELECTRODE)); + volt_coord[0] = discLines[0][pos[0]]; + volt_coord[1] = discLines[1][pos[1]]; + volt_coord[2] = discLines[2][pos[2]]; + volt_coord[n]+=delta[n]*0.5; + CSProperties* prop = CSX->GetPropertyByCoordPriority(volt_coord,(CSProperties::PropertyType)(CSProperties::ELECTRODE)); if (prop) { CSPropElectrode* elec = prop->ToElectrode(); if (elec!=NULL) { - if ((elec->GetActiveDir(n)) )//&& (pos[n]GetActiveDir(n)) && ( (elec->GetExcitType()==0) || (elec->GetExcitType()==1) ))//&& (pos[n]GetWeightedExcitation(n,coord)*GetMeshDelta(n,pos);// delta[n]*gridDelta; + amp = elec->GetWeightedExcitation(n,volt_coord)*GetMeshDelta(n,pos);// delta[n]*gridDelta; if (amp!=0) { vExcit.push_back(amp); @@ -980,16 +980,16 @@ bool Operator::CalcEFieldExcitation() pos[2] = path.posPath[2].at(t); MainOp->SetPos(pos[0],pos[1],pos[2]); deltaN=fabs(MainOp->GetIndexDelta(n,pos[n])); - coord[0] = discLines[0][pos[0]]; - coord[1] = discLines[1][pos[1]]; - coord[2] = discLines[2][pos[2]]; - coord[n] += 0.5*deltaN; + volt_coord[0] = discLines[0][pos[0]]; + volt_coord[1] = discLines[1][pos[1]]; + volt_coord[2] = discLines[2][pos[2]]; + volt_coord[n] += 0.5*deltaN; // cerr << n << " " << coord[0] << " " << coord[1] << " " << coord[2] << endl; if (elec!=NULL) { - if ((elec->GetActiveDir(n)) && (pos[n]GetActiveDir(n)) && (pos[n]GetExcitType()==0) || (elec->GetExcitType()==1) )) { - amp = elec->GetWeightedExcitation(n,coord)*deltaN*gridDelta; + amp = elec->GetWeightedExcitation(n,volt_coord)*deltaN*gridDelta; if (amp!=0) { vExcit.push_back(amp); diff --git a/FDTD/operator.h b/FDTD/operator.h index ba202b3..e90e1a1 100644 --- a/FDTD/operator.h +++ b/FDTD/operator.h @@ -107,9 +107,8 @@ protected: int m_BC[6]; - //E-Field Excitation - //! Calc the electric field excitation. - virtual bool CalcEFieldExcitation(); + //! Calculate the field excitations. + virtual bool CalcFieldExcitation(); virtual bool CalcPEC();