|
[Sponsors] |
customized BCs: using value as gradient of another parameter and no constraint |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 15, 2020, 23:05 |
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 |
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 |
|
August 22, 2020, 00:38 |
|
#2 |
New Member
dp
Join Date: Jul 2020
Posts: 6
Rep Power: 6 |
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. |
|
Tags |
gradient at boundary, groovybc, no constraint |
|
|