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

fixedGradientFvPatchScalarField or fixedGradientFvPatchField?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Tobermory
  • 1 Post By dlahaye

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2024, 07:46
Default fixedGradientFvPatchScalarField or fixedGradientFvPatchField?
  #1
New Member
 
Teddy Liu
Join Date: May 2024
Posts: 5
Rep Power: 2
TeddyL is on a distinguished road
Hello!

I am using OpenFOAM-v2212, and trying to understand the boundary condition: fixedFluxPressure. But I find the code rather strange, as it calls member functions from a class that seems does not exist (fixedGradientFvPatchScalarField). I searched in the API guide only to find a class named "fixedGradientFvPatchField". How could this code possibly run without errors? I think it may be a version-related issue, but I still can't understand.

in fixedFluxPressureFvPatchScalarField.C:
Code:
void Foam::fixedFluxPressureFvPatchScalarField::updateSnGrad
(
    const scalarField& snGradp
)
{
    if (updated())
    {
        return;
    }
 
    curTimeIndex_ = this->db().time().timeIndex();
 
    gradient() = snGradp;
    fixedGradientFvPatchScalarField::updateCoeffs();
// could it probably be fixedGradientFvPatchField?
}
Thanks for any help!
TeddyL is offline   Reply With Quote

Old   November 10, 2024, 14:10
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14
Tobermory will become famous soon enough
The answer is a little subtle. Class fixedGradientFvPatchScalarField is the implementation of the fixedGradientFvPatchField class, for a scalar field (the field type is the class parameter). It is generated in fixedGradientFvPatchFields.H (https://www.openfoam.com/documentati...8H_source.html), which calls a macro in fvPatchField.H
(https://www.openfoam.com/documentati...ce.html#l00715) to generate the class.

That's why you can't find it in Doxygen, or with a grep on the src folder.
TeddyL likes this.
Tobermory is offline   Reply With Quote

Old   November 10, 2024, 14:19
Default
  #3
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 19
dlahaye is on a distinguished road
The dependency graph at https://www.openfoam.com/documentati...rField_8H.html
does show that fixedFluxPressureFvPatchScalarField does call fixedGradientFvPatchScalarField.

Not sure how this complements what Tobermory provides as information.
TeddyL likes this.
dlahaye is offline   Reply With Quote

Old   November 11, 2024, 08:18
Default
  #4
New Member
 
Teddy Liu
Join Date: May 2024
Posts: 5
Rep Power: 2
TeddyL is on a distinguished road
Wow, Thank You, Tobermory!! It really helped! I never thought it would be a generate class.
TeddyL is offline   Reply With Quote

Old   November 11, 2024, 08:30
Default
  #5
New Member
 
Teddy Liu
Join Date: May 2024
Posts: 5
Rep Power: 2
TeddyL is on a distinguished road
Quote:
Originally Posted by dlahaye View Post
The dependency graph at https://www.openfoam.com/documentati...rField_8H.html
does show that fixedFluxPressureFvPatchScalarField does call fixedGradientFvPatchScalarField.

Not sure how this complements what Tobermory provides as information.
Yes! Thank you! I think I got it, the fixedFluxPressureFvPatchScalarField calls fixedGradientFvPatchFields, which calls fixedGradientFvPatchField to generate a new class based on Scalar type
TeddyL is offline   Reply With Quote

Reply

Tags
boundary condition, fixedfluxpressure, 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 23:28.