Jeff Hiller
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                18 ago 2017, 15:33 GMT-4                            
                        
                        
                                                
                            Hello Asha,
See https://www.comsol.com/blogs/manually-work-entity-numbers-selections/
Best,
Jeff                        
                                                
                                                                                                            
                                             
                                            
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                18 ago 2017, 16:24 GMT-4                            
                        
                        
                                                    Hello Jeff,
             Thank you for valuable suggestion.
But in my geometry, i am having 200 circles and can't let the material property to get changed within each domain. So i used 'for' loop while using 'ballselection' for 200circles as below:        
 numpart=200
for j=1:numpart
          selball=(j);
ballsel1=strcat('c',selball)
          partno=j;
          ctxname=(ctx(partno));
          ctyname=(cty(partno));
model.geom('geom1').create(ballsel1, 'BallSelection');
model.geom('geom1').feature(ballsel1).set('r', [radpart]);
model.geom('geom1').feature(ballsel1).set('posx', [ctxname]);
model.geom('geom1').feature(ballsel1).set('posy', [ctyname]);
model.geom('geom1').feature(ballsel1).set('condition', 'allvertices');
end
model.geom('geom1').run;
But its producing following error:
Error using PermittThreeCirc (line 46)
Java exception occurred:
Exception:
	com.comsol.util.exceptions.FlException: An object with the given name
    already exists
	(rethrown as com.comsol.util.exceptions.FlException)
	(rethrown as com.comsol.util.exceptions.FlException)
Messages:
	An object with the given name already exists
	An object with the given name already exists
	An object with the given name already exists.
	- Tag: ballsel1
Please suggest solution.                                                
                                                
                            Hello Jeff,
             Thank you for valuable suggestion.
But in my geometry, i am having 200 circles and can't let the material property to get changed within each domain. So i used 'for' loop while using 'ballselection' for 200circles as below:        
 numpart=200
for j=1:numpart
          selball=(j);
ballsel1=strcat('c',selball)
          partno=j;
          ctxname=(ctx(partno));
          ctyname=(cty(partno));
model.geom('geom1').create(ballsel1, 'BallSelection');
model.geom('geom1').feature(ballsel1).set('r', [radpart]);
model.geom('geom1').feature(ballsel1).set('posx', [ctxname]);
model.geom('geom1').feature(ballsel1).set('posy', [ctyname]);
model.geom('geom1').feature(ballsel1).set('condition', 'allvertices');
end
model.geom('geom1').run;
But its producing following error:
Error using PermittThreeCirc (line 46)
Java exception occurred:
Exception:
	com.comsol.util.exceptions.FlException: An object with the given name
    already exists
	(rethrown as com.comsol.util.exceptions.FlException)
	(rethrown as com.comsol.util.exceptions.FlException)
Messages:
	An object with the given name already exists
	An object with the given name already exists
	An object with the given name already exists.
	- Tag: ballsel1
Please suggest solution.                        
                                                
                                                                                                            
                                             
                                            
                            
                                                                                        
                                Lars Gregersen
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                22 ago 2017, 06:54 GMT-4                            
                        
                        
                                                    Hi
I can't see why your code should result in the error message you see. Can you send your model and script to support?
What type of variation of material parameters do you wish to have for each circle? Are all the parameters different or can you group the material settings?
You can either use different materials for different selections or you can define Variables (Component->Definitions->Variables) that use different expressions in different domains.
I would use the function mphselectcoords for finding the entity numbers. It works similarly to a BallSelection, but doesn't add selections to the model. You can then use the returned entity numbers when setting up your model.
--
Lars Gregersen
Comsol Denmark                                                
                                                
                            Hi
I can't see why your code should result in the error message you see. Can you send your model and script to support?
What type of variation of material parameters do you wish to have for each circle? Are all the parameters different or can you group the material settings?
You can either use different materials for different selections or you can define Variables (Component->Definitions->Variables) that use different expressions in different domains.
I would use the function mphselectcoords for finding the entity numbers. It works similarly to a BallSelection, but doesn't add selections to the model. You can then use the returned entity numbers when setting up your model.
--
Lars Gregersen
Comsol Denmark                        
                                                
                                                                                                            
                                             
                        
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                22 ago 2017, 07:04 GMT-4                            
                        
                        
                                                    Hello Lars,
Thank you for your valuable suggestion.
This link     
www.comsol.com/blogs/manually-...ork-entity-numbers-selections/    worked for me.
Actually i was writing code like
model.geom('geom1').create(ballsel1, 'BallSelection');
Instead of
tag=model.geom('geom1').feature.uniquetag('ballsel');
model.geom('geom1').feature.create(tag, 'BallSelection');
------------------
Asha Sharma                                                
 
                                                
                            Hello Lars,
Thank you for your valuable suggestion.
This link     www.comsol.com/blogs/manually-...ork-entity-numbers-selections/    worked for me.
Actually i was writing code like
model.geom('geom1').create(ballsel1, 'BallSelection');
Instead of
tag=model.geom('geom1').feature.uniquetag('ballsel');
model.geom('geom1').feature.create(tag, 'BallSelection');
------------------
Asha Sharma