How to output a variable with only one value per time step?

Hello, everyone. I have a problem when using a two-fluid model to simulate a fluidized bed. I want to output a value related to particle volume fraction in the binary particle system, which is calculated in each grid at each time step. I successfully output it using ReactionRate.

But in the subsequent process, I encountered difficulties. I want to process the data that meet certain conditions within each time step (like standard deviation), which means that a “standard deviation” will be calculated for each time step. I failed to output this “standard deviation”.

I first tried to write this code in source_v_g.f and tried using ReactionRate output, but the value of ReactionRate output is always 0. Later, I tried to add a custom subroutine in source_v_g.f, but still couldn’t output it successfully. Afterwards, I tried to output the “standard deviation” in usr_write_out1. f and usr1. f respectively, but all failed without exception. Even running the calculation after using usr1. f will result in a float invalid operation error.

May I ask if you can help me solve this difficulty? Is there a way to output this value? Looking forward to your help and reply. Thank you.

I tried outputting in write_usr1.f, and this time I didn’t think there was any logical problem. However, when I ran the program, it still reported an error and displayed float invalid. It looks like there is a problem with the ep_s, and I don’t know the reason for this issue or how it can be resolved. I urgently need your help, thank you.
My case and f file are as follows.
test.mfx (9.7 KB)
write_usr1.f (3.5 KB)

The problem can be seen in Problems in using write_usr1.f , which is newest.