# Boundary Conditions

By Emerson Melo, Tom Chen and Xin Lei

This tutorial will guide you through the process of setting up boundary conditions to truncate the simulation domain. We will use a solar cell simulation as an example to illustrate the usage of PML, PEC, Periodic, and Bloch boundary conditions.

Share On:
Additional information: This Tutorial was updated in Aug 31, 2023

Tidy3D GUI: Tutorial 9

This tutorial will guide you through the process of setting up boundary conditions to truncate the simulation domain. We'll use the solar cell simulation we constructed in a previous tutorial. So, please start by creating a new task based on that simulation.

Then, set up a FieldMonitor at the central xz plane and adjust its wavelength to 0.75 microns. This will allow you to observe how the fields propagate throughout the solar cell. Now, go ahead, run the simulation, and take a look at the results.

As you can see, the transmittance is nearly null across the entire wavelength range, thanks to the efficient Aluminum reflector at the bottom of the solar cell structure. Most energy gets absorbed within P3HT medium, resulting in low reflectance values from 0.40 to 0.65 microns. However, beyond 0.65 microns, the reflectance values increase almost linearly, with the reflected flux reaching 50% at 0.75 microns. Now, let's delve into the boundary conditions we've applied in this simulation.

When you click on "Boundary and Symmetry", you'll notice that we've employed "Periodic" boundary conditions in both the x- and y-directions. That is because the gold nanospheres are organized in a periodic lattice, so the fields are expected to have the same periodicity at the xy plane. Using "Periodic" boundary conditions lets us simulate just one unit cell, sparing us from the need to simulate a large periodic structure.

In the z-direction, we don't have periodicity, and the field can escape to the far field or infinity. To address this, we've implemented perfectly matched layers (PML) to truncate the spatial domain. When you select the PML boundary condition, the simulation domain is enclosed by layers of a special lossy material designed to absorb incoming waves from all angles with minimal reflection. It's worth noting that in the minus z-direction, wave propagation is restricted beyond the Aluminum thin film, as we saw previously. Aluminum is sufficiently conductive in the wavelength of interest, hence, we can model it as a perfect electric conductor (PEC) to shrink the simulation domain further.

So, create a new simulation version, disable the transmittance monitor and the Aluminum medium, then modify the geometry to limit the simulation domain to the bottom of the P3HT medium. Select the "PECBoundary" condition in the minus z-direction, then run the simulation. When you check out the simulation results, you'll find a reflectance spectrum like the one obtained using PML but with about 50% less computational effort.

At the PEC boundary, the tangential component of the electric field goes to zero, as expected. It works as a highly effective reflector, so being a good approximation to the Aluminum layer. In some circumstances, you might need to enforce the tangential components of the magnetic field to zero. For such a case, you can use the "PMCBoundary" condition. Another boundary option is the "BlochBoundary" condition, which you can explore to study the device's response to oblique incident light.

So, click "Boundary and Symmetry" and opt for the "BlochBoundary" choice in the x- and y-directions. Then, select the "plane_wave" source and adjust the "angle_theta" parameter to a value other than zero. You can set the light incidence angle to a positive or negative value relative to the normal direction of the source plane. Let's set it to 30 degrees for this example. After running the simulation, proceed to the post-run results. You'll notice that the reflectance spectrum is blue-shifted by a few nanometers compared to the normal light incidence direction case. Finally, select the "Ex" field component and fine-tune the color scale for better visualization. In the total field region between the source plane and the PEC, you'll observe an interference pattern generated by the incident and scattered waves, making it challenging to discern the light incidence angle. However, between the PML at the positive z-direction and the source plane, you can clearly distinguish the wavefronts going up at -30 degrees.

To conclude, it's worth noting that in specific scenarios, such as when dispersive materials extend to the edges of the simulation domain, you might achieve better results using "Absorber" or "StablePML" boundaries, which encompass the simulation domain with additional layers. Another important tip is to make your structures invariant within the PML whenever possible.