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.

Feasibility of iteration with parametric sweep

Please login with a confirmed email address before reporting spam

We need to run the simulation iteratively in Comsol, which means we need the result of the first simulation as an input of the second simulation. Since the number of iteration is quite high, we have used Comsol with Matlab to run the iteration automatically and it works quite well. The only problem here is the simulation is too slow. So we try to use parametric sweep now, because the geometry and mesh has to be only generated once for the entire calculation, unlike previously in Comsol with Matlab, the geometry and mesh is generated in every iteration and it is very time-consuming. But in parametric sweep it seems that the values of all the parameters have to be given before we run the simulation. What we wish is that we can set the value of the second parameter after the simulation with the first parameter. Is it possible in Comsol?

5 Replies Last Post Sep 9, 2016, 5:29 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Aug 30, 2016, 5:16 p.m. EDT
What you did in the MATLAB you can do same in JAVA methods using application builder.
What you did in the MATLAB you can do same in JAVA methods using application builder.

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Aug 30, 2016, 6:18 p.m. EDT
I agree that the doing this in JAVA might be a good way to go. I've had some luck exporting projects with parametric sweeps in java format and looping them so that the geometry and mesh are only built once and so that I can change input parameters each time.

In java, you can just copy and paste the 'run' command to duplicate it. In between each run, you should be able to redefine the input variables using previous run output variables in between each run. Doing this in a loop would probably be the cleanest in terms of coding.

I hope this helps!

-Andy
I agree that the doing this in JAVA might be a good way to go. I've had some luck exporting projects with parametric sweeps in java format and looping them so that the geometry and mesh are only built once and so that I can change input parameters each time. In java, you can just copy and paste the 'run' command to duplicate it. In between each run, you should be able to redefine the input variables using previous run output variables in between each run. Doing this in a loop would probably be the cleanest in terms of coding. I hope this helps! -Andy

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 1, 2016, 7:00 a.m. EDT
Thanks for your reply. We are trying with Java now
Thanks for your reply. We are trying with Java now

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 1, 2016, 7:05 a.m. EDT

I agree that the doing this in JAVA might be a good way to go. I've had some luck exporting projects with parametric sweeps in java format and looping them so that the geometry and mesh are only built once and so that I can change input parameters each time.

In java, you can just copy and paste the 'run' command to duplicate it. In between each run, you should be able to redefine the input variables using previous run output variables in between each run. Doing this in a loop would probably be the cleanest in terms of coding.

I hope this helps!

-Andy


Thanks for your reply! Actually I also opened a "support case" about the same question. And the support engineer doesn't think there is a difference between "comsol with matlab" and Java: "Because the MATLAB Livelink internally uses the COMSOL API, I do not think that it would make a difference to create a java program".
[QUOTE] I agree that the doing this in JAVA might be a good way to go. I've had some luck exporting projects with parametric sweeps in java format and looping them so that the geometry and mesh are only built once and so that I can change input parameters each time. In java, you can just copy and paste the 'run' command to duplicate it. In between each run, you should be able to redefine the input variables using previous run output variables in between each run. Doing this in a loop would probably be the cleanest in terms of coding. I hope this helps! -Andy [/QUOTE] Thanks for your reply! Actually I also opened a "support case" about the same question. And the support engineer doesn't think there is a difference between "comsol with matlab" and Java: "Because the MATLAB Livelink internally uses the COMSOL API, I do not think that it would make a difference to create a java program".

Please login with a confirmed email address before reporting spam

Posted: 8 years ago Sep 9, 2016, 5:29 a.m. EDT

I agree that the doing this in JAVA might be a good way to go. I've had some luck exporting projects with parametric sweeps in java format and looping them so that the geometry and mesh are only built once and so that I can change input parameters each time.

In java, you can just copy and paste the 'run' command to duplicate it. In between each run, you should be able to redefine the input variables using previous run output variables in between each run. Doing this in a loop would probably be the cleanest in terms of coding.

I hope this helps!

-Andy


We have tried it with Java. And it seems to make no difference with "comsol with matlab". Is it possible to give us an example of your model? Thank you very much in advance!
[QUOTE] I agree that the doing this in JAVA might be a good way to go. I've had some luck exporting projects with parametric sweeps in java format and looping them so that the geometry and mesh are only built once and so that I can change input parameters each time. In java, you can just copy and paste the 'run' command to duplicate it. In between each run, you should be able to redefine the input variables using previous run output variables in between each run. Doing this in a loop would probably be the cleanest in terms of coding. I hope this helps! -Andy [/QUOTE] We have tried it with Java. And it seems to make no difference with "comsol with matlab". Is it possible to give us an example of your model? Thank you very much in advance!

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.