Vibration UDF for TFM model

I am trying to give a sinusoidal vibrational effect on gas phase and solid phase in a fluidized bed(2D TFM).

There will be a displacement due to vibration,
displacement, d = A * sin(2 * pi * f * time)
A: amplitude
f: frequency

and the second derivative of vibrational displacement will be vibrational acceleration.
vibrational acceleration, a = 4 * pi^2 * f^2 * A * sin(2 * pi * f * time)

Using this vibrational acceleration, I want to modify the gravity term in the momentum equation for both gas and solid phases.

g_modified = gravity - a

My question is, can anyone give me some advice/guidance on developing the udf file?
I think the approach is using “usr1.f” and change the GRAVITY_X, GRAVITY_Y, and GRAVITY_Z.
Can anyone share some example on this?

Thanks

KJ

2 Likes

Yes, you can implement this in usr1.

time is accessed from the run module
pi and gravity_y etc are accessed from in the constants module

Make sure to rebuild the solver to include your changes.

1 Like

Hi Jusser

I was working on UDF file for applying vibration effect.
There is too short description in MFIX web at 8.2. User-Defined Functions.
Is there any step by step UDF tutorial I can check?

KJ

1 Like

Check the rotating drum legacy tutorial in legacy_tutorials/DEM_Wall_HT and look at the pdf (see attached excerpt) and study the udfs.

2 Likes

I modified the usr1.f as below,

 SUBROUTINE USR1 

      Use usr
      Use run     
      USE constants
	
      IMPLICIT NONE
!-----------------------------------------------
!
!  Include files defining common blocks here
!
!  Define local variables here
!
!
!  Include files defining statement functions here

  CALL_USR = .TRUE. 

  CONSA = 0.0027   ! Vibration amplitude

  CONSW = 87.1478  ! Vibration angular frequency
	
  SUMA = -CONSA*CONSW*CONSW*SIN(CONSW*TIME)

  GRAVITY_Y = GRAVITY_Y - SUMA

      RETURN  
      END SUBROUTINE USR1 

And my question is,

I want to give gravity_y term for both solid & gas phase like shown in attached file.

How can I give gravity_y term for both phases(with fraction and density as well) in the usr1.f?

1 Like

gravity_y applies to both gas and solids phases. You don’t need to touch the volume fraction and density in usr1.f, this will be handled automatically.

1 Like

Firstly, I put modified usr1.f file in the project file directory.

And then, I got an error message as below after clicking the build solver.

Can you help me with this problem?

Thanks

KJ

The error message points to the issue:

USE constants
Fatal Error: Can't open module file 'constatns.mod' for reading at (1): No such file or directory

The correct module name is constant without the s.

Dear jmusser

Thank you for your reply!

I got an another error message as below,

I suggest you look for and follow an intro to Fortran. You need to delcare your variables. Also, google is your friend.

Hey Jeff (or anyone),

Where are these legacy tutorials stored now? A simple search for “legacy_tutorials” and “DEM_Wall_HT” comes up with nothing, at least in the mfix-19.3.1 anaconda directory. All the tutorials I’m seeing are new.

On the Download page, please go to the “Source/Pip” tab and download the tarball. This contains all source code and legacy tests/tutorials. These are not guaranteed to run in the GUI, you may need to run from command line.

1 Like

Perfect, that’s just what I needed. Thanks!