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.
Problem with create new solution in comsol 4.1
Posted 13.04.2011, 12:43 GMT-4 Interfacing, LiveLink for MATLAB, Studies & Solvers Version 4.1, Version 4.2, Version 4.2a, Version 4.3, Version 4.3a 5 Replies
Please login with a confirmed email address before reporting spam
I have problem with crating a solution using script in Comsol 4.1. In help I read that Comsol enabled functionality to manipulate solutions (see help model.sol). I want to creates a solution object from more than one solutions. The Comsol provides function model.sol(<tag>).createSolution(). In accordingly with the Comosol Manual a new created solutions is based on the input from the following sets (real and imaginary components) setU(int,double[]),setPNames(String[]),setPVals(double[]),setPVals(int,double[]) The solution is created at this stage. Afterwards the user input is cleared. If a created solution is used before this function is run the result is unpredictable. When I call createSolution function we get following exception:
??? Java exception occurred:
Exception:
java.lang.NullPointerException
(rethrown as com.comsol.util.exceptions.FlException)
Messages:
Stack trace:
at com.comsol.model.impl.SolverSequenceImpl.K(Unknown Source)
at com.comsol.model.impl.SolverSequenceImpl.createSolution(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$h.a(Unknown Source)
at com.comsol.server.internal.b$h.a(Unknown Source)
at com.comsol.server.internal.b$h$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 ==> przyklad at 147
model.sol('sol3').createSolution()
model.study.create('std3');
model.study('std3').feature.create('time', 'Transient');
model.study('std3').feature('time').set('tlist', {'0','0.1','0.2'});
model.sol.create('sol3');
model.sol('sol3').study('std3');
model.sol('sol3').feature.create('st1', 'StudyStep');
model.sol('sol3').feature('st1').set('study', 'std3');
model.sol('sol3').feature('st1').set('studystep', 'time');
model.sol('sol3').feature.create('v1', 'Variables');
model.sol('sol3').feature.create('t1', 'Time');
model.sol('sol3').feature('t1').set('tlist', {'0','0.1','0.2'});
%Create new solution
model.sol('sol3').setPNames(model.sol('sol2').getPNames());
model.sol('sol3').setPVals([0.0045,0.005,0.0055]);
model.sol('sol3').setPValsImag([0.0045,0.005,0.0055]);
model.sol('sol3').setU(1,model.sol('sol1').getU(1));
model.sol('sol3').setUImag(1,model.sol('sol1').getUImag(1));
model.sol('sol3').setU(2,model.sol('sol2').getU(2));
model.sol('sol3').setUImag(2,model.sol('sol2').getUImag(2));
model.sol('sol3').setU(3,model.sol('sol2').getU(3));
model.sol('sol3').setUImag(3,model.sol('sol2').getUImag(3));
model.sol('sol3').createSolution();
The sol1 and sol2 consist a results of calculation.
Can you help me!!! What should I do to create a new solution properly without any exception using script Comsol 4.1??
Hello Pawel Idziak
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.