Skip to content
Snippets Groups Projects
Commit 52643ce9 authored by Guillaume Demesy's avatar Guillaume Demesy
Browse files

spline for bi-sin

parent 2c456f7b
No related branches found
No related tags found
1 merge request!4Grating3d
......@@ -96,99 +96,100 @@ If (tag_geom==5)
EndIf
If (tag_geom==6)
nsin = 2;
pp=newp;
ll=newl;
ss=news;
nsin = 10;
For i In {0:nsin}
xx~{i} = -period_x/2+i*period_x/(nsin);
yy~{i} = -period_y/2+i*period_y/(nsin);
xx1~{i} = -period_x/2+i*period_x/2/(nsin-1);
xx2~{i} = i*period_x/2/(nsin-1);
EndFor
lss={};
pp=newp;//pp=pp-1;
For i In {0:nsin-1}
For j In {0:nsin-1}
pp=newp;ll=newl;lll=newll;
ssij=ss+i*nsin+j;
Point(pp+0) = {xx~{i},yy~{j},rz/4*(Cos(2*Pi*xx~{i}/period_x)+Cos(2*Pi*yy~{j}/period_y))+hh_L_3+thick_L_3/2};
Point(pp+1) = {xx~{i+1},yy~{j},rz/4*(Cos(2*Pi*xx~{i+1}/period_x)+Cos(2*Pi*yy~{j}/period_y))+hh_L_3+thick_L_3/2};
Point(pp+2) = {xx~{i+1},yy~{j+1},rz/4*(Cos(2*Pi*xx~{i+1}/period_x)+Cos(2*Pi*yy~{j+1}/period_y))+hh_L_3+thick_L_3/2};
Point(pp+3) = {xx~{i},yy~{j+1},rz/4*(Cos(2*Pi*xx~{i}/period_x)+Cos(2*Pi*yy~{j+1}/period_y))+hh_L_3+thick_L_3/2};
Line(ll+0) = {pp,pp+1};
Line(ll+1) = {pp+1,pp+2};
Line(ll+2) = {pp+2,pp+3};
Line(ll+3) = {pp+3,pp};
// If(i==0)
// Line{ll} In Surface{25};
// EndIf
Line Loop(lll) = {ll,ll+1,ll+2,ll+3};
Surface(ssij) = {lll};
lss(i*nsin+j) = ssij;
// Surface{ss} In Volume{5};
EndFor
yy=-period_y/2;
Point(newp) = {xx1~{i},yy,rz/4*(Cos(2*Pi*xx1~{i}/period_x)+Cos(2*Pi*yy/period_y))+hh_L_3+thick_L_3/2};
Point(newp) = {yy,xx1~{i},rz/4*(Cos(2*Pi*yy/period_x)+Cos(2*Pi*xx1~{i}/period_y))+hh_L_3+thick_L_3/2};
yy=0;
Point(newp) = {xx1~{i},yy,rz/4*(Cos(2*Pi*xx1~{i}/period_x)+Cos(2*Pi*yy/period_y))+hh_L_3+thick_L_3/2};
Point(newp) = {yy,xx1~{i},rz/4*(Cos(2*Pi*yy/period_x)+Cos(2*Pi*xx1~{i}/period_y))+hh_L_3+thick_L_3/2};
yy=period_y/2;
Point(newp) = {xx1~{i},yy,rz/4*(Cos(2*Pi*xx1~{i}/period_x)+Cos(2*Pi*yy/period_y))+hh_L_3+thick_L_3/2};
Point(newp) = {yy,xx1~{i},rz/4*(Cos(2*Pi*yy/period_x)+Cos(2*Pi*xx1~{i}/period_y))+hh_L_3+thick_L_3/2};
yy=-period_y/2;
Point(newp) = {xx2~{i},yy,rz/4*(Cos(2*Pi*xx2~{i}/period_x)+Cos(2*Pi*yy/period_y))+hh_L_3+thick_L_3/2};
Point(newp) = {yy,xx2~{i},rz/4*(Cos(2*Pi*yy/period_x)+Cos(2*Pi*xx2~{i}/period_y))+hh_L_3+thick_L_3/2};
yy=0;
Point(newp) = {xx2~{i},yy,rz/4*(Cos(2*Pi*xx2~{i}/period_x)+Cos(2*Pi*yy/period_y))+hh_L_3+thick_L_3/2};
Point(newp) = {yy,xx2~{i},rz/4*(Cos(2*Pi*yy/period_x)+Cos(2*Pi*xx2~{i}/period_y))+hh_L_3+thick_L_3/2};
yy=period_y/2;
Point(newp) = {xx2~{i},yy,rz/4*(Cos(2*Pi*xx2~{i}/period_x)+Cos(2*Pi*yy/period_y))+hh_L_3+thick_L_3/2};
Point(newp) = {yy,xx2~{i},rz/4*(Cos(2*Pi*yy/period_x)+Cos(2*Pi*xx2~{i}/period_y))+hh_L_3+thick_L_3/2};
EndFor
BooleanUnion { Surface{lss(0)}; Delete; }{ Surface{lss({1:#lss()-1})}; Delete; }
// Line(305) = {25, 57};
// Line(306) = {57, 34};
// Line(307) = {29, 167};
// Line(308) = {167, 38};
// Line(309) = {31, 177};
// Line(310) = {177, 40};
// Line(311) = {36, 78};
// Line(312) = {78, 27};
EndIf
Coherence;
// // // Physical Surface("ENDPML",770) = {69,37};
Call SetPBCs;
Physical Volume("PMLBOT" ,1) = {1};
Physical Volume("LAYER_L6_SUBS" ,2) = {2};
Physical Volume("LAYER_L5_LOW" ,3) = {3};
Physical Volume("LAYER_L4_GUI" ,4) = {4};
Physical Volume("LAYER_L3_EMB" ,5) = {10};
Physical Volume("LAYER_L2_TOP" ,6) = {6};
Physical Volume("LAYER_L1_SUPER",7) = {7};
Physical Volume("PMLTOP" ,8) = {8};
Physical Volume("SCAT" ,9) = {9};
Physical Surface("BXM" ,101 ) = masterX();
Physical Surface("BXP" ,102 ) = slaveX();
Physical Surface("BYM" ,201 ) = masterY();
Physical Surface("BYP" ,202 ) = slaveY();
Physical Surface("STOP",301 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, PML_top_hh-e,period_x/2+e, period_y/2+e, PML_top_hh+e};
Physical Surface("SBOT",302 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, hh_L_6-e,period_x/2+e, period_y/2+e, hh_L_6+e};
Physical Surface("SPMLTOP",401 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, PML_top_hh+PML_top-e,period_x/2+e, period_y/2+e, PML_top_hh+PML_top+e};
Physical Surface("SPMLBOT",402 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, PML_bot_hh-e,period_x/2+e, period_y/2+e, PML_bot_hh+e};
// Physical Volume("DEPOSIT" ,10000) = {11};
pts_PMLBOT() = PointsOf{ Physical Volume{1}; };
pts_LAYER_L6() = PointsOf{ Physical Volume{2}; };
pts_LAYER_L5() = PointsOf{ Physical Volume{3}; };
pts_LAYER_L4() = PointsOf{ Physical Volume{4}; };
pts_LAYER_L3() = PointsOf{ Physical Volume{5}; };
pts_LAYER_L2() = PointsOf{ Physical Volume{6}; };
pts_LAYER_L1() = PointsOf{ Physical Volume{7}; };
pts_PMLTOP() = PointsOf{ Physical Volume{8}; };
pts_ROD() = PointsOf{ Physical Volume{9}; };
// pts_DEPOSIT() = PointsOf{ Physical Volume{10000}; };
// For k In {0:#pts_PMLBOT()-1}
// Printf("blabal %g %f PML_lc;",pts_PMLBOT(k),PML_lc);
// EndFor
Characteristic Length{:} = PML_lc;
Characteristic Length{pts_LAYER_L1()} = L1_lc/refine_mesh_L1;
Characteristic Length{pts_LAYER_L2()} = L2_lc/refine_mesh_L2;
Characteristic Length{pts_LAYER_L4()} = L4_lc/refine_mesh_L4;
Characteristic Length{pts_LAYER_L5()} = L5_lc/refine_mesh_L5;
Characteristic Length{pts_LAYER_L6()} = L6_lc/refine_mesh_L6;
Characteristic Length{pts_LAYER_L3()} = L3_lc/refine_mesh_L3;
Characteristic Length{pts_ROD()} = scat_lc;
If (tag_geom==3)
Mesh.Algorithm = 6;
For k In {1:11}
BSpline(newl) = {pp+k:pp+12*nsin:12};
EndFor
BSpline(newl) = {pp :pp+12*(nsin-1):12};
Line(newl) = {25,pp};
Line(newl) = {34,pp};
Line(newl) = {29,pp+5};
Line(newl) = {38,pp+5};
Line(newl) = {27,pp+4};
Line(newl) = {36,pp+4};
pp=newp;
Line(newl) = {40,pp-1};
Line(newl) = {31,pp-1};
Surface(news)=
{85,86,87,96};
EndIf
Mesh.SurfaceEdges = 0;
Mesh.VolumeEdges = 0;
// Coherence;
// // // // Physical Surface("ENDPML",770) = {69,37};
// Call SetPBCs;
// Physical Volume("PMLBOT" ,1) = {1};
// Physical Volume("LAYER_L6_SUBS" ,2) = {2};
// Physical Volume("LAYER_L5_LOW" ,3) = {3};
// Physical Volume("LAYER_L4_GUI" ,4) = {4};
// Physical Volume("LAYER_L3_EMB" ,5) = {10};
// Physical Volume("LAYER_L2_TOP" ,6) = {6};
// Physical Volume("LAYER_L1_SUPER",7) = {7};
// Physical Volume("PMLTOP" ,8) = {8};
// Physical Volume("SCAT" ,9) = {9};
// Physical Surface("BXM" ,101 ) = masterX();
// Physical Surface("BXP" ,102 ) = slaveX();
// Physical Surface("BYM" ,201 ) = masterY();
// Physical Surface("BYP" ,202 ) = slaveY();
// Physical Surface("STOP",301 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, PML_top_hh-e,period_x/2+e, period_y/2+e, PML_top_hh+e};
// Physical Surface("SBOT",302 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, hh_L_6-e,period_x/2+e, period_y/2+e, hh_L_6+e};
// Physical Surface("SPMLTOP",401 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, PML_top_hh+PML_top-e,period_x/2+e, period_y/2+e, PML_top_hh+PML_top+e};
// Physical Surface("SPMLBOT",402 ) = Surface In BoundingBox{-period_x/2-e,-period_y/2-e, PML_bot_hh-e,period_x/2+e, period_y/2+e, PML_bot_hh+e};
// // Physical Volume("DEPOSIT" ,10000) = {11};
// pts_PMLBOT() = PointsOf{ Physical Volume{1}; };
// pts_LAYER_L6() = PointsOf{ Physical Volume{2}; };
// pts_LAYER_L5() = PointsOf{ Physical Volume{3}; };
// pts_LAYER_L4() = PointsOf{ Physical Volume{4}; };
// pts_LAYER_L3() = PointsOf{ Physical Volume{5}; };
// pts_LAYER_L2() = PointsOf{ Physical Volume{6}; };
// pts_LAYER_L1() = PointsOf{ Physical Volume{7}; };
// pts_PMLTOP() = PointsOf{ Physical Volume{8}; };
// pts_ROD() = PointsOf{ Physical Volume{9}; };
// // pts_DEPOSIT() = PointsOf{ Physical Volume{10000}; };
// // For k In {0:#pts_PMLBOT()-1}
// // Printf("blabal %g %f PML_lc;",pts_PMLBOT(k),PML_lc);
// // EndFor
// Characteristic Length{:} = PML_lc;
// Characteristic Length{pts_LAYER_L1()} = L1_lc/refine_mesh_L1;
// Characteristic Length{pts_LAYER_L2()} = L2_lc/refine_mesh_L2;
// Characteristic Length{pts_LAYER_L4()} = L4_lc/refine_mesh_L4;
// Characteristic Length{pts_LAYER_L5()} = L5_lc/refine_mesh_L5;
// Characteristic Length{pts_LAYER_L6()} = L6_lc/refine_mesh_L6;
// Characteristic Length{pts_LAYER_L3()} = L3_lc/refine_mesh_L3;
// Characteristic Length{pts_ROD()} = scat_lc;
// If (tag_geom==3)
// Mesh.Algorithm = 6;
// EndIf
// Mesh.SurfaceEdges = 0;
// Mesh.VolumeEdges = 0;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment