Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Is there an easy way to create a high number of geometric components with a random roughness component?

Please login with a confirmed email address before reporting spam

Hi all,

I am using COMSOL 4.3 to simulate a 2D photonic crystal waveguide made of air holes in a dielectric (using the emw study of the RF module), and I wish to look at how roughness around the holes (as will be inevitable from the eventual fabrication) affects the confinement of light in the waveguide. I have been wondering how to create the surface roughness, and I have come up with two solutions, neither of which are desirable:

1) Using MATLAB, I can create a script which will give the x and y coordinates for an appropriate rough circle (using the random number generator in a clever way). This can be read in to COMSOL as an interpolation curve, and there we have the first rough circle. Now, we need many circles to create the crystal. The easy way out is just to copy the one random rough circle into an array, but this is in no way good enough.

2) Same as above, but with several circles. I.e., creating several txt files from the matlab script, and importing each into an interpolation curve. Ideally this should be done for each 'circle', but it might be way to time-consuming, depending on the size of the crystal. One idea here would be to create enough 'circles', and placing them in a 'random' way, while being careful not to get any periodicity in the placement (i.e., if we have circle 1,2,3, we would not like them placed 1 1 3 2 1 1 3 2, etc...).

Probably both of these solutions are just a substitute for actual knowledge of the geometry part of the simulation tool: There must be an easier way to do this? I would suspect that it is possible to create the geometry in CAD, and importing it to COMSOL: Is there an easier way to do this with CAD software? Any other ideas?

I sincerely appreciate any help on this!

Cheers,
Marius

Edit: It would be extremely nice if there was a way which would let me redefine the roughness (i.e. the expected frequency and amplitude of the error from a perfect circle) so I can find some threshold for when the light will be guided and not... Again, I will be grateful for any help on this one...

8 Replies Last Post 05.06.2017, 10:57 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 06.11.2012, 12:19 GMT-5
I don't think there is a nice way of doing it. I found this workaround.

If you use MATLAB rand function, you can use a different seed every time you call the function from COMSOL. For example, you can pass x-coordinate of a circle as a seed. So each circle will have unique shape based on its x-position.
I don't think there is a nice way of doing it. I found this workaround. If you use MATLAB rand function, you can use a different seed every time you call the function from COMSOL. For example, you can pass x-coordinate of a circle as a seed. So each circle will have unique shape based on its x-position.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 07.11.2012, 08:36 GMT-5
I just started using LiveLink for MATLAB, and this allows me to create similar geometries in batch (by for-looping the appropriate geometry command with different calls, e.g., location and size). Once the geometry is complete I will export it to the desktop version of COMSOL and do the remaining tasks from there, although all can be done using MATLAB (useful for looking at how the model responds to changes in geometry). This is a really nice tool, and I found it quite easy to get into by reading the LiveLinkForMATLABUsersGuide.pdf which is included in the documentation, and probably available online as well...

If anyone else is interested in this type of problem I will be happy to share some minimal example code once I get it up and running!

Cheers,

Marius
I just started using LiveLink for MATLAB, and this allows me to create similar geometries in batch (by for-looping the appropriate geometry command with different calls, e.g., location and size). Once the geometry is complete I will export it to the desktop version of COMSOL and do the remaining tasks from there, although all can be done using MATLAB (useful for looking at how the model responds to changes in geometry). This is a really nice tool, and I found it quite easy to get into by reading the LiveLinkForMATLABUsersGuide.pdf which is included in the documentation, and probably available online as well... If anyone else is interested in this type of problem I will be happy to share some minimal example code once I get it up and running! Cheers, Marius

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 27.03.2014, 00:48 GMT-4
Hey,Marius
I am working on modelling 2D microstructure geometry in Comsol. I want to create abuot 500 random circle. Could you give me some suggestions?

Thank you very much.

yuliang

Hey,Marius I am working on modelling 2D microstructure geometry in Comsol. I want to create abuot 500 random circle. Could you give me some suggestions? Thank you very much. yuliang

Giovanni Giansiracusa

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 31.10.2016, 07:45 GMT-4

Hey,Marius
I am working on modelling 2D microstructure geometry in Comsol. I want to create abuot 500 random circle. Could you give me some suggestions?

Thank you very much.

yuliang


Hi, did you manage to do it? I have the same problem. Let me know
[QUOTE] Hey,Marius I am working on modelling 2D microstructure geometry in Comsol. I want to create abuot 500 random circle. Could you give me some suggestions? Thank you very much. yuliang [/QUOTE] Hi, did you manage to do it? I have the same problem. Let me know

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 31.10.2016, 15:39 GMT-4
Hello Giovanni,
Marius's solution of using LiveLink for MATLAB is a good one. Alternatively, you could use an app to generate this geometry (same idea, different programming language: Java instead of MATLAB).
Best,
Jeff
Hello Giovanni, Marius's solution of using LiveLink for MATLAB is a good one. Alternatively, you could use an app to generate this geometry (same idea, different programming language: Java instead of MATLAB). Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 24.02.2017, 08:02 GMT-5
Hey Marius
I am working on similar problem and I would really appreciate if you can share your example code for generating a random distribution of pores in a geometry.

Thanks!
Hey Marius I am working on similar problem and I would really appreciate if you can share your example code for generating a random distribution of pores in a geometry. Thanks!

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 24.02.2017, 08:33 GMT-5
See Walter's and my posts in this thread:
www.comsol.com/community/forums/general/thread/123442
There is also a recorded webinar that shows how to generate a geometry algorithmically with the Application Builder:
www.comsol.com/events/webinar/Automating-Preprocessing-and-Postprocessing-with-the-Application-Builder-Webinar-23741
Best,
Jeff
See Walter's and my posts in this thread: https://www.comsol.com/community/forums/general/thread/123442 There is also a recorded webinar that shows how to generate a geometry algorithmically with the Application Builder: https://www.comsol.com/events/webinar/Automating-Preprocessing-and-Postprocessing-with-the-Application-Builder-Webinar-23741 Best, Jeff

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 05.06.2017, 10:57 GMT-4
See this new blog: www.comsol.com/blogs/how-to-generate-random-surfaces-in-comsol-multiphysics/
Best,
Jeff
See this new blog: https://www.comsol.com/blogs/how-to-generate-random-surfaces-in-comsol-multiphysics/ Best, Jeff

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.