FastFieldSolvers Forum
FastFieldSolvers Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
 All Forums
 FastFieldSolvers
 FasterCap and FastCap2
 Inconclusive test for normal flipping
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chgad

9 Posts

Posted - Feb 07 2019 :  11:43:00  Show Profile  Reply with Quote
Hello everyone ,

as the subject already states i get the error messsage as follows :

Input: idt_on_si_o2.lst
Surface idt_lower_cond_air.txt has 56 quads and 50 tris
Surface idt_upper_cond_air.txt has 59 quads and 28 tris
flip_normal: inconclusive test for normal flipping
Surface: dielectric.txt
Translation: (0 0 0)
Reference point: (0 0 1)
Panel corner: (0.5 0.5 -0.4)
Normal: (0 0 0)

I buillt FastCap2 from source (ht*ps://github.com/ediloren/FastCap2) for Linux.

So now i got 2 Questions:

1. What does this message want to tell me ?
2. How can i find out where the issue comes from ?

Enrico

399 Posts

Posted - Feb 07 2019 :  23:44:59  Show Profile  Reply with Quote
Please see ht*ps://w*w.fastfieldsolvers.com/forum/topic.asp?TOPIC_ID=1169 (you need to replace the * in the link, they are inserted to protect from spam; you can also search with the "Search" link on the top right the words "inconclusive test for normal flipping")

Best Regards,
Enrico


Go to Top of Page

chgad

9 Posts

Posted - Feb 11 2019 :  08:55:33  Show Profile  Reply with Quote
Hi, i read the article but it does not provide additional information on where the error originally occurs.

Is it because a face is incorrectly defined ?
Is it a round off error ?
(I might have identified the exact line :
Q 1
0.4999999701976776 0.4999999701976776 -0.4000000059604645
6.833333492279053 0.4999999701976776 -0.4000000059604645
6.833333492279053 6.833333492279053 -0.4000000059604645
0.4999999701976776 6.833333492279053 -0.4000000059604645
)



I remesh my model with the Open Source Program Blender :ht*ps://w*w.blender.org/.

I perform so called insets, and subdivides. If i only subdivide my models faces everything works as expected (although i do not get a convergences but that's a different topic.)

Go to Top of Page

Enrico

399 Posts

Posted - Feb 18 2019 :  19:43:09  Show Profile  Reply with Quote
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
Go to Top of Page

chgad

9 Posts

Posted - Feb 21 2019 :  16:23:12  Show Profile  Reply with Quote
Thank you very mich for the detailed answer. In the meanwhile i tracked the actual problem down and found an error within my discritization procedure which messed up nearly all of my faces.

Nonetheless there are probably 2 more Problems i face right now. they do not relateto this in so i guess i will open up new topics for them.

Thank you very much again.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
FastFieldSolvers Forum © 2018 FastFieldSolvers S.R.L. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06