fix in end-criteria and field-energy-calc
parent
37295c02a9
commit
c7ed4a2e76
|
@ -110,9 +110,12 @@ double ProcessFields::CalcTotalEnergy()
|
||||||
{
|
{
|
||||||
for (pos[2]=0;pos[2]<Op->numLines[2];++pos[2])
|
for (pos[2]=0;pos[2]<Op->numLines[2];++pos[2])
|
||||||
{
|
{
|
||||||
energy+=fabs(Eng->volt[0][pos[0]][pos[1]][pos[2]] * Eng->curr[0][pos[0]][pos[1]][pos[2]]);
|
energy+=fabs(Eng->volt[0][pos[0]][pos[1]][pos[2]] * Eng->curr[1][pos[0]][pos[1]][pos[2]]);
|
||||||
energy+=fabs(Eng->volt[1][pos[0]][pos[1]][pos[2]] * Eng->curr[1][pos[0]][pos[1]][pos[2]]);
|
energy+=fabs(Eng->volt[0][pos[0]][pos[1]][pos[2]] * Eng->curr[2][pos[0]][pos[1]][pos[2]]);
|
||||||
energy+=fabs(Eng->volt[2][pos[0]][pos[1]][pos[2]] * Eng->curr[2][pos[0]][pos[1]][pos[2]]);
|
energy+=fabs(Eng->volt[1][pos[0]][pos[1]][pos[2]] * Eng->curr[0][pos[0]][pos[1]][pos[2]]);
|
||||||
|
energy+=fabs(Eng->volt[1][pos[0]][pos[1]][pos[2]] * Eng->curr[2][pos[0]][pos[1]][pos[2]]);
|
||||||
|
energy+=fabs(Eng->volt[2][pos[0]][pos[1]][pos[2]] * Eng->curr[0][pos[0]][pos[1]][pos[2]]);
|
||||||
|
energy+=fabs(Eng->volt[2][pos[0]][pos[1]][pos[2]] * Eng->curr[1][pos[0]][pos[1]][pos[2]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ void ProcessingArray::DeleteAll()
|
||||||
|
|
||||||
int ProcessingArray::Process()
|
int ProcessingArray::Process()
|
||||||
{
|
{
|
||||||
int nextProcess=1e100;
|
int nextProcess=maxInterval;
|
||||||
//this could be done nicely in parallel??
|
//this could be done nicely in parallel??
|
||||||
for (size_t i=0;i<ProcessArray.size();++i)
|
for (size_t i=0;i<ProcessArray.size();++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
class ProcessingArray
|
class ProcessingArray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProcessingArray() {};
|
ProcessingArray(unsigned int maximalInterval) {maxInterval=maximalInterval;}
|
||||||
~ProcessingArray() {};
|
~ProcessingArray() {};
|
||||||
|
|
||||||
void AddProcessing(Processing* proc);
|
void AddProcessing(Processing* proc);
|
||||||
|
@ -69,6 +69,7 @@ public:
|
||||||
int Process();
|
int Process();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
unsigned int maxInterval;
|
||||||
vector<Processing*> ProcessArray;
|
vector<Processing*> ProcessArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ int openEMS::SetupFDTD(const char* file)
|
||||||
|
|
||||||
//*************** setup processing ************//
|
//*************** setup processing ************//
|
||||||
cout << "Setting up processing..." << endl;
|
cout << "Setting up processing..." << endl;
|
||||||
PA = new ProcessingArray();
|
PA = new ProcessingArray(Nyquist);
|
||||||
|
|
||||||
double start[3];
|
double start[3];
|
||||||
double stop[3];
|
double stop[3];
|
||||||
|
@ -274,11 +274,13 @@ void openEMS::RunFDTD()
|
||||||
if (t_diff>4)
|
if (t_diff>4)
|
||||||
{
|
{
|
||||||
currE = ProcField.CalcTotalEnergy();
|
currE = ProcField.CalcTotalEnergy();
|
||||||
if ((currE>0) && (currE>maxE))
|
if (currE>maxE)
|
||||||
maxE=currE;
|
maxE=currE;
|
||||||
cout << "Timestep: " << setw(12) << currTS << " (" << setw(6) << setprecision(2) << std::fixed << (double)currTS/(double)NrTS*100.0 << "%)" ;
|
cout << "Timestep: " << setw(12) << currTS << " (" << setw(6) << setprecision(2) << std::fixed << (double)currTS/(double)NrTS*100.0 << "%)" ;
|
||||||
cout << " with currently " << setw(6) << setprecision(1) << std::fixed << speed*(double)(currTS-prevTS)/t_diff << " MCells/s" ;
|
cout << " with currently " << setw(6) << setprecision(1) << std::fixed << speed*(double)(currTS-prevTS)/t_diff << " MCells/s" ;
|
||||||
cout << " --- Energy: ~" << setw(6) << setprecision(2) << std::scientific << currE << " (decrement: " << setw(6) << setprecision(2) << std::fixed << fabs(10.0*log10(currE/maxE)) << "dB)" << endl;
|
if (maxE)
|
||||||
|
change = currE/maxE;
|
||||||
|
cout << " --- Energy: ~" << setw(6) << setprecision(2) << std::scientific << currE << " (decrement: " << setw(6) << setprecision(2) << std::fixed << fabs(10.0*log10(change)) << "dB)" << endl;
|
||||||
prevTime=currTime;
|
prevTime=currTime;
|
||||||
prevTS=currTS;
|
prevTS=currTS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue