From f53eba2d1e2390d2d05be8bd2b14bb1ee9d35ce7 Mon Sep 17 00:00:00 2001 From: Guillaume Demesy <guillaume.demesy@fresnel.fr> Date: Wed, 10 Oct 2018 20:08:03 +0200 Subject: [PATCH] second order interp + elements --- DiffractionGratings/grating2D.pro | 48 ++++++++++++++++++-------- DiffractionGratings/grating2D_data.geo | 28 ++++++++------- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/DiffractionGratings/grating2D.pro b/DiffractionGratings/grating2D.pro index 94b0f25..3d89655 100644 --- a/DiffractionGratings/grating2D.pro +++ b/DiffractionGratings/grating2D.pro @@ -256,14 +256,13 @@ Function{ source_chi_r[] = k0^2 * (chi[]-chi_annex[]) * ur[]; source_chi_i[] = k0^2 * (chi[]-chi_annex[]) * ui[]; EndIf - - } +} Constraint { {Name Bloch; Case { { Region SurfBlochRight; Type LinkCplx ; RegionRef SurfBlochLeft; - Coefficient deph[]; Function Vector[$X-d,$Y,$Z] ; + Coefficient deph[]; Function Vector[$X-d,$Y,$Z] ; } } } @@ -283,17 +282,32 @@ Jacobian { } Integration { - { Name Int_1 ; - Case { - { Type Gauss ; - Case { - { GeoElement Point ; NumberOfPoints 1 ; } - { GeoElement Line ; NumberOfPoints 4 ; } - { GeoElement Triangle ; NumberOfPoints 12 ; } + If (Flag_o2_geom==0) + { Name Int_1 ; + Case { + { Type Gauss ; + Case { + { GeoElement Point ; NumberOfPoints 1 ; } + { GeoElement Line ; NumberOfPoints 4 ; } + { GeoElement Triangle ; NumberOfPoints 12 ; } + } } } } - } + EndIf + If (Flag_o2_geom==1) + { Name Int_1 ; + Case { + { Type Gauss ; + Case { + { GeoElement Point ; NumberOfPoints 1 ; } + { GeoElement Line2 ; NumberOfPoints 4 ; } + { GeoElement Triangle2 ; NumberOfPoints 12 ; } + } + } + } + } + EndIf } FunctionSpace { @@ -301,15 +315,19 @@ FunctionSpace { BasisFunction { { Name sn; NameOfCoef un; Function BF_Node; Support Region[Omega]; Entity NodesOf[Omega]; } { Name sn2; NameOfCoef un2; Function BF_Node_2E; Support Region[Omega]; Entity EdgesOf[Omega]; } - // { Name un3; NameOfCoef un3; Function BF_Node_2F; Support Region[Omega]; Entity FacetsOf[Omega]; } - // { Name un4; NameOfCoef un4; Function BF_Node_3E; Support Region[Omega]; Entity EdgesOf[Omega]; } - // { Name un5; NameOfCoef un5; Function BF_Node_3F; Support Region[Omega]; Entity FacetsOf[Omega]; } + If (Flag_o2_interp==1) + { Name un3; NameOfCoef un3; Function BF_Node_2F; Support Region[Omega]; Entity FacetsOf[Omega]; } + { Name un4; NameOfCoef un4; Function BF_Node_3E; Support Region[Omega]; Entity EdgesOf[Omega]; } + { Name un5; NameOfCoef un5; Function BF_Node_3F; Support Region[Omega]; Entity FacetsOf[Omega]; } + EndIf } Constraint { { NameOfCoef un; EntityType NodesOf ; NameOfConstraint Bloch; } { NameOfCoef un2; EntityType EdgesOf ; NameOfConstraint Bloch; } - // { NameOfCoef un3; EntityType EdgesOf ; NameOfConstraint Bloch; } + If (Flag_o2_interp==1) + { NameOfCoef un3; EntityType EdgesOf ; NameOfConstraint Bloch; } + EndIf } } } diff --git a/DiffractionGratings/grating2D_data.geo b/DiffractionGratings/grating2D_data.geo index e808529..ddb9bfc 100644 --- a/DiffractionGratings/grating2D_data.geo +++ b/DiffractionGratings/grating2D_data.geo @@ -42,7 +42,7 @@ DefineConstant[ h_sup = {300 , Name StrCat[pp01 , "4superstrate thickness [nm]"] , Highlight Str[colorpp01], Closed close_menu}, Flag_glue_rod_subs = { 0, Name StrCat[pp02, "0glue rod to substrate?"] , Choices {0,1} } , - Shape_rod = { 1, Name StrCat[pp02, "1rod section shape"] , Choices {0="Trapezoidal",1="Ellipsoidal"} } , + Shape_rod = { 1, Name StrCat[pp02, "1rod section shape"] , Choices {0="Trapezoidal",1="Ellipsoidal"} } , N_rods = { 3, Name StrCat[pp02, "2number of rods [-]"] , Highlight Str[colorpp02], Closed close_menu}, w_rod_bot = { 200, Name StrCat[pp02, "3bottom rod width if trapz rod OR x-diameter if elliptic rod [nm]"] , Highlight Str[colorpp02], Closed close_menu}, w_rod_top = { 500, Name StrCat[pp02, "4top rod width if trapz rod [nm]"] , Highlight Str[colorpp02], Closed close_menu}, @@ -57,8 +57,8 @@ DefineConstant[ flag_mat_2 = { 6 , Name StrCat[pp1, "0Dispersive materials/1material deposit layer"] , Choices {0="Air",1="SiO2",2="Ag (palik)",3="Al (palik)",4="Au (johnson)",5="Nb2O5",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",10="Si",11="ITO",12="Cu (palik)",13="custom 1 (lossless)",14="custom 2",15="custom 3"} }, flag_mat_3 = { 6 , Name StrCat[pp1, "0Dispersive materials/2material embedding rod"] , Choices {0="Air",1="SiO2",2="Ag (palik)",3="Al (palik)",4="Au (johnson)",5="Nb2O5",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",10="Si",11="ITO",12="Cu (palik)",13="custom 1 (lossless)",14="custom 2",15="custom 3"} }, flag_mat_4 = { 2 , Name StrCat[pp1, "0Dispersive materials/3material rods"] , Choices {0="Air",1="SiO2",2="Ag (palik)",3="Al (palik)",4="Au (johnson)",5="Nb2O5",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",10="Si",11="ITO",12="Cu (palik)",13="custom 1 (lossless)",14="custom 2",15="custom 3"} }, - flag_mat_5 = { 1 , Name StrCat[pp1, "0Dispersive materials/4material cover layer"] , Choices {0="Air",1="SiO2",2="Ag (palik)",3="Al (palik)",4="Au (johnson)",5="Nb2O5",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",10="Si",11="ITO",12="Cu (palik)",13="custom 1 (lossless)",14="custom 2",15="custom 3"} }, - flag_mat_6 = { 0 , Name StrCat[pp1, "0Dispersive materials/5material superstrate"] , Choices {0="Air",1="SiO2",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",13="custom 1 (lossless)"} }, + flag_mat_5 = { 1 , Name StrCat[pp1, "0Dispersive materials/4material cover layer"] , Choices {0="Air",1="SiO2",2="Ag (palik)",3="Al (palik)",4="Au (johnson)",5="Nb2O5",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",10="Si",11="ITO",12="Cu (palik)",13="custom 1 (lossless)",14="custom 2",15="custom 3"} }, + flag_mat_6 = { 0 , Name StrCat[pp1, "0Dispersive materials/5material superstrate"] , Choices {0="Air",1="SiO2",6="ZnSe",7="MgF2",8="TiO2",9="PMMA",13="custom 1 (lossless)"} }, epsr_custom_1_re = { 8.9 , Name StrCat[pp1 , "1Custom non-dispersive materials/0custom relative permittivity 1 (real part)"] , Highlight Str[colorpp] , Closed 1} , epsr_custom_1_im = { 0 , Name StrCat[pp1 , "1Custom non-dispersive materials/1custom relative permittivity 1 (imag part)"] , ReadOnly 1, Highlight Str[colorro] , Closed 1} , @@ -78,14 +78,16 @@ DefineConstant[ epsr_custom_anisoXY_im = { 0 , Name StrCat[pp2b , "8 epsilonr XY im"] , Highlight Str[colorpp] , Closed 1} , h_pmltop = {lambda_max, Name StrCat[pp3, "0top PML size [nm]"] , ReadOnly 1, Highlight Str[colorro]}, - h_pmlbot = {lambda_max, Name StrCat[pp3, "1bottom PML size [nm]"] , ReadOnly 1, Highlight Str[colorro]} - paramaille = {20 , Name StrCat[pp3, "2nb of mesh elements per wavelength [-]" ] , ReadOnly 0, Highlight Str[colorpp]}, - paramaille_scale_sub = {1 , Name StrCat[pp3, "3Custom mesh parameters/refine substrate [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, - paramaille_scale_layer_dep = {1 , Name StrCat[pp3, "3Custom mesh parameters/refine deposit layer [-]"] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, - paramaille_scale_rod_out = {1 , Name StrCat[pp3, "3Custom mesh parameters/refine embedding [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, - paramaille_scale_rods = {3 , Name StrCat[pp3, "3Custom mesh parameters/refine rods [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, - paramaille_scale_layer_cov = {1 , Name StrCat[pp3, "3Custom mesh parameters/refine cover layer [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, - paramaille_scale_sup = {1 , Name StrCat[pp3, "3Custom mesh parameters/refine superstrate [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, + h_pmlbot = {lambda_max, Name StrCat[pp3, "1bottom PML size [nm]"] , ReadOnly 1, Highlight Str[colorro]}, + Flag_o2_interp = {1 , Name StrCat[pp3, "2Second order interpolation?"] , Choices {0,1}}, + Flag_o2_geom = {0 , Name StrCat[pp3, "3Second order mesh?"] , Choices {0,1}, Visible 0}, + paramaille = {10 , Name StrCat[pp3, "4nb of mesh elements per wavelength [-]" ] , ReadOnly 0, Highlight Str[colorpp]}, + paramaille_scale_sub = {1 , Name StrCat[pp3, "6Custom mesh parameters/refine substrate [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, + paramaille_scale_layer_dep = {1 , Name StrCat[pp3, "6Custom mesh parameters/refine deposit layer [-]"] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, + paramaille_scale_rod_out = {1 , Name StrCat[pp3, "6Custom mesh parameters/refine embedding [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, + paramaille_scale_rods = {3 , Name StrCat[pp3, "6Custom mesh parameters/refine rods [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, + paramaille_scale_layer_cov = {1 , Name StrCat[pp3, "6Custom mesh parameters/refine cover layer [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, + paramaille_scale_sup = {1 , Name StrCat[pp3, "6Custom mesh parameters/refine superstrate [-]" ] , ReadOnly 0, Highlight Str[colorpp], Closed 1}, multiplot = {0, Choices{0,1}, Name StrCat[pp4, "Plot solution on multiple periods"]}, plotRTgraphs = {1, Choices{0,1}, Name StrCat[pp4, "Plot R and T"]} @@ -93,8 +95,8 @@ DefineConstant[ d = d * nm; dy = dy * nm; -h_sup = h_sup * nm; -h_sub = h_sub * nm; +h_sup = h_sup * nm; +h_sub = h_sub * nm; h_layer_dep = h_layer_dep * nm; h_layer_cov = h_layer_cov * nm; w_rod_bot = w_rod_bot * nm; -- GitLab