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

Boundary condition with value, gradient and constant/source term

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By abhishekmonu96`

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 25, 2022, 15:03
Default Boundary condition with value, gradient and constant/source term
  #1
New Member
 
Arman N
Join Date: Mar 2019
Posts: 13
Rep Power: 7
Arman_N is on a distinguished road
Hello everyone,

I need to implement a boundary condition which is a combination of the value and gradient of a parameter with a constant/source term.
For example, for parameter Y the desired equation at boundary is as follows:

c_{1}\nabla Y + c_{2}Y = c_{3}

where c_{1}, c_{2}, and c_{3} are constants.

I wanted to know if there is any BC already available in openFoam for this purpose and if not, how can this be achieved.

*PS: I know this can be somehow implemented using the mixed BC when c_{3} = 0, but I need the more general approach.

Any hint is appreciated.

Arman
Arman_N is offline   Reply With Quote

Old   February 1, 2022, 11:27
Default
  #2
New Member
 
Join Date: May 2021
Posts: 5
Rep Power: 5
abhishekmonu96` is on a distinguished road
Hi Arman,
You can achieve this by using codeStream. Use codedFixedValue, include necesary libraries and <#include "fvCFD.H"> in the required header files. You can use most of the functions provided in openfoam by this BC.
Here is the link for template:
https://www.openfoam.com/documentati...xed-value.html
Arman_N likes this.
abhishekmonu96` is offline   Reply With Quote

Old   February 5, 2022, 07:43
Default Solved!
  #3
New Member
 
Arman N
Join Date: Mar 2019
Posts: 13
Rep Power: 7
Arman_N is on a distinguished road
Hi "abhishekmonu96`",

Thanks for your reply. I'm not really familiar with codeStream but I assume it is an efficient way to tweak your way into custom BCs. I will give it a try!

*UPDATE:
After all, I did some more searching and found that apparently, wallHeatTransfer BC does something similar to what I'm looking for, which is itself based on the mixed BC.
Thank to this post, I was able to figure out how it works and apply my own BC.

The mixed BC calculates the value on patch using the following equation:

Y_{face} = \omega Y_{ref} + (1 - \omega) (Y_{cell} + \delta \nabla Y_{ref})

where \omega is valueFraction, Y_{ref} is refValue, Y_{cell} is the cell internal value next to face, \nabla Y_{ref} is refGrad, and \delta is the distance between cell face and cell center (=1/deltaCoeffs()).

The main idea is to replace the derivative term with its linear approximation. Therefore, the equation becomes:

c_{1} (\frac{Y_{face} - Y_{cell}}{\delta}) + c_{2} Y_{face} = c_{3}

reordering into the mixed BC form gives:

Y_{face} = (\frac{1}{1+\frac{c_{1}}{\delta c_{2}}}) \frac{c_{3}}{c_{2}} + (\frac{\frac{c_{1}}{\delta c_{2}}}{1+\frac{c_{1}}{\delta c_{2}}}) Y_{cell}

Therefore, by assuming \omega = \frac{1}{1+\frac{c_{1}}{\delta c_{2}}} , Y_{ref} = \frac{c_{3}}{c_{2}} , and \nabla Y_{ref} = 0 , one can implement the desired boundary condition similar to wallHeatTransfer BC.

Cheers,
Arman_N is offline   Reply With Quote

Reply

Tags
boundary condition, boundary gradient, boundary value, mixed boundary condition, source term


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
Boundary condition with value, gradient and constant Arman_N OpenFOAM Programming & Development 0 January 25, 2022 14:50


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