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.

[Application Builder] Linux compatilibity problem

Please login with a confirmed email address before reporting spam

I'm currently working on an application on Windows created with the Application Builder. When running this application on Linux (or Mac), everything mostly works. However, the following line works perfectly on Windows but not Linux/Mac:

model.study("std1").create("opt", "Optimization");

The optimization module is installed on both computers. I would like to know what could be causing this problem only on Linux and Mac.


4 Replies Last Post Jun 10, 2019, 2:54 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 6, 2019, 4:15 a.m. EDT

Hi Joao, please include context details and description of your source code. Otherwise its hard to help you. Thanks Peter

Hi Joao, please include context details and description of your source code. Otherwise its hard to help you. Thanks Peter

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 6, 2019, 4:55 a.m. EDT

Joao already shows the source code that works in Windows but not in Linux. I could check in a minute that it works in Windows. I don't (yet) use Linux/Mac though. So any Linux/Mac expert can try to reproduce the issue as a first step. Any takers?

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Joao already shows the source code that works in Windows but not in Linux. I could check in a minute that it works in Windows. I don't (yet) use Linux/Mac though. So any Linux/Mac expert can try to reproduce the issue as a first step. Any takers? Cheers Edgar

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 6, 2019, 7:51 a.m. EDT
Updated: 5 years ago Jun 6, 2019, 7:52 a.m. EDT

Linux user here. I will try to reproduce the problem later today, but it definitely rings a bell : I think I remember not being able to access model.opt() from java once, so this and that could be related.

Linux user here. I will try to reproduce the problem later today, but it definitely rings a bell : I think I remember not being able to access **model.opt()** from java once, so this and that could be related.

Please login with a confirmed email address before reporting spam

Posted: 5 years ago Jun 10, 2019, 2:54 a.m. EDT
Updated: 5 years ago Jun 10, 2019, 3:29 a.m. EDT

Ok, let's take this example from LiveLink for Matlab documentation for Comsol 5.2:

model = ModelUtil.create('Model'); geom1 = model.geom.create('geom1', 3); geom1.feature.create('blk1', 'Block'); geom1.run; phys = model.physics.create('ht', 'HeatTransfer', 'geom1'); model.physics('ht') solid = phys.feature('solid1') solid.set('kmat', 1, 'userdef'); solid.set('k', '400'); hs = phys.feature.create('hs1', 'HeatSource', 3); hs.selection.set([1]); hs.set('Q', 1, '1e5'); temp = phys.feature.create('temp1', 'TemperatureBoundary', 2); temp.selection.set([3 5 6]); temp.set('T0', 1, '300[K]'); model.mesh.create('mesh1', 'geom1'); std = model.study.create('std1'); std.feature.create('stat', 'Stationary'); model.study('std1').create('opt', 'Optimization')

The very last line works under Linux as well.

Only when I removed the next to last line "std.feature.create('stat', 'Stationary');" and run it freshly, I got this error:

" Java exception occurred: Exception: com.comsol.util.exceptions.FlException: Operation cannot be created in this context (rethrown as com.comsol.util.exceptions.FlException) (rethrown as com.comsol.util.exceptions.FlException) Messages: Operation cannot be created in this context

Operation cannot be created in this context

Operation cannot be created in this context.
- Operation: Optimization

Stack trace: at com.comsol.clientapi.engine.c.handleException(Unknown Source) at com.comsol.client.interfaces.f$d.e(Unknown Source) at com.comsol.client.interfaces.f.a(Unknown Source) at com.comsol.client.interfaces.f.runAndWait(Unknown Source) at com.comsol.clientapi.engine.APIEngine.runMethod(Unknown Source) at com.comsol.clientapi.impl.StudyFeatureListClient.create(Unknown Source) Caused by: Exception: com.comsol.util.exceptions.FlException: Operation cannot be created in this context (rethrown as com.comsol.util.exceptions.FlException) Messages: Operation cannot be created in this context

Operation cannot be created in this context.
- Operation: Optimization

at com.comsol.clientapi.engine.c.handleException(Unknown Source)
at com.comsol.client.interfaces.f.a(Unknown Source)
at com.comsol.client.interfaces.f.processCommandAnswer(Unknown Source)
... 5 more

Caused by: Exception: com.comsol.util.exceptions.FlException: Operation cannot be created in this context Messages: Operation cannot be created in this context. - Operation: Optimization

at com.comsol.model.method.PropFeatureListMethod.create(Unknown Source)
at com.comsol.model.internal.impl.PropFeatureListImpl.a(Unknown Source)
at com.comsol.model.internal.impl.StudyFeatureListImpl.b(Unknown Source)
at com.comsol.model.internal.impl.StudyFeatureListImpl$1.a(Unknown Source)
at com.comsol.model.internal.impl.StudyFeatureListImpl$1.execute(Unknown Source)
at com.comsol.model.clientserver.ClientManager$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

" Hence, I suppose the problem might be that command model.study('std1').create('opt', 'Optimization') is executed prior to the code creating the stationary study.

Peter

Ok, let's take this example from LiveLink for Matlab documentation for Comsol 5.2: *model = ModelUtil.create('Model'); geom1 = model.geom.create('geom1', 3); geom1.feature.create('blk1', 'Block'); geom1.run; phys = model.physics.create('ht', 'HeatTransfer', 'geom1'); model.physics('ht') solid = phys.feature('solid1') solid.set('kmat', 1, 'userdef'); solid.set('k', '400'); hs = phys.feature.create('hs1', 'HeatSource', 3); hs.selection.set([1]); hs.set('Q', 1, '1e5'); temp = phys.feature.create('temp1', 'TemperatureBoundary', 2); temp.selection.set([3 5 6]); temp.set('T0', 1, '300[K]'); model.mesh.create('mesh1', 'geom1'); std = model.study.create('std1'); std.feature.create('stat', 'Stationary'); model.study('std1').create('opt', 'Optimization')* The very last line works under Linux as well. Only when I removed the next to last line "std.feature.create('stat', 'Stationary');" and run it freshly, I got this error: " Java exception occurred: Exception: com.comsol.util.exceptions.FlException: Operation cannot be created in this context (rethrown as com.comsol.util.exceptions.FlException) (rethrown as com.comsol.util.exceptions.FlException) Messages: Operation cannot be created in this context Operation cannot be created in this context Operation cannot be created in this context. - Operation: Optimization Stack trace: at com.comsol.clientapi.engine.c.handleException(Unknown Source) at com.comsol.client.interfaces.f$d.e(Unknown Source) at com.comsol.client.interfaces.f.a(Unknown Source) at com.comsol.client.interfaces.f.runAndWait(Unknown Source) at com.comsol.clientapi.engine.APIEngine.runMethod(Unknown Source) at com.comsol.clientapi.impl.StudyFeatureListClient.create(Unknown Source) Caused by: Exception: com.comsol.util.exceptions.FlException: Operation cannot be created in this context (rethrown as com.comsol.util.exceptions.FlException) Messages: Operation cannot be created in this context Operation cannot be created in this context. - Operation: Optimization at com.comsol.clientapi.engine.c.handleException(Unknown Source) at com.comsol.client.interfaces.f.a(Unknown Source) at com.comsol.client.interfaces.f.processCommandAnswer(Unknown Source) ... 5 more Caused by: Exception: com.comsol.util.exceptions.FlException: Operation cannot be created in this context Messages: Operation cannot be created in this context. - Operation: Optimization at com.comsol.model.method.PropFeatureListMethod.create(Unknown Source) at com.comsol.model.internal.impl.PropFeatureListImpl.a(Unknown Source) at com.comsol.model.internal.impl.StudyFeatureListImpl.b(Unknown Source) at com.comsol.model.internal.impl.StudyFeatureListImpl$1.a(Unknown Source) at com.comsol.model.internal.impl.StudyFeatureListImpl$1.execute(Unknown Source) at com.comsol.model.clientserver.ClientManager$1.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) " Hence, I suppose the problem might be that command model.study('std1').create('opt', 'Optimization') is executed prior to the code creating the stationary study. Peter

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.