CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Degassing Boundary Condition

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2016, 04:11
Default Degassing Boundary Condition
  #1
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
Hey guys,


i am using interFoam and i want to implement a very simple degassing boundary condition.
I would like to use pressureInletOuteltVelocity-BC or inletOutlet-BC or directionMixed-BC.
I want an outlet-BC which only lets the fluid (Gas and Liquid) out, if the alpha-value 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
Zhiheng Wang likes this.
Lokati is offline   Reply With Quote

Old   February 14, 2016, 08:47
Default Detail information/example
  #2
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
For example pressureInletOutletVelocity:

The main Part ist this:
************************************************** **********

void Foam:ressureInletOutletVelocityFvPatchVectorFiel 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:ressureInletOutletVelocityFvPatchVectorFiel 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
Zhiheng Wang likes this.
Lokati is offline   Reply With Quote

Old   February 15, 2016, 06:40
Default
  #3
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
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:
Originally Posted by Lokati View Post
[code]
...

forAll(*this, i)
{
if (alpha1[i] < 0.2)
{
valueFraction[i]= symmTensor::zero;
}
}

...

// but this line would overwrite the valueFraction...
valueFraction() = neg(phip)*(I - sqr(patch().nf()));

directionMixedFvPatchVectorField::updateCoeffs();
directionMixedFvPatchVectorField::evaluate();
}
Philip
bigphil is offline   Reply With Quote

Old   February 15, 2016, 07:01
Default
  #4
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
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
Lokati is offline   Reply With Quote

Old   February 15, 2016, 09:09
Default
  #5
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
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
Lokati is offline   Reply With Quote

Old   February 15, 2016, 11:06
Default
  #6
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
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.
chriss85 is offline   Reply With Quote

Old   February 18, 2016, 05:28
Smile Please help
  #7
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
Hey people,

Could someone please help, i am stuck in the problem i mentioned above.

Best regards,
Timucin
Zhiheng Wang likes this.
Lokati is offline   Reply With Quote

Old   February 24, 2016, 10:29
Default
  #8
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
Hey guys,

in the BC pressureNormalInletOutletVelocity.H there is written:
A zero-gradient 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
Lokati is offline   Reply With Quote

Old   February 24, 2016, 16:23
Default
  #9
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Lokati View Post
Hey guys,

in the BC pressureNormalInletOutletVelocity.H there is written:
A zero-gradient 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
Hi,

You could do the following:
Code:
forAll(*this, faceI)
{
    if (alpha[faceI] > 0.2)
    {
        // Set face to fixedValue in all three directions
        valueFraction()[faceI] = I;

        // Set fixedValue on the face to whatever you like
        refValue()[faceI] = vector(1,2,3);
    }
    else
    {
        // Set face to fixedGradient in all three directions
        valueFraction()[faceI] = symmTensor::zero;

        // Set fixedGradient on the face to whatever you like (zero if you like)
        refGrad()[faceI] = vector::zero;
    }
}
Note: if you wanted to set the normal component of velocity as opposed to the entire vector, you can set valueFraction to "sqr(patch().nf())": this would set the normal component to fixedValue and the tangential components would be fixedGradient. The valueFraction lets you blend between fixedValue and fixedGradient.

Philip
Lokati likes this.
bigphil is offline   Reply With Quote

Old   February 25, 2016, 10:15
Default
  #10
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
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 for-loop.
But how do I have to add valueFraction = sqr(patch().nf()) in the for-loop?

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
Lokati is offline   Reply With Quote

Old   February 25, 2016, 11:17
Default
  #11
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Lokati View Post
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 for-loop.
But how do I have to add valueFraction = sqr(patch().nf()) in the for-loop?

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
Timucin,

Try this:
Code:
// Calculate and store face unit normals
const vectorField nf = patch().nf();

forAll(*this, faceI)
{
    if (alpha[faceI] > 0.2)
    {
        // Set face to fixedValue in normal direction
        valueFraction()[faceI] = sqr(nf[faceI]);

        // Set fixedValue on the face to whatever you like
        // Note: only the normal component of this vector is actually used
        refValue()[faceI] = vector(1,2,3);
    }
    else
    {
        // Set face to fixedGradient in all three directions
        valueFraction()[faceI] = symmTensor::zero;

        // Set fixedGradient on the face to whatever you like (zero if you like)
        refGrad()[faceI] = vector::zero;
    }
}
Philip
bigphil is offline   Reply With Quote

Old   February 25, 2016, 13:10
Default
  #12
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
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
Lokati is offline   Reply With Quote

Old   February 25, 2016, 13:39
Default
  #13
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Lokati View Post
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
Hi Timucin,

Yes, this:
Code:
refValue()[faceI] = vector::zero;
is the same as this:
Code:
refValue()[faceI] = vector(0,0,0);
If you want to set the normal velocity then you could do this:
Code:
refValue()[faceI] = normalVelocity*nf[faceI];
where "normalVelocity" is the scalar normal velocity you would like to set.

Philip
bigphil is offline   Reply With Quote

Old   February 25, 2016, 13:48
Default
  #14
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
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
Lokati is offline   Reply With Quote

Old   February 26, 2016, 01:22
Default
  #15
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
Hi Philip,

If i want a ''no slip'' boundary condition ( like in a normal fixedValue-BC), which refvalue (See above) do i have to choose?

Best regards
Timucin
Lokati is offline   Reply With Quote

Old   February 26, 2016, 03:32
Default
  #16
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
Hi Philip,

If i use the pressureNormalInletOutletVelocity without changing it, it acts like a fixedValue-BC.

My question:
How could i change this BC to switch between fixedValue and zeroGradient depending on the alpha value ?

Thank you,

Best regards
Timucin
Lokati is offline   Reply With Quote

Old   March 22, 2016, 03:19
Default
  #17
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
Hi Phil,

everything works, thank you again.
I have a question about the theoretical background of the directionMixed-BC:

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
Lokati is offline   Reply With Quote

Old   March 22, 2016, 06:34
Default
  #18
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Timucin,

Please see this post.

Philip
bigphil is offline   Reply With Quote

Old   March 22, 2016, 06:45
Default
  #19
New Member
 
Timucin Kislak
Join Date: Feb 2016
Location: Germany
Posts: 20
Rep Power: 10
Lokati is on a distinguished road
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
Lokati is offline   Reply With Quote

Old   March 22, 2016, 06:49
Default
  #20
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,093
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Lokati View Post
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
"sqr" means square i.e. "sqr(n) = n*n"

"valueFraction = sqr(n)" means fixedValue in the "n" direction and fixedGradient in the two orthogonal directions.

Philip
Zhiheng Wang likes this.
bigphil is offline   Reply With Quote

Reply

Tags
boundary, degas, interfoam, openfoam, outlet


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 03:53
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 07:49


All times are GMT -4. The time now is 16:50.