CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Semi-permeable Lagrangian Baffles (

RDanks March 28, 2012 17:10

Semi-permeable Lagrangian Baffles
I am looking to simulate particle flow in a domain that features baffles that are semi-permeable to the particles. (i.e. I would ideally specify a probability of penetration for the baffle which would then only allow some of the particles through.)

I've created the cyclic baffles with createBaffles and modified the PacthInteractions folder such that I have a fourth interaction type ("baffle"). Within LocalInteraction.C, in the case of the baffle model I have the following code


active = true;
keepParticle = true;
int randomNum = (rand() % 100);
int probVal=int(patchData_[patchI].penProb()*100);
if (randomNum > probVal)
        active = false;
        U = vector::zero;
        massStick_[patchI] += p.mass()*p.nParticle();

Which I thought, should act the same as the "stick" interaction for cases where the particle doesn't penetrate, and should not effect the particle in cases where it's allowed to penetrate.

What is actually happening is that regardless of the value of randomNum, all the particles stick. Adding an "else" case and copying the rebound code, has no effect either, the particles just always stick!

It's not an issue with rand, or my logic for the probability if statement (I;ve already checked those repeatedly). And everything compiles and runs no problem.

Has anyone attempted anything like this? Or does anyone have any pointers or suggestions for what I'm doing wrong?


All times are GMT -4. The time now is 05:07.