Degassing Boundary Condition
Hey guys,
i am using interFoam and i want to implement a very simple degassing boundary condition. I would like to use pressureInletOuteltVelocityBC or inletOutletBC or directionMixedBC. I want an outletBC which only lets the fluid (Gas and Liquid) out, if the alphavalue is < 0.2. I think accesing to the patch values of alpha is not the main problem. The most important problem is which boundary should I use? And how do I have to change the variables of the BC? (valuefraction, phip, refValue, refGradient, or maybe other variables? Best regards, Timucin 
Detail information/example
For example pressureInletOutletVelocity:
The main Part ist this: ************************************************** ********** void Foam::pressureInletOutletVelocityFvPatchVectorFiel d::updateCoeffs() { if (updated()) { return; } const fvsPatchField<scalar>& phip = patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); valueFraction() = neg(phip)*(I  sqr(patch().nf())); directionMixedFvPatchVectorField::updateCoeffs(); directionMixedFvPatchVectorField::evaluate(); } ************************************************** ********** So here is my idea, but i need help for this (i think simple problem): void Foam::pressureInletOutletVelocityFvPatchVectorFiel d::updateCoeffs() { if (updated()) { return; } const fvsPatchField<scalar>& phip = patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); ]const fvPatchField<scalar>& alpha1 = patch().lookupPatchField<volScalarField, scalar>("alpha1"); forAll (*this, i) { if (alpha1[i] < 0.2) { valueFraction[i]= 0; (but it does not work, because it is a tensor, maybe i have do something with the values of the variable phip?? or patch.nf??or something else with valueFraction??? ) } } } valueFraction() = neg(phip)*(I  sqr(patch().nf())); directionMixedFvPatchVectorField::updateCoeffs(); directionMixedFvPatchVectorField::evaluate(); } Please help. Best regards Timucin 
Hi Lokati,
I'm not sure I fully follow what you are trying to do, but to get your code to compile you can set the valueFraction to be a zero symmTensor: Quote:

Hi Phil,
in really simple words: Let fluid out if alpha < 0.2 Do not let fluid out if alpha > 0.2. I think this would be an outlet boundary condition, which acts like a fixedValue (nothing of the fluid goes out) for alpha values > 0.2. But if the alpha value is < 0.2 the boundary should let fluid out. Please let me know, if there is still something unclear. Best regards, Timucin 
Hi Philip,
thank you for the line: [I]valueFraction= symmTensor::zero; But this has not the effect that i need. I would like to implement an outlet boundary condition, which lets the fluid out, if the alpha value is < 0.2 and forbid the fluid to get out, if the value is > 0.2. Maybe i just have to include/add the alpha value somewhere in this line: valueFraction() = neg(phip)*(I  sqr(patch().nf())); But where do i have to change something in that line to achieve that kind of outlet boundary. in simple words: if alpha < 0.2 fluid can get out if alpha > 0.2 fluid can not get out Best regards, Timucin 
I am also interested in this topic. Currently I'm using source terms in the first cell layer next to the boundary, but this is problematic because it leads to the requirement to include additional source terms in the enthalpy equation and the handling of the momentum is also complicated. In my case, I know a specific evaporation/ablation rate in mass/area/time. Using the patch face areas this quantity can be converted to a mass source term. The question is how to include this in a boundary condition? It also needs to work with supersonic flows in my case.

Please help
Hey people,
Could someone please help, i am stuck in the problem i mentioned above. Best regards, Timucin 
Hey guys,
in the BC pressureNormalInletOutletVelocity.H there is written: A zerogradient condiion is applied for outflow..... What do i have to do if i want to switch between fixedValue and zeroGradient depending on the alpha value (interFoam)? In the BC freestream there is a switch between fixedValue and zeroGradient but i do not understand how it is done in detail and how i could use it for my problem with interFoam (and alpha values). In simple words: I need a BC for velocity which changes between fixedValue and zeroGradient depending on the alphaValue (interFoam)? Best regards, Timucin 
Quote:
You could do the following: Code:
forAll(*this, faceI) Philip 
Hi Philip,
thank you for your reply. Everythink you said works very good!!!! May I ask you one more thing? The absolut correct implementation I need would be to use “valueFraction = sqr(patch().nf())” in the forloop. But how do I have to add valueFraction = sqr(patch().nf()) in the forloop? Example: forAll (*this, faceI) { if (alpha[faceI] > 0.2) { valueFraction()[faceI] = sqr(patch().nf()); } else { valueFraction()[faceI] = symmTensor::zero; } } I can not compile this example. In the line “valueFraction()[faceI] = sqr(patch().nf()); “ there is a mistake. Have you got an idea? Best regards, Timucin 
Quote:
Try this: Code:
// Calculate and store face unit normals 
Hi Philip,
I will test it as soon as possible. Thank you for your reply once again. In the loop there you always wrote: refValue()[faceI] = vector(1,2,3); But which vector components do i have to use for my implementation? Isn't it correct to use a refValue like this: refValue()[faceI] = vector::zero; OR ( I think it is the same): refValue()[faceI] = vector(0,0,0); Best regards Timucin 
Quote:
Yes, this: Code:
refValue()[faceI] = vector::zero; Code:
refValue()[faceI] = vector(0,0,0); Code:
refValue()[faceI] = normalVelocity*nf[faceI]; Philip 
Hi Philip,
so when i use: valueFraction()[faceI] = sqr(nf[faceI]); Which refValue is correct or in other words which refValue correspond better to the valueFraction? >refValue()[faceI] = vector::zero; ? >refValue()[faceI] = normalVelocity*nf[faceI]; ? Timucin 
Hi Philip,
If i want a ''no slip'' boundary condition ( like in a normal fixedValueBC), which refvalue (See above) do i have to choose? Best regards Timucin 
Hi Philip,
If i use the pressureNormalInletOutletVelocity without changing it, it acts like a fixedValueBC. My question: How could i change this BC to switch between fixedValue and zeroGradient depending on the alpha value ? Thank you, Best regards Timucin 
Hi Phil,
everything works, thank you again. I have a question about the theoretical background of the directionMixedBC: 1) What does sqr(patch().nf()) do with the valueFraction, which components of the tensor(valueFraction) are modified? 2) What does valueFraction = symmTensor::zero do with the valueFraction. Does it make every component to zero? Best regards, Timucin 

Hi Phil,
that is great thank you. What in detail means sqr? How can sqr(patch().nf()) make a fixedvalue (valueFraction = (1 0 0 1 0 1)) ? Best regards, Timucin 
Quote:
"valueFraction = sqr(n)" means fixedValue in the "n" direction and fixedGradient in the two orthogonal directions. Philip 
so it is like this:
valueFraction()= sqr(n) = n*n so n*n leads to a valueFraction=(1 0 0 1 0 1) . I am really bad in mathematics so here is my question? If you multiply the normal vectors n*n , how does it change the valueFraction to (1 0 0 1 0 1)?? The valueFraction is a tensor, but the normal vector is a vector. Best regards, Timucin 
Quote:
It seems that you are a bit confused. Some info that might help clarify things for you: n*n does not equal (1 0 0 1 0 1). (1 0 0 1 0 1) is the identity tensor in symmetric tensor form i.e. (xx xy xz yy yz zz). valueFraction is a symmetric tensor not a tensor, hence it has 6 independent components, not 9. If the normal vector is (nx ny nz) then n*n (an outer product) is a symmetric tensor: (nx*nx nx*ny nx*nz ny*ny ny*nz nz*nz). To set valueFraction to (1 0 0 1 0 1): Code:
valueFraction() = symmTensor(1, 0, 0, 1, 0, 1); Philip 
Hi Phil,
how can (nx*nx nx*ny nx*nz ny*ny ny*nz nz*nz) set the normal component to fixedValue and the tangential components to fixedGradient? Best regards, Timucin 
Hi Phil,
do yo know how i could directly change the value of the velocity neighbour cells? I want to fix the neighbour cells to Zero. Accessing to a neigbour value is not the problem...but how can i directly change the value? Best regards, Timucin 
Hi Lokati,
I am also trying degassing outlet in bubble column. I don't have condition on alpha as you, so can simply use Slip BC for the liquid and pressureInletOutletVelocity BC for the gas at the degassing patch? Isn't combination of these two BCs indeed the degassing BC? 
Hi Jigar,
i understand you're problem, but it is different from mine, because you do not have alpha. I do not know how you can specify the BC for you're problem. My advice is that you just make a case with openFOAM and try out some things. This thread is very good for you i think, but i really don't know more about this BC. Best regards Timucin 
Dear Lokati,
Thanks for the reply. I'll make a test case and will get back with its details as well as the results (if any). Jigar 
All times are GMT 4. The time now is 06:53. 