How can I output the drag coefficient from maybe the drag subroutine

I need to compare the drag coefficients calculated from different drag models. How can I output these drag coefficients from different drag models during or after simulation? I am still relatively new to MFiX and not sure how to go about this.
Thank you!

Please can someone assist?

Please provide as much information as possible so you can get useful answers. What model are you running (TFM, DEM, PIC?) and what data do you want (cell data, particle data, average over volume etc).

For TFM, the drag is computed in drag_gs.f while for DEM it is computed in des/drag_gp_des.f

If you use TFM, you can save data in the array ReactionRates. This is a dummy array that was used in the past to output reaction rates, but it can be used to output any cell data. You would need to assign values to ReactionRates in a subroutine of interest (in a cell loop). You first need to define the number of variables you want to store by setting a non-zero value of nrr (Model setup pane, Reactionrates array size). Then you can save this array in te vtk files (Output pane> VTK > define a vtk region with cell data> Reaction tab).

If yo use DEM, you can use a user scalar to store the drag for each particle. Check "Enable User scalar tracking in the Model setup pane and define the number of scalars you want to track. Then in the Output>VTK pane, you should see the DES User scalar variables when you create a VTK region (particle data). You would store the data in DES_USR_VAR in a particle loop.

For both methods above, you will also need to build the custom solver so the changes in the code are taken into account.

Thank you so much for your reply and sorry for not providing enough information.
I am using the MFIX-SQP model. I want to output particle data.
I see that the drag is computed in des/drag_gp_des.f just as in DEM you described above. I will follow your guidance and see what happens. Thank you!

Could you please elaborate more on storing the data in DES_USR_VAR in a particle loop? Thank You.

Let’s say you want to store DGA and F_gstmp, go near the bottom of subroutine des_drag_gp (after these variables have been assigned, and add

 des_usr_var(1,NP)=DGA
 des_usr_var(2,NP)=F_gstmp

This routine is called from within a particle loop, where the particle ID is NP. In general, you want to make sure DES_USR_VAR is accessible by using the discritelement module with ``

use discretelement, only: DES_USR_VAR

Here there is already a use discretelement in the routine so you should be good to go. In the above example, I am storing two user-defined scalars, so you should define at least two tracked scalars (DES_USR_VAR_SIZE) in the Model setup pane (check “Enable User scalar tracking” and define the number of scalars you want to track).

Thank you so much, Sir. This solved the problem.
You are a life saver.
I could not access the forum yesterday, was it only me or there was a general issue?

We experienced a short outage on the website yesterday, I apologize for the inconvenience.