introduced a setting to fix the maximum diameter of metasurfaces. Practically this is translated into an additional constraint on the optimization algorithm that fixes to zero the degrees of freedom that are outside the designated region. Overall, the number of pixels does not change to guarantee sufficient padding for the fft. Added metaprop_fibermode_doublet_ego_sym.py that implements the ego optimization for finding the optimal distance values under mirror boundary conditions.

This commit is contained in:
Edoardo Vergerio
2026-08-22 10:32:06 +02:00
parent 367ffc3457
commit 00a1a802c3
2 changed files with 803 additions and 6 deletions
+9 -6
View File
@@ -39,7 +39,7 @@ k0 = 2 * np.pi / lda0
k1 = 2 * np.pi / lda1
k2 = 2 * np.pi / lda2
opt_max_eval = 150
opt_max_eval = 200
unit_cell_pitch = 700e-9 #equivalent to spatial sampling
@@ -84,9 +84,12 @@ phase_max = 2 * np.pi
##############################
#Source
beam_waist = 5.2e-6
beam_waist = 5.2e-6 #[um]
#output fibre
output_fiber_core_diameter = 19e-6
output_fiber_core_diameter = 19e-6 #[um]
#fibre cladding diameter
fibre_cladding_diameter = 125e-6 #[um]
max_available_diameter = 122e-6
##############################
##############################
@@ -491,12 +494,12 @@ phase_mask = phase_given_w(w_norm)
norm_phase_min = 0
norm_phase_max = 1
mask_buffer = 100e-6
mask_upper_bounds = norm_phase_max * np.where((np.abs(X.flatten()) > size_x/2 - mask_buffer) | (np.abs(Y.flatten()) > size_y/2 - mask_buffer), 0, 1)
#the upper bounds are set to 1 only within the fibre cladding diameter and zero outside
mask_upper_bounds = norm_phase_max * np.where( X.flatten()**2 + Y.flatten()**2 < (max_available_diameter/2)**2, 1, 0)
mask_upper_bounds_symm = mask_upper_bounds.reshape((Nx,Ny))[:nx+1, :ny+1].flatten()
mask_upper_bounds_symm = np.concatenate((mask_upper_bounds_symm, mask_upper_bounds_symm),axis=0)
mask_lower_bounds_symm = np.zeros_like(mask_upper_bounds_symm)
###########################
intermediate_fields = [None, None]
@@ -610,7 +613,7 @@ def cost_fun(x, grad):
Returns:
The cost function value for the input parameter field x.
'''
#since the objective function is to maximize the overlap, and the target mode is C4 symmetric,
#since the objective function is to maximize the overlap, and the target mode is mirror symmetric,
#we can let the algorithm optimize only a fourth of the phase mask and then synthetize automatically the remaining three quadrants.
#Since we have two metasurfaces, the total number of parameters the algorithm needs to optimize is S/2 (S/4 for each metasurface)
ms1_first_quadrant = x[:dof//2].reshape(nx+1, ny+1)