diff --git a/DiffractionGratings/grating3D.geo b/DiffractionGratings/grating3D.geo
index fd2c52a33807e03abe2f090679da845a96faab91..127c743f40b5a1a870fd39bed4829f6933554bea 100644
--- a/DiffractionGratings/grating3D.geo
+++ b/DiffractionGratings/grating3D.geo
@@ -221,7 +221,7 @@ EndFor
 If (tag_geom==3) // Split torus weird otherwise
   Mesh.Algorithm = 6;
 EndIf
-// Mesh.Optimimze3D=1;
+Mesh.Optimimze3D=1;
 // Mesh.SurfaceEdges = 0;
 Mesh.VolumeEdges = 0;
 Mesh.ElementOrder = og;
diff --git a/DiffractionGratings/grating3D.pro b/DiffractionGratings/grating3D.pro
index 1e18bc107cd74c4221ae013fe1405be5e88bd185..8af300f720f9be44a785ba8175920e04e36b8b2e 100644
--- a/DiffractionGratings/grating3D.pro
+++ b/DiffractionGratings/grating3D.pro
@@ -32,6 +32,7 @@ Group {
   
 	SurfDirichlet  = Region[{401,402}];
   SurfBloch      = Region[{}];
+  SurfExcludeFacets = Region[501];
   // SurfBloch      = Region[{SurfBlochXm,SurfBlochXp,SurfBlochYm,SurfBlochYp}];
 
   L_1 = Region[{L_1_temp,SurfIntTop}];
@@ -268,9 +269,9 @@ FunctionSpace {
       { Name sn; NameOfCoef un; Function BF_Edge; Support Region[{Omega}]; Entity EdgesOf[All]; }
       { Name sn2; NameOfCoef un2; Function BF_Edge_2E;Support Region[{Omega}]; Entity EdgesOf[All]; }
       If(oi==2)
-        { Name sn3; NameOfCoef un3; Function BF_Edge_3F_b; Support Region[Omega]; Entity FacetsOf[Omega]; }
-        { Name sn4; NameOfCoef un4; Function BF_Edge_3F_c; Support Region[Omega]; Entity FacetsOf[Omega]; }
-        { Name sn5; NameOfCoef un5; Function BF_Edge_4E  ; Support Region[Omega]; Entity  EdgesOf[Omega]; }
+        { Name sn3; NameOfCoef un3; Function BF_Edge_3F_b; Support Region[Omega]; Entity FacetsOf[Omega, Not SurfExcludeFacets]; }
+        { Name sn4; NameOfCoef un4; Function BF_Edge_3F_c; Support Region[Omega]; Entity FacetsOf[Omega, Not SurfExcludeFacets]; }
+        { Name sn5; NameOfCoef un5; Function BF_Edge_4E  ; Support Region[Omega]; Entity  EdgesOf[Omega, Not SurfExcludeFacets]; }
       EndIf
     }
     Constraint {
diff --git a/DiffractionGratings/grating3D_data_bisin.geo b/DiffractionGratings/grating3D_data_bisin.geo
index d3566731a2ac6115349ed8d989e9c9e601fd4762..46c12218a1b51a34c6302aa0ec6b9e428b5aa87d 100644
--- a/DiffractionGratings/grating3D_data_bisin.geo
+++ b/DiffractionGratings/grating3D_data_bisin.geo
@@ -12,9 +12,9 @@ DefineConstant[
     psideg        = {0     , Name StrCat[pp1,"/4psi0 [deg]"]},
     period_x      = {1000  , Name StrCat[pp2,"/1X period [nm]"]},
     period_y      = {1000  , Name StrCat[pp2,"/2Y period [nm]"]},
-    thick_L_1     = {100   , Name StrCat[pp2,"/3thickness layer 1 [nm] (superstrate)"]},
-    thick_L_2     = {100   , Name StrCat[pp2,"/4thickness layer 2 [nm]"]},
-    thick_L_3     = {400, Name StrCat[pp2,"/5thickness layer 3 [nm]"]},
+    thick_L_1     = {200   , Name StrCat[pp2,"/3thickness layer 1 [nm] (superstrate)"]},
+    thick_L_2     = {150   , Name StrCat[pp2,"/4thickness layer 2 [nm]"]},
+    thick_L_3     = {500   , Name StrCat[pp2,"/5thickness layer 3 [nm]"]},
     thick_L_4     = {100   , Name StrCat[pp2,"/6thickness layer 4 [nm]"]},
     thick_L_5     = {100   , Name StrCat[pp2,"/7thickness layer 5 [nm]"]},
     thick_L_6     = {200   , Name StrCat[pp2,"/8thickness layer 6 [nm] (substrate)"]},
@@ -48,7 +48,7 @@ DefineConstant[
     
     og            = {0          , Name StrCat[pp5,"/0geometrical order [-]"]  , Choices {0="1",1="2"} },
     oi            = {1          , Name StrCat[pp5,"/0interpolation order [-]"], Choices {0="1",1="2"} },
-    paramaille    = {9     , Name StrCat[pp5,"/1Number of mesh elements per wavelength [-]"]},
+    paramaille    = {8     , Name StrCat[pp5,"/1Number of mesh elements per wavelength [-]"]},
     lc_scat       = {lambda0/(2*paramaille)    , Name StrCat[pp5,"/2Scatterer absolute mesh size [nm]"]},
     PML_top       = {lambda0, Name StrCat[pp5,"/4PML top thickness [nm]"]},
     PML_bot       = {lambda0, Name StrCat[pp5,"/5PML bot thickness [nm]"]},
diff --git a/DiffractionGratings/grating3D_data_hole.geo b/DiffractionGratings/grating3D_data_hole.geo
index 9285664f7546d55988d46c5e84f8b79e8b0604ac..cbc63f305be89e6589b6895fdf24eceb26d5074a 100644
--- a/DiffractionGratings/grating3D_data_hole.geo
+++ b/DiffractionGratings/grating3D_data_hole.geo
@@ -10,8 +10,8 @@ DefineConstant[
     thetadeg      = {0     , Name StrCat[pp1,"/2theta0 [deg]"]},
     phideg        = {0     , Name StrCat[pp1,"/3phi0 [deg]"]},
     psideg        = {45    , Name StrCat[pp1,"/4psi0 [deg]"]},
-    period_x      = {999 , Name StrCat[pp2,"/1X period [nm]"]},
-    period_y      = {999 , Name StrCat[pp2,"/2Y period [nm]"]},
+    period_x      = {1000.01 , Name StrCat[pp2,"/1X period [nm]"]},
+    period_y      = {1000.01 , Name StrCat[pp2,"/2Y period [nm]"]},
     thick_L_1     = {100   , Name StrCat[pp2,"/3thickness layer 1 [nm] (superstrate)"]},
     thick_L_2     = {50   , Name StrCat[pp2,"/4thickness layer 2 [nm]"]},
     thick_L_3     = {50    , Name StrCat[pp2,"/5thickness layer 3 [nm]"]},
@@ -48,14 +48,14 @@ DefineConstant[
     
     og            = {0          , Name StrCat[pp5,"/0geometrical order [-]"]  , Choices {0="1",1="2"} },
     oi            = {1          , Name StrCat[pp5,"/0interpolation order [-]"], Choices {0="1",1="2"} },
-    paramaille    = {4.5     , Name StrCat[pp5,"/1Number of mesh elements per wavelength [-]"]},
-    lc_scat       = {lambda0/(6*paramaille)    , Name StrCat[pp5,"/2Scatterer absolute mesh size [nm]"]},
+    paramaille    = {4.         , Name StrCat[pp5,"/1Number of mesh elements per wavelength [-]"]},
+    lc_scat       = {lambda0/(5*paramaille)    , Name StrCat[pp5,"/2Scatterer absolute mesh size [nm]"]},
     PML_top       = {lambda0, Name StrCat[pp5,"/4PML top thickness [nm]"]},
     PML_bot       = {lambda0, Name StrCat[pp5,"/5PML bot thickness [nm]"]},
     Nmax          = {2      , Name StrCat[pp5,"/6Number of non specular order to output [-]"]},
     refine_mesh_L_1= {1      , Name StrCat[pp5,"/7refine layers/1refine mesh layer 1 [-]"]},
-    refine_mesh_L_2= {1      , Name StrCat[pp5,"/7refine layers/2refine mesh layer 2 [-]"]},
-    refine_mesh_L_3= {7      , Name StrCat[pp5,"/7refine layers/3refine mesh layer 3 [-]"]},
+    refine_mesh_L_2= {2      , Name StrCat[pp5,"/7refine layers/2refine mesh layer 2 [-]"]},
+    refine_mesh_L_3= {6      , Name StrCat[pp5,"/7refine layers/3refine mesh layer 3 [-]"]},
     refine_mesh_L_4= {1      , Name StrCat[pp5,"/7refine layers/4refine mesh layer 4 [-]"]},
     refine_mesh_L_5= {1      , Name StrCat[pp5,"/7refine layers/5refine mesh layer 5 [-]"]},
     refine_mesh_L_6= {1      , Name StrCat[pp5,"/7refine layers/6refine mesh layer 6 [-]"]},