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.

Who has a simple script to share to reset a model file and clear solutions and mesh ?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Hello

I'm sure you all have disk space issues with your numerous COMSOL model files;)

so certainly someone has written a simple script to open up and clear mesh and solutions + history reset, and then save the file again, and this for all files in a directory.

I would find it handy (should be part of the distribution kit I believe too, but that's up to COMSOL ;) so who accept to shear it with us others ?

Thanks for your help

--
Have fun COMSOLing
Ivar

5 Replies Last Post 29 giu 2014, 21:58 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 30 mag 2011, 05:08 GMT-4
Hi Ivar do you mean a shell script a ajava script or a matlab script?

i dont see how to make a shell script for I dont know how to run comsol command from there..[ and I dont think it is currently possible]

a java script should be possible but I dont know how to do it [ but everybody with a comsol license could use it ]

on the other hand
a matlab script using comsol api seems pretty trivial to do for what you describe. Do you have matlab?

I should say that personally I archive everything on dvd and "reset" a model only when I want to use it again.. and keep a log on the case/model.

JF

Hi Ivar do you mean a shell script a ajava script or a matlab script? i dont see how to make a shell script for I dont know how to run comsol command from there..[ and I dont think it is currently possible] a java script should be possible but I dont know how to do it [ but everybody with a comsol license could use it ] on the other hand a matlab script using comsol api seems pretty trivial to do for what you describe. Do you have matlab? I should say that personally I archive everything on dvd and "reset" a model only when I want to use it again.. and keep a log on the case/model. JF

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 30 mag 2011, 10:32 GMT-4
Hi Jean François

Well ideally a shell script, COMSOL could propose that for next release (are you listening ? :)

But any script should do.
Indeed I do have Matlab, but since I've got V4 I have hardly used it, I can do almost everything in side the GUI, so I haven't really learned myself the new LiveLink/matlab commands either, spending my time rather studying new physics and using COMSOL for my and my fellow's projects, and that it's real fun ;)

I would like to save on DVD's, but currently many of my models are >5Gb, per model, so they do not even fit on a DVD, so for me "tant pis" rerun 8-12 hours for a "safety" backup is acceptable and always possible, and then I can pack indeed 100 "empty" models on a DVD, or on our company servers, and keep my last weeks work "active" on my workstation

--
Have fun COMSOLing
Ivar
Hi Jean François Well ideally a shell script, COMSOL could propose that for next release (are you listening ? :) But any script should do. Indeed I do have Matlab, but since I've got V4 I have hardly used it, I can do almost everything in side the GUI, so I haven't really learned myself the new LiveLink/matlab commands either, spending my time rather studying new physics and using COMSOL for my and my fellow's projects, and that it's real fun ;) I would like to save on DVD's, but currently many of my models are >5Gb, per model, so they do not even fit on a DVD, so for me "tant pis" rerun 8-12 hours for a "safety" backup is acceptable and always possible, and then I can pack indeed 100 "empty" models on a DVD, or on our company servers, and keep my last weeks work "active" on my workstation -- Have fun COMSOLing Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 31 mag 2011, 09:42 GMT-4
Hi Ivar,
does that mean that comsol api could be called from the shell...????????

it could be possibly usefull for people without matlab but based on what I understand of the way comsol is written I dont see how it is possible without calling a java machine, which can be already done today then...
I think your script could be written in 5' in Matlab did you try it ..?

JF


Hi Ivar, does that mean that comsol api could be called from the shell...???????? it could be possibly usefull for people without matlab but based on what I understand of the way comsol is written I dont see how it is possible without calling a java machine, which can be already done today then... I think your script could be written in 5' in Matlab did you try it ..? JF

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 31 mag 2011, 11:07 GMT-4
Hi Jean-François

No not yet, I'm overrun by 3 projects (all with COMSOL) so my 24 CPUs are overheating my office (OK today it's colder again ;)

I was hoping that someone had it already

--
Good luck
Ivar
Hi Jean-François No not yet, I'm overrun by 3 projects (all with COMSOL) so my 24 CPUs are overheating my office (OK today it's colder again ;) I was hoping that someone had it already -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 29 giu 2014, 21:58 GMT-4
I've posted my new script for this here: evgeni.org/oldfish/Script_for_clearing_Comsol_solution_data_in_all_your_MPH_files

It doesn't clear the meshes or reset history by default. I couldn't find an easy way to clear mesh data via the API, but didn't try very hard, as those are usually just a few MB each. There is a line that can be uncommented to reset history, if you're not afraid that it might cause additional errors on some models. (When using Comsol, reset history fails for me a small percentage of the time.)
I've posted my new script for this here: http://evgeni.org/oldfish/Script_for_clearing_Comsol_solution_data_in_all_your_MPH_files It doesn't clear the meshes or reset history by default. I couldn't find an easy way to clear mesh data via the API, but didn't try very hard, as those are usually just a few MB each. There is a line that can be uncommented to reset history, if you're not afraid that it might cause additional errors on some models. (When using Comsol, reset history fails for me a small percentage of the time.)

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.