Usr drag with dx

@jmusser you mentioned in the users’ group meeting this week that we can now use the fluid mesh dx in the user drag routine, do you have an example of that?

Sure. In the user drag model (4.8 KB) created by @YupengXu, the cell volume is computed from the fluid mesh size which is used to compute the filter size ratio.

The mesh size is obtained from the m_geomData object.

    const amrex::Real* dx = m_geomData.CellSize();
    amrex::Real const cell_volume = dx[0] * dx[1] * dx[2];

m_geomData is an AMReX GeometryData struct that contains basic geometry information like grid spacing and domain extents.

1 Like

Can it be used in the mfix_usr_reactions_rates_K.H?

Yes! You can get the cell volume (dx[0]*dx[1]*dx[2]) inside the Eulerian and Lagrangian reactions defined in the mfix_usr_reactions_rates_K.H header file, through the class method cell_volume():

const amrex::Real cell_volume = reactions.cell_volume();

1 Like

@RobertoPorcu is that cell volume just dx[0]*dx[1]*dx[2] or is volfrac included in it as well?

@RobertoPorcu and how about the fluid.density()? Is volfrac included in it?

No. volfrac is geometrical, i.e., the uncovered volume, it would not be included in fluid field variables.

1 Like

@YupengXu, vfrac() is available in the reactions object, while density() and volume_fraction() are available for the fluid:

const amrex::Real cell_volume = reactions.cell_volume();
const amrex::Real cell_vfrac = reactions.vfrac();
const amrex::Real fluid_density = fluid.density();
const amrex::Real fluid_epg = fluid.volume_fraction();
2 Likes