# How to create a new boundary condition ?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 May 18, 2009, 22:14 How to create a new boundary condition ? #1 Member   Jitao Liu Join Date: Mar 2009 Location: Jinan , China Posts: 64 Rep Power: 15 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); σ(u)·n－p·n=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. Thanks in advance. Jitao Liu

 May 19, 2009, 00:17 #2 Member   Jitao Liu Join Date: Mar 2009 Location: Jinan , China Posts: 64 Rep Power: 15 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: T=-pI+2*mu*D,D=0.5*[grad(u)+grad(u)^T] 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

 May 20, 2009, 08:33 #3 Member   Jitao Liu Join Date: Mar 2009 Location: Jinan , China Posts: 64 Rep Power: 15 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

 May 20, 2009, 10:03 #4 New Member   Join Date: May 2009 Posts: 7 Rep Power: 15 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; refGradient uniform 0; valueFraction uniform 0; value uniform 0; } inlet { type fixedValue; value uniform 1; } for pd: wall { type mixed; refValue uniform 0; refGradient uniform 0; valueFraction uniform 1e-5; value uniform 0; } inlet { type zeroGradient; } for U: wall { type partialSlip; valueFraction uniform 0; } inlet { type fixedValue; value uniform (0 1 0); } I hope these boundaries can help you. 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.

 May 20, 2009, 12:19 #5 Member   Jitao Liu Join Date: Mar 2009 Location: Jinan , China Posts: 64 Rep Power: 15 Hi Dario, Thanks for your reply. 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. About adding the temperature equation in Interfoam,You can have a look at the following links 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

May 30, 2009, 04:00
#6
Member

Jitao Liu
Join Date: Mar 2009
Location: Jinan , China
Posts: 64
Rep Power: 15
Quote:
 Originally Posted by francesco_b 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.

Jitao Liu

Last edited by awacs; May 30, 2009 at 06:12.