MFiX DEM monitor write interval

Hi,

I am attempting to write data to a monitor file at a rate of 1.0E-5 s. The above settings produces two CSV files: one file containing what I am assuming is instantaneous data, the other, with the suffix _tavg, produces time averages using the 0.01s averaging interval. Nevertheless, it seems that the instantaneous data is only written at a rate of 0.01 s (the fluid timestep, whereas the solid timestep is ~7E-7). Is the write interval constrained by the fluid timestep? Or am I not understanding the monitor setup?

The subroutine WRITE_OUTPUTS is responsible for checking time intervals and writing outputs (monitors and other files) if appropriate.

Examining the code, this subroutine is called in time_step.f (the fluid time step) and also in des/des_time_march.f, but in the latter case it is only called for DEM only (no fluid phase) cases:

! Initialize time stepping variables for coupled gas/solids simulations.
      IF(DES_CONTINUUM_COUPLED) THEN
         IF(DT_TMP.GE.DTSOLID) THEN
            FACTOR = CEILING(real(DT_TMP/DTSOLID))
         ELSE
            FACTOR = 1
            DTSOLID = DT_TMP
         ENDIF

! Initialize time stepping variable for pure granular simulations.
      ELSE
         FACTOR = CEILING(real((TSTOP-TIME)/DTSOLID))
         DT = DTSOLID
         CALL WRITE_OUTPUTS(.FALSE., .FALSE.)
      ENDIF   ! end if/else (des_continuum_coupled)
...

! The following section targets data writes for DEM only cases:
         IF(.NOT.DES_CONTINUUM_COUPLED) THEN
! Keep track of TIME and number of steps for DEM simulations
            TIME = S_TIME
            NSTEP = NSTEP + 1
! Call the output manager to write RES and SPx data.
            DLB = .TRUE.
            CALL WRITE_OUTPUTS(.FALSE., .FALSE.)
         ENDIF  ! end if (.not.des_continuum_coupled)

I think the assumption is that for coupled cases, the WRITE_OUTPUTS in the fluid time step will be sufficient.

As an experiment, you could change line 122 from

        IF(DES_CONTINUUM_COUPLED)

(lines 122
to

        IF(.FALSE.)

and line 450 from

             IF(.NOT.DES_CONTINUUM_COUPLED) THEN

to

             IF(.TRUE.)

and build a custom solver.

Let us know if this works out!

– Charles

Charles,

This works perfectly. Thank you very much.

PJ

Ok maybe perfectly is the wrong word. this significantly alters what is written to *LOG. I can no longer see the progress of the simulation, i.e., fluid and dem number of iterations, solver wall times, etc. Currently looking into how to recover what I would consider ‘normal’ behavior.

regardless, the fix above does what I was looking for in the original post.

-P

1 Like

Can you see the progress of the simulation in the GUI dashboard?

It is the same.

I see the first iterations (t = 0.0). After, I only get indications when VTPs are written. See attached for examples of what stdout (left) and the LOG (right) files look like.

I have gotten around this a bit by setting

! The following section targets data writes for DEM only cases:
         !IF(.NOT.DES_CONTINUUM_COUPLED) THEN
         IF(.TRUE.) THEN ! PZ 09 16 2025
! Keep track of TIME and number of steps for DEM simulations
            TIME = S_TIME
            NSTEP = NSTEP + 1
! Call the output manager to write RES and SPx data.
            DLB = .TRUE.
            !CALL WRITE_OUTPUTS(.FALSE., .FALSE.)
            CALL WRITE_OUTPUTS(.FALSE., .TRUE.) !PZ 09 16 2025
         ENDIF  ! end if (.not.des_continuum_coupled)

         IF(CALL_USR) CALL USR2_DES

         IF(ADJUST_PARTITION) THEN
            EXIT_LOOP = .TRUE.
            RETURN
         ENDIF

this at least outputs the elapsed time and estimated eta (very much like pure DEM simulations, which makes sense considering the logic).

1 Like

I’m a bit late in following up on this. But I would like to note that I spoke way too soon: the fix Charles suggested ended up disabling the fluid solver after the initial timestep.

Thanks for following up. Sorry that suggestion did not work out.

1 Like

If you really need to save monitor data at such high frequency, here is something you can try:

Open model/output_manager.f, go around line 204: IF(any(MONITOR_DEFINED)) THEN

and copy that block.

Then open model/des/des_time_march.f go around line 451 (below the block that writes vtk files). Paste the block that writes monitors here (you may need to adjust it). This should force the monitor to be written within a DEM loop.

Thanks Jeff. We are exploring a wider range of bed properties than what was done during PJ’s PhD, hence the very high frequency: https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2024JF007760