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.

Problem using Comsol 4.0a and MATLAB

Please login with a confirmed email address before reporting spam

Hi,
I am quite new to Comsol, we are using it for an university project.
I try to simualte an electrostatic actor and in oder to be able to move different electrodes i want to use parameters. Using parameters for rectangles and for example circles works perfectly fine, but as soon as I am using points its not working anymore.

Here is a very basic example code for the creation of a point using parameters:

model = ModelUtil.create('Model');
model.param.set('a','0.2');
model.geom().create('geom1',2);
model.geom('geom1').feature.create('p1','Point');
model.geom('geom1').feature('p1').set('p',{'a','2'});
model.geom('geom1').run;
mphgeom(model,'geom1');

And here is the error message generated by MATLAB:

??? Java exception occurred:
Exception:
com.comsol.util.exceptions.FlException: Unknown variable name
Messages:
Unknown variable name
- Name: a
- Property name: p

Stack trace:
at com.comsol.util.classes.o.a(Unknown Source)
at com.comsol.util.classes.o.a(Unknown Source)
at com.comsol.util.classes.o.b(Unknown Source)
at com.comsol.util.classes.o.a(Unknown Source)
at com.comsol.nativeutil.parser.ParseUtil.e(Unknown Source)
at com.comsol.nativeutil.parser.ParseUtil.a(Unknown Source)
at com.comsol.nativeutil.parser.ParseUtil.a(Unknown Source)
at com.comsol.nativeutil.parser.ParseUtil.a(Unknown Source)
at com.comsol.nativeutil.parser.ParseUtil.a(Unknown Source)
at com.comsol.nativeutil.parser.ParseUtil.a(Unknown Source)
at com.comsol.nativeutil.properties.ai.set(Unknown Source)
at com.comsol.model.impl.PropValueImpl.set(Unknown Source)
at com.comsol.model.impl.PropFeatureImpl.c(Unknown Source)
at com.comsol.model.impl.PropFeatureImpl$p.a(Unknown Source)
at com.comsol.model.impl.PropFeatureImpl$p.execute(Unknown Source)
at com.comsol.model.clientserver.ClientManagerImpl$d.call(Unknown
Source)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Error in ==> Actor_MATLAB_Handwritten at 10
model.geom('geom1').feature('p1').set('p',{'a','2'});

Any ideas what I am doing wrong?

Thanks,
Michael

1 Reply Last Post Dec 2, 2010, 12:07 PM EST
Ivar Kjelberg CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Dec 2, 2010, 12:07 PM EST
Hi

it could be a naming conflict, most single eltter are already used by COMSOL, I always use at least 2 lettre names, or even adding a "_1" or "_mine" suffix.

Normally COMSOl tells you but often you are allowed to modify the internal variables soCOMSOl cannot always tell if it is allowed/intentional or not to use the same name

--
Good luck
Ivar
Hi it could be a naming conflict, most single eltter are already used by COMSOL, I always use at least 2 lettre names, or even adding a "_1" or "_mine" suffix. Normally COMSOl tells you but often you are allowed to modify the internal variables soCOMSOl cannot always tell if it is allowed/intentional or not to use the same name -- Good luck Ivar

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.