|
[Sponsors] |
December 5, 2022, 06:45 |
Difference between operator= and operator==
|
#1 | |
New Member
peyman havaej
Join Date: Jan 2016
Posts: 16
Rep Power: 10 |
Dear all,
I have developed a boundary condition, which is very similar to the movingWallVelocity in foam extend. In this code, the velocity of the wall is updated according to a rigid body motion. Hence, it is a time-dependent condition. I tried two different ways to update the boundary values: 1- Code:
vectorField::operator=(Up + n*(Un - (n & Up)) + UNew); 2- Code:
vectorField::operator==(Up + n*(Un - (n & Up)) + UNew); Here, UNew is between 0-0.1 and it is varying by time. There is a big difference between the transient simulations of these cases, and I don't know which one is correct. According to this discussion, I know that: Quote:
Any comments or further explanations would be appreciated. Kind regards, Peyman |
||
December 28, 2022, 22:51 |
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
On a vector field there is no difference - you are looking at the wrong place. For fvPatchField, a double - will force assignment for all types and single - will behave differently depending on type.
For example, on a fixedValue patch, op= does nothing and op== will force the new value onto a patch even though its type is Dec;armed as fixedValue. This is very important for the code to work correctly. However, your problem is somewhere else. Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
Tags |
assignment, boundary condition, openfoam, operator, programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difference between forAll(boundary...) and operator==(..) in custom boundary | quarkz | OpenFOAM Programming & Development | 3 | April 1, 2022 20:55 |