1 Introduction

Two dimensional photonic crystals (2D-PhCs), with engineered defects, are now recognized as a promising platform for controlling light waves in a photonic integrated circuit (PIC) at the wavelength scale (Notomi et al. 2004; Askarian and Parandin 2022, 2023). This has led to the demonstration of ultrafast and compact photonic devices for optical integrated circuits (OICs) such as switches, data converters, adders, subtractors, comparators, decoders and encoders (Alipour-Banaei et al.2021; Mehdizadeh et al. 2017a; Chen et al. 2021; Serajmohammadi et al. 2018; Askarian et al. 2019a, b; Askarian 2021a, b, cd, e, 2022a, b; Parandin 2020, 2021a, b). In OICs, all optical encoders (AOENCs) are logic circuits with \({2}^{n}\) input and \(\mathrm{n}\) output ports which can be used for producing binary codes in optical data convertors. Most recently, all optical 4 × 2 AOENC based on photonic crystal has been proposed using multimode interference procedure, self-collimation effect, beams interference method and combining nonlinear Kerr effect with ring resonator (RR) (Saranya et al.2021; Rajasekar et al. 2020; Haddadan and Soroosh 2019; Latha et al. 2022a; Arunkumar et al. 2022; Chhipa et al 2022; Fallahi et al. 2021; Khatib et al. 2020; Ouahab and Naoum 2016; Kamal et al. 2023). For example, Alipour-Banaei et al. (Alipour-Banaei et al. 2016) employed self-collimation effect inside 2D-PhC structures for realizing all optical 4 × 2 encoder. In this structure the lowest normalized optical intensity for logic “1” was 54% and the highest normalized optical intensity for logic “0” was 21%. Also, the total footprint of the design and response time was about 3795 μm2 and 1.4 ps, respectively. Seif-Dargahi (Seif-Dargahi 2018) proposed another all optical encoder based PhC platform using four RRs. In this work, they did not use nonlinear materials for designing the proposed structure. In their proposed encoder, the delay time and the ON–OFF contrast ratio (CR) for output ports were 1.8 ps and 9.2 dB, respectively. Gholamnejad and Zavvari (Gholamnejad and Zavvari 2017) proposed an all optical encoder via combining optical waveguides with nonlinear ring resonators (NRRs) inside PhC structure. In this work, the delay time and the normalized power for all output ports in ON states were 1 ps and 60%, respectively. Hamedi et al. (Hamedi et al. 2021) presented another optical encoder based on PhC structure using plasmonic effect. Their optical device with area of 627 μm2 was composed of the array of GaAs rods in the pentane background. Recently, two structures (namely ENC_1 and ENC_2) for all optical encoders have been proposed by Kamal et al. (Kamal et al. 2023). The contrast ratio, footprint and response time for ENC_1 were reported as 6.69 dB, 204.8 μm2 and 254 fs, respectively. Also, the values of these parameters for ENC_2 were reported as 12.9 dB, 160.4 μm2 and 163 fs, respectively. Hassangholizadeh-Kashtiban et al. (Hassangholizadeh-Kashtiban et al. 2015) proposed the first structure for creating a reversible all optical 4 × 2 encoder based on PhC scheme which has been made using elliptical ring resonators with nonlinear refractive index. Their encoder has very compact structure with size of 217 μm2 which make in capable to be integrated in PICs. In this paper, a new PhC structure is applied to design all optical 4 × 2 encoder constructed from Si dielectric rods with hexagonal lattice in the air background. This structure is based on optical Kerr effect and nonlinear ring resonators that can be used to improve the time delay, total footprint and contrast ratio. Most recently, ring resonators were used for designing all optical devices such as biosensor (Gharsallah et al. 2018, 2019), gate (Chhipa et al. 2021a), switch (Chhipa et al. 2021b; Radhouene et al. 2018) and temperature sensor (Radhouene et al. 2017). The operation of proposed encoder is simulated and evaluated with different numerical methods such as finite difference time domain (FDTD) and plane wave expansion (PWE). The BandSOLVE and FullWAVE tools of RSoft.Photonic.CAD.v8.2 software are applied for calculating the band structure and field view, respectively. The rest of the paper is organized as follows: Sect. 2 describes the structural design of proposed optical encoder and a FDTD simulation results are presented in Sect. 3. Finally, Sect. 4 concluded the proposed study.

2 Structural design of proposed all optical 4 × 2 encoder

The operation of the proposed optical encoder is based on optical Kerr effect and NRRs. In PhC structures, the nonlinear Kerr effect is an optical effect occurring when the highly intense light waves are interacting with nonlinear rods. Under the light field strength (\(E\)) with angular frequency (\(\omega\)), the total polarization (\(P\)) of a nonlinear optical medium up to the third order is described by (Shen 1984):

$$P={\varepsilon }_{0}{\chi }^{(1)}E+{\varepsilon }_{0}{\chi }^{(2)}EE+{\varepsilon }_{0}{\chi }^{(3)}EEE+\dots$$
(1)
$$E\left(t\right)=\mathrm{E}\left(\omega \right){e}^{-i\omega t}+c.c.$$
(2)

where \({\varepsilon }_{0}\) and \({\chi }^{(n)}\) are the the free space permittivity and \(n-th\) order component of the electric susceptibility of the medium. By replacing (2) in (1), the total polarization (\({P}^{TOT}(\omega )\)) of the material system is then described by

$${P}^{TOT}(\omega )={\varepsilon }_{0}{\chi }^{\left(1\right)}E(\omega )+2{\varepsilon }_{0}{\chi }^{(2)}E(\omega )E(0)+3{\varepsilon }_{0}{\chi }^{(3)}{|E(\omega )|}^{2}E(\omega )+\dots$$
(3)

If we consider the two first terms of the total polarization, this approximation is known as the linear electro-optic Pockels effect, which leads to an electric-field induced change in the refractive index. On the other hand, the part of the nonlinear polarization that affects the propagation of a beam of frequency \(\omega\) is just obtained by the third term of Eq. (3), which leads us to the study of the optical Kerr effect. In this case, polarization can be expressed as

$$P\left(\omega \right)\cong {\varepsilon }_{0}{\chi }^{\left(1\right)}E\left(\omega \right)+3{\varepsilon }_{0}{\chi }^{\left(3\right)}{\left|E\left(\omega \right)\right|}^{2}E\left(\omega \right)\equiv {\varepsilon }_{0}{\chi }_{eff}E\left(\omega \right)$$
(4)
$${\chi }_{eff}={\chi }^{\left(1\right)}+3{\varepsilon }_{0}{\chi }^{\left(3\right)}{\left|E\left(\omega \right)\right|}^{2}$$
(5)

where \({\chi }_{eff}\) is the effective susceptibility. Based on the formula of refractive index for non-magnetic materials, we have the complete expression for the refractive index \(n\) of a Kerr medium

$$n=\sqrt{1+{\chi }_{eff}}$$
(6)
$${n}_{0}=\sqrt{1+{\chi }^{\left(1\right)}}$$
(7)
$$n={n}_{0}+\frac{3{\chi }^{(3)}}{4{{n}_{0}}^{2}{\varepsilon }_{0}c}I={n}_{0}+{n}_{2}I$$
(8)

where \(c\) is the velocity of light in free space, \({n}_{0}\) and \({n}_{2}\) are the linear refractive index and nonlinear refractive index of nonlinear rods, and \(I\) is the intensity of the optical waves. Therefore, the change of refractive index is proportional to the intensity of light waves that pass through the proposed optical structure.

For creating the fundamental structure of the proposed design, a two-dimensional PhC consisting of 31 × 41 silicon (Si) dielectric rods in hexagonal lattice surrounded in air (\({n}_{air}=1\)) has been used. The lattice constant, radius of the fundamental rods and their refractive index are \(a=610 \; nm\), \(r=0.2a=122 \; nm\) and \({n}_{Si}=3.4\), respectively (for operating at the optical wavelength of 1550 nm). As shown in Fig. 1, in this hexagonal lattice, two nonlinear ring resonators (labeled NRR1 and NRR2) (Askarian et al. 2020, 2022a, b) with doped glasses rods (black rods) and six optical waveguides (labeled W1–W6) are created for the final structure of the proposed all optical 4 × 2 encoder. Based on Kerr effect, the change of refractive index is proportional to the intensity of light waves that pass through the proposed optical structure. In order to take advantage of the nonlinear optical Kerr effect, a set of doped glasses rods are placed inside the core of ring resonators. The optical behavior of the proposed AOENC can be controlled using nonlinear rods in each of the NRRs. The resonant wavelength of the NRRs depends on the refractive index of the core rods. Therefore, the refractive index of nonlinear rods increases by increasing the light intensity that it changes the resonant wavelength.

Fig. 1
figure 1

Schematic structure of the proposed AOENC

The band structure diagram or dispersion curve of the proposed optical encoder without defects for TM modes in the normalized frequency range of 0.28–0.45 (a/λ) (the wavelength range of 1355–2178 (nm)) is shown in Fig. 2. The suggested design consists of four input ports, namely as I0, I1, I2, and I3 and two output ports labeled as O0 and O1, respectively. For the doped glasses, the linear refractive index and nonlinear refractive index are \({n}_{0}=1.4\) and \({{n}_{2}=10}^{-14}\) m2/w, respectively (Saleh et al. 2019). The design parameters of the proposed AOENC are summarized in Table 1.

Fig. 2
figure 2

Photonic band gap representation of the proposed AOENC

Table 1 The design parameters of the proposed AOENC

To obtain the desired lattice constant of the proposed AOENC, we performed the simulation process for different lattice constant and calculated the CR in each step. After the simulation process, it was found that the highest CR value was obtained with a lattice constant of 610 nm (Fig. 3). Therefore, the optimal value of the lattice constant is 610 nm. Also, to obtain the desired radius of the fundamental rods of the proposed AOENC, we performed four steps of the simulation process for different radii and calculated the CR in each step. After the simulation process, it was found that the highest CR value was obtained with a radius of 122 nm (Fig. 4). Therefore, the optimal value of the radius is 122 nm.

Fig. 3
figure 3

The CR of the proposed AOENC corresponding to variations in the lattice constant

Fig. 4
figure 4

The CR of the proposed AOENC corresponding to variations in the radius of the rods

3 Result and discussion

After design the 2D-PhC structure of proposed AOENC, in this section we are going to simulate and investigate its optical behavior using 2D-FDTD. Accurate simulation of PhC structures requires 3D calculations, which are very time consuming and require large memory as well as very powerful computer systems. Two-dimensional analysis is widely used to convert Maxwell's 3D equations into specific forms with faster solution. As such, the 2D domain will be described in a mathematical sense, although any radiated electromagnetic field occurs in 3D physical space. The good agreement between 2 and 3D simulations convinces us to use 2D simulations for fundamental studies of 2D photonic crystal devices. It is also better to use phenomenological models for 2D simulation to cover losses due to out-of-plane scattering (Ferrini et al. 2003). In the 2D-FDTD method, the simulation is done in a two-dimensional form and mesh sizes in X and Z directions are chosen to be less than λ/16, where λ is the free space wavelength. Thus, the time steps (\(\Delta t\)) of the simulation should satisfy the inequality,

$$\Delta t\le \frac{1}{c}\sqrt{{\left(\frac{1}{\Delta x}\right)}^{2}+{\left(\frac{1}{\Delta z}\right)}^{2}}$$
(9)

where c is the velocity of light in free space, \(\Delta x\) and \(\Delta z\) are the mesh sizes in X and Z directions, respectively. The grid size and time step are about \(a/16=38 \; \mathrm{nm}\) and \(\Delta t=0.0190\) 56, respectively. To simulate the proposed AOENC, four Gaussian pulses at a wavelength of 1550 nm with TM polarization are used at the input ports. These pulses have one cycle with a width of 5 ps and we have removed the part of output pulse that has zero width. The optical switching power of nonlinear ring resonator is about 0.7 W/μm2. Therefore, for the structure to function as an optical encoder, the optical intensity of optical pulses for ports I0, I1 and I2 should be less than 0.7 W/μm2. Also, the optical intensity of optical pulse for ports I3 should be more than 0.7 W/μm2. The working states of the AOENC have four approaches as follows.

Approach 1: When input I0 is ON and other input ports are OFF (i.e., I0 = 1, I1 = 0, I2 = 0 and I3 = 0). In this case, the optical waves of I0 port inside W2 waveguide are not coupled inside the structure. Hence, there is no optical power reached at the output ports O0 and O1 as shown in Fig. 5a. As a result, O0 and O1 remain OFF (O0 = 0 and O1 = 0). Figure 5a represents the optical field propagation of proposed AOENC and its corresponding output response curve depicts in Fig. 5b.

Fig. 5
figure 5

a The optical field propagation and b its corresponding output response curve of the proposed AOENC when input I0 is ON and other input ports are OFF (i.e., I0 = 1, I1 = 0, I2 = 0 and I3 = 0)

Approach 2: When input I1 is ON and other input ports are OFF (i.e., I1 = 1, I0 = 0, I2 = 0 and I3 = 0). In this case, the value of optical intensity of I1 port near NRR1 is low (less than 0.7 W/µ\({\text{m}}^{2}\)). This ring resonator is in linear state and can transmit the light waves of I1 port inside W1 into W4 and guide them toward O0. Around 81% of optical waves achieved at the output port O0 and 1% of these waves attained at output port O1. As a result, O0 is ON, but O1 remains OFF (O0 = 1, O1 = 0). Figure 6a represents the optical field propagation of proposed AOENC and its corresponding output response curve depicts in Fig. 6b. In this case, according to output response curve, the maximum rise and fall times are obtained as 0.4 ps and 0.25 ps, respectively.

Fig. 6
figure 6

a The optical field propagation and b its corresponding output response curve of the proposed AOENC when input I1 is ON and other input ports are OFF (i.e., I1 = 1, I0 = 0, I2 = 0 and I3 = 0)

Approach 3: When input I2 is ON and other input ports are OFF (i.e., I2 = 1, I0 = 0, I1 = 0 and I3 = 0). In this case, the value of optical intensity of I2 port near NRR2 is low (less than 0.7 W/µ\({\mathrm{m}}^{2}\)). This ring resonator is in linear state and can transmit the light waves of I2 port inside W6 into W5 and guide them toward O1. Around 81% of optical waves achieved at the output port O1 and 1% of these waves attained at output port O0. As a result, O1 is ON, but O0 is OFF (O0 = 0, O1 = 1). Figure 7a represents the optical field propagation of proposed AOENC and its corresponding output response curve depicts in Fig. 7b. In this case, according to output response curve, the maximum rise and fall times are obtained as 0.4 ps and 0.25 ps, respectively.

Fig. 7
figure 7

a The optical field propagation and b its corresponding output response curve of the proposed AOENC when input I2 is ON and other input ports are OFF (i.e., I2 = 1, I0 = 0, I1 = 0 and I3 = 0)

Approach 4: When input I3 is ON and other input ports are OFF (i.e., I3 = 1, I0 = 0, I1 = 0 and I2 = 0). In this case, the light waves of I3 port are divided into two equal parts that propagate inside waveguides W4 and W5. Due to high value of optical intensity coming from port I3 (more than 0.7 W/µ\({\mathrm{m}}^{2}\)) inside W4 and W5 waveguides, the NRR1 and NRR2 are in the nonlinear state. So, based on nonlinear Kerr effect, these ring resonators cannot transmit the optical waves and these light waves can only travel toward O0 and O1 ports. Around 50% of optical waves achieved at the output port O1 and 50% of these waves attained at output port O0. As a result, O0 and O1 are ON (O0 = 1, O1 = 1). Figure 8a represents the optical field propagation of proposed AOENC and its corresponding output response curve depicts in Fig. 8b. In this case, according to output response curve, the maximum rise and fall times are obtained as 0.25 ps and 0.02 ps, respectively.

Fig. 8
figure 8

a The optical field propagation and b its corresponding output response curve of the proposed AOENC when input I3 is ON and other input ports are OFF (i.e., I3 = 1, I0 = 0, I1 = 0 and I2 = 0)

Simulation results of suggested AOENC by the FDTD method are summarized at Table 2. According to output response curves and these simulation results, the minimum contrast ratio, maximum rise, fall and delay times and bit rate for the proposed AOENC are obtained as 16.98 dB, 0.4 ps, 0.25 ps, 1.5 ps and 667 Gbit/s, respectively.

Table 2 Simulation results of suggested AOENC by the FDTD method

The optical structure characteristic parameters such as delay time, footprint and contrast ratio of the designed AOENC are compared with the reported encoders based on 2D-PhC scheme which are listed in Table 3. Based on functional parameters comparison, the suggested AOENC is smaller than previous all optical 4 × 2 encoders (Alipour-Banaei et al. 2016; Moniem 2016; Mehdizadeh et al. 2017b; Seif-Dargahi 2018; Latha et al. 2022b). From the Table 3, it is investigated that the proposed AOENC has better values of contrast ratio than the encoders of references (Hassangholizadeh-Kashtiban et al. 2015; Alipour-Banaei et al. 2016; Mehdizadeh et al. 2017b; Seif-Dargahi 2018; Parandin 2019; Mostafa et al. 2019; Latha et al. 2022b). Also, it has less time delay than the references (Moniem 2016; Seif-Dargahi 2018). According to the comparison results, it can be concluded that an improvement in the performance of the proposed AOENC has been achieved in this work.

Table 3 Functional parameters comparison of proposed AOENC with reported encoders

4 Conclusion

In this attempt, a digital all optical 4 × 2 encoder (4 × 2 AOENC) was designed by hexagonal lattice with array of silicon rods which was surrounded in air substrate. Plane wave expansion (PWE) and finite difference time domain (FDTD) were applied to analyze the proposed all optical encoder in order to obtain the photonic band gap (PBG) and electric field distribution inside structure, respectively. The suggested AOENC was providing the contrast ratio of 16.98 dB, response time of 1.5 ps and the switching speed of 667 Gbit/s for operating at the optical wavelength of 1550 nm. Due to the simple structure of the proposed AOENC and its desired results, this optical device is suitable for use in OICs.