## 12.3. Command-Line Samples

Here are some examples to help clarify the use of the command line:

### Start CFX-Solver

To start CFX-Solver running from the CFX-Solver input file model.def, enter the command:

    cfx5solve -def model.def

If the input file is for a multiple configuration (.mdef file), enter the command:

    cfx5solve -mdef model.mdef

### Start CFX-Solver Manager

To start CFX-Solver Manager, passing it the name of the CFX-Solver input file, enter the command:

    cfx5solve -interactive -def model.def

### Produce a Partition File

To produce a partition file with the `MeTiS` partitioning method and seven partitions, but not run CFX-Solver to solve for the solution, enter the command:

    cfx5solve -def model.def -partition 7

This command will produce a file named model_001.par in the local run directory.

Note: If the file model.par exists in the working directory, then the partition type (`MeTiS`, `RecCoordBis` or `SpecDir`) is read from this file, even if you have not specified the file model.par. Because this could potentially be confusing, you are advised to use the CFX-Solver Manager to set up a partitioning run, unless you are certain that either there is no file model.par or that the partitioning method specified in the model.par file is what you require.

### Start CFX-Solver in Local Parallel

To run CFX-Solver in parallel, starting from the CFX-Solver input file model.def and running only on the local machine with two partitions, enter the command:

    cfx5solve -def model.def -par-local -partition 2

If you have already created a file model.par (for instance, by using the command `cfx5solve -def model.def -partition 7`), then you can run the parallel CFX-Solver by entering the command:

    cfx5solve -def model.def -par-local -parfile-read model.par

To run the CFX-Solver in parallel for the configuration named `<config>` and in serial for other configurations in a multi-configuration simulation, enter the command:

    cfx5solve -mdef model.mdef -config "<config>" -par-local -partition 2

### Start CFX-Solver in Distributed Parallel

Note: To ensure that the following example works, define the hosts `hosta`, `hostb` and `hostc` in the central hostinfo.ccl file. (`cfx5solve` attempts to automatically detect hosts that are not listed in hostinfo.ccl, but this is not guaranteed to work.)

To run CFX-Solver in distributed parallel, starting from the CFX-Solver input file model.def, and using one partition on `hosta`, two partitions on `hostb`, and four partitions on `hostc`, for a total of seven partitions, enter the command:

    cfx5solve -def model.def -par-dist 'hosta,hostb*2,hostc*4'

### Start CFX-Solver in Parallel

To start the CFX-Solver in parallel with four partitions on two hosts, enter the command:

    cfx5solve -def file.def -par-dist 'hosta*2,hostb*2'

If you have already created a partitioning file, say model.par (for instance, by using the command `cfx5solve -def model.def -partition 7`), then you can execute the distributed parallel run as follows:

    cfx5solve -def model.def -parfile-read model.par -par-dist \
       'hosta,hostb*2,hostc*4'

The number of partitions specified using the `-par-dist` command-line flag must be the same as that in the partitioning file, model.par, or the run will fail.

### Start CFX-Solver in Parallel with Cray MPI

To start the CFX solver in parallel on a system running the Cray Linux Environment, having reserved the required processing elements via the built-in batch queuing system:

    cfx5solve -def model.def -start-method “Cray MPI Distributed Parallel”

### Start an ANSYS Multi-field Run (FSI)

To start an ANSYS Multi-field Run, launching both the Mechanical application and CFX Solvers, starting from the CFX-Solver input file model.def and using the Mechanical application input file model.inp:

    cfx5solve -def model.def -ansys-input model.inp

To start an ANSYS Multi-field run, launching the Mechanical application solver only, disabling the processing of the Mechanical application input file and using the Mechanical application input file model.inp:

    cfx5solve -def model.def -ansys-input model.inp -mfx-run-mode \
      "Start ANSYS only" -ansys-input-is-complete

To start an ANSYS Multi-field run, launching CFX-Solver only and telling it to communicate with the already running Mechanical application solver on a particular port number and host, enter the command:

    cfx5solve -def model.def -mfx-run-mode "Start CFX only" -cplg-host \
       49800@machine1 -cplg-slave CFX

### Preprocess Incomplete Configuration Files

Configuration definition (.cfg) files that are created in conjunction with a multi-configuration simulation file (.mdef) are incomplete; they do not contain global information like equation and material definitions.

To preprocess the configuration files so that they are complete and can be run independent of the multi-configuration simulation, enter the command:

     cfx5solve -mdef model.mdef -norun

To preprocess the configuration definition file corresponding to the configuration name `<config>`, enter the command:

    cfx5solve -mdef model.mdef -config "<config>" -norun

### Stopping the CFX-Solver from the Command Line

After CFX-Solver is running, stop it by using `cfx5stop` from the command line.

Suppose a run is called `mixer_001` in the current directory. There will be a temporary directory called `mixer_001.dir` in the current directory while that run is actually running. To stop the run, enter the following command line:

    cfx5stop -directory mixer_001.dir

Release 18.2 - © ANSYS, Inc. All rights reserved.