CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

DirectionMixed mixed bc

Register Blogs Community New Posts Updated Threads Search

Like Tree78Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2019, 06:37
Default
  #61
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Pavithra View Post
Hello Everyone

I am unable to understand the mixed boundary condition clearly.

I have a vertical wall and I want to set the x-component of velocity to be u = 0 and y-component of velocity to be set as dv/dx = 0.

In order to achieve this, I have implemented the following

sideWall
{
type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (0 0 0 0 0 1);
}

but, when I plot I see non-zero values for the x-component.

Kindly, please help me.

With Thanks & Regards,
Pavithra.
Hi Pavithra,

To set the normal component to fixedValue and the two tangential components to fixedGradient, the valueFraction should be:
Code:
valueFraction = n*n
where 'n' are the unit normals.

Alternatively (your case), to set the normal component to fixedGradient and the two tangential components to fixedValue, the valueFraction should be:
Code:
valueFraction = I - n*n
In your case, n = (0 1 0), so the valueFraction should be:
Code:
    valueFraction                uniform (1 0 0 0 0 1);
Philip
Pavithra likes this.
bigphil is offline   Reply With Quote

Old   June 12, 2019, 09:19
Default
  #62
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi Pavithra,

To set the normal component to fixedValue and the two tangential components to fixedGradient, the valueFraction should be:
Code:
valueFraction = n*n
where 'n' are the unit normals.

Alternatively (your case), to set the normal component to fixedGradient and the two tangential components to fixedValue, the valueFraction should be:
Code:
valueFraction = I - n*n
In your case, n = (0 1 0), so the valueFraction should be:
Code:
    valueFraction                uniform (1 0 0 0 0 1);
Philip

Respected Sir,

Thank you so much for your kind reply and the detailed explanation.

In my case, I have a vertical wall. So, v and w are my tangential components and u is my normal component.

I wan to set dv/dx =0, dw/dx = 0 and u = 0.

i.e. I want to set fixed gradient for my tangential components and fixed value for my normal component.

Hence, I feel to set



Code:
valueFraction       uniform ( 0 0 1 0 0 0)
Sir, Please correct me if I am wrong.

With Thanks & Regards,
Pavithra.
Pavithra is offline   Reply With Quote

Old   June 12, 2019, 09:33
Default
  #63
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Pavithra,

It would be helpful if you could give the unit normal of this "vertical wall", as it is unclear what exactly you are referring to.

Philip
Pavithra likes this.
bigphil is offline   Reply With Quote

Old   June 12, 2019, 09:38
Default
  #64
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi Pavithra,

It would be helpful if you could give the unit normal of this "vertical wall", as it is unclear what exactly you are referring to.

Philip

Sir,



My wall is in yz-plane and the unit normal vector is (1 0 0)


Thank You.
Pavithra is offline   Reply With Quote

Old   June 12, 2019, 13:46
Default
  #65
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Pavithra View Post
Sir,



My wall is in yz-plane and the unit normal vector is (1 0 0)


Thank You.
In that case, n*n = (1 0 0 0 0 0), where the componets are (XX XY XZ YY YZ ZZ).

This will set Ux to zero and set dUy/dx and dUz/dx to zero.

Philip
Pavithra likes this.
bigphil is offline   Reply With Quote

Old   June 12, 2019, 20:46
Default
  #66
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by bigphil View Post
In that case, n*n = (1 0 0 0 0 0), where the componets are (XX XY XZ YY YZ ZZ).

This will set Ux to zero and set dUy/dx and dUz/dx to zero.

Philip
Sir, Thank you so much for your kind help.

- Pavithra
Pavithra is offline   Reply With Quote

Old   October 2, 2019, 01:12
Default
  #67
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Hello Everyone,

Back again here
I want to implement the following boundary condition on the horizontal walls of a 2-D square cavity.



\beta \frac{du_x}{dy} = (1-\beta)u_x


u_y = 0

The value of \beta varies from 0 to 1 in steps of 0.25.

I understand that when \beta = 0, the boundary condition becomes u_x = 0 and u_y = 0.

Also, when \beta = 1, the boundary condition becomes \frac{du_x}{dy} = 0 and u_y = 0.

I am able to achieve the above two cases using directionMixed boundary condition.

But I am unable to figure out how to set the boundary condition when \beta takes a value such as 0.25, 0.5 or 0.75.

For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x.

Kindly please give me some directions to implement this boundary condition.

Thank You.

With Thanks
Pavithra.
Pavithra is offline   Reply With Quote

Old   December 24, 2020, 05:01
Default
  #68
New Member
 
shiyu
Join Date: Mar 2018
Location: london
Posts: 9
Rep Power: 8
shiyu is on a distinguished road
Quote:
Originally Posted by Pavithra View Post
Hello Everyone,

Back again here
I want to implement the following boundary condition on the horizontal walls of a 2-D square cavity.



\beta \frac{du_x}{dy} = (1-\beta)u_x


u_y = 0

The value of \beta varies from 0 to 1 in steps of 0.25.

I understand that when \beta = 0, the boundary condition becomes u_x = 0 and u_y = 0.

Also, when \beta = 1, the boundary condition becomes \frac{du_x}{dy} = 0 and u_y = 0.

I am able to achieve the above two cases using directionMixed boundary condition.

But I am unable to figure out how to set the boundary condition when \beta takes a value such as 0.25, 0.5 or 0.75.

For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x.

Kindly please give me some directions to implement this boundary condition.

Thank You.

With Thanks
Pavithra.
Hi Pavithra,

I faced a very similar question, like yours. Have you figured out how to implement the boundary condition below?
[/QUOTE] For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x. [/QUOTE]

Thanks.

Best,
Shiyu
shiyu is offline   Reply With Quote

Old   December 24, 2020, 22:38
Default
  #69
Member
 
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7
Pavithra is on a distinguished road
Quote:
Originally Posted by shiyu View Post
Hi Pavithra,

I faced a very similar question, like yours. Have you figured out how to implement the boundary condition below?
For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x. [/QUOTE]

Thanks.

Best,
Shiyu[/QUOTE]


Hi Shiyu,



There is a boundary condition called "groovyBCDirection".



Thank You.
Pavithra is offline   Reply With Quote

Old   April 13, 2021, 04:13
Default
  #70
New Member
 
tom tony
Join Date: Oct 2018
Posts: 2
Rep Power: 0
tomtony is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi G. Paulo,


I occasionally use directionMixed for stress simulations where I want a fixedValue (displacement) in the patch normal direction and some fixedGradient (traction) in the patch tangential direction.

So to achieve a fixedValue in the normal direction, and a fixedGradient in the tangential direction on a patch, then the valueFraction (which is a symmTensor, where the components of a symmTensor are (xx xy xz yy yz zz) ) should be set:
valueFraction = symm(n*n)
where n is the patch normal.

If your patch faces all have the same normal then you can calculate symm(n*n) by hand and put it in your initial conditions, eg:
for a patch with n = ( 1 0 0 )
then the valueFraction = symm( (1 0 0)(1 0 0) ) = ( 1 0 0 0 0 0)
then refValue will be enforced in the patch normal direction and refGradient will be enforced in the patch tangential direction.

If your patch faces have all different normals then you will have to set the patch valueFraction in the solver (using refCast etc.) to be symm(n*n).

So to sum up, if you want a fixedValue in the patch normal direction and a fixedGradient in the patch tangential direction then it looks like this:
refValue uniform (fixed_value_you_want)
refGradient uniform (shear_gradient_you_want)
valueFraction uniform (symm(n*n))

directionMixed can also be used for other situations:
it can act just like a fixedValue BC if valueFraction = (1 0 0 1 0 1),

Or, it can act just like a fixedGradient BC if valueFraction = (0 0 0 0 0 0).

If you look at the directionMixed BC source code, you can see it calculates it.


Hope it helps,
Philip
Hi,Sir,your post give me a great help!

According to your post ,I want to set a boundary conditon.

the pacth is top wall ,I want to set dUz/dz = 5;

so n = (0,0,1),then I-n*n = (1 0 0 1 0 0),refrefGradient repressent the dU/dn,so refGradient = (0 0 5)
Code:
type				directionMixed;
		refValue uniform (0 0 0);
		refGradient uniform (0 0 5);
		valueFraction uniform (1 0 0 1 0 0);
That 's right?
tomtony is offline   Reply With Quote

Old   April 13, 2021, 13:17
Default
  #71
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi tomtony,

Yes that's correct, assuming you want Ux and Uy to be zero.

By the way, solvers (or paraview) may also want "value" to be define in the boundary condition, which corresponds to the current value on the patch e.g. the initial condition; you could just set this to the same value as refValue if you are not sure.

Philip
bigphil is offline   Reply With Quote

Old   December 12, 2021, 00:36
Default
  #72
Senior Member
 
mohammad
Join Date: Sep 2015
Posts: 281
Rep Power: 12
mostanad is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi tomtony,

Yes that's correct, assuming you want Ux and Uy to be zero.

By the way, solvers (or paraview) may also want "value" to be define in the boundary condition, which corresponds to the current value on the patch e.g. the initial condition; you could just set this to the same value as refValue if you are not sure.

Philip

Hi Philip,
I know you have answered to multiple questions about directionMixed. Your help was so useful for many about this BC. For me, I tried to figure out the valueFraction tensor I need for my case, but I think asking you is the best option for me.


As you see here, I have a normal vector (1 0 0). The difference is that I need to have two fixed value components, one in normal direction and another on one of the tangential directions. Finally, the remaining tangential direction should be fixedGradient. You can see this in the following image:





Code:
type                 directionMixed;
refValue             uniform (2 0 2);
refGradient          uniform (0 1 0);
valueFraction        uniform (1 0 0 0 0 1);
My concern is whether OF extracts the normal direction from the tensor? If yes, it might be possible for my case to be misunderstood by a n=(0 1 0).

So can you please check the values I considered for my case? How it detects the normal direction? Through valueFraction?


Cheers,
Mohammad

Last edited by mostanad; December 12, 2021 at 02:17.
mostanad is offline   Reply With Quote

Old   December 13, 2021, 09:11
Default
  #73
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Mohammad,

If I understand correctly, then yes your proposed valueFraction is correct. It will use fixedValue in the X and Z directions and fixedGradient in the Y direction.

As for "How it detects the normal direction?", I am not sure I understand your question; the normal directions are just taken directly from the mesh geometry. The valueFraction here is independent of the normals and it is up to you to define it appropriately. For example, if the normals were non-uniform on the patch then you may need to define the valueFraction field as non-uniform in order to enforce what ever condition you want.

Philip
mostanad likes this.
bigphil is offline   Reply With Quote

Old   December 13, 2021, 18:43
Default
  #74
Senior Member
 
mohammad
Join Date: Sep 2015
Posts: 281
Rep Power: 12
mostanad is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi Mohammad,

If I understand correctly, then yes your proposed valueFraction is correct. It will use fixedValue in the X and Z directions and fixedGradient in the Y direction.

As for "How it detects the normal direction?", I am not sure I understand your question; the normal directions are just taken directly from the mesh geometry. The valueFraction here is independent of the normals and it is up to you to define it appropriately. For example, if the normals were non-uniform on the patch then you may need to define the valueFraction field as non-uniform in order to enforce what ever condition you want.

Philip

OK. Good. So the normal direction comes from patch.nf and not be extracted by valueFraction.
Thank you for sharing you valuable information.
Cheers,
Mohammad
mostanad is offline   Reply With Quote

Old   April 4, 2023, 13:06
Default
  #75
Member
 
Ching Liu
Join Date: Sep 2017
Posts: 52
Rep Power: 9
qingqingliu is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Hi G. Paulo,


I occasionally use directionMixed for stress simulations where I want a fixedValue (displacement) in the patch normal direction and some fixedGradient (traction) in the patch tangential direction.

So to achieve a fixedValue in the normal direction, and a fixedGradient in the tangential direction on a patch, then the valueFraction (which is a symmTensor, where the components of a symmTensor are (xx xy xz yy yz zz) ) should be set:
valueFraction = symm(n*n)
where n is the patch normal.

If your patch faces all have the same normal then you can calculate symm(n*n) by hand and put it in your initial conditions, eg:
for a patch with n = ( 1 0 0 )
then the valueFraction = symm( (1 0 0)(1 0 0) ) = ( 1 0 0 0 0 0)
then refValue will be enforced in the patch normal direction and refGradient will be enforced in the patch tangential direction.

If your patch faces have all different normals then you will have to set the patch valueFraction in the solver (using refCast etc.) to be symm(n*n).

So to sum up, if you want a fixedValue in the patch normal direction and a fixedGradient in the patch tangential direction then it looks like this:
refValue uniform (fixed_value_you_want)
refGradient uniform (shear_gradient_you_want)
valueFraction uniform (symm(n*n))

directionMixed can also be used for other situations:
it can act just like a fixedValue BC if valueFraction = (1 0 0 1 0 1),

Or, it can act just like a fixedGradient BC if valueFraction = (0 0 0 0 0 0).

If you look at the directionMixed BC source code, you can see it calculates it.


Hope it helps,
Philip
Hi Philip,
I saw you have answered many questions about directionMixed. Based on my understanding of directMixed condition, I set up it for my case. I think you are the right person to ask if my setup is correct or not.
Here is my case:
Normal vector: (0 1 0)
Velocity vector: (Vx, Vy, Vz)
I want to set Vx = 0, dVy/dn = 0, and dVz/dn = 0. Below is my setup, do you think it is right?

type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (1 0 0 0 0 0);

Thanks for your help!!!
qingqingliu is offline   Reply With Quote

Old   April 5, 2023, 08:19
Default
  #76
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by qingqingliu View Post
Hi Philip,
I saw you have answered many questions about directionMixed. Based on my understanding of directMixed condition, I set up it for my case. I think you are the right person to ask if my setup is correct or not.
Here is my case:
Normal vector: (0 1 0)
Velocity vector: (Vx, Vy, Vz)
I want to set Vx = 0, dVy/dn = 0, and dVz/dn = 0. Below is my setup, do you think it is right?

type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (1 0 0 0 0 0);

Thanks for your help!!!
Yes, that looks correct.

After running the model, I suggest you check the boundary conditions are enforced as you expect, e.g. check Vx on the patch, and plot Vy and Vz away from the wall to check the gradient is zero.
bigphil is offline   Reply With Quote

Old   April 5, 2023, 11:27
Default
  #77
Member
 
Ching Liu
Join Date: Sep 2017
Posts: 52
Rep Power: 9
qingqingliu is on a distinguished road
Quote:
Originally Posted by bigphil View Post
Yes, that looks correct.

After running the model, I suggest you check the boundary conditions are enforced as you expect, e.g. check Vx on the patch, and plot Vy and Vz away from the wall to check the gradient is zero.
Hi Philip,

Thanks so much for your reply!
qingqingliu is offline   Reply With Quote

Reply


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
mixed difference Shuo Main CFD Forum 1 September 3, 2008 02:25
mixed convection sumesh FLUENT 0 March 7, 2008 01:00
Mixed CPU/GPU computing Joe Main CFD Forum 4 September 20, 2006 13:04
Direction mixed bc evgenii OpenFOAM Pre-Processing 1 November 30, 2005 05:37
mixed convection raj calay Main CFD Forum 6 April 21, 1999 23:33


All times are GMT -4. The time now is 18:53.