Rotary drum - imposing tangential velocity tutorial

I am trying to simulate the rotary drum tutorial - imposing tangential velocity. I am new to this. I believe I am supposed to create a text file with keyframe data(velocity and time) in the same directory as the mfix file.

also, few files are supposed to be used. i searched for those files(usr_mod.f ,…) in mfix source and copied to the same directory. I cant find one of the files,( in the mfix source. Is my approach correct? please confirm

Thanks in advance


For a new project, we usually copy the files required to be modified into the project folder. Then compile mfix in project directory but with cmake pointing the original unmodified “source” directory.

From what I see, your usr_init_namelist.f seems to be unmodified meaning that you copied the unmodified source file to the project directory. Is this the case? Therefore, this may not do what you actually wanted. Have you looked into the actual tutorial files in this location?


1 Like

Thank You. Yes, I did not modify the usr_init_namelist.f file. I am very new to this kind of simulation. It would be very much useful if you could elaborate cmake compiling process. I dont see this in the tutorial file in the mfix website.

From version 20 onwards, MFiX GUI has a built-in code editor which lets you modify Fortran files and handles copying files from the source to the project directory.

You don’t have to use CMake from the command line if you don’t want to - there’s a button in the GUI to compile MFiX.

1 Like

Code editor:

1 Like

Build button:

1 Like

In general, the mfix solver creation process is done in two steps:

  1. Using cmake to let the code know the location of source files, modified files, type of optimization needed, etc. as well as the type of compilers to be used. This process is called configuration and this will in turn will generate a Makefile.
  2. Using Makefile to compile and create the mfix executable.

In addition to @cgw 's answer, you can also compile in terminal in case if you use Linux. From the tutorial folder, you can, for example, use the following command:

cmake  /path/to/mfix    -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_Fortran_FLAGS="-O2 -g  -fcheck=all" -DENABLE_MPI=0

Here, -DENABLE_MPI=0 will enable the code to compile in serial and =1 for parallel. For more information, I would recommend you to have a look here:

1 Like

Note that compiler options can also be specified when you build the solver by clicking the button, and this is the recommended way of doing it. We have tried to make the build process as simple as possible!

Cmake is available as an alternative for situations where the build popup is not usable, but the build popup is best for basic use.

1 Like

Thanks a lot. This is really helpful. I still cannot turn on the read_kf to true. I am trying to simulate the imposing tangential velocity tutorial. So, I initially created a drum geometry, regions for initial particles, inlet, outlet, and wall. Defined mesh, initial conditions, and boundary conditions. For this tutorial, I am asked to create a text file with time and velocity values. I have used the same values as in the default tutorial. Now when I copy the required .f and .inc files, I couldn’t find the in the mfix source. However, I proceeded with compiling with the build solver button. The building was successful. I believe for the keyframe file(the text document with velocity data) to be read, it is necessary to turn on the read_kf to true in the advanced pane. This is where I face issue. I couldnt find the read_kf option. I also tried copying the from the default tutorial, but then when I try compiling using the build solver button, it throws an error. I don’t know where I am going wrong. Please shed some light.

Thanks in advance.

Go to Advanced pane. Click “+” to add keyword. Select ‘read_kf’ from the list of available keywords (you can type the name in to the search bar). Then click “Update key” on the add keyword popup.

Keywords appear in the Advanced popup if (a) they are already set in the project file or (b) the user adds them via the above procedure. We should probably simplify this so that keywords from usr_init_namelist.f are automatically added without this extra step. Note that read_kf is not set in the mfx file, just the usr_init_namelist.f, so it’s not getting picked up by the GUI. Will try to simplify this in the upcoming release.