CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   fixedValue BC with zeroGradient (https://www.cfd-online.com/Forums/openfoam-programming-development/227837-fixedvalue-bc-zerogradient.html)

Gerry Kan June 11, 2020 12:39

fixedValue BC with zeroGradient
 
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 June 12, 2020 03:42

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.

Steve80 July 11, 2020 06:54

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 July 11, 2020 08:24

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 (Post 777497)
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 July 12, 2020 14:57

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

shuxuejia August 21, 2020 23:41

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 August 23, 2020 16:59

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


All times are GMT -4. The time now is 12:14.