COMSOL : a problem about self-varying() subdomain IDs in Comsol with Matlab

In summary, the conversation discusses the difficulties the speaker is facing while trying to create a script that generates and analyzes geometry in a for-next loop. They are experiencing issues with subdomain IDs changing even though the main geometry is only being scaled. They have attempted to use the [g,st] = geomcsg(sl) command to retrieve subdomain IDs, but have been unsuccessful in accessing the rows of the variable st. The speaker is seeking suggestions or ideas to solve this issue. The conversation also touches on the difference between geometry IDs and subdomain IDs.
  • #1
incensus
6
0
Hi all;
I'm trying to write a script that automatically generates a geometry and does the analysis in a for-next loop.
It changes specified geometry properties in a for-next step like scaling the geometry.
But I've got a problem about subdomain IDs.
Although the main geometry isn't changed in the script (as i said it isonly scaled, there is no new generated subdomains) , the subdomain idsare changing. Because of this, i cannot specify the initial conditionscorrectly.
I tried to use [g,st] = geomcsg(sl) command to getsubdomain IDs with their associated geometry IDs. So i could update thescript every time when i change the geometry properties. But i'vefailed because i couldn't reach the rows of variable st.
Although typing variable st in Matlab command window gives therelation between geometries and subdomains, i couldn't reach it fromscript. It is seen as 2xm matrix in command window but nxm matrix ofdoubles in workspace so commands like st(1,:) doesn't work.
Is there any suggestions to solve this problem or any idea why does it happen?: )
Thanks in advance..
 
Physics news on Phys.org
  • #2
Problem solved..
subdomain IDs can be read by FIND(x) command from st variable
 
  • #3
What's the difference between the geometry ID and the subdomain ID?
 

What is COMSOL?

COMSOL is a finite element analysis software used for modeling and simulating scientific and engineering problems. It allows for multiphysics simulations, meaning it can handle multiple physical phenomena simultaneously.

What is a self-varying() subdomain ID in COMSOL?

A self-varying() subdomain ID is a feature in COMSOL that allows for the automatic creation of subdomains during a simulation. This can be useful when the number or location of subdomains changes during the simulation.

How do I use self-varying() subdomain IDs in COMSOL with Matlab?

To use self-varying() subdomain IDs in COMSOL with Matlab, you must first define the subdomain IDs in the COMSOL model. Next, you can use the "mphselectsubd" function in Matlab to retrieve the subdomain IDs and then use them in your code to perform operations on the subdomains.

What are some common problems with self-varying() subdomain IDs in COMSOL with Matlab?

Some common problems with self-varying() subdomain IDs in COMSOL with Matlab include incorrect definitions of subdomain IDs, errors in retrieving the IDs in Matlab, and issues with performing operations on the subdomains. It is important to carefully define and test the subdomain IDs in order to avoid these problems.

Can I use self-varying() subdomain IDs in COMSOL with other programming languages?

Yes, self-varying() subdomain IDs can be used with other programming languages, such as Python or C++. The process will be similar to using Matlab, where the subdomain IDs must be defined in the COMSOL model and then retrieved and used in the code to perform operations on the subdomains.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
10K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Atomic and Condensed Matter
Replies
4
Views
1K
Back
Top