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

About fixedGradient BC and the definition of deltaCoeffs()

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Gerry Kan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 29, 2020, 22:03
Question About fixedGradient BC and the definition of deltaCoeffs()
  #1
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 10
fedez91 is on a distinguished road
I am looking at the implementation of fixedGradient BC in OpenFoam 7. In fixedGradientFvPatchField.C (line 144) we have that the value at the boundary is calculated as:

Code:
 Field<Type>::operator=
     (
         this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
     );
What I don't understand is the following: If we have a positive gradient, the value at the first cell center should be bigger than the value at the boundary, therefore deltaCoeffs() should be negative. But by definition deltaCoeffs() cannot be negative (https://openfoamwiki.net/index.php/O...n;;deltaCoeffs).

This leads to the second part that I do not fully understand: From surfaceInterpolation.C (line 318), deltaCoeffs is calculated as
Code:
nonOrthDeltaCoeffs[facei] = 1.0/max(unitArea & delta, 0.05*mag(delta));
where unitArea points outside of the mesh (5.1.1.2 User manual https://cfd.direct/openfoam/user-gui...sh-description) and delta points from the boundary center to the cell center, and therefore unitArea & delta should always be negative (they point in different directions). Finally

unitArea & delta< 0 < 0.05*mag(delta))

and

deltaCoeffs = 1.0/(0.05*mag(delta)).

There must be something wrong with this reasoning, but I can't find where. Would you please help me
fedez91 is offline   Reply With Quote

Old   July 30, 2020, 12:18
Default
  #2
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 376
Rep Power: 11
Gerry Kan is on a distinguished road
Dear Federico:

I believe surface normal is defined as positive pointing out of the domain, so deltaCoeffs will be positive.

Hope that helps, Gerry.
Gerry Kan is offline   Reply With Quote

Old   July 30, 2020, 15:11
Default
  #3
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 10
fedez91 is on a distinguished road
Quote:
Originally Posted by Gerry Kan View Post
Dear Federico:

I believe surface normal is defined as positive pointing out of the domain, so deltaCoeffs will be positive.

Hope that helps, Gerry.
Thank you Gerry for your answer. To my understanding, delta points from the boundary to the cell center, or is it the other way arround?
Code:
vector delta = C[neighbour[facei]] - C[owner[facei]];
If delta points from the cell center to the boundary my second doubt would be cleared. But what about the definition of fixedGradient? The value of the gradient we define in the BC is actually the gradient in the direction pointing outside of the mesh? It looks a little counterintuitive.
Attached Images
File Type: png Image_CELL.png (24.0 KB, 51 views)
fedez91 is offline   Reply With Quote

Old   July 31, 2020, 03:41
Default
  #4
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 376
Rep Power: 11
Gerry Kan is on a distinguished road
Dear Federico:

Yes, the 'direction' of deltaCoeffs is from the cell center to the patch center. The direction oof the gradient follows the patch normal, i.e., out is positive.

However, I must confess I have always thought (too simplistically) that deltaCoeffs is 'just the distance between the cell center and patch center', but this forum post gave a more accurate description:

mesh.surfaceInterpolation::deltaCoeffs()

Gerry.

P.S. - After some digging, I think I know where you are coming from ...
fedez91 likes this.
Gerry Kan is offline   Reply With Quote

Reply

Tags
deltacoeffs, fixedgradient


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 09:28.