How to change the local gas velocity?

Hello everyone:
I have encountered a problem in mfix-dem:
how do I change the local gas velocity(Ug) so that I can add a pulsating velocity(Uac)to the original gas velocity?
image
image
image
where x is distence, t is time.(U, f and k are constant)

You need to write a UDF (User-defined function) for this.

Consult the UDF section of the documentation, and look at some of the tutorials which use UDFs (silane pyrolysis, absorption column, and variable density)

If you have additional questions after reviewing these, you can follow up here.

Thanks for your reply, cgw.
I realized that I need to modify the UDF file, and I have carefully reviewed the three tutorials you recommended, but did not see any relevant information to modifiy the gas velocity. Could you help me with this?
For example, it is only necessary to modify the gas velocity in the y-direction at each time step.

in fldvar_mod.f:

! y-component of gas velocity
      DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE ::  V_g

So your UDF needs to have

use fldvar, only: V_g

and you can assign to elements of that array, using funijk(i,j,k) to get the cell indices.
Are you adding the same value to each cell, or is the velocity position-dependent?

thanks for your help cgw,
the gas velocity is position and time-dependent (x indicates the height of the cell in the y-direction, and the Uac is a sine wave as shown in the formula).

Ok, then you will need to loop over the I,J,K indices, compute the velocity per-cell, and add that to V_g(funijk(I,J,K)) Let us know if you have any problems with this.

hi cgw,I write a user-defined function (UDF) in the usr_mod.f file (mfix-22.2.2) to modify the y-direction component of the gas velocity.
However, when I compiled the solver, there were a large number of errors. :sweat_smile:
the udf file is uploaded as below:
usr_mod.f (1.4 KB)
test-3.mfx (14.4 KB)

can you help me with this?

Plese see

in particular Fig 10.1 which explains the purpose of the various usr_* files.

You probably don’t need a usr_mod.f since you are not adding any new variables.

You want a function to be called on every time step, so this should go into usr1.f

See pic/silane_pyrolysis_3d/usr1.f for an example. You will not need the

      DO M = 1, MMAX

loop because you are not looping over solids phases. You only need the IJK loop. To get the Y coordinate, you can do something like this:

use indices
use geometry
double precision::  y
y = y_length * (j_of(ijk)/jmax) + y_min

thanks cgw. due to the Uac is time dependent, so, how should i get the simulation time?

use run, only: time

thanks for your reply, cgw!