From 84f05130cb83df4865ef111be44d0fbf213d3aab Mon Sep 17 00:00:00 2001
From: Guillaume Demesy <guillaume.demesy@fresnel.fr>
Date: Thu, 19 Sep 2019 10:46:23 +0200
Subject: [PATCH] rounding geo

---
 DiffractionGratings/grating2D_data.geo |   2 +-
 NonLinearEVP/NonLinearEVP.geo          | 142 ++++++++++++++++---------
 NonLinearEVP/NonLinearEVP_data.geo     |   5 +-
 3 files changed, 94 insertions(+), 55 deletions(-)

diff --git a/DiffractionGratings/grating2D_data.geo b/DiffractionGratings/grating2D_data.geo
index 5f894f1..fd30158 100644
--- a/DiffractionGratings/grating2D_data.geo
+++ b/DiffractionGratings/grating2D_data.geo
@@ -80,7 +80,7 @@ DefineConstant[
   h_pmltop                    = {lambda_max, Name StrCat[pp3, "0top PML size [nm]"] ,  ReadOnly 1, Highlight Str[colorro], ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
   h_pmlbot                    = {lambda_max, Name StrCat[pp3, "1bottom PML size [nm]"] ,  ReadOnly 1, Highlight Str[colorro], ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
   Flag_o2_interp              = {1         , Name StrCat[pp3, "2Second order interpolation?"] , Choices {0,1}, ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
-  Flag_o2_geom                = {0         , Name StrCat[pp3, "3Second order mesh?"] , Choices {0,1}, Visible 0, ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
+  Flag_o2_geom                = {1         , Name StrCat[pp3, "3Second order mesh?"] , Choices {0,1}, Visible 0, ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
   paramaille                  = {10 , Name StrCat[pp3, "4nb of mesh elements per wavelength [-]"   ] , ReadOnly 0, Highlight Str[colorpp], ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
   paramaille_scale_sub        = {1  , Name StrCat[pp3, "6Custom mesh parameters/refine substrate [-]"    ] , ReadOnly 0, Highlight Str[colorpp], Closed 1, ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
   paramaille_scale_layer_dep  = {1  , Name StrCat[pp3, "6Custom mesh parameters/refine deposit layer [-]"] , ReadOnly 0, Highlight Str[colorpp], Closed 1, ServerAction "Reset GetDP/T0, GetDP/R0, GetDP/Lambda_step, GetDP/total absorption"},
diff --git a/NonLinearEVP/NonLinearEVP.geo b/NonLinearEVP/NonLinearEVP.geo
index ae3b765..2948937 100644
--- a/NonLinearEVP/NonLinearEVP.geo
+++ b/NonLinearEVP/NonLinearEVP.geo
@@ -20,7 +20,6 @@ lc_cell = a_lat/paramaille;
 lc_sq   = lc_cell/4;
 lc_pml  = lc_cell*1.2;
 lc_sqa  = lc_sq;
-
 lc_sq_inside = lc_sq*1.4;
 epsc         = lc_sq*0.8;
 
@@ -30,67 +29,106 @@ If (flag_Tmesh==0)
   Point(2)  = { a_lat/2. ,-d_sq/2.-space2pml, 0. , lc_cell};
   Point(3)  = { a_lat/2. , d_sq/2.+space2pml, 0. , lc_cell};
   Point(4)  = {-a_lat/2. , d_sq/2.+space2pml, 0. , lc_cell};
-
-  Point(5)  = {-d_sq/2. ,-d_sq/2., 0. , lc_sq};
-  Point(6)  = { d_sq/2. ,-d_sq/2., 0. , lc_sq};
-  Point(7)  = { d_sq/2. , d_sq/2., 0. , lc_sq};
-  Point(8)  = {-d_sq/2. , d_sq/2., 0. , lc_sq};
-
   Point(9)  = {-a_lat/2. ,-d_sq/2.-space2pml-pmlsize, 0. , lc_pml};
   Point(10) = { a_lat/2. ,-d_sq/2.-space2pml-pmlsize, 0. , lc_pml};
   Point(11) = { a_lat/2. , d_sq/2.+space2pml+pmlsize, 0. , lc_pml};
   Point(12) = {-a_lat/2. , d_sq/2.+space2pml+pmlsize, 0. , lc_pml};
-
   Point(13) = {-a_lat/2. , a_lat/2., 0. , lc_sqa};
   Point(14) = {-a_lat/2. ,-a_lat/2., 0. , lc_sqa};
   Point(15) = { a_lat/2. , a_lat/2., 0. , lc_sqa};
   Point(16) = { a_lat/2. ,-a_lat/2., 0. , lc_sqa};
-
-  Line(1) = {1, 2};
-  Line(3) = {3, 4};
-  Line(5) = {5, 6};
-  Line(6) = {6, 7};
-  Line(7) = {7, 8};
-  Line(8) = {8, 5};
-
-  Line(15) = {1, 14};
-  Line(16) = {14, 13};
-  Line(17) = {13, 4};
-  Line(18) = {2, 16};
-  Line(19) = {16, 15};
-  Line(20) = {15, 3};
-
-  Line(9) = {4, 12};
-  Line(10) = {12, 11};
-  Line(11) = {11, 3};
-  Line(12) = {1, 9};
-  Line(13) = {9, 10};
-  Line(14) = {10, 2};
-
-  Line Loop(1) = {12, 13, 14, -1};
-  Plane Surface(1) = {1};
-  Line Loop(2) = {5, 6, 7, 8};
-  Plane Surface(2) = {2};
-  Line Loop(3) = {17, -3, -20, -19, -18, -1, 15, 16};
-  Plane Surface(3) = {2, -3};
-  Line Loop(4) = {9, 10, 11, 3};
-  Plane Surface(4) = {-4};
-
-  Periodic Line { 14,18,19,20,11 } = {12,15,16,17,9 } Translate {a_lat,0,0} ;
-
-  Physical Surface(100) = {2};   // 1 dom in
-  Physical Surface(101) = {3};  // 2 dom out
-  Physical Surface(102) = {1};  // PML bot
-  Physical Surface(103) = {4};  // PML top
-  Physical Line(1001)   = {12,15,16,17,9}; // bloch x left
-  Physical Line(1002)   = {14,18,19,20,11}; // bloch x right
-  Physical Line(1003)   = {10}; // top bound
-  Physical Line(1004)   = {13}; // bot bound
-  Physical Line(1005)   = {5,6,7,8}; // bound for lag
-  Physical Point(10000) = {1};   // Printpoint
+  If (flag_rounding==0)
+    Point(5)  = {-d_sq/2. ,-d_sq/2., 0. , lc_sq};
+    Point(6)  = { d_sq/2. ,-d_sq/2., 0. , lc_sq};
+    Point(7)  = { d_sq/2. , d_sq/2., 0. , lc_sq};
+    Point(8)  = {-d_sq/2. , d_sq/2., 0. , lc_sq};
+    Line(1) = {1, 2};
+    Line(3) = {3, 4};
+    Line(5) = {5, 6};
+    Line(6) = {6, 7};
+    Line(7) = {7, 8};
+    Line(8) = {8, 5};
+    Line(15) = {1, 14};
+    Line(16) = {14, 13};
+    Line(17) = {13, 4};
+    Line(18) = {2, 16};
+    Line(19) = {16, 15};
+    Line(20) = {15, 3};
+    Line(9) = {4, 12};
+    Line(10) = {12, 11};
+    Line(11) = {11, 3};
+    Line(12) = {1, 9};
+    Line(13) = {9, 10};
+    Line(14) = {10, 2};
+    Line Loop(1) = {12, 13, 14, -1};
+    Plane Surface(1) = {1};
+    Line Loop(2) = {5, 6, 7, 8};
+    Plane Surface(2) = {2};
+    Line Loop(3) = {17, -3, -20, -19, -18, -1, 15, 16};
+    Plane Surface(3) = {2, -3};
+    Line Loop(4) = {9, 10, 11, 3};
+    Plane Surface(4) = {-4};
+    Periodic Line { 14,18,19,20,11 } = {12,15,16,17,9 } Translate {a_lat,0,0} ;    
+    Physical Line("SCATBOUND",1005)   = {5,6,7,8}; // bound for lag
+  Else
+    Point(20)  = {-d_sq/2.+corner_rad ,-d_sq/2., 0. , lc_sq};
+    Point(21)  = {-d_sq/2. ,-d_sq/2.+corner_rad, 0. , lc_sq};
+    Point(22)  = {-d_sq/2.+corner_rad ,-d_sq/2.+corner_rad, 0. , lc_sq};
+    Point(23)  = { d_sq/2.-corner_rad ,-d_sq/2., 0. , lc_sq};
+    Point(24)  = { d_sq/2. ,-d_sq/2.+corner_rad, 0. , lc_sq};
+    Point(25) = { d_sq/2.-corner_rad ,-d_sq/2.+corner_rad, 0. , lc_sq};
+    Point(26)  = { d_sq/2.-corner_rad , d_sq/2., 0. , lc_sq};
+    Point(27)  = { d_sq/2. , d_sq/2.-corner_rad, 0. , lc_sq};
+    Point(28)  = { d_sq/2.-corner_rad , d_sq/2.-corner_rad, 0. , lc_sq};
+    Point(29)  = {-d_sq/2.+corner_rad , d_sq/2., 0. , lc_sq};
+    Point(30)  = {-d_sq/2. , d_sq/2.-corner_rad, 0. , lc_sq};
+    Point(31)  = {-d_sq/2.+corner_rad , d_sq/2.-corner_rad, 0. , lc_sq};
+
+    Line(1) = {1, 2};
+    Line(3) = {3, 4};
+    Line(15) = {1, 14};
+    Line(16) = {14, 13};
+    Line(17) = {13, 4};
+    Line(18) = {2, 16};
+    Line(19) = {16, 15};
+    Line(20) = {15, 3};
+    Line(9) = {4, 12};
+    Line(10) = {12, 11};
+    Line(11) = {11, 3};
+    Line(12) = {1, 9};
+    Line(13) = {9, 10};
+    Line(14) = {10, 2};
+    Circle(21) = {30, 31, 29};
+    Circle(22) = {26, 28, 27};
+    Circle(23) = {24, 25, 23};
+    Circle(24) = {21, 22, 20};
+    Line(25) = {29, 26};
+    Line(26) = {27, 24};
+    Line(27) = {23, 20};
+    Line(28) = {21, 30};    
+    Line Loop(1) = {12, 13, 14, -1};
+    Plane Surface(1) = {1};
+    Curve Loop(2) = {25, 22, 26, 23, 27, -24, 28, 21};
+    Plane Surface(2) = {2};
+    Curve Loop(3) = {20, 3, -17, -16, -15, 1, 18, 19};
+    Plane Surface(3) = {2, 3};
+    Line Loop(4) = {9, 10, 11, 3};
+    Plane Surface(4) = {-4};
+    Periodic Line { 14,18,19,20,11 } = {12,15,16,17,9 } Translate {a_lat,0,0} ;
+    Physical Line("SCATBOUND",1005)    = {21,22,23,24,25,26,27,28}; // bound for lag
+  EndIf
+  Physical Surface("SCAT",100)       = {2};   // 1 dom in
+  Physical Surface("OUT",101)        = {3};  // 2 dom out
+  Physical Surface("PMLBOT",102)     = {1};  // PML bot
+  Physical Surface("PMLTOP",103)     = {4};  // PML top
+  Physical Line("BLOCHXL",1001)      = {12,15,16,17,9}; // bloch x left
+  Physical Line("BLOCHXR",1002)      = {14,18,19,20,11}; // bloch x right
+  Physical Line("TOP",1003)          = {10}; // top bound
+  Physical Line("BOT",1004)          = {13}; // bot bound
+  Physical Point("PRINTPOINT",10000) = {1};   // Printpoint    
 EndIf
-If (flag_Tmesh==1)
 
+If (flag_Tmesh==1)
   Point(1)  = {-a_lat/2. ,-d_sq/2.-space2pml, 0. , lc_cell};
   Point(2)  = { a_lat/2. ,-d_sq/2.-space2pml, 0. , lc_cell};
   Point(3)  = { a_lat/2. , d_sq/2.+space2pml, 0. , lc_cell};
diff --git a/NonLinearEVP/NonLinearEVP_data.geo b/NonLinearEVP/NonLinearEVP_data.geo
index 67844ac..56a3eb5 100644
--- a/NonLinearEVP/NonLinearEVP_data.geo
+++ b/NonLinearEVP/NonLinearEVP_data.geo
@@ -57,8 +57,8 @@ DefineConstant[
   flag_Tmesh     = {0     , Name StrCat[pp4 , "2locally structured mesh?"] , Choices {0="unstruct",1="struct"} },
   flag_o2g       = {1     , Name StrCat[pp4 , "3Geometry order"] , Choices {0="o1 (linear)",1="o2 (curved)"} },
   flag_o2i       = {1     , Name StrCat[pp4 , "4Interpolation order"] , Choices {0="o1",1="o2"} },
-  flag_outEigvec = {1     , Name StrCat[pp4 , "5Corner rounding/0Do it!"], Choices{0,1}, ServerAction "ResetDatabase"},
-  corner_rad_frac= {0.1   , Name StrCat[pp4 , "5Corner rounding/1corner radius (fraction of square side)"] , Highlight Str[colorpp0]  , Min 0.01, Max 0.49},
+  flag_rounding  = {1     , Name StrCat[pp4 , "5Corner rounding/0Do it!"], Choices{0,1}, ServerAction "ResetDatabase"},
+  corner_rad_frac= {0.1   , Name StrCat[pp4 , "5Corner rounding/1corner radius (fraction of square side)"] , Highlight Str[colorpp2]  , Min 0.01, Max 0.49},
   flag_outEigvec = {1     , Name StrCat[pp4 , "7output eigenvector?"], Choices{0,1}},
   
   flag_res       = {2     , Name StrCat[pp5  , "0resolution type"], 
@@ -88,6 +88,7 @@ eig_min_im     = eig_min_im    / norm;
 eig_max_im     = eig_max_im    / norm;
 om_d_1         = om_d_1        / norm;
 gam_1          = gam_1         / norm;
+corner_rad     = d_sq*corner_rad_frac;
 
 eps_oo_2       = 1;
 om_d_2         = 0;
-- 
GitLab