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
Posted 4 juin 2019, 06:50 UTC−4 Simulation Apps Version 5.2 4 Replies
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.
Please login with a confirmed email address before reporting spam
Hi Joao, please include context details and description of your source code. Otherwise its hard to help you. Thanks Peter
Please login with a confirmed email address before reporting spam
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
Please login with a confirmed email address before reporting spam
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
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.
Suggested Content
- BLOG Apps for Teaching Mathematical Modeling of Tubular Reactors
- KNOWLEDGE BASE Stabilization Schemes in COMSOL
- KNOWLEDGE BASE Running parametric sweeps, batch sweeps, and cluster sweeps from the command line
- KNOWLEDGE BASE Warning: New Constraint Force Nodes Detected
- FORUM Errors Compute Model in Linux