|
[Sponsors] |
May 17, 2006, 10:21 |
Hi all,
I'm trying to under
|
#1 |
New Member
Miriam
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
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 |
|
May 17, 2006, 10:25 |
Says:
The current value on
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
May 17, 2006, 12:00 |
Thanks for your ready answer,
|
#3 |
New Member
Miriam
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
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 |
|
May 17, 2006, 12:21 |
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 |
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
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
August 22, 2019, 12:08 |
|
#5 | |
New Member
chen wang
Join Date: Aug 2019
Location: Manchester, UK
Posts: 8
Rep Power: 7 |
Quote:
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. |
||
|
|
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 |