How to get cell volume?

Please select the most relevant MFiX category: | Installation | How to | Bug report | Share | for this topic.
Hello developer,
I am writing udf for specifying reaction rates for heterogeneous reactions. Doing so, I require cell volume which has to be multiplied with the reaction rate. Because, my original reaction rate has unit of 1/s. Can i calculate cell volume for each cell, if so, could you please let me know the keyword of it? Thanks.

The scalar cell volume is stored in the array VOL and is indexed by the cell index (typically IJK), so if you are in an IJK loop, the cell volume is VOL(IJK)

To access the array, make sure you have the following at the top of your UDF:

use geometry, only: vol

Hi, Dr. Dietiker,

Which keywords can we use to get cell center coordinates?

I noticed that they can be output in the MFIX GUI.


I have searched for them in the source code, but I haven’t found them yet. Two years ago, you answered my similar question, but I am not sure if they can be used to output the cell center coordinates like the option in the GUI does.

What do you mean by “get cell center coordinates”?

The keyword to write the cell center coordinate into the vtk file is VTK_SCALAR_CC(VTK_REGION)=.true., where VTK_REGION is the index of a defined vtk region.

If you want to use the coordinates in the code, the variable is CENTER_S(IJK,C), where IJK is the cell index and C is the coordinate index, C=1 means X, C=2 means Y and C=3 means Z

Before using it i the code, make sure you have

USE geometry, ONLY: center_s

at the top of the routine so you can access it.

1 Like