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.

Parametric Sweep and exporting data

Please login with a confirmed email address before reporting spam

Hi, I'm doing a parametric sweep in a model with a geometry that depends on the same parameter wich I sweep. I run my parametric sweep and works well (the solver remeshes the model for each value of my parameter, etc), the problem is that I need to export data corresponding to each value of this parameter and I can only select one value at a time, so once the simulation is finished I have to export data value per value which is... greatly counterproductive.

I've seen that defining an "internal" parametric sweep under "Stationary Solver" gives me the option of exporting all values in a file. The problem is that this method only works for constant geometries (the solver doesn't reconstruct and remesh the model), which is not my case.

Any help will be highly appreciated.

2 Replies Last Post Oct 27, 2012, 4:30 a.m. EDT
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 Oct 26, 2012, 7:24 a.m. EDT
Hi

What follows is my personal understanding of how COMSOL operates, only COMSOL developpers can really tell what is going on, as even in verbose mode, the solver log does not tell us where the initial conditions are taken from, for each step, nor many other usefull details to debug complex solver sequences, unfortunately, Let's hope it might change one day ...

===========
COMSOL behaves differently depending on how you define a parametric sweep. Your external Parametric Sweep node tells COMSOL to loop all around the model, (I believe not rereading Parameters, but all the rest Yes) in this way your parameter sweep can update the geometry, get the mesher to remesh, and then Solve the model. One caveat: when solving in this way, the solver takes the initial values from the initial value node, or the one defined in the solver sequence dependent variables solved for / NOT solved for.

The other way is to define a "Solver Continuation" sweep (under the Solver node tab), here you do not add an external Parametric Sweep node, but you tell the solver to loop around (and only the solver node, not the geometry, nor the mesh). This means ALSO that, once one parameter value have been solved, the solver uses the latest results as initial values for the next iteration step, hence mostly greatly improves the convergence time and the precision of the results.

Changes in 4.3a. I have noticed a few weeks ago with 4.3a, you have a new tab in the Parametric Solver Node, that says Study extensions "automartic" or "off", if "off" what I said above is and remain true, in Automatic mode COMSOL checks if the sweep can be attributed to a "solver continuation sweep" or if it has too lopp around the geometry too. This might give you some unexpecetd results. And how exactly COMSOL takes the initial parameters is not fully clear for me today, I still need to test out all combinations, as this is not (yet?) covered in the doc

You can get some details, by asking for a "detailed" log, and monitoring the presence or not of "Scales for dependent variables", as well of the presence, or not, of Parametric, Store Solution N" sub nodes.

Hope this clarifies the situation for the difference in solver cases

Now for the exporting, you need to refer to the correct "Data set Solution N" node, as some are just the last running single parameter data, other have all parameter data stored internally, so when you right click the Data Set Solution N to "Add data to export" get the correct one. And therein you can only select one parameter at the time.

Which then means that probably you can not link them automatically if you have 100 parameter combinations. Perhaps you relly need Matlab for that

So I suggest you that you send a "suggestion" to "support" that they find a way to dump more than one parameters into a file, for next release ...
Cannt do better, but other have perhaps some tricks ?

--
Good luck
Ivar
Hi What follows is my personal understanding of how COMSOL operates, only COMSOL developpers can really tell what is going on, as even in verbose mode, the solver log does not tell us where the initial conditions are taken from, for each step, nor many other usefull details to debug complex solver sequences, unfortunately, Let's hope it might change one day ... =========== COMSOL behaves differently depending on how you define a parametric sweep. Your external Parametric Sweep node tells COMSOL to loop all around the model, (I believe not rereading Parameters, but all the rest Yes) in this way your parameter sweep can update the geometry, get the mesher to remesh, and then Solve the model. One caveat: when solving in this way, the solver takes the initial values from the initial value node, or the one defined in the solver sequence dependent variables solved for / NOT solved for. The other way is to define a "Solver Continuation" sweep (under the Solver node tab), here you do not add an external Parametric Sweep node, but you tell the solver to loop around (and only the solver node, not the geometry, nor the mesh). This means ALSO that, once one parameter value have been solved, the solver uses the latest results as initial values for the next iteration step, hence mostly greatly improves the convergence time and the precision of the results. Changes in 4.3a. I have noticed a few weeks ago with 4.3a, you have a new tab in the Parametric Solver Node, that says Study extensions "automartic" or "off", if "off" what I said above is and remain true, in Automatic mode COMSOL checks if the sweep can be attributed to a "solver continuation sweep" or if it has too lopp around the geometry too. This might give you some unexpecetd results. And how exactly COMSOL takes the initial parameters is not fully clear for me today, I still need to test out all combinations, as this is not (yet?) covered in the doc You can get some details, by asking for a "detailed" log, and monitoring the presence or not of "Scales for dependent variables", as well of the presence, or not, of Parametric, Store Solution N" sub nodes. Hope this clarifies the situation for the difference in solver cases Now for the exporting, you need to refer to the correct "Data set Solution N" node, as some are just the last running single parameter data, other have all parameter data stored internally, so when you right click the Data Set Solution N to "Add data to export" get the correct one. And therein you can only select one parameter at the time. Which then means that probably you can not link them automatically if you have 100 parameter combinations. Perhaps you relly need Matlab for that So I suggest you that you send a "suggestion" to "support" that they find a way to dump more than one parameters into a file, for next release ... Cannt do better, but other have perhaps some tricks ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Oct 27, 2012, 4:30 a.m. EDT
Thanks for the solver clarification, Ivar.. So it seems that my only option left for the moment is trying to do some script on MATLAB... I will look into it.
Thanks for the solver clarification, Ivar.. So it seems that my only option left for the moment is trying to do some script on MATLAB... I will look into it.

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.