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.
COMSOL 4.3b Java API question
Posted Oct 21, 2013, 1:08 p.m. EDT 2 Replies
Please login with a confirmed email address before reporting spam
Hello everyone!
I’m trying to solve a parametric optimization problem in 2D. Due to intricacies the API seems to be the only way.
I use a circle that represents “air” around the model. One of boundary conditions is Zero magnetic scalar potential defined on the circle’s borders (there are 4 borders, ¼ of circumference each). In COMSOL you just select those borders and it generates code like this:
model.physics("mfnc").feature().create("zsp1", "ZeroMagneticScalarPotential", 1);
model.physics("mfnc").feature("zsp1").selection().set(new int[]{23,24,25,27});
The problem is that IDs of the borders – 23,24,25,27 – often change as result of geometry changes and perhaps (I’m not sure) even when reordering some API calls. I guess there should be a way to get the IDs through API at runtime, but cannot understand how exactly from reading APIReferenceManual. Did anyone solve such problems?
I’m trying to solve a parametric optimization problem in 2D. Due to intricacies the API seems to be the only way.
I use a circle that represents “air” around the model. One of boundary conditions is Zero magnetic scalar potential defined on the circle’s borders (there are 4 borders, ¼ of circumference each). In COMSOL you just select those borders and it generates code like this:
model.physics("mfnc").feature().create("zsp1", "ZeroMagneticScalarPotential", 1);
model.physics("mfnc").feature("zsp1").selection().set(new int[]{23,24,25,27});
The problem is that IDs of the borders – 23,24,25,27 – often change as result of geometry changes and perhaps (I’m not sure) even when reordering some API calls. I guess there should be a way to get the IDs through API at runtime, but cannot understand how exactly from reading APIReferenceManual. Did anyone solve such problems?
2 Replies Last Post Oct 22, 2013, 4:27 a.m. EDT