# Possible to simulate a fluctuating MI/MO boundary condition?

Hey all,

Does anyone know if it’s possible to simulate a velocity BC with a time-varying value that alternates between positive (inflow) and negative (outflow)? I’ve checked out this post:

…which is helpful in understanding how to code the appropriate UDF and broadcast values, but I don’t know how to get around the “invalid flow direction” issue when you want to assign a negative number (outflow). I could override these checks but I’m expecting it will cause issues down the road i.e. in solving the continuity and momentum equations.

Is there a way to do this? Mathematically, it seems like it should be possible, but I can’t think of a way to implement it that doesn’t require a very large amount of programming.

In CFD, switching from inlet to outlet BC is not as straightforward as reversing the sign of the velocity. These are two different Boundary Conditions. You would need to change the BC type with time, which I am not sure will be numerically stable.

Jeff,

I see, thanks for the heads up. Maybe I’ll try a really slow, single-cycle fluctuation and see what happens.

Do you know which modules/functions I would need to call to switch from MI to MO mid-simulation? Would I need to basically mirror most of the boundary initialization routines? It sounds like several call <> statements beyond just set_bc0_flow would be required.

The module that has all the bc keywords is `bc_mod.f`. I think you would have to call `set_bc0_flow.f` when you make the change.

Perhaps you could place an inflow and outflow next to each other and have each one vary between 0 and a maximum value … this is an approximation but would save you from having to change the `BC_TYPE`

Charles,

That’s an interesting idea! I will have to try that as well. So far it’s looking like the behavior may be more sensitive to one half cycle than the other (i.e. more sensitive to mass outflow portion than the mass inflow portion) so I might get lucky and be able to zero out one of the half cycles.