COMSOL - M-file with unnecessary entries

  • Thread starter DJ_GoodNews
  • Start date
  • Tags
    Comsol
In summary, the user is experiencing issues with their Comsol generated m-files containing repeating entries and old values. They have tried using the reset option, but the m-file remains unstructured. The Comsol support team has confirmed that the reset option does not clear the complete history. The user is seeking advice on how others work with the script and if anyone has found a solution to this problem. They have also mentioned using text editors and scripting as a workaround.
  • #1
DJ_GoodNews
5
0
Hello everybody!

I have the problem that my comsol generated m-files contain a lot of repeating entries and old values which have been changed in the process of creating the *.mph-file.

Comsol writes in the knowledge base:
"When saving a model as an M-file it contains by default all the command history. This makes the file dense and not easy to work with. Using the reset option under the file menu makes the script clear as it only keeps the commands that correspond to the current model."

I am already doing it like this, I am using the reset model option, but still the m-file is unstructured because of unnecessary entries.

How can one get rid of these? Thanks!


DJ_Goodnews.
 
Physics news on Phys.org
  • #2
Hi,

(..."Using the reset option under the file menu makes the script clear as it only keeps the commands that correspond to the current model." ..)

I got an message from the Comsol support. They state, that the "reset option" does not clear the complete history.

Since I got no answers so far, Iwoulde be interested if anyone has the same problem?

And how people in general you work with the skript.
-Do you start from scratch? Or convert a mph. to an m-file ? ...
-Any suggestions, how to get along with the script?

Cheers,
DJ_GoodNews
 
  • #3
Yeah, the reset is what it is in terms of cleaning the m - file. Haven't come up with any other way than to mix text editors with highlighting and scripting to script m - files (i.e. generate m - files using python/perl so don't have to repeat everything every time or resort to too much copy - pasting). So essentially from scratch.
 

1. What is a COMSOL M-file?

A COMSOL M-file is a script written in the COMSOL Multiphysics software that contains a series of commands and functions used to create, manipulate, and analyze models. It is written in the MATLAB programming language and can be used to automate tasks and customize simulations in COMSOL.

2. What are unnecessary entries in a COMSOL M-file?

Unnecessary entries in a COMSOL M-file refer to lines of code that are not essential for the functioning of the model or simulation. These lines may be leftover from previous versions of the file or were added for testing purposes and are no longer needed.

3. How can I identify and remove unnecessary entries in a COMSOL M-file?

To identify unnecessary entries in a COMSOL M-file, you can use the debugging tools in the software or manually review the code. Once identified, you can simply delete these lines or comment them out to prevent them from being executed.

4. Will removing unnecessary entries affect the functionality of my model?

No, removing unnecessary entries will not affect the functionality of your model. However, it can improve the readability and efficiency of the code, making it easier to troubleshoot and modify in the future.

5. Are there any benefits to keeping unnecessary entries in a COMSOL M-file?

No, there are no benefits to keeping unnecessary entries in a COMSOL M-file. In fact, they can make the code more confusing and increase the file size, which can slow down the simulation process. It is best to remove them for a cleaner and more streamlined code.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
22K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
10K
  • Programming and Computer Science
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Special and General Relativity
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
274
  • Special and General Relativity
Replies
1
Views
2K
  • Biology and Medical
Replies
6
Views
5K
  • General Discussion
Replies
2
Views
2K
Back
Top