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

fixedShearStress b.c., Un = 0?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2018, 07:26
Default fixedShearStress b.c., Un = 0?
  #1
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Hi,

Does the fixedshearstress B.C. set the patch normal component of velocity Un to 0? Could someone guide me the math of this B.C. and explain the formula in the source code?

regards,
cfdopenfoam is offline   Reply With Quote

Old   June 25, 2018, 04:10
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
From the description in the header file: Set a constant shear stress as tau0 = -nuEff dU/dn.


it is derived from th3 fixedValueFvPatchVectorField. That means it sets the value at the boundary.


rearrangin tau0 = -nuEff dU/dn gives:



operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc)));


vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL); -> unit vector in direction of the shear


tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc)) -> consider only shearstress (i.e. the shear in direction of tau0_ and exclude normal stress)



(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc))); -> update velocity components only in direction of tau0_


i hope the explanation is understandeble.
mAlletto is offline   Reply With Quote

Old   June 25, 2018, 07:50
Default
  #3
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
From the description in the header file: Set a constant shear stress as tau0 = -nuEff dU/dn.


it is derived from th3 fixedValueFvPatchVectorField. That means it sets the value at the boundary.


rearrangin tau0 = -nuEff dU/dn gives:



operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc)));


vector tauHat = tau0_/(mag(tau0_) + ROOTVSMALL); -> unit vector in direction of the shear


tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc)) -> consider only shearstress (i.e. the shear in direction of tau0_ and exclude normal stress)



(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc))); -> update velocity components only in direction of tau0_


i hope the explanation is understandeble.
Thank you for your explanation, Michael. A few more questions:

1) how does the negative "-" comes from in tau0 = -nuEff dU/dn? As I see in textbooks, its like tau0 = nuEff dU/dy.



2) look back to my original question, does this B.C. set Un to 0? I see a lot of code doing mathmatical operations like this:

const vectorField nHat(this->patch().nf()); // get patch normal vector (unit) and do the following
nHat*(nHat & U)

could you please explain what we can get from the above formula and what is the result? Is it giving the patch-normal component of U? and how? I cannot understand this formula mathmatically.




3) Also, we see the following at a lot of place:

transform(I - sqr(nHat), this->patchInternalField()) // see all mentioned code in fixedNormalSlipFvPatchField.C

Does this give us the component of patchInternalField() parallel to the patch?

So many questions. Thank you for your patience.
cfdopenfoam is offline   Reply With Quote

Old   June 25, 2018, 14:25
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough

1) how does the negative "-" comes from in tau0 = -nuEff dU/dn? As I see in textbooks, its like tau0 = nuEff dU/dy.



The minus sign comes from the fact the the boundary conditions applied model the shear force exerted by the boundary on the fluid. If someone wants to calculate the force exerted by the fluid on the boundary the plus sign is the correct sign.


2) look back to my original question, does this B.C. set Un to 0? I see a lot of code doing mathmatical operations like this:

It does not set the velocity Un to zero. This boundary condition only imposes the velocty components parallel to the patch and extrapolates the components normal to the patch from the cell centre next to the boundary.


const vectorField nHat(this->patch().nf()); // get patch normal vector (unit) and do the following
nHat*(nHat & U)

could you please explain what we can get from the above formula and what is the result? Is it giving the patch-normal component of U? and how? I cannot understand this formula mathmatically.


this-> patch().nf() returns the list of face normal vectors at the boundary

nHat*(nHat & U) is the flow velocity component in the direction of the face normal.


nHat & U is the dot product between the velocity at the boundary and the face normals (it gives the projection of U in patch normal direction).

by multiplying the projection of U in patch normal direction with the patch normal vector you get the component of U in direction of the patch normal.



3) Also, we see the following at a lot of place:

transform(I - sqr(nHat), this->patchInternalField()) // see all mentioned code in fixedNormalSlipFvPatchField.C

Does this give us the component of patchInternalField() parallel to the patch?

So many questions. Thank you for your patience.


I cannot find the above code in the newer OF version (4.x or 5.x) which one are you using.
mAlletto is offline   Reply With Quote

Old   June 26, 2018, 07:48
Default
  #5
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by mAlletto View Post

1) how does the negative "-" comes from in tau0 = -nuEff dU/dn? As I see in textbooks, its like tau0 = nuEff dU/dy.



The minus sign comes from the fact the the boundary conditions applied model the shear force exerted by the boundary on the fluid. If someone wants to calculate the force exerted by the fluid on the boundary the plus sign is the correct sign.


2) look back to my original question, does this B.C. set Un to 0? I see a lot of code doing mathmatical operations like this:

It does not set the velocity Un to zero. This boundary condition only imposes the velocty components parallel to the patch and extrapolates the components normal to the patch from the cell centre next to the boundary.


const vectorField nHat(this->patch().nf()); // get patch normal vector (unit) and do the following
nHat*(nHat & U)

could you please explain what we can get from the above formula and what is the result? Is it giving the patch-normal component of U? and how? I cannot understand this formula mathmatically.


this-> patch().nf() returns the list of face normal vectors at the boundary

nHat*(nHat & U) is the flow velocity component in the direction of the face normal.


nHat & U is the dot product between the velocity at the boundary and the face normals (it gives the projection of U in patch normal direction).

by multiplying the projection of U in patch normal direction with the patch normal vector you get the component of U in direction of the patch normal.



3) Also, we see the following at a lot of place:

transform(I - sqr(nHat), this->patchInternalField()) // see all mentioned code in fixedNormalSlipFvPatchField.C

Does this give us the component of patchInternalField() parallel to the patch?

So many questions. Thank you for your patience.


I cannot find the above code in the newer OF version (4.x or 5.x) which one are you using.

Thank you very much, Michael. I may have different views into these questions. Pls correct me if I am wrong anywhere.


For question 1), as said, tau0 = -nuEff dU/dn. I think the minus sign comes from the fact that n (vector) is the out-pointing normal vector from the patch face, and so is dn.

In many textbooks, we see tau0 = nuEff dU/dy because y is pointing into the fluid region. In this context, tau0 = nuEff dU/dy and dU = U_y - U_y0 and dy = y - y0.

When using tau0 = -nuEff dU/dn, there should be dU = U_cell - U_patch and dn = point_face - point_cell such that the minus sign is needed.



For question 2), I guess the fixedShearStress b.c. forces Un = 0.

Firstly, this b.c. is in group of grpWallBoundaryConditions (see fixedShearStressFvPatchVectorField.H). From the word "wall", I guess this b.c. is for patch of a wall type.

Secondly, following question 1), (tau0_*(1.0/(ry*nuEff)) + Uc) gives U_patch. Then tauHat*(tauHat & U_patch) gives U_patch component in the direction of tauHat (or parallel to the patch face if tau0_ is parallel to the patch face).

At last operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc))) only sets the velocity at patch to be in the direction of tau0_ and Un will be zero if tau0_ is parallel to the patch face.



For question 3), I am using OF-2.3.0. I've checked. You can see this piece of code in fixedNormalSlipFvPatchField.C (void Foam::fixedNormalSlipFvPatchField<Type>::evaluate( )), even in 5.x.
cfdopenfoam is offline   Reply With Quote

Old   June 26, 2018, 12:29
Default
  #6
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
For question 1), as said, tau0 = -nuEff dU/dn. I think the minus sign comes from the fact that n (vector) is the out-pointing normal vector from the patch face, and so is dn.

In many textbooks, we see tau0 = nuEff dU/dy because y is pointing into the fluid region. In this context, tau0 = nuEff dU/dy and dU = U_y - U_y0 and dy = y - y0.

When using tau0 = -nuEff dU/dn, there should be dU = U_cell - U_patch and dn = point_face - point_cell such that the minus sign is needed.




Of course the sign of tau0 = -nuEff dU/dn. depends on where the normal vector is pointing. In classical textbook the expression tau0 = nuEff dU / dy is the force exerted by the fluid on the wall. If you think of a Couette flow which is flowing in x direction and the velocity is increasing in y direction (the bottom wall) tau0 points in positive x direction, hence it is the force exerted by the fluid on the wall.





For question 2), I guess the fixedShearStress b.c. forces Un = 0.

Firstly, this b.c. is in group of grpWallBoundaryConditions (see fixedShearStressFvPatchVectorField.H). From the word "wall", I guess this b.c. is for patch of a wall type.

Secondly, following question 1), (tau0_*(1.0/(ry*nuEff)) + Uc) gives U_patch. Then tauHat*(tauHat & U_patch) gives U_patch component in the direction of tauHat (or parallel to the patch face if tau0_ is parallel to the patch face).

At last operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc))) only sets the velocity at patch to be in the direction of tau0_ and Un will be zero if tau0_ is parallel to the patch face.

You're right: i oversee a bracket. the dot product tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc) leads to a zero component in the direction normal to tauHat. Hence the velocity in this direction is set to zero.

For question 3), I am using OF-2.3.0. I've checked. You can see this piece of code in fixedNormalSlipFvPatchField.C (void Foam::fixedNormalSlipFvPatchField<Type>::evaluate( )), even in 5.x.[/QUOTE]


I thought we where talking about fixedShearStressFvPatchVectorField.C
mAlletto is offline   Reply With Quote

Old   June 27, 2018, 08:06
Default
  #7
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
For question 1), as said, tau0 = -nuEff dU/dn. I think the minus sign comes from the fact that n (vector) is the out-pointing normal vector from the patch face, and so is dn.

In many textbooks, we see tau0 = nuEff dU/dy because y is pointing into the fluid region. In this context, tau0 = nuEff dU/dy and dU = U_y - U_y0 and dy = y - y0.

When using tau0 = -nuEff dU/dn, there should be dU = U_cell - U_patch and dn = point_face - point_cell such that the minus sign is needed.




Of course the sign of tau0 = -nuEff dU/dn. depends on where the normal vector is pointing. In classical textbook the expression tau0 = nuEff dU / dy is the force exerted by the fluid on the wall. If you think of a Couette flow which is flowing in x direction and the velocity is increasing in y direction (the bottom wall) tau0 points in positive x direction, hence it is the force exerted by the fluid on the wall.





For question 2), I guess the fixedShearStress b.c. forces Un = 0.

Firstly, this b.c. is in group of grpWallBoundaryConditions (see fixedShearStressFvPatchVectorField.H). From the word "wall", I guess this b.c. is for patch of a wall type.

Secondly, following question 1), (tau0_*(1.0/(ry*nuEff)) + Uc) gives U_patch. Then tauHat*(tauHat & U_patch) gives U_patch component in the direction of tauHat (or parallel to the patch face if tau0_ is parallel to the patch face).

At last operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc))) only sets the velocity at patch to be in the direction of tau0_ and Un will be zero if tau0_ is parallel to the patch face.

You're right: i oversee a bracket. the dot product tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc) leads to a zero component in the direction normal to tauHat. Hence the velocity in this direction is set to zero.

For question 3), I am using OF-2.3.0. I've checked. You can see this piece of code in fixedNormalSlipFvPatchField.C (void Foam::fixedNormalSlipFvPatchField<Type>::evaluate( )), even in 5.x.

I thought we where talking about fixedShearStressFvPatchVectorField.C[/QUOTE]

Thank you for your help, Michael. Now clear. Hope discussion here would help someone else.
cfdopenfoam is offline   Reply With Quote

Old   July 5, 2018, 00:27
Default
  #8
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
For question 1), as said, tau0 = -nuEff dU/dn. I think the minus sign comes from the fact that n (vector) is the out-pointing normal vector from the patch face, and so is dn.

In many textbooks, we see tau0 = nuEff dU/dy because y is pointing into the fluid region. In this context, tau0 = nuEff dU/dy and dU = U_y - U_y0 and dy = y - y0.

When using tau0 = -nuEff dU/dn, there should be dU = U_cell - U_patch and dn = point_face - point_cell such that the minus sign is needed.




Of course the sign of tau0 = -nuEff dU/dn. depends on where the normal vector is pointing. In classical textbook the expression tau0 = nuEff dU / dy is the force exerted by the fluid on the wall. If you think of a Couette flow which is flowing in x direction and the velocity is increasing in y direction (the bottom wall) tau0 points in positive x direction, hence it is the force exerted by the fluid on the wall.





For question 2), I guess the fixedShearStress b.c. forces Un = 0.

Firstly, this b.c. is in group of grpWallBoundaryConditions (see fixedShearStressFvPatchVectorField.H). From the word "wall", I guess this b.c. is for patch of a wall type.

Secondly, following question 1), (tau0_*(1.0/(ry*nuEff)) + Uc) gives U_patch. Then tauHat*(tauHat & U_patch) gives U_patch component in the direction of tauHat (or parallel to the patch face if tau0_ is parallel to the patch face).

At last operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc))) only sets the velocity at patch to be in the direction of tau0_ and Un will be zero if tau0_ is parallel to the patch face.

You're right: i oversee a bracket. the dot product tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc) leads to a zero component in the direction normal to tauHat. Hence the velocity in this direction is set to zero.

For question 3), I am using OF-2.3.0. I've checked. You can see this piece of code in fixedNormalSlipFvPatchField.C (void Foam::fixedNormalSlipFvPatchField<Type>::evaluate( )), even in 5.x.

I thought we where talking about fixedShearStressFvPatchVectorField.C[/QUOTE]


Hi,I got one more question for the fixedShearStress boundary condition. Hope you could help. Its about nuEff in tau0 = -nuEff dU/dn. I think we should use nuEff at said patch. However from the source it does not look like in that way. See line 112.

scalarField nuEff(turbModel.nuEff(patch().index())); // what does patch().index() give us? Does this mean we use nuEff at patch connected cell?

Should not it be something like:

const fvPatchField<scalar>& nuEff =
patch().lookupPatchField<volScalarField, scalar>("nuEff");

Any hints?
cfdopenfoam is offline   Reply With Quote

Old   July 5, 2018, 02:22
Default
  #9
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
patch().index() gives back the index of this patch in the boundary mesh.



https://www.openfoam.com/documentati...732edc13c119c7
mAlletto is offline   Reply With Quote

Old   July 5, 2018, 02:26
Default
  #10
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
the call you described probably works too, since it it used also in https://www.openfoam.com/documentati...ce.html#l00104


so probably bath ways to assess the values of a given field at a given patch is works. I actually never tried it out. The best would be to write both commands in an on boundary condition and try it out if the list of values they give back are actually the same
mAlletto is offline   Reply With Quote

Old   July 10, 2018, 10:28
Default
  #11
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
patch().index() gives back the index of this patch in the boundary mesh.



https://www.openfoam.com/documentati...732edc13c119c7
Thank you so much for your discussion here. One more question for fixedShearStress B.C. in fixedShearStressFvPatchVectorField.C.

In Eqn tau0 = -nuEff dU/dn, from the source code (of-2.3.0) I see it uses the Kinematic viscosity. Should not it be the dynamic viscosity?

Correct me if I am wrong anywhere.
cfdopenfoam is offline   Reply With Quote

Old   July 10, 2018, 16:39
Default
  #12
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
this is because for the incompressible solvers the equations solved are divided by the density. Hence you get the kinematic viscosity.
mAlletto is offline   Reply With Quote

Old   July 11, 2018, 00:40
Default
  #13
Member
 
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11
cfdopenfoam is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
this is because for the incompressible solvers the equations solved are divided by the density. Hence you get the kinematic viscosity.
Do you mean the shear stress, tau0_ to be specified, has been divided by the density? If it is, we should be careful to specify the value of tau0_ because physically its tau/rho.
cfdopenfoam is offline   Reply With Quote

Old   July 11, 2018, 02:05
Default
  #14
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Exactly. Since for the incompressible solvers the momentum equation is divided by the density, it is tau_0/rho which has to be specified.
mAlletto 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
partial slip b.c., convergence issues Saideep OpenFOAM Running, Solving & CFD 3 August 2, 2016 09:18
Heat transfer over prediction in coupled b.c. meriam_1260 FLUENT 0 February 20, 2014 10:29
Urgent! Help on UDF to set B.C. of 3rd type Ray Hong FLUENT 0 December 28, 2005 19:35
How to set B.C. of the 2nd or 3rd type in UDS? Ray Hong FLUENT 0 December 28, 2005 06:03
Non-Reflecting B.C. in NSC2KE Zou Chu Main CFD Forum 2 May 27, 1999 21:26


All times are GMT -4. The time now is 00:23.