In general, this error is telling you that FastCap is not able to understand the direction of the normal to a dielectric panel. For instance, it might be that the reference point for the dielectric surface lies in the same plane of the panel. In this case, it is not possible to tell which way the normal points. It can happen if you have not carefully defined the reference point position - remember that FastCap has no notion of in/out, it simply tests every panel of a dielectric surface against the reference point position.
Another case, and this is probably your case, the panel normal cannot be defined. For instance, if your panel is degenerate. From the printed traces, you see that the normal vector is (0,0,0) and this is clearly wrong.
As a general strategy to troubleclear your issue, you need to narrow down the offending file to the shortest possible offending file (it does not matter if it is not representative of your geometry any more; you are just trying to catch the error).
Then you can usually spot the error.
Of course the normal flipping error can also be triggered by numerical issues, but this also means that the reference point has some issues w.r.t. the panel, or the panel is sort of valid but very narrow (e.g. a very thin triangle).
Looking at the full function checking the reference point position (and providing the error) may help you as well to see what I mean.
/*
determine if normal needs to be flipped to get dielectric bdry cond right
- this function uses 0.0 as a breakpoint when really machine precision
weighted checks should be done (really not an issue if ref point far)
*/
int flip_normal(panel)
charge *panel;
{
double x, y, z;
double norm, norm_sq;
surface *surf = panel->surf;
int ref_inside = surf->ref_inside, flip_normal;
double *ref = surf->ref, *normal, angle, norm_n;
char *surf_name = surf->name;
if(surf->type != DIELEC && surf->type != BOTH) return(FALSE);
/* get panel corner (relative to reference point) and normal */
x = panel->corner[0][0] - ref[0];
y = panel->corner[0][1] - ref[1];
z = panel->corner[0][2] - ref[2];
norm_sq = x*x + y*y + z*z;
norm = sqrt(norm_sq);
normal = panel->Z;
norm_n =
sqrt(normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]);
/* figure the dot product between the normal and the corner-ref point
- ref_inside and angle <= 90 => flip
- ref_inside and angle > 90 => no flip
- !ref_inside and angle <= 90 => no flip
- !ref_inside and angle > 90 => flip */
/* figure angle */
angle = (x*normal[0] + y*normal[1] + z*normal[2])/(norm*norm_n);
if(ref_inside && angle <= 0.0) flip_normal = TRUE;
else if(ref_inside && angle > 0.0) flip_normal = FALSE;
else if(!ref_inside && angle <= 0.0) flip_normal = FALSE;
else if(!ref_inside && angle > 0.0) flip_normal = TRUE;
else {
viewprintf(stderr,
"flip_normal: inconclusive test for normal flipping\n");
viewprintf(stderr, " Surface: %s\n", hack_path(surf_name));
viewprintf(stderr, " Translation: (%g %g %g)\n", surf->trans[0],
surf->trans[1], surf->trans[2]);
viewprintf(stderr, " Reference point: (%g %g %g)\n",
ref[0], ref[1], ref[2]);
viewprintf(stderr, " Panel corner: (%g %g %g)\n",
panel->corner[0][0], panel->corner[0][1], panel->corner[0][2]);
viewprintf(stderr, " Normal: (%g %g %g)\n",
normal[0], normal[1], normal[2]);
FCExit(FC_GENERIC_ERROR);
}
return(flip_normal);
}
If you still cannot get out of the issue and believe we have a bug, please post, or send me (see "Contacts" for the address) the minimum offending file (ideally a couple of lines!) and I will look into it.
BTW have you tried to run the file also through the pre-compiled FastCap2 under Windows? This could give you additional insight, in case the problem is not present in this binary.
Best Regards,
Enrico