Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
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.
Creating selections based on geometric objects
Posted Apr 13, 2013, 11:18 p.m. EDT Geometry Version 4.2 0 Replies
Please login with a confirmed email address before reporting spam
The geometry creation works fine, what I need is to create selections for the internal and external domains (the innermost sphere, and the external domain that belongs to the layer) of each sphere separately.
I tried to figure this out by myself looking through the Java API documentation, without success.
Is there any way to create what I want?
Thanks in advance.
PS: Here is a simplified piece of code that I use to create the spheres:
int sphIndex = SP_START_INDEX;
int neighbors = NEIGHBORS;
for (int i = -neighbors; i <= neighbors; i++)
{
for (int j = -neighbors; j <= neighbors; j++)
{
for (int k = -neighbors; k <= neighbors; k++)
{
String sphName = "sph" + sphIndex;
model.geom("geom1").feature().create(sphName, "Sphere");
String shpAlias = sphereName(i,j,k); // just create an unique alias
model.geom("geom1").feature(sphName).name(shpAlias);
model.geom("geom1").feature(sphName)
.set("pos", new String[]{String.valueOf(i) + "*Cd", String.valueOf(j) + "*Cd", String.valueOf(k) + "*Cd"}); // Cd is just a constant
model.geom("geom1").feature(sphName).set("axis", "0 0");
model.geom("geom1").feature(sphName)
.set("layername", new String[]{"Layer 1"});
model.geom("geom1").feature(sphName).set("layer", new String[]{"Ct"}); // Ct is another constant
model.geom("geom1").feature(sphName).set("r", "Cr"); // so is Cr
String sysName = "sys" + sphIndex;
model.coordSystem().create(sysName, "geom1", "Spherical");
model.coordSystem(sysName).name(shpAlias + "System");
model.coordSystem(sysName).set("origin", new String[]{String.valueOf(i) + "*Cd",
"0" : String.valueOf(j) + "*Cd", "0" : String.valueOf(k) + "*Cd"});
sphIndex++;
}
}
}
Hello Heric Farias
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.