-
-
May 26, 2023 at 8:27 pm
Mateus Corato Zanarella
SubscriberHi,
I cannot figure out how to programatically add a frequency monitor to an existing mode expansion monitor. This is particularly problematic when creating the mode expansion monitor using a construction script in model, because then we cannot manually alter the expansion monitor.
Could someone please tell me how to do it?
Thanks,
Mateus -
May 29, 2023 at 5:42 pm
Amrita Pati
Ansys EmployeeHi Mateus,
You can use the setexpansion script command to select a DFT monitor for expansion. For example, if the name of the DFT monitor is "dft", then you can use the following code:setexpansion("out","::model::dft");
Please let me know if you have any further questions.Regards,
Amrita -
May 31, 2023 at 2:11 pm
Mateus Corato Zanarella
SubscriberThank you for your answer, Amrita! That command worked.
I have another question: now once the simulation is done and I want to calculate the expansion results to then grab them using getresult, how can I do it programmatically? Manually I can do it by right-clicking, but I'd like to to it programmatically in a loop.
Thanks again for your help! -
May 31, 2023 at 11:00 pm
Amrita Pati
Ansys EmployeeHi Mateus,
You are welcome!
Generally, if you have a mode expansion monitor called "Exp" and the expansion results are "out" then you use the following code:out = getresult("Exp","expansion for out");
But if you are using loop, it could be a bit tricky since the expansion results are a dataset. I believe the simplest approach would be to save the individual results of the output (expansion results) in different arrays. And if you wish, you can combine these results to form a dataset after the loop ends.
For example, if I am only interested in T_forward and T_backward results for 2 iterations and the data is collected at a single wavelength then I can use the following code:clear;
T_forward = matrix(2);
T_backward = matrix(2);
for(i = 1:1:2){
switchtolayout;
run;out = getresult("Exp","expansion for out");
T_forward(i) = out.T_forward;
T_backward(i) = out.T_backward;
}
Here, I just have 2 reptitions and a single wavelength, which is why I initialize T_forward and T_backward as matrix(2).
I believe you can also use the sweep utility instead of the loop. The sweep utility automatically reconstructs dataset so you can easily access all the results at one place. Please let me know if you have any further questions.Regards,
Amrita
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Why am I getting “process exited without calling finalize”, and how do I fix it?
- “Import optical generation” or “delta generation rate”?
- Error: addfdtd is not a valid function or a variable name
- Error on Lumerical device
- Using a license file on a new license server
- Ansys Insight: Transmission results greater than one
- Ansys Insight: Diverging Simulations
- Finding your Ansys (or Lumerical) account number
- Is there a Lumerical script command to output the Simulation and Memory requirements?
- Ansys Insight: Why my simulation result is different from published paper or experiment?
-
5290
-
3311
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.