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)
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 - ref;
y = panel->corner - ref;
z = panel->corner - ref;
norm_sq = x*x + y*y + z*z;
norm = sqrt(norm_sq);
normal = panel->Z;
sqrt(normal*normal + normal*normal + normal*normal);
/* 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 + y*normal + z*normal)/(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;
"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,
viewprintf(stderr, " Reference point: (%g %g %g)\n",
ref, ref, ref);
viewprintf(stderr, " Panel corner: (%g %g %g)\n",
panel->corner, panel->corner, panel->corner);
viewprintf(stderr, " Normal: (%g %g %g)\n",
normal, normal, 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.