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

customized BCs: using value as gradient of another parameter and no constraint

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By shuxuejia

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 15, 2020, 23:05
Smile customized BCs: using value as gradient of another parameter and no constraint
  #1
New Member
 
dp
Join Date: Jul 2020
Posts: 6
Rep Power: 6
shuxuejia is on a distinguished road
Dear all,
I have been studying OpenFOAM and groovyBC boundary condition recently since I really need to use some kinds of customized boundary conditions in my customized solver. I am not sure if they can be realized in OpenFOAM or by groovyBC. I know it is very powerful but unfortunately I cannot fully handle it now. The two boundary conditions are very straightforward:

1, using value as gradient of another parameter. For example, I have two parameters to be solved, r and s. At the boundary I would like to set r=-normal gradient (s), s=0. It is different from commonly-used fixedValue, fixedGradient and mixed.

2, setting zero value and zero gradient for one parameter at the same time and no constraint for another parameters. For example, I have two parameters to be solved, p and q. At the boundary I would like to set p=0, normal gradient (p)=0, and no constraint for q.

Mathematically, the number of equations and boundary conditions did not change and still the same. Someone posted a similar question recently but what if the parameter to be solved is not the velocity but a new parameter ?

fixedValue BC with zeroGradient

Moreover, I am confused with no constraint boundary condition. Typically I called it free boundary condition. However, in the CFD and OpenFOAM, it seems that every boundary need to be implemented a boundary constraint.

If it cannot be done by groovyBC, how can I realize it by programming a new boundary condition ? I am looking forward to your responses. Thank you all for your help and comments in advance !

dp
shuxuejia is offline   Reply With Quote

Old   August 22, 2020, 00:38
Lightbulb
  #2
New Member
 
dp
Join Date: Jul 2020
Posts: 6
Rep Power: 6
shuxuejia is on a distinguished road
Although I did not get response here, I have solved these problems by myself. I would like to share my methods if you need.

1)
Use a user defined BC for r. The key code is

void Foam:: sGradientFvPatchScalarField::updateCoeffs()
{
const fvPatchField<scalar>& si =
patch().lookupPatchField<volScalarField, scalar>("s");
scalarField sigrad = si.snGrad();
operator==(-sigrad);
fixedValueFvPatchScalarField::updateCoeffs();
}

2)
First set fixedValue BC with value 0. Then use fvOptions FixedValueConstraint to set value 0 in the adjacent cell of the BC.
the_ichthyologist likes this.
shuxuejia is offline   Reply With Quote

Reply

Tags
gradient at boundary, groovybc, no constraint


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



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