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

Difference between forAll(boundary...) and operator==(..) in custom boundary

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2022, 11:33
Default Difference between forAll(boundary...) and operator==(..) in custom boundary
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 401
Rep Power: 19
quarkz is on a distinguished road
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);
			   
	}
2.

Code:
cur_incoming_vel = vector( starting_incoming_vel*time, 0,0);
					
operator==( cur_incoming_vel );
So are they the same? Can I use either mtd?

Thanks
quarkz is offline   Reply With Quote

Old   April 1, 2022, 07:25
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
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.
Tobermory is offline   Reply With Quote

Old   April 1, 2022, 09:07
Default
  #3
Member
 
Join Date: Feb 2020
Posts: 90
Rep Power: 6
Shibi is on a distinguished road
I asked something similar some time ago for ESI version:

see if it helps: Coding a new boundary condition
Shibi is offline   Reply With Quote

Old   April 1, 2022, 19:55
Default
  #4
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 401
Rep Power: 19
quarkz is on a distinguished road
Hi Tobermory adn Shibi, thanks for the info!
quarkz 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



All times are GMT -4. The time now is 08:21.