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.

[SOLVED] "Solution not initialized" when using Livelink for Matlab

Please login with a confirmed email address before reporting spam

(Documenting for others' possible benefit.)


This error happened:
============================================================
Error using com.comsol.model.impl.SolverSequenceImpl/getPVals
Java exception occurred:
Exception:
com.comsol.util.exceptions.FlException: Solution not initialized
Messages:
Solution not initialized


Stack trace:

at com.comsol.model.internal.impl.SolverSequenceImpl.ax(Unknown Source)

at com.comsol.model.internal.impl.SolverSequenceImpl.U(Unknown Source)

at com.comsol.model.internal.impl.SolverSequenceImpl.getPVals(Unknown
Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.comsol.clientserver.impl.JobImpl.run(Unknown Source)

at com.comsol.server.internal.b.a(Unknown Source)

at com.comsol.server.internal.b.a(Unknown Source)

at com.comsol.server.internal.b$a.a(Unknown Source)

at com.comsol.server.internal.b$a.a(Unknown Source)

at com.comsol.server.internal.b$a$a.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)



at com.comsol.model.clientserver.ClientManagerImpl.a(Unknown Source)

at com.comsol.model.clientserver.ClientManagerImpl.runServerJob(Unknown
Source)

at com.comsol.model.internal.impl.SolverSequenceImpl.getPVals(Unknown
Source)

at com.comsol.model.impl.SolverSequenceImpl.getPVals(Unknown Source)

Caused by: Exception:
com.comsol.util.exceptions.FlException: Solution not initialized
Messages:
Solution not initialized


at com.comsol.model.internal.impl.SolverSequenceImpl.ax(Unknown Source)

at com.comsol.model.internal.impl.SolverSequenceImpl.U(Unknown Source)

at com.comsol.model.internal.impl.SolverSequenceImpl.getPVals(Unknown
Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.comsol.clientserver.impl.JobImpl.run(Unknown Source)

at com.comsol.server.internal.b.a(Unknown Source)

at com.comsol.server.internal.b.a(Unknown Source)

at com.comsol.server.internal.b$a.a(Unknown Source)

at com.comsol.server.internal.b$a.a(Unknown Source)

at com.comsol.server.internal.b$a$a.run(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)


Error in C:\Programs\COMSOL43a\mli\mphsolinfo.p>mphsolinfo (line 102)


Error in process_hexes2D_v2/process_one (line 63)
info = mphsolinfo(m, 'dataset', 'dset2');

Error in process_hexes2D_v2 (line 30)
process_one(m);

============================================================



By saving as Java (after "Reset History") and comparing (gvimdiff) against an earlier version, I found that the following lines mentioning "sol2" appeared in the Java source:

...
model.batch("p1").feature("so1").set("psol", "sol2");
...
model.sol().create("sol2");
model.sol("sol2").study("std1");
...

Removing them, deleting the .run() calls and compiling as usual, everything worked normally.

The moral of the story is that if you create a solution, you'll be hit with a "Solution not initialized" error.

2 Replies Last Post 8 avr. 2013, 23:06 UTC−4
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 avr. 2013, 01:50 UTC−4
Hi

I would rather say, if you add a solution, tweak it, then change your physics such that the solver should be updated, you might get a solver issue, as COMSOL has recorded that you have changed it's default settings, so it does not want to clear all and reset to default.

This is a reasonable approach, up to us to say hey this implies solver changes and do them, once started, or to generate a new solver default sequence, set it active and solve again

--
Good luck
Ivar
Hi I would rather say, if you add a solution, tweak it, then change your physics such that the solver should be updated, you might get a solver issue, as COMSOL has recorded that you have changed it's default settings, so it does not want to clear all and reset to default. This is a reasonable approach, up to us to say hey this implies solver changes and do them, once started, or to generate a new solver default sequence, set it active and solve again -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 8 avr. 2013, 23:06 UTC−4
I forgot to mention that *all* I did was:

1. Run the simulation.
2. Right-click on "Solver configurations" and "Clear solutions".
3. Run the simulation.
4. Save the MPH file.
5. Try to access the results via Livelink for Matlab.

And it gives me the error as described above.

The solution I've provided allows one to take the existing simulation and make it accessible via Livelink again. It does mean that the simulation has to be re-run. But that's not as much human effort as rebuilding it from scratch — in a case such as mine, the only way to get useful access to the results is via mphinterp in Livelink (I need to sample points over a non-trivial boundary which would be prohibitively difficult to specify without a programming language).

I find that the "Model Builder" tree paradigm is very well suited for working with geometry, mesh sequences, physics interfaces, and plots, but it's not quite right for solvers and datasets. Parametric sweeps, adaptive mesh refinement steps, etc. are not always just sequences and trees, so it's no surprise that they lead to a mess when being represented using a tree.
I forgot to mention that *all* I did was: 1. Run the simulation. 2. Right-click on "Solver configurations" and "Clear solutions". 3. Run the simulation. 4. Save the MPH file. 5. Try to access the results via Livelink for Matlab. And it gives me the error as described above. The solution I've provided allows one to take the existing simulation and make it accessible via Livelink again. It does mean that the simulation has to be re-run. But that's not as much human effort as rebuilding it from scratch — in a case such as mine, the only way to get useful access to the results is via mphinterp in Livelink (I need to sample points over a non-trivial boundary which would be prohibitively difficult to specify without a programming language). I find that the "Model Builder" tree paradigm is very well suited for working with geometry, mesh sequences, physics interfaces, and plots, but it's not quite right for solvers and datasets. Parametric sweeps, adaptive mesh refinement steps, etc. are not always just sequences and trees, so it's no surprise that they lead to a mess when being represented using a tree.

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.