From 4eda584445f248b128d87d9b59eeda5f785f45f0 Mon Sep 17 00:00:00 2001 From: Guillaume Demesy <guillaume.demesy@fresnel.fr> Date: Tue, 20 Sep 2022 15:41:29 +0200 Subject: [PATCH] add a total field formulation for the 3D grating --- DiffractionGratings/grating2D.geo | 1 + DiffractionGratings/grating3D.pro | 108 ++++++++---------- .../grating3D_data_2Dlamellar.geo | 1 + DiffractionGratings/grating3D_data_bisin.geo | 1 + .../grating3D_data_checker.geo | 1 + DiffractionGratings/grating3D_data_conv.geo | 1 + .../grating3D_data_halfellipsoid.geo | 1 + DiffractionGratings/grating3D_data_hole.geo | 1 + .../grating3D_data_pyramid.geo | 1 + DiffractionGratings/grating3D_data_skew.geo | 2 + .../grating3D_data_solarcell.geo | 4 +- DiffractionGratings/grating3D_data_torus.geo | 1 + DiffractionGratings/grating3D_runall.sh | 25 ++-- ElectromagneticScattering/scattering.pro | 16 +-- 14 files changed, 87 insertions(+), 77 deletions(-) diff --git a/DiffractionGratings/grating2D.geo b/DiffractionGratings/grating2D.geo index e56fe9e..db87e8e 100644 --- a/DiffractionGratings/grating2D.geo +++ b/DiffractionGratings/grating2D.geo @@ -270,3 +270,4 @@ EndIf Solver.AutoMesh=1; Geometry.Points = 0; Mesh.SurfaceEdges = 0; +// Mesh.MshFileVersion = 2.0; \ No newline at end of file diff --git a/DiffractionGratings/grating3D.pro b/DiffractionGratings/grating3D.pro index d474b5e..1a4741b 100644 --- a/DiffractionGratings/grating3D.pro +++ b/DiffractionGratings/grating3D.pro @@ -200,8 +200,8 @@ Function{ H1d[Omega_super] = Hr[]; H1d[Omega_subs] = Ht[]; - source[] = (om0/cel)^2*(epsr[]-epsr_annex[])*E1[]; - + source_vol_scat[] = (om0/cel)^2*(epsr[]-epsr_annex[])*E1[]; + source_surf_tot[] = -2*I[]*om0*mu0*Vector[0,0,1] /\ Hi[]; // Bloch phase shifts skx1[] = k1x[]; // sky1[] = -k0*n1[]*Sin[theta0]*Sin[phi0+xsi]; @@ -324,7 +324,11 @@ Formulation { Equation{ Galerkin { [-1/mur[] * Dof{Curl u} , {Curl u}]; In Omega ; Jacobian JVol; Integration I1; } Galerkin { [k0^2*epsr[] * Dof{u} , {u}]; In Omega ; Jacobian JVol; Integration I1; } - Galerkin { [source[] , {u}]; In Omega_source; Jacobian JVol; Integration I1; } + If (FLAG_TOTAL==0) + Galerkin { [source_vol_scat[] , {u}]; In Omega_source; Jacobian JVol; Integration I1; } + Else + Galerkin { [source_surf_tot[] , {u}]; In SurfIntTop; Jacobian JVol; Integration I1; } + EndIf } } } @@ -346,40 +350,54 @@ PostProcessing { { Name postpro_helmholtz_vector; NameOfFormulation helmholtz_vector; NameOfSystem M; Quantity { { Name u ; Value { Local { [ {u} ]; In Omega; Jacobian JVol; } } } - { Name Etot ; Value { Local { [ {u}+E1[] ]; In Omega; Jacobian JVol; } } } - { Name Htot ; Value { Local { [ H1[]-I[]/(mur[]*mu0*om0)*{Curl u}]; In Omega; Jacobian JVol; } } } - { Name Edif ; Value { Local { [ {u}+E1d[] ]; In Omega; Jacobian JVol; } } } - { Name E1 ; Value { Local { [ E1[] ]; In Omega; Jacobian JVol; } } } - { Name Em ; Value { Local { [ E1d[] ]; In Omega; Jacobian JVol; } } } - { Name source ; Value { Local { [ source[] ]; In Omega; Jacobian JVol; } } } - { Name epsr_xx; Value { Local { [ CompXX[epsr[]] ]; In Omega; Jacobian JVol; } } } { Name Damp_pml_top; Value { Local { [Damp_pml_top[] ]; In Omega; Jacobian JVol; } } } - { Name Poy_tot; Value { Local { [ 0.5*Re[Cross[{u}+E1[] , Conj[ H1[]-I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } - { Name Poy_ref; Value { Local { [ 0.5*Re[Cross[{u}+E1d[], Conj[H1d[]-I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } - { Name Poy_inc; Value { Local { [ 0.5*Re[Cross[ Ei[] , Conj[Hi[]]] ] ]; In Omega; Jacobian JVol; } } } + { Name epsr_xx; Value { Local { [ CompXX[epsr[]] ]; In Omega; Jacobian JVol; } } } + { Name Poy_inc; Value { Local { [ 0.5*Re[Cross[ Ei[] , Conj[Hi[]]]] ]; In Omega; Jacobian JVol; } } } + { Name E1 ; Value { Local { [ E1[] ]; In Omega; Jacobian JVol; } } } { Name lambda_step ; Value { Local { [ lambda0/nm ]; In Omega ; Jacobian JVol; } } } - - For k In {2:6} - { Name Abs_L~{k} ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}+E1[]]) / (Pinc*period_x*dyc) ] ; In L~{k} ; Integration I1 ; Jacobian JVol ; } } } - EndFor - { Name Abs_scat ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}+E1[]]) / (Pinc*period_x*dyc) ] ; In Scat ; Integration I1 ; Jacobian JVol ; } } } - { Name Abs_scat2; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}+E1[]]) ] ; In Scat ; Integration I1 ; Jacobian JVol ; } } } + + If (FLAG_TOTAL==0) + { Name Etot ; Value { Local { [ {u}+E1[] ]; In Omega; Jacobian JVol; } } } + { Name Htot ; Value { Local { [ H1[]-I[]/(mur[]*mu0*om0)*{Curl u}]; In Omega; Jacobian JVol; } } } + { Name Poy_tot; Value { Local { [ 0.5*Re[Cross[{u}+E1[] , Conj[ H1[]-I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } + { Name Poy_ref; Value { Local { [ 0.5*Re[Cross[{u}+E1d[], Conj[H1d[]-I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } + For k In {2:6} + { Name Abs_L~{k} ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}+E1[]]) / (Pinc*period_x*dyc) ] ; In L~{k} ; Integration I1 ; Jacobian JVol ; } } } + EndFor + { Name Abs_scat ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}+E1[]]) / (Pinc*period_x*dyc) ] ; In Scat ; Integration I1 ; Jacobian JVol ; } } } + Else + { Name Etot ; Value { Local { [ {u} ]; In Omega; Jacobian JVol; } } } + { Name Htot ; Value { Local { [ -I[]/(mur[]*mu0*om0)*{Curl u}]; In Omega; Jacobian JVol; } } } + { Name Poy_tot; Value { Local { [ 0.5*Re[Cross[{u} , Conj[ -I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } + { Name Poy_ref; Value { Local { [ 0.5*Re[Cross[{u}-Ei[], Conj[-Hi[]-I[]/(mur[]*mu0*om0)*{Curl u}]]] ]; In Omega; Jacobian JVol; } } } + For k In {2:6} + { Name Abs_L~{k} ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}]) / (Pinc*period_x*dyc) ] ; In L~{k} ; Integration I1 ; Jacobian JVol ; } } } + EndFor + { Name Abs_scat ; Value { Integral { [ ep0*om0 * 0.5*Im[CompXX[epsr[]]]*(SquNorm[{u}]) / (Pinc*period_x*dyc) ] ; In Scat ; Integration I1 ; Jacobian JVol ; } } } + EndIf For i In {0:Nb_ordre-1} For j In {0:Nb_ordre-1} - { Name int_x_t~{i}~{j} ; Value { Integral { [ CompX[{u}+E1[] ]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntBot ; Integration I1 ; Jacobian JSur ; } } } - { Name int_y_t~{i}~{j} ; Value { Integral { [ CompY[{u}+E1[] ]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntBot ; Integration I1 ; Jacobian JSur ; } } } - { Name int_x_r~{i}~{j} ; Value { Integral { [ CompX[{u}+E1d[]]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntTop ; Integration I1 ; Jacobian JSur ; } } } - { Name int_y_r~{i}~{j} ; Value { Integral { [ CompY[{u}+E1d[]]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntTop ; Integration I1 ; Jacobian JSur ; } } } - { Name eff_t~{i}~{j} ; Value { Term{Type Global; [ - 1/(gammat~{i}~{j}[]*-k1z[]*Cos[xsi]^2) * ( (gammat~{i}~{j}[]^2+alpha~{i}~{j}[]^2)*SquNorm[$int_x_t~{i}~{j}]+ + If (FLAG_TOTAL==0) + { Name int_x_t~{i}~{j} ; Value { Integral { [ CompX[{u}+E1[] ]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntBot ; Integration I1 ; Jacobian JSur ; } } } + { Name int_y_t~{i}~{j} ; Value { Integral { [ CompY[{u}+E1[] ]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntBot ; Integration I1 ; Jacobian JSur ; } } } + { Name int_x_r~{i}~{j} ; Value { Integral { [ CompX[{u}+E1d[]]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntTop ; Integration I1 ; Jacobian JSur ; } } } + { Name int_y_r~{i}~{j} ; Value { Integral { [ CompY[{u}+E1d[]]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntTop ; Integration I1 ; Jacobian JSur ; } } } + Else + { Name int_x_t~{i}~{j} ; Value { Integral { [ CompX[{u} ]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntBot ; Integration I1 ; Jacobian JSur ; } } } + { Name int_y_t~{i}~{j} ; Value { Integral { [ CompY[{u} ]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntBot ; Integration I1 ; Jacobian JSur ; } } } + { Name int_x_r~{i}~{j} ; Value { Integral { [ CompX[{u}-Ei[]]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntTop ; Integration I1 ; Jacobian JSur ; } } } + { Name int_y_r~{i}~{j} ; Value { Integral { [ CompY[{u}-Ei[]]*expialphaxy~{i}~{j}[]/(period_x*period_y) ] ; In SurfIntTop ; Integration I1 ; Jacobian JSur ; } } } + EndIf + { Name eff_t~{i}~{j} ; Value { Term{Type Global; [ + 1/(gammat~{i}~{j}[]*-k1z[]*Cos[xsi]^2) * ((gammat~{i}~{j}[]^2+alpha~{i}~{j}[]^2)*SquNorm[$int_x_t~{i}~{j}]+ (gammat~{i}~{j}[]^2+ beta~{j}~{j}[]^2)*SquNorm[$int_y_t~{i}~{j}]+ - 2*alpha~{i}~{j}[]*beta~{i}~{j}[]*Re[$int_x_t~{i}~{j}*Conj[$int_y_t~{i}~{j}]] ) ] ; In SurfIntBot ; } } } - { Name eff_r~{i}~{j} ; Value { Term{Type Global; [ - 1/(gammar~{i}~{j}[]*-k1z[]*Cos[xsi]^2) * ((gammar~{i}~{j}[]^2+alpha~{i}~{j}[]^2)*SquNorm[$int_x_r~{i}~{j}]+ - (gammar~{i}~{j}[]^2+ beta~{i}~{j}[]^2)*SquNorm[$int_y_r~{i}~{j}]+ - 2*alpha~{i}~{j}[]*beta~{i}~{j}[]*Re[$int_x_r~{i}~{j}*Conj[$int_y_r~{i}~{j}]]) ] ; In SurfIntTop ; } } } - { Name numbering_ij~{i}~{j} ; Value { Term{Type Global; [Vector[i-Nmax,j-Nmax,0]] ; In SurfIntBot ; } } } + 2*alpha~{i}~{j}[]*beta~{i}~{j}[]*Re[$int_x_t~{i}~{j}*Conj[$int_y_t~{i}~{j}]] ) ] ; In SurfIntBot ; } } } + { Name eff_r~{i}~{j} ; Value { Term{Type Global; [ + 1/(gammar~{i}~{j}[]*-k1z[]*Cos[xsi]^2) * ((gammar~{i}~{j}[]^2+alpha~{i}~{j}[]^2)*SquNorm[$int_x_r~{i}~{j}]+ + (gammar~{i}~{j}[]^2+ beta~{i}~{j}[]^2)*SquNorm[$int_y_r~{i}~{j}]+ + 2*alpha~{i}~{j}[]*beta~{i}~{j}[]*Re[$int_x_r~{i}~{j}*Conj[$int_y_r~{i}~{j}]]) ] ; In SurfIntTop ; } } } + { Name numbering_ij~{i}~{j} ; Value { Term{Type Global; [Vector[i-Nmax,j-Nmax,0]] ; In SurfIntBot ; } } } EndFor EndFor } @@ -426,34 +444,6 @@ PostOperation { Print [ Poy_tot , OnPlane { {-period_x/2,0,hh_L_6} {period_x/2,0,hh_L_6} {-period_x/2,0,hh_L_1+thick_L_1} } {npts_interpX,npts_interpZTot} , File StrCat[myDir,"Poy_tot_cut_Y=0.pos"], Name "Poy_tot_cut_Y=0"]; Print [ Poy_tot , OnPlane { {0,-period_y/2,hh_L_6} {0,period_y/2,hh_L_6} {0,-period_y/2,hh_L_1+thick_L_1} } {npts_interpY,npts_interpZTot} , File StrCat[myDir,"Poy_tot_cut_X=0.pos"], Name "Poy_tot_cut_X=0"]; EndIf - // // // // For DEBUG - // Print [ epsr_xx , OnElementsOf Omega, File StrCat[myDir,"epsr_xx.pos"]]; - // Print [ H1x , OnElementsOf Omega, File StrCat[myDir,"H1x.pos"]]; - // Print [ Etot , OnElementsOf Omega, File StrCat[myDir,"Etot.pos"]]; - // Print [ u , OnElementsOf Omega, File StrCat[myDir,"u.pos"]]; - // Print [ E1 , OnElementsOf Omega, File StrCat[myDir,"E1.pos"]]; - // Print [ Htotx , OnElementsOf Omega, File StrCat[myDir,"Htotx.pos"]]; - // Print [ uper , OnElementsOf Omega, File StrCat[myDir,"uper.pos"]]; - // Print [ uperx , OnElementsOf Omega, File StrCat[myDir,"uperx.pos"]]; - // Print [ upery , OnElementsOf Omega, File StrCat[myDir,"upery.pos"]]; - // Print [ uperz , OnElementsOf Omega, File StrCat[myDir,"uperz.pos"]]; - - // Print [ E1perx , OnElementsOf Omega, File StrCat[myDir,"E1perx.pos"]]; - // Print [ E1pery , OnElementsOf Omega, File StrCat[myDir,"E1pery.pos"]]; - // Print [ Etotpery , OnElementsOf Omega, File StrCat[myDir,"Etotpery.pos"]]; - // Print [ Poy_tot , OnPlane { {0.5*(-period_x-dys), -dyc/2,(hh_L_6+hh_L_5)/2} - // {0.5*( period_x-dys), -dyc/2,(hh_L_6+hh_L_5)/2} - // {0.5*(-period_x+dys), dyc/2,(hh_L_6+hh_L_5)/2} } - // {npts_checkpoyX-1,npts_checkpoyY-1} , File StrCat[myDir,"Poy_tot.pos"]]; - // Print [ Poy_ref , OnPlane { {0.5*(-period_x-dys), -dyc/2, hh_L_1+thick_L_1/2} - // {0.5*( period_x-dys), -dyc/2, hh_L_1+thick_L_1/2} - // {0.5*(-period_x+dys), dyc/2, hh_L_1+thick_L_1/2} } - // {npts_checkpoyX-1,npts_checkpoyY-1} , File StrCat[myDir,"Poy_ref.pos"]]; - // Print [ Poy_inc , OnPlane { {0.5*(-period_x-dys), -dyc/2, hh_L_1+thick_L_1/2} - // {0.5*( period_x-dys), -dyc/2, hh_L_1+thick_L_1/2} - // {0.5*(-period_x+dys), dyc/2, hh_L_1+thick_L_1/2} } - // {npts_checkpoyX-1,npts_checkpoyY-1} , File StrCat[myDir,"Poy_inc.pos"]]; - //////////// END DEBUG ///////// Print [ Poy_tot , OnPlane { {0.5*(-period_x-dys), -dyc/2,(hh_L_6+hh_L_5)/2} {0.5*( period_x-dys), -dyc/2,(hh_L_6+hh_L_5)/2} diff --git a/DiffractionGratings/grating3D_data_2Dlamellar.geo b/DiffractionGratings/grating3D_data_2Dlamellar.geo index b6d19e0..27dc260 100644 --- a/DiffractionGratings/grating3D_data_2Dlamellar.geo +++ b/DiffractionGratings/grating3D_data_2Dlamellar.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {1000 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {30 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {90 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_bisin.geo b/DiffractionGratings/grating3D_data_bisin.geo index f46e343..65840b2 100644 --- a/DiffractionGratings/grating3D_data_bisin.geo +++ b/DiffractionGratings/grating3D_data_bisin.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {830 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {0 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {0 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_checker.geo b/DiffractionGratings/grating3D_data_checker.geo index f10ec4d..169cb1f 100644 --- a/DiffractionGratings/grating3D_data_checker.geo +++ b/DiffractionGratings/grating3D_data_checker.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {500 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {0 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {0 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_conv.geo b/DiffractionGratings/grating3D_data_conv.geo index 334fa7b..1e227c4 100644 --- a/DiffractionGratings/grating3D_data_conv.geo +++ b/DiffractionGratings/grating3D_data_conv.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Paramameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {495 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {40 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {36 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_halfellipsoid.geo b/DiffractionGratings/grating3D_data_halfellipsoid.geo index 0dd7f2f..9075c04 100644 --- a/DiffractionGratings/grating3D_data_halfellipsoid.geo +++ b/DiffractionGratings/grating3D_data_halfellipsoid.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {495 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {40 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {36 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_hole.geo b/DiffractionGratings/grating3D_data_hole.geo index 593f69e..d057124 100644 --- a/DiffractionGratings/grating3D_data_hole.geo +++ b/DiffractionGratings/grating3D_data_hole.geo @@ -12,6 +12,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {500 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {0 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {0 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_pyramid.geo b/DiffractionGratings/grating3D_data_pyramid.geo index 1382421..fb97f52 100644 --- a/DiffractionGratings/grating3D_data_pyramid.geo +++ b/DiffractionGratings/grating3D_data_pyramid.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {1533 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {30 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {45 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_skew.geo b/DiffractionGratings/grating3D_data_skew.geo index 064c68a..7ceee28 100644 --- a/DiffractionGratings/grating3D_data_skew.geo +++ b/DiffractionGratings/grating3D_data_skew.geo @@ -6,6 +6,8 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {495 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {40 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {36 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_solarcell.geo b/DiffractionGratings/grating3D_data_solarcell.geo index 74a0c16..7c26bb7 100644 --- a/DiffractionGratings/grating3D_data_solarcell.geo +++ b/DiffractionGratings/grating3D_data_solarcell.geo @@ -7,8 +7,8 @@ pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ - // lambda0 = {500 , Name StrCat[pp1,"/1lambda0 [nm]"]}, - lambda0 = {500 , Min 500, Max 700, Step 50, Name StrCat[pp1, "0wavelength [nm]"] , Loop 1}, + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, + lambda0 = {500 , Min 500, Max 700, Step 50, Name StrCat[pp1, "0wavelength [nm]"] , Loop 1}, thetadeg = {0 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {0 , Name StrCat[pp1,"/3phi0 [deg]"]}, psideg = {45 , Name StrCat[pp1,"/4psi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_data_torus.geo b/DiffractionGratings/grating3D_data_torus.geo index a22f891..6435345 100644 --- a/DiffractionGratings/grating3D_data_torus.geo +++ b/DiffractionGratings/grating3D_data_torus.geo @@ -6,6 +6,7 @@ pp4 = "4Layer Materials"; pp5 = "5Computational Parameters"; pp6 = "6Output"; DefineConstant[ + FLAG_TOTAL = {0 , Name StrCat[pp1,"/0Formulation"],Choices {0="scattered field",1="total field"}}, lambda0 = {1000 , Name StrCat[pp1,"/1lambda0 [nm]"]}, thetadeg = {0 , Name StrCat[pp1,"/2theta0 [deg]"]}, phideg = {0 , Name StrCat[pp1,"/3phi0 [deg]"]}, diff --git a/DiffractionGratings/grating3D_runall.sh b/DiffractionGratings/grating3D_runall.sh index 368e0a3..b296018 100644 --- a/DiffractionGratings/grating3D_runall.sh +++ b/DiffractionGratings/grating3D_runall.sh @@ -1,13 +1,22 @@ -GMSHDIR="/home/demesy/programs/gmsh-4.4.1-Linux64/bin" -for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar solarcell conv skew +rm -r res3D* + +# for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar solarcell conv skew +for t in halfellipsoid torus do - $GMSHDIR/gmsh grating3D.pro -setstring test_case $t - - mv res3D res3D_$t + for f in 0 1 + do + gmsh grating3D.pro -setstring test_case $t -setnumber FLAG_TOTAL $f - + mv res3D res3D_$t"_FLAG_TOTAL_"$f + done done -for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar solarcell conv skew +# for t in bisin checker halfellipsoid hole pyramid torus 2Dlamellar solarcell conv skew +for t in halfellipsoid torus do - $GMSHDIR/gmsh grating3D.geo -setstring test_case $t res3D_$t/*.pos & - echo "____________\n"$t - python grating3D_postplot.py res3D_$t + for f in 0 1 + do + # gmsh grating3D.geo -setstring test_case $t res3D_$t"_FLAG_TOTAL_"$f"/*.pos" & + echo "____________\ntest case "$t" - FLAG_TOT="$f + python grating3D_postplot.py res3D_$t"_FLAG_TOTAL_"$f + done done \ No newline at end of file diff --git a/ElectromagneticScattering/scattering.pro b/ElectromagneticScattering/scattering.pro index b4dde40..789f6bc 100644 --- a/ElectromagneticScattering/scattering.pro +++ b/ElectromagneticScattering/scattering.pro @@ -369,11 +369,11 @@ Resolution { } Operation { CreateDir[Str[myDir]]; - Evaluate[Python[]{"scattering_init.py"}]; + // Evaluate[Python[]{"scattering_init.py"}]; Generate[P]; Solve[P]; PostOperation[PW_postop]; - Evaluate[Python[]{"scattering_post.py"}]; + // Evaluate[Python[]{"scattering_post.py"}]; } } EndIf @@ -384,7 +384,7 @@ Resolution { } Operation { CreateDir[Str[myDir]]; - Evaluate[Python[]{"scattering_init.py"}]; + // Evaluate[Python[]{"scattering_init.py"}]; For pe In {1:p_max} Evaluate[ $isN = 0 ]; @@ -403,7 +403,7 @@ Resolution { SolveAgain[T]; PostOperation[VPWN_postop~{pe}]; EndFor - Evaluate[Python[]{"scattering_post.py"}]; + // Evaluate[Python[]{"scattering_post.py"}]; } } @@ -417,13 +417,13 @@ Resolution { } Operation { CreateDir[Str[myDir]]; - Evaluate[Python[]{"scattering_init.py"}]; + // Evaluate[Python[]{"scattering_init.py"}]; For ncomp In {0:2} Generate[M~{ncomp}]; Solve[M~{ncomp}]; PostOperation[GreenAll_postop~{ncomp}]; EndFor - Evaluate[Python[]{"scattering_post.py"}]; + // Evaluate[Python[]{"scattering_post.py"}]; } } EndIf @@ -434,11 +434,11 @@ Resolution { } Operation{ CreateDir[Str[myDir]]; - Evaluate[Python[]{"scattering_init.py"}]; + // Evaluate[Python[]{"scattering_init.py"}]; GenerateSeparate[E]; EigenSolve[E,neig,eigtarget,0,EigFilter[]]; PostOperation[QNM_postop]; - Evaluate[Python[]{"scattering_post.py"}]; + // Evaluate[Python[]{"scattering_post.py"}]; } } EndIf -- GitLab