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

fixedValue BC with zeroGradient

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

Like Tree2Likes
  • 2 Post By shuxuejia

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 11, 2020, 12:39
Default fixedValue BC with zeroGradient
  #1
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10
Gerry Kan is on a distinguished road
Howdy Foamers:

Lately I have been thinking about implementing a sort of boundary condition that allows me to specify a fixed value at the boundary, but at the same time with zero shear stress, similar to ehat happens at a free surface.

My 'classical' training tells me that such discretization is not possible, but based on a simple analysis, I should be able to produce a non-trivial solution without over- or under-constraining my system of equations.

Is there a type of BC in OF that I could derive my implementation on?

Thanks in advance, Gerry.
Gerry Kan is offline   Reply With Quote

Old   June 12, 2020, 03:42
Default
  #2
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10
Gerry Kan is on a distinguished road
Last night I have been looking into how boundary conditions are applied in OpenFOAM in more detail (particularly the mixed boundary condition).

I notice that each BC has four common functions:

- valueInternalCoeffs
- valueBoundaryCoeffs
- gradientInternalCoeffs
- gradientBoundaryCoeffs

Based on the description, the terms "Internal" and "Boundary" refers to the matrix and source term side of the linearized equation coefficients.

What I don't know if whether the "value" and "gradient" member functions have to be mutually exclusive. That is, if I use one set, I cannot use another and, if I wish to use them both together, I need to "blend" them, for example the weighting factor in the mixed boundary condition?

Thanks, Gerry.
Gerry Kan is offline   Reply With Quote

Old   July 11, 2020, 06:54
Default
  #3
New Member
 
Stephan
Join Date: Aug 2017
Posts: 6
Rep Power: 8
Steve80 is on a distinguished road
Hi Gerry, what you could do is to set the nu, nut values to zero at the boundary face. I use this trick to prevent diffusion of species through an inlet patch, where a fixed concentration is specified, but transient value of the mass flow rate can be zero.
Best regards
Stephan
Steve80 is offline   Reply With Quote

Old   July 11, 2020, 08:24
Default
  #4
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 347
Rep Power: 10
Gerry Kan is on a distinguished road
Hello Stephen:

Thanks for the tip. To be honest I haven't thought about such approach, and I think that should work. One question for you, though. Did you do this only on RANS turbulence model, or did you also try this on LES and DNS and got the desired result you had.

Again thanks, Gerry.

Quote:
Originally Posted by Steve80 View Post
Hi Gerry, what you could do is to set the nu, nut values to zero at the boundary face. I use this trick to prevent diffusion of species through an inlet patch, where a fixed concentration is specified, but transient value of the mass flow rate can be zero.
Best regards
Stephan
Gerry Kan is offline   Reply With Quote

Old   July 12, 2020, 14:57
Default
  #5
New Member
 
Stephan
Join Date: Aug 2017
Posts: 6
Rep Power: 8
Steve80 is on a distinguished road
Hi Gerry, so far I only used it with RANS. You can set the molecular viscosity to zero, but I don’t know whether it is possible to suppress the turbulent fluctuations as well on a boundary face.
Good luck ;-)
Kind regards
Stephan
Steve80 is offline   Reply With Quote

Old   August 21, 2020, 23:41
Default
  #6
New Member
 
dp
Join Date: Jul 2020
Posts: 6
Rep Power: 5
shuxuejia is on a distinguished road
Hello,
I used this method: First set fixedValue BC with value 0. Then use fvOptions FixedValueConstraint to set value 0 in the adjacent cell of the BC.
shuxuejia is offline   Reply With Quote

Old   August 23, 2020, 16:59
Lightbulb
  #7
New Member
 
dp
Join Date: Jul 2020
Posts: 6
Rep Power: 5
shuxuejia is on a distinguished road
Hello,
For the four functions, a book titled The Finite Volume Method in Computational Fluid Dynamics An Advanced Introduction with OpenFOAM and Matlab has clear introduction. You can refer to Chapter 18, Boundary Conditions in OpenFOAM and uFVM.
Here I can excerpt some useful information:

To write a new boundary condition it is essential to understand the role of five main functions, namely, updateCoeffs, valueInternalCoeffs, valueBoundaryCoeffs, gradientInternalCoeffs, and gradientBoundaryCoeffs. updateCoeffs: This member function is responsible for the explicit update of the values at the boundary face centers. The function is called whenever the patch field values need to be updated iteratively.

With updateCoeffs() the values at the face centroids are set explicitly as for a Dirichlet condition. However the other functions, valueInternalCoeffs, value BoundaryCoeffs, gradientInternalCoeffs, and gradientBoundaryCoeffs are used to linearize the boundary condition in order to complement the updateCoeffs() function.
The valueInternalCoeffs and valueBoundaryCoeffs are generally used to linearize the boundary condition for a divergence operator since for that operator the value at the patch faces is needed. On the other hand, the gradientInternalCoeffs and gradientBoundaryCoeffs are used to linearize the boundary condition for a laplace type operator since for that operator the gradient at the patch faces is needed.

For a Neumann (zeroFlux) boundary condition and assuming an orthogonal mesh, the value of the boundary patch is equal to the value of the boundary element since the normal gradient should be equal to zero. For the divergence term where the boundary patch value will be needed, the specified value at the boundary patch is written in term of the valueInternalCoeffs and valueBoundaryCoeffs, which represent the linearization of the boundary element value and its non-linearizable part, respectively. For the laplacian operator, the gradient at the boundary is needed. In this case the gradient at the boundary patch is set to zero (zeroFlux). This is done through the use of the gradient linearization.

A summary of the value of the coefficients used to implement a zeroFlux boundary condition is
Neumann (zero order)...........Diagonal Coeff.............Source term
Divergence...........................Value(1)..... ................0
Laplacian .............................0.................... ...........0

A summary of the coefficient values to Dirichlet boundary condition is
Dirichlet............................Diagonal Coeff...........Source term
Divergence........................0............... ..............Boundary value
Laplacian...........................Delta......... ..............Boundary value and delta
Gerry Kan and davcrisp like this.
shuxuejia is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
change boundary condition when switching solver Virtual-iCFD OpenFOAM Running, Solving & CFD 3 August 14, 2019 05:02
rSF: p divergence in combustor (wt negative value) zonda OpenFOAM Pre-Processing 4 April 10, 2018 06:59
uniformTotalPressure BC problems Slanth OpenFOAM 2 January 12, 2015 02:04
[swak4Foam] Air Conditioned room groovyBC Sebaj OpenFOAM Community Contributions 7 October 31, 2012 14:16
Pressure instability with rhoSimpleFoam daniel_mills OpenFOAM Running, Solving & CFD 44 February 17, 2011 17:08


All times are GMT -4. The time now is 01:11.