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.

Using model.save method to save as mph

Please login with a confirmed email address before reporting spam

I am trying to have my simulations be saved automatically under specified names as they are automatically computed in my app, but I am having trouble getting them to save under specified names.

Both of the following methods work fine:

  • model.save("filename","m")
  • model.save("filename","java")

But I am unable to save the file as a mph file:

  • model.save("filename","mph") gives error "Unknown output type," as does
  • model.save("filename.mph", "mph")

And

  • model.save("filename") won't compile with error "Unhandled exception type IOExpection," as does
  • model.save("filename.mph")

saveApplication(); doesn't allow me to specify names the name and saveApplicationAs(): requires user input.

How can I save the model files under specified names programatically?


1 Reply Last Post Jun 11, 2019, 6:00 a.m. EDT
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago Jun 11, 2019, 6:00 a.m. EDT

model.save("filename") works. Since this method throws Exceptions you must enclose this statement in a try...catch block or use the throw keyword on you own method.

-------------------
Lars Gregersen
Comsol Denmark
model.save("filename") works. Since this method throws Exceptions you must enclose this statement in a try...catch block or use the throw keyword on you own method.

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.