CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

changing boundary cell value

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By fumiya

LinkBack Thread Tools Display Modes
Old   August 10, 2015, 03:29
Default changing boundary cell value
Join Date: May 2014
Posts: 31
Rep Power: 5
kcn is on a distinguished road

I used the following piece of code to change the boundary condition of a certain patch during each solver iteration.

label patchID = mesh.boundaryMesh().findPatchID("name of patch");

const polyPatch& cPatch = mesh.boundaryMesh()[patchID];

forAll (cPatch,faceI)

U.boundaryField()[patchID][faceI] == expression;


I need to define a source term which is only present at the cells that are attached to a particular patch. I hope to do this by first declaring a field that is every where zero and then during solution updating the values attached to the patch of interest, similar to updating the boundary face values in above code.

Can some one please tell me how to modify the code to access and change the values of cells attached to a boundary patch?
kcn is offline   Reply With Quote

Old   August 11, 2015, 09:30
Senior Member
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 213
Blog Entries: 1
Rep Power: 11
fumiya is on a distinguished road

You can use faceCells() and might want to read my slide(

Best regards,
adamonov likes this.
fumiya is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 45 February 8, 2016 05:42
Low torque values on Screw Turbine Shaun Waters CFX 34 July 23, 2015 08:16
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Solution Diverging with Trimmer Mesh rietuk STAR-CCM+ 8 February 27, 2013 05:50
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15

All times are GMT -4. The time now is 05:58.