Is there a bug in mass_outflow_dem?

Hello, developers!
Is the judgement condition of particle leave domain or still inside domain wrong?
In mass_outflow_dem.f line 93 and 94:

IF(DIST > compareDist) THEN
                  CALL SET_NORMAL(NP)

The distance of particle and boundary bigger than compareDist (i.e DES_RADIUS, particle radiu, is positive number), which means the particle has left the building, but this set the particle is nomal particle. This conflict with line 111. Isn’t this supposed to be:

IF(DIST <  -compareDist) THEN
                  CALL SET_NORMAL(NP)

and in line 111:

ELSEIF(DIST > -compareDist .and. DIST < compareDist) THEN

@cgw @jeff.dietiker

It is not a bug. DIST is the (signed) distance from the particle center to the BC plane, so a positive value means the particle is inside the fluid domain. Negative values mean the particle has crossed the BC plane and is outside the fluid domain.

from line 82 to lin 87:

CASE('S'); DIST = YN(BC_J_s(BCV)-1) - DES_POS_NEW(NP,2)
CASE('N'); DIST = DES_POS_NEW(NP,2) - YN(BC_J_s(BCV))
CASE('W'); DIST = XE(BC_I_w(BCV)-1) - DES_POS_NEW(NP,1)
CASE('E'); DIST = DES_POS_NEW(NP,1) - XE(BC_I_w(BCV))
CASE('B'); DIST = ZT(BC_K_b(BCV)-1) - DES_POS_NEW(NP,3)
CASE('T'); DIST = DES_POS_NEW(NP,3) - ZT(BC_K_b(BCV))

Is ‘S’, ‘N’, ‘W’, ‘E’, ‘B’, ‘T’ means region plane ‘bottom’, ‘top’, ‘left’, ‘right’, ‘back’, ‘front’ in Regions of mfix gui:


if so, it should be positive value of DIST mean the particle has crossed the BC plane and is outside the fluid domain. For example, when case ‘N’, DIST > 0 means particle’s y coordinate bigger than YN(BC_J_s(BCV)) (Is BC_J_s(BCV) == JMAX2, and YN(JMAX2) is the maximum y value of domain, right?), the particle is outside the fluid domain.

No it is not the same. BC_PLANE refers to the S, N, W, E, B, T plane of a BC region. You can think of a BC region as a rectangular region bounded by 6 planes. Although most BC regions have zero-thickness in one direction and are located along the edges of the computational domain, they can have some thickness when we define an internal obstacle.

Now, say you define an outlet BC for BC#2 along the y=ymax plane, where ymax=0.9, and the grid spacing in the y-direction is 0.02. We define a south and north coordinates for this BC:

bc_y_s(2)  = 0.9 #!MFIX-GUI eq{float(ymax)}
bc_y_n(2)  = 0.9 #!MFIX-GUI eq{float(ymax)}

Internally, this is seen as a rectangular region, and the north coordinate of this region is actually extended into the ghost region (on cell thick), so it becomes bc_y_n=0.92 (0.9 + 0.02). You can verify this by inspecting the [RUN_NAME].OUT file:

       Boundary condition no :    2
         Type of boundary condition : PO
           (Outlet with specified gas pressure)
                                                 Specified        Simulated
         X coordinate of west face   (BC_X_w) =   0.0000           0.0000
         X coordinate of east face   (BC_X_e) =  0.15000          0.15000
         Y coordinate of south face  (BC_Y_s) =  0.90000          0.90000
         Y coordinate of north face  (BC_Y_n) =  0.90000          0.92000
         Z coordinate of bottom face (BC_Z_b) =   0.0000         -0.40000E-02
         Z coordinate of top face    (BC_Z_t) =  0.40000E-02       0.0000

So here, to check if a particle has crossed the y=ymax boundary, we use the south face y-coordinate of the BC region and BC_PLANE is S

I get it. Thank you very much for your patient answer.