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.

Batch syntax for parameter values

Please login with a confirmed email address before reporting spam

I am running COMSOL in batch mode and having trouble entering parameters using the command line arguments -pname and -plist. Below is an example of how I entered the command with the parameters "p_start", "dp", and "p_end" defined in the file "input.mph". The file runs but the parameter values entered on the command line are ignored.

comsol batch -inputfile input.mph -outputfile results.mph -pname p_start,dp,p_end -plist .25,.5,3

I am guessing that I'm missing something in how to structure the command, but I could not find an example in the documentation. Could someone point out what I'm doing wrong?

Thanks,
John

6 Replies Last Post 2016年12月16日 GMT-5 09:01
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 2010年9月21日 GMT-4 11:03
Hi

I have never tried that one, but perhps a "Comma-Separated list of parmeter ..." means that there is a "" required around them or a [] or {}, it's true I connot find any examples, only with one variable and one value. That could be made more explicit.

In the programmers guide pname is to be a "string", but this does not really help much

--
Good luck
Ivar
Hi I have never tried that one, but perhps a "Comma-Separated list of parmeter ..." means that there is a "" required around them or a [] or {}, it's true I connot find any examples, only with one variable and one value. That could be made more explicit. In the programmers guide pname is to be a "string", but this does not really help much -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月21日 GMT-4 11:12
Using quotes didn't work either (i.e. -pname "p_start,dp,p_end" -plist ".25,.5,3") . Thanks though.

Using quotes didn't work either (i.e. -pname "p_start,dp,p_end" -plist ".25,.5,3") . Thanks though.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年2月17日 GMT-5 07:37
Hi,

I don't know if you are still interested by the answer, but I got the comsol batch + pname / plist command to work, also with many parameters. In a nutshell, the key seems to explicitly add a 'Batch node' in the relevant study for this to work.

At first I tried what you probably did also: I just created a model, with two parameters (defined under Global Definitions -> parameters ) and some studies.

I tried running:
comsol batch -inputfile input.mph -outputfile output.mph -study std2 -pname param1,param2 -plist 0.1,0.3

to run my job with param1=0.1, and param2=0.3. It did not work, in the sense that the calculation was done using the values for the parameters given under Global definitions.

Then, I added a batch 'node' to my study2, and clicked show default solver in the 'job configuration' panel. I saved my file, and ran comsol batch in the exact same way. This time however, the value of the parameters were read from the command line, as expected.

Another important thing I observed is that you cannot have blank spaces between your parameters or in the parameter list. For example:
-pname param1,param2 -plist 0.1,0.3 will function
-pname param1, param2 -plist 0.1,0.3 will not.

I hope this helps
Charles
Hi, I don't know if you are still interested by the answer, but I got the comsol batch + pname / plist command to work, also with many parameters. In a nutshell, the key seems to explicitly add a 'Batch node' in the relevant study for this to work. At first I tried what you probably did also: I just created a model, with two parameters (defined under Global Definitions -> parameters ) and some studies. I tried running: comsol batch -inputfile input.mph -outputfile output.mph -study std2 -pname param1,param2 -plist 0.1,0.3 to run my job with param1=0.1, and param2=0.3. It did not work, in the sense that the calculation was done using the values for the parameters given under Global definitions. Then, I added a batch 'node' to my study2, and clicked show default solver in the 'job configuration' panel. I saved my file, and ran comsol batch in the exact same way. This time however, the value of the parameters were read from the command line, as expected. Another important thing I observed is that you cannot have blank spaces between your parameters or in the parameter list. For example: -pname param1,param2 -plist 0.1,0.3 will function -pname param1, param2 -plist 0.1,0.3 will not. I hope this helps Charles

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2014年9月29日 GMT-4 16:52
Hi,

I found your reply really helpful for me.

I am in trouble with the output for comsol batch. I am using comsol without GUI in a Linux system.

I want to export the temperature of the node with tag pev1 in a .txt file. What command should I type?

I am looking forward to your reply.
Hi, I found your reply really helpful for me. I am in trouble with the output for comsol batch. I am using comsol without GUI in a Linux system. I want to export the temperature of the node with tag pev1 in a .txt file. What command should I type? I am looking forward to your reply.

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2016年12月15日 GMT-5 03:39
Another subtlety for the case of a negative parameter:

-pname t_input,Duration,CYC -plist 303.15,900,-1 will function
-pname CYC,t_input,Duration -plist -1,303.15,900 will not

Seems that minus sign is misinterpreted when it follows -plist

Another subtlety for the case of a negative parameter: -pname t_input,Duration,CYC -plist 303.15,900,-1 will function -pname CYC,t_input,Duration -plist -1,303.15,900 will not Seems that minus sign is misinterpreted when it follows -plist

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2016年12月16日 GMT-5 09:01
Hi Denis,
I checked with some colleagues. They reported that this problem does not occur in the current version, 5.2a.
Best regards,
Jeff
Hi Denis, I checked with some colleagues. They reported that this problem does not occur in the current version, 5.2a. Best regards, Jeff

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.