engine interface: improve interpolation for e-fields on boundary edges

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
pull/13/head
Thorsten Liebig 2014-10-09 21:08:11 +02:00
parent dae788a2a4
commit 22d526f0ee
1 changed files with 8 additions and 4 deletions

View File

@ -67,6 +67,13 @@ double* Engine_Interface_FDTD::GetRawInterpolatedField(const unsigned int* pos,
case NODE_INTERPOLATE: case NODE_INTERPOLATE:
for (int n=0; n<3; ++n) for (int n=0; n<3; ++n)
{ {
if (pos[n]==m_Op->GetNumberOfLines(n, true)-1) // use only the "lower value" at the upper bound
{
--iPos[n];
out[n] = (double)GetRawField(n,iPos,type);
++iPos[n];
continue;
}
delta = m_Op->GetEdgeLength(n,iPos); delta = m_Op->GetEdgeLength(n,iPos);
out[n] = GetRawField(n,iPos,type); out[n] = GetRawField(n,iPos,type);
if (delta==0) if (delta==0)
@ -74,11 +81,8 @@ double* Engine_Interface_FDTD::GetRawInterpolatedField(const unsigned int* pos,
out[n]=0; out[n]=0;
continue; continue;
} }
if (pos[n]==0) if (pos[n]==0) // use only the "upper value" at the lower bound
{
out[n] *= 0.5; //make it consistant with upper PEC boundary
continue; continue;
}
--iPos[n]; --iPos[n];
double deltaDown = m_Op->GetEdgeLength(n,iPos); double deltaDown = m_Op->GetEdgeLength(n,iPos);
double deltaRel = delta / (delta+deltaDown); double deltaRel = delta / (delta+deltaDown);