|
[Sponsors] |
Difference between forAll(boundary...) and operator==(..) in custom boundary |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 31, 2022, 12:33 |
Difference between forAll(boundary...) and operator==(..) in custom boundary
|
#1 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
Hi,
I wanted to create a custom inlet U BC which changes with time and I'm trying to use the codedFixedValue method. I come across 2 ways to modifly the inlet U: 1. Code:
time = this->db().time().value(); const fvPatch& boundaryPatch = patch(); vectorField& field = *this; forAll(boundaryPatch, faceI) { field[faceI] = vector( starting_incoming_vel*time, 0,0); } Code:
cur_incoming_vel = vector( starting_incoming_vel*time, 0,0); operator==( cur_incoming_vel ); Thanks |
|
April 1, 2022, 08:25 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 737
Rep Power: 14 |
It seems that the header file for codedFixedValueFvPatchField.H (https://cpp.openfoam.org/v8/codedFix...8H_source.html) uses operator==() as an example, so I would suggest giving it a try. I guess they included it precisely to make it easier, and avoid you having to use a forAll loop.
|
|
April 1, 2022, 10:07 |
|
#3 |
Member
Join Date: Feb 2020
Posts: 90
Rep Power: 6 |
I asked something similar some time ago for ESI version:
see if it helps: Coding a new boundary condition |
|
April 1, 2022, 20:55 |
|
#4 |
Senior Member
TWB
Join Date: Mar 2009
Posts: 414
Rep Power: 19 |
Hi Tobermory adn Shibi, thanks for the info!
|
|
|
|