XFlow Adapter Command-Line Arguments

You can use command-line arguments to customize how the XFlow adapter runs and and saves the XFlow project.

You can enter command-line arguments from the Execute tab of the XFlow adapter editor.

This page discusses:

See Also
About the XFlow Adapter
Executing an XFlow Simulation

Running a Custom Process

You can use the -customExec "process arguments" command with the XFlow adapter to run a customized process instead of the standard domain discretization and solver processes.

For example, you can use this command for an HPC-MPI (high-performance computing message passing interface) or any other environment where you must customize the execution. You can use this argument to call an execution script distributed within the XFlow Physics Simulation or available from the station.

The working directory for the custom process is the directory that contains the XFlow project. You can include the following environment variables in the process environment:

Environment Variable Description
XFLOW_DOE_APPLICATION_DIR Contains the path to the directory containing the XFlow executables.
XFLOW_DOE_PROJECT_DIR Contains the path to the directory containing the XFlow project.
XFLOW_DOE_PROJECT_FILE Contains the XFlow project file name, including the extension.
XFLOW_DOE_PROJECT_PATH Contains the absolute file path to the XFlow project file.

The -customExec value can contain references to the adapter pre-execution input parameters using the expression ${Pre-ExecuteParameterName}.

Example of -customExec Use
-customExec “/bin/sh exampleXFlowScript.sh”
Here the contents of the script are:
#!/bin/bash
echo "Executing example script"
echo "XFlow Application dir: $XFLOW_DOE_APPLICATION_DIR"
echo "XFlow Project dir: $XFLOW_DOE_PROJECT_DIR"
echo "XFlow Project file: $XFLOW_DOE_PROJECT_FILE"
echo "XFlow Project path: $XFLOW_DOE_PROJECT_PATH“

echo "Current Working dir: $PWD“

echo "Executing: $XFLOW_DOE_APPLICATION_DIR/generateDomain3d $XFLOW_DOE_PROJECT_FILE"
$XFLOW_DOE_APPLICATION_DIR/generateDomain3d $XFLOW_DOE_PROJECT_FILE
if [[ $? -ne 0 ]]; then    
  exit 1
fi

echo "Executing: $XFLOW_DOE_APPLICATION_DIR/xflow-engine $XFLOW_DOE_PROJECT_FILE"
$XFLOW_DOE_APPLICATION_DIR/xflow-engine $XFLOW_DOE_PROJECT_FILE
if [[ $? -ne 0 ]]; then    
  exit 1
fi

Specifying a Directory for the XFlow Project Folders

You can use the -useDir command to specify a root directory that the adapter uses to create or consume the XFlow project folders (instead of the default temporary location).

For example,

-useDir /hpc-fs/xf_example_projects
tells the adapter to create XFlow project folders in the directory /hpc-fs/xf_example_projects.

Customizing the Names of the XFlow Project Subfolders

In addition to customizing the directory for the project folders, you can also customize the subfolder names. You can use one of the following arguments with -useDir:

-dirPrefix
Specifies a prefix for the XFlow project subfolders.
-dirName
Specifies a name for the XFlow project subfolders.

You can only use one of these arguments at a time with -useDir. By default, the project subfolder used by the adapter uses the name from the iteration, or run number, of the adapter. If the process runs the XFlow adapter three times, the subfolders are 1, 2, and 3.

You can use the -dirPrefix argument to specify a prefix for the XFlow project subfolders. In the example below, you add the prefix ExampleA to the default subfolder name:

-useDir /hpc-fs/xf_example_projects -dirPrefix ExampleA
If the adapter runs three times, the names of the subfolders are ExampleA_1, ExampleA_2, and ExampleA_3.

Alternatively, if the run number is in a parameter, you can use the -dirName argument with an expression that obtains the value of a parameter in the process. So if your process has a parameter named RUN_NUMBER for the iteration number, you can use ${RUN_NUMBER} to include the parameter value in the subfolder name that you specify, as shown in the example below:

-useDir /hpc-fs/xf_example_projects -dirName ExampleB_${RUN_NUMBER}
Here, the ${RUN_NUMBER} expression appends the run number to the end of each subfolder name. If the process runs the XFlow adapter three times, the subfolders would be ExampleB_1, ExampleB_2, and ExampleB_3. If you do not include ${RUN_NUMBER}, and enter only ExampleB as the -dirName, the name of each subfolder would be ExampleB. For more information, see Expressions and Parameters.

You can also use this syntax to refer to pre-execute input parameters in the Pre-Execute tab of the adapter editor. For example, if you have an input parameter LENGTH that is equal to 25, you can enter the following arguments:

-useDir /hpc-fs/xf_example_projects -dirPrefix ${LENGTH}_Example
The project data are then saved in subfolders prepended with 25_Example. If the value of the parameter changes on a different iteration (for example, as the result of a DOE varying input parameters), the subfolder for that run includes the new value.

Generating Only the XFlow Project

You can use the -onlyGenerateProject command to specify that the XFlow adapter generates only the XFlow project.

This mode skips the domain discretization, simulation execution, and the KPI computation; it generates a project with no output. For example,

-onlyGenerateProject -useDir /hpc-fs/xf_example_projects -dirName exampleProject
generates an XFlow project without running the domain discretization, running the simulation, and computing the domain. The command then saves the empty output in a subfolder named exampleProject within the directory /hpc-fs/xf_example_projects.

Running Only the Domain Discretization Stage

You can use the -onlyGenerateDomain command to specify that the XFlow adapter performs only the domain discretization stage of the simulation.

This mode skips the project generation, simulation execution, and the KPI computation; it generates a project with no output. For example,

-onlyGenerateDomain -useDir /hpc-fs/xf_example_projects -dirName exampleGendomProject 
performs the domain discretization stage and saves the project files in a subfolder named exampleGendomProject within the directory /hpc-fs/xf_example_projects.

Retrieving KPIs from a Previous XFlow Adapter

You can use the -onlyProcessOutput command to specify that the XFlow adapter retrieves only the KPIs generated from a previous XFlow adapter and uploads them to Process Composer.

This mode skips the XFlow project generation, the domain discretization, the simulation execution, and the KPI computation. For example,

-useDir /hpc-fs/xf-example_projects –onlyProcessOutput
retrieves KPIs from another XFlow adapter that runs earlier in the simulation process.