To add an Application Argument node (

), right-click the
Inputs node (

) and choose
Application Argument, or click the
Application Argument button (

) on the
Home toolbar. Use an
Application Argument node to define an input argument for an application. You can add several
Application Argument nodes to support multiple input arguments to the application. The order is not important because it is the name that is used to map the command-line arguments.
To specify command-line arguments when running an application, you specify the names using appargnames and the corresponding values using
appargvalues. This syntax makes it possible to mix both general built-in arguments supported for all applications and custom arguments supported for a specific application. The following example shows a command line where the renderer is set to DirectX and the custom application arguments
width and
height are also specified:
If an argument appears both in the file and explicitly using -appargvalues, the value given using
-appargvalues overrides the value given in the file. Passing the value of the
-appargsfile as a text file instead of an inline argument is recommended when the argument contains special characters such as backslash characters in a file path.
To use several files with values, use the command-line parameters -appargvarlist and
-appargfilelist. You can use them in a similar way as
-appargnames and
-appargvalues. The only difference is that
-appargfilelist is a comma-separated list of files. In this case, the file only contains the values and does not need to contain the name of the input parameter to assign the values to. This approach has the advantage that files exported on the spreadsheet format from COMSOL Multiphysics can be directly be passed as input. The following command line shows an example of this:
Command-line arguments for applications can also use a file declaration as the target. The argument value has to be a file on the client file system. For example, consider an application file_argument.mph, which has an argument
interpfile that points to a file declaration
file1. Such an application can include an interpolation function that uses a file
upload:///file1. You can then start the application using, for example, the following command-line arguments, using a text file called
simpleinterp.txt on the local file system:
In the Name field, specify a name for this node that also becomes the name of the input argument.
In addition, the Settings window includes the following sections:
This section contains a tree with a filtered view of the trees in the Application Builder window. The nodes either represent some sort of data or have children that do. For an Application Argument, the tree contains all the declarations in the application (that is, all primitive declarations such as Boolean, integer, double, and string scalar and array data types). The value for a command-line argument with the given name will end up in the declaration that you select. The input data will also be automatically converted to the data type of the declaration. An error will occur if the conversion fails, such as if the user of the application specifies 3.7 as the value for a command-line argument where an integer is expected. When you select a node that represents data, the
Use as Source toolbar button below the tree becomes enabled. You can click it or, alternatively, press Enter, double-click, or right-click the node and choose
Use as Source to add it as the selected source. You can also click the
Create New Declaration and Use It as Source button (

) in the
Source section header to create a new variable declaration for the application argument and use it as the source. A
Create and Use Declaration dialog box opens, so that you can select the data type of the source (if applicable) and its name and initial value. The name cannot be in conflict with any existing variable declaration. Click the
Edit Node toolbar button (

) below the tree to move to the corresponding node.