comsol script

4
AS-74.3177 Modelling and control of time- and space-dependent processes Quick g uide to st arting COMSOL Scipt The COMSOL Script environment allows the COMSOL user to utilize m-script like, home-made functions and scripts to configure his/her model further than what the general COMSOL GUI allows. The main principles of using COMSOL Script are as follows: - The script should follow the MATLAB m-script connotations - The script output variables’ dimensions MUST match those of corresponding COMSOL variable dimensions Starting COMSOL Script is straight forward. After having started-up the COMSOL software as usual, select Fi l e -> C O M SO L Scr i pt . This will start the COMSOL Script command prompt, typically in the default COMSOL  path, which is the COMSOL installation folder (below).

Upload: khaja-mohiddin

Post on 02-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: comsol script

7/27/2019 comsol script

http://slidepdf.com/reader/full/comsol-script 1/4

AS-74.3177 Modelling and control of time- and space-dependent processes

Quick guide to starting COMSOL Scipt

The COMSOL Script environment allows the COMSOL user to utilize m-script like,

home-made functions and scripts to configure his/her model further than what the generalCOMSOL GUI allows. The main principles of using COMSOL Script are as follows:

- The script should follow the MATLAB m-script connotations- The script output variables’ dimensions MUST match those of corresponding

COMSOL variable dimensions

Starting COMSOL Script is straight forward. After having started-up the COMSOLsoftware as usual, select Fi l e - > COMSOL Scr i pt .

This will start the COMSOL Script command prompt, typically in the default COMSOL path, which is the COMSOL installation folder (below).

Page 2: comsol script

7/27/2019 comsol script

http://slidepdf.com/reader/full/comsol-script 2/4

Next, open the model you are planning to run – or if you are creating a new model, createa new model and save it in your working directory – doing this in COMSOL, the regular

way.

In order for you to be able to use the scripts with your model, COMSOL Script needs to be run in the same path as where your model is – i.e. in the path of your working

Page 3: comsol script

7/27/2019 comsol script

http://slidepdf.com/reader/full/comsol-script 3/4

directory. Hence, change the path in the COMSOL Script command prompt with thecommand cd .

Before running the model, you can test your script in the COMSOL Script command prompt by giving the script its input arguments manually (e.g. below).

If everything seems to work O.K. you should now be able to use the COMSOL Scriptscripts as functions in your COMSOL model, e.g. as in the picture below. Althoughfurther using the functions themselves in COMSOL is rather self-explanatory, help for this is found in the COMSOL help documents. COMSOL Script functions can also beused directly as functions in various COMSOL expressions, but this is maintaining amodel with several independent direct “script-function” inputs may become tedious if e.g. changes to the function argument configuration are made.

Page 4: comsol script

7/27/2019 comsol script

http://slidepdf.com/reader/full/comsol-script 4/4