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

  • Context: MATLAB 
  • Thread starter Thread starter incensus
  • Start date Start date
  • Tags Tags
    Comsol Matlab
Click For Summary
SUMMARY

The discussion focuses on a problem encountered in COMSOL when using MATLAB to automate geometry generation and analysis. The user faced issues with changing subdomain IDs despite the main geometry remaining unchanged, which affected the specification of initial conditions. The solution identified involves using the FIND(x) command to read subdomain IDs from the 'st' variable, which is crucial for maintaining correct associations between geometries and their corresponding subdomains.

PREREQUISITES
  • Familiarity with COMSOL Multiphysics for geometry and analysis tasks.
  • Basic understanding of MATLAB scripting and command syntax.
  • Knowledge of geometry properties and subdomain management in COMSOL.
  • Experience with matrix operations in MATLAB, particularly with variable types and dimensions.
NEXT STEPS
  • Explore the use of the FIND(x) command in MATLAB for extracting specific data from matrices.
  • Research best practices for managing subdomain IDs in COMSOL when automating geometry changes.
  • Learn about the geomcsg function in COMSOL and its applications in geometry manipulation.
  • Investigate advanced MATLAB techniques for handling matrix dimensions and data types effectively.
USEFUL FOR

Engineers, researchers, and developers working with COMSOL and MATLAB who are involved in automating simulations and managing complex geometries.

incensus
Messages
6
Reaction score
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
Problem solved..
subdomain IDs can be read by FIND(x) command from st variable
 
What's the difference between the geometry ID and the subdomain ID?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
11K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K