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

what does constrainHbyA.C do?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By M.Davoodi
  • 2 Post By mAlletto
  • 1 Post By mAlletto

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 15, 2021, 08:51
Default what does constrainHbyA.C do?
  #1
New Member
 
Mahdi
Join Date: May 2020
Posts: 10
Rep Power: 6
M.Davoodi is on a distinguished road
Hi Guys,

Does anyone know what happens on the parts of the constrainHbyA.C code (the part shown by the red and blue fonts?):
It seems that in the red part it is trying to find the value of pressure at the boundaries and then it does NOTHING? No variable is changed or modified here, it just finds the value of pressure and literally does nothing! A bit strange?

Also what about the blue part? It says HbyA value at the boundaries are equal to the value of velocity????! Where does that come from?



\*---------------------------------------------------------------------------*/

#include "constrainHbyA.H"
#include "volFields.H"
#include "fixedFluxExtrapolatedPressureFvPatchScalarField.H "

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Foam::tmp<Foam::volVectorField> Foam::constrainHbyA
(
const tmp<volVectorField>& tHbyA,
const volVectorField& U,
const volScalarField& p
)
{
tmp<volVectorField> tHbyANew;

if (tHbyA.isTmp())
{
tHbyANew = tHbyA;
tHbyANew.ref().rename("HbyA");
}
else
{
tHbyANew = new volVectorField("HbyA", tHbyA);
}

volVectorField& HbyA = tHbyANew.ref();
volVectorField::Boundary& HbyAbf = HbyA.boundaryFieldRef();

forAll(U.boundaryField(), patchi)
{
if
(
!U.boundaryField()[patchi].assignable()
&& !isA<fixedFluxExtrapolatedPressureFvPatchScalarFie ld>
(
p.boundaryField()[patchi]
)
)
{
HbyAbf[patchi] = U.boundaryField()[patchi];
}
}

return tHbyANew;
}


// **************************************************
Jim1310 likes this.
M.Davoodi is offline   Reply With Quote

Old   February 15, 2021, 09:25
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
There is a small description of the function here:

https://openfoamwiki.net/index.php/SimpleFoam


is this of help?
M.Davoodi and yueyun like this.
mAlletto is offline   Reply With Quote

Old   February 15, 2021, 09:47
Default
  #3
New Member
 
Mahdi
Join Date: May 2020
Posts: 10
Rep Power: 6
M.Davoodi is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
There is a small description of the function here:

https://openfoamwiki.net/index.php/SimpleFoam


is this of help?
Many thanks man, it was really helpful. So obvious now that I saw the response (when pressure gradient is zero, HbyA is equal to U!)…

Also a quick question about the red part. Do u have any idea what is that part doing? It says if “!U.boundaryField()[patchi].assignable()
&& !isA<fixedFluxExtrapolatedPressureFvPatchScalarFie ld>”
Then do:

p.boundaryField()[patchi]

?
M.Davoodi is offline   Reply With Quote

Old   February 15, 2021, 13:06
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
The red text is the argument to the function which checks if it is a fixedfluxpressure boundary condition
M.Davoodi likes this.
mAlletto is offline   Reply With Quote

Old   February 15, 2021, 13:10
Default
  #5
New Member
 
Mahdi
Join Date: May 2020
Posts: 10
Rep Power: 6
M.Davoodi is on a distinguished road
Quote:
Originally Posted by mAlletto View Post
The red text is the argument to the function which checks if it is a fixedfluxpressure boundary condition
Really helpful, cheers man!
M.Davoodi is offline   Reply With Quote

Reply


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
what does constrainHbyA.C do? M.Davoodi OpenFOAM Programming & Development 0 February 15, 2021 08:41


All times are GMT -4. The time now is 06:32.