CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to create a new boundary condition ? (https://www.cfd-online.com/Forums/openfoam-programming-development/64656-how-create-new-boundary-condition.html)

 awacs May 18, 2009 21:14

How to create a new boundary condition ?

Dear Foamers,

I am trying to create a new solver based on interFoam to simulate polymer melt flows(two phase flow with an free interface). I want to use the following boundary condition in my simulation:
The no-slip boundary condition is applied on the polymer melt only. The air is free to leave the cavity as pushed out by the advancing melt. This type of boundary condition is dynamic and changes as the polymer melt advances in the cavity. It must satify the following conditions on the boundary:
u=0 when gamma>=0.5 (filled);
σ(unn=0 when gamma<0.5 (empty);
where, u is the velocity, σ is the deviatoric stress tensor, p is the pressure and n is the outside normal direction.

I am a green hand in this field, could you guys give me tips how could I proceed it.

Jitao Liu

 awacs May 18, 2009 23:17

what's more:
The air treated as pseudio-fluid is free to leave the mold wall as pushed out by the advancing melt.The traction free boundary condition is
T.n=0 at the interface between the wall and the air.
The total stress tensor is defined as follows:

The boundary conditions are switched dynamically according to the
ﬁlling status there.
for the ﬁlled mold wall (polymer melt), Γwall,melt :
no-slip bc: u = 0, when
gamma≥0.5
for the empty mold wall (air), Γwall,air :
traction free bc: T · n = 0, when
gamma< 0.5

 awacs May 20, 2009 07:33

I think it is a kind of mixed type boundary condition like inletOutlet, outltIlet and groovyBC (in OF1.5-dev).
Maybe,it is possible to use groovyBC to define this boundary. The valueFraction can be specified by the value of gamma:
valueFraction=1 when gamma>=0.5
valueFraction=0 when gamma<0.5

But I am not sure about that. And I have no idea how the traction free boundary condition treated on the velocity and pressure patches respectively.

Any suggestions will be appreciated.:)

Jitao liu

 dakos May 20, 2009 09:03

Hi Liu,
I'm new to this forum and also to OpenFoam.
I'm also intrested in filling simulation and I tried to use Interfoam to solve my problems.
About the boundary condition I think you are rigth using a mixed type.
I did a simulation with these boundary and the result seems good:
for gamma:
wall
{
type mixed;
refValue uniform 0;
valueFraction uniform 0;
value uniform 0;
}
inlet
{
type fixedValue;
value uniform 1;
}
for pd:
wall
{
type mixed;
refValue uniform 0;
valueFraction uniform 1e-5;
value uniform 0;
}

inlet
{
}
for U:
wall
{
type partialSlip;
valueFraction uniform 0;

}
inlet
{
type fixedValue;
value uniform (0 1 0);
}

Dario

Ps: do you know how to introduce the temperature equation in Interfoam?
I'm very intrested in heat exchange, but I don't understand how to modify the solver.

 awacs May 20, 2009 11:19

Hi Dario,

I need a nonuniform valueFraction, so that the changes of the valueFraction can be used to switch between no-slip bc and traction free bc. I want to control it's value through the value of gamma （Fluid volume fraction) on the boundary cells. I will pay more attention to it.
http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

http://www.cfd-online.com/Forums/ope...interfoam.html

You should add a temperature field to createFields.H. The the energy equation should be added to interFoam.c after the momentum equation is solved (after the PISO loop), but before the time step is written.

Jitao Liu

 awacs May 30, 2009 03:00

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
It is posted by Francesco in thread : http://www.cfd-online.com/Forums/ope...tml#post217639

I am confused on these issues too. Help from the forum members will be appreciated.