5.1. Building Custom Interactive Solver

If you are just starting with MFiX, you could use the default solver installed with MFiX. It is possible to run most of the Tutorials with the default solver.

Note

Among the tutorials listed on the New Menu, only the tfm/silane_pyrolysis_2d case has UDFs and requires running with a custom solver to run correctly.

However, for some cases you may want to use a custom mfixsolver. For instance, when running cases with UDFs (User Defined Functions, which are defined in Fortran source files in the project directory), it is necessary to build a custom solver. A custom solver is an mfixsolver executable built in the project directory, specific to that project. This includes projects with chemical reactions, since those have UDFs.

5.1.1. Custom Solver From GUI

Press the build (Build) button to display the Build Dialog box. Select appropriate compilation options, then press the “Build Solver” button. It may take a few minutes to compile. See Build dialog for further details about compilation options. The “Build Command” of the build dialog will show the equivalent command for Building Custom Interactive Solver.

After building the custom solver, run a simulation by pressing play (Run) to display the Run dialog. Select the mfixsolver file you have just built.

You can pause, unpause, stop, or get info from the solver.

5.1.2. Custom Solver From Command Line

For example, the tfm/silane_pyrolysis_2d tutorial has UDFs and will not run with the default solver.

> cd tutorials/tfm/silane_pyrolysis_2d/
> ls
SP2D.mfx  usr0.f  usr1.f  usr_mod.f  usr_rates.f

To build a custom solver for tfm/silane_pyrolysis_2d:

> build_mfixsolver
...build output...
> ls  *
build/ lib/ mfixsolver SP2D.mfx  usr0.f  usr0.o usr1.f  usr_mod.f  usr_rates.f

The build_mfixsolver command creates a wrapper script mfixsolver, that runs the case-specific MFiX solver (which is installed in the lib directory).

The build directory can be deleted, and the custom mfixsolver will still run. However, leaving the build directory will greatly speed up rebuilds if you want to edit the UDFs and run build_mfixsolver again.