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

FixedGradient Boundary Condition

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By hjasak
  • 1 Post By hjasak

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2006, 10:21
Default Hi all, I'm trying to under
  #1
New Member
 
Miriam
Join Date: Mar 2009
Posts: 15
Rep Power: 17
shrina is on a distinguished road
Hi all,

I'm trying to understand how evaluate function is implemented in fixedGradientFvPatchField.C, but the following lines are obscure to me:

Field<type>::operator=
(
this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
);

The function I'm referring to is this one:

// Evaluate the field on the patch
template<class>
void fixedGradientFvPatchField<type>::evaluate()
{
if (!this->updated())
{
this->updateCoeffs();
}

Field<type>::operator=
(
this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
);

fvPatchField<type>::evaluate();
}

Thanks in advance
shrina is offline   Reply With Quote

Old   May 17, 2006, 10:25
Default Says: The current value on
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Says:

The current value on the boundary = the value in the cells next to the boundary + (boundary-normal gradient)*(distance form the cell centre to the boundary face).

The this->patch().deltaCoeffs() bit means 1/distance, which is why you have a division instead of multiplication.

Better?

Hrv
zjdedongxi and parthigcar like this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 17, 2006, 12:00
Default Thanks for your ready answer,
  #3
New Member
 
Miriam
Join Date: Mar 2009
Posts: 15
Rep Power: 17
shrina is on a distinguished road
Thanks for your ready answer, but what was not clear to me was how the assignment was done, where was the receiver of the operation, since there is not anything on the left of operator "=", apart from Field<type>::, which is the scope resolution operator used to specify which class the operator "=" refers to.
I'have just read the effective implementation of this operator in the file "List.C" and I've seen that there is any type returned, the "returned type" is void, consequently no object has to be put on the left of "=", the operator "=" can be called as a usual function that "returns a void".
Have I understood correctly? I'm a beginner in C++.
Thanks again
shrina is offline   Reply With Quote

Old   May 17, 2006, 12:21
Default This is pure C++. I can call
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
This is pure C++. I can call operator= in 2 ways:

class HrvsClass
{
void operator=(const HrvsClass&);
;}

and then

HrvsClass a;
HrvsClass b;

a = b;


which is the same as

a.operator=(b);

In the code above I would have to write

this->operator=(b)

Additionally, I wish to call operator= from the base class rather than the current class. So, the long (and ugly) notation would say:

Field<type>& f = *this;
f = this->patchInternalField() + gradient_/this->patch().deltaCoeffs();


which is pretty ugly.

Hope this helps,

Hrv
meth likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 22, 2019, 12:08
Default
  #5
New Member
 
chen wang
Join Date: Aug 2019
Location: Manchester, UK
Posts: 8
Rep Power: 7
chen wang is on a distinguished road
Quote:
Originally Posted by hjasak View Post
Says:

The current value on the boundary = the value in the cells next to the boundary + (boundary-normal gradient)*(distance form the cell centre to the boundary face).

The this->patch().deltaCoeffs() bit means 1/distance, which is why you have a division instead of multiplication.

Better?

Hrv

Can you tell me the value of the cells next to the boundary is known (taken from the previous iteration) or unknown (to be solved together with the current value on the boundayry ) ? Many thanks.
chen wang 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
Problem with fixedGradient BC kar OpenFOAM Running, Solving & CFD 5 April 22, 2015 21:06
FixedGradient BC update stefan82 OpenFOAM Running, Solving & CFD 4 April 28, 2009 04:10
Boundary Condition Help cwang5 OpenFOAM Running, Solving & CFD 0 October 24, 2008 07:12
Boundary condition of the third kind or Danckwertz boundary condition plage OpenFOAM Running, Solving & CFD 4 October 3, 2006 13:21
Slip Boundary Condition for Moving Boundary Shukla Main CFD Forum 3 November 11, 2005 16:02


All times are GMT -4. The time now is 07:56.