CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Selective outlet boundary condition for InterFoam (https://www.cfd-online.com/Forums/openfoam-solving/59146-selective-outlet-boundary-condition-interfoam.html)

 caw December 21, 2007 05:30

Dear FOAMers, just before c

Dear FOAMers,

just before christmas there is one problem that haunts me night by night ;-)
So any help is highly appreciated.

A two phase flow problem, which can be handled by interFoam quite well, is the basic thing.
I am looking for a way to prevent fluid 1 leaving the flow domain at an outlet while fluid 2 can pass through.

-A quite complicated way to do this would be to move faces from the outlet-bc to a wall-bc if gamma is > 0 in the adjacent cell.

-Or is there a way to force the flux to zero on those faces (not the whole path of course)?

Any hints?

Thanks in advance and have a nice holiday season

kind regards
Christian

 hjasak December 21, 2007 05:47

Are you sure this is what you

Are you sure this is what you want?

If so, take a mixed boundary condition and manipulate the fixed value-fixed gradient switch based on gamma. It would be easiest just to write a new fvPatchField class.

Enjoy,

Hrv

 caw December 21, 2007 06:48

Actually i dont know what i want...just some clues for the most efficient solution i suppose ;-))

I will look into the existing fvPatchField classes...that was probably the hint i was looking for.

Kind regards
Christian

 francesco_b February 11, 2008 10:43

Hi, I've tried to make this

Hi,

I've tried to make this boundary condition, but I've got some issues concerning the switch, can you pls help me with the implementation?

The function should be something like

template<class>
void filterFvPatchField<type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const volScalarField& gammap = gamma
(
reinterpret_cast<double>(NULL)
);

this->valueFraction() = 0.0;

for (int i = 0; i < boundarysize; i++)
{
if (gammap(cellnexttoboundary(i)) > 0.5)
{
this->valueFraction(i) = 1.0;
}
}

mixedFvPatchField<type>::updateCoeffs();
}

I've got this questions:

1) Is the initialization of gammap correct? If it is not, how should it be?
2) What is the name of the variable which gives me "boundarysize"?
3) What should I write to obtain the value of gammap(cellnexttoboundary(i))?
4) Is there a better way of doing this?

As I said before, I'm new to C++, I know these are stupid questions but for me it is not so clear,

Francesco

 awacs May 29, 2009 23:42

Quote:
 Originally Posted by francesco_b (Post 180458) Hi, I've tried to make this boundary condition, but I've got some issues concerning the switch, can you pls help me with the implementation? The function should be something like template void filterFvPatchField::updateCoeffs() { if (this->updated()) { return; } const volScalarField& gammap = gamma ( reinterpret_cast(NULL) ); this->valueFraction() = 0.0; for (int i = 0; i < boundarysize; i++) { if (gammap(cellnexttoboundary(i)) > 0.5) { this->valueFraction(i) = 1.0; } } mixedFvPatchField::updateCoeffs(); } I've got this questions: 1) Is the initialization of gammap correct? If it is not, how should it be? 2) What is the name of the variable which gives me "boundarysize"? 3) What should I write to obtain the value of gammap(cellnexttoboundary(i))? 4) Is there a better way of doing this? As I said before, I'm new to C++, I know these are stupid questions but for me it is not so clear, Thanks in advance Francesco
Dear Francesco,

I am also confused on this issue. How did you retrieve the value of gamma in the cell close to the boundary patch? How to write valueFraction as a function of gamma?
I am a newbie in OpenFOAM. Please give me some tips.:)