Comments (5)
A tangential k-vector is determined by the angle of incidence and other k-vectors are defined according to the diffraction order. Afterwards, the eigenmode is calculated according to these k-vectors. Since the add_layer
function perform the eigenmode calculation, the angle must be set before and the set_incident_angle function
must come first. Depending on the wavelength and angle, the eigenvalue and eigenmode are different. Also, due to the GPU memory issue, we couldn't verify the computation time reduction according to vectorization, so we have to create individual simulations for now. So, for now, I think you should use the following code for sweeping over incident angle.
for inc_ind in range(len(inc_ang)):
inc_now = inc_ang[inc_ind]
sim = torcwa.rcwa(freq=1/lamb0_now,order=order,L=L,dtype=sim_dtype,device=device)
sim.add_input_layer(eps=substrate_eps)
sim.set_incident_angle(inc_ang=inc_now,azi_ang=azi_ang)
layer0_eps = layer0_geometry*pc_eps + (1.-layer0_geometry)
sim.add_layer(thickness=layer0_thickness,eps=layer0_eps)
sim.solve_global_smatrix()
Thank you.
from torcwa.
-
First, if you use the
sim.add_layer(...)
function in the example, the eigenmodes for each layer are calculated. (If you only need the eigenmode of individual layers, you do not need to usesim.solve_global_matrix
, etc.) Each time you usesim.add_layer(...)
, the number of the layer is given from 0. And for a specificlayer_num
, eigenvalues and eigenvectors can be obtained withsim.kz_norm[ layer_num]
andsim.E_eigvec[layer_num]
, respectively. kz_norm is normalized to k0 and becomes the effective mode index. However, they are not sorted in ascending or descending order.
I haven't done this task myself, but I think you can get the eigenvalue map for a certain mode by doing the following. With sweeping according to the wavelength, sorting in descending or ascending order for one of the real part, imaginary part, or absolute value of kz_norm. Then, the eigenvalue for the i-th mode can be obtained among the sorted values.
However, it does not seem to guarantee that the i-th mode sorted at one wavelength is the same as the [i]th mode sorted at another wavelength. One thing to note is that the eigenvalue is set to have positive imaginary part to ensure decay during propagation. Because of this, if the imaginary part of some eigenvalue is 0 exactly but has a very small value numerically, it is possible to have -2.30 + j0.000001 as an example, so there are cases where the real part becomes negative to make it positive imaginary part. Because of this, it is necessary to find an appropriate sorting method. -
After using
sim.solve_global_matrix()
, you can calculate the coupling coefficient usingsim.C[fb][layer_num][m,n]
. If fb=0, it is the coefficient for forward incidence, and backward incidence when fb is 1. Using the previous code, the coupling coefficient of the [n]-th E-field Fourier component for the [m]-th positive mode in a specificlayer_num
is calculated. For the coupling coefficient for the negative mode, use [m+2G] instead of [m], where G is the total number of Fourier orders. However, just like first question, proper sorting is required to ensure that the specific [m]-th mode is the same mode. Using this method, you will be able to track changes in the coupling coefficient.
Thank you.
from torcwa.
Thank you very much for the detailed answer. I am testing several sorting methods from the simplest like EigenShuffle to a the more elaborated (see for example arxiv.org/abs/2006.14254).
from torcwa.
Hello,
I get the following error when I try to compute sim.add_layer(...)
before setting the incident angle for the simulation
AttributeError: 'rcwa' object has no attribute 'Kx_norm'
Should it be possible to running sweeps over the incident angle only after calculating the eigenmodes of all layers including the input layer? Assuming the wavelength is kept constant.
sim = torcwa.rcwa(freq=1/lamb0_now,order=order,L=L,dtype=sim_dtype,device=device)
sim.add_input_layer(eps=substrate_eps)
layer0_eps = layer0_geometry*pc_eps + (1.-layer0_geometry)
sim.add_layer(thickness=layer0_thickness,eps=layer0_eps)
for inc_ind in range(len(inc_ang)):
inc_now=inc_ang[inc_ind]
sim.set_incident_angle(inc_ang=inc_now,azi_ang=azi_ang)
sim.solve_global_smatrix()
would you please advise on a way to reduce the computation time when running multiple sweeps such as the incident waves angle and wavelength?
thank you
from torcwa.
To further clarify my question on a similar topic, please check out the following
https://optics.ansys.com/hc/en-us/articles/7320004780307
from torcwa.
Related Issues (20)
- Multi-Objective FoM Parallelization HOT 1
- RuntimeError: Function 'EigBackward' returned nan values in its 0th output. Unstable P/Q Matrices? HOT 2
- Materials module not installed HOT 4
- Increased GPU Memory Usage compared to reference paper HOT 2
- CUDA out of memory in optimization problems HOT 2
- multiple patterns within a single layer HOT 2
- Fourier order do't converge for metals HOT 2
- Extract the electric field and angle by orders HOT 7
- Normalization of intensity integrated on all orders HOT 4
- convergence of structured geom to homogenous layer when lattice size equals to the geom size HOT 2
- _LinAlgError for a specific lattice size (px=3000) HOT 2
- Absorption layer-by-layer and incoherent layers
- Batch simulation with varying layer thickness
- Topological optimization for unit cell smaller than source wavelength HOT 2
- NaN occurs when lattice constant equals to wavelength at normal incidence
- Focusing of field HOT 4
- PEC/Metallic Structures HOT 4
- Definition of "order" HOT 1
- GPU memory consumption HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torcwa.