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

Need ur help

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   October 28, 2012, 21:44
Default Need ur help
  #1
New Member
 
Mandeep
Join Date: Aug 2012
Location: Canada
Posts: 9
Rep Power: 13
Rocky4 is on a distinguished road
Dear Foamers,

i have a volScalarField (say X) whose value at the patches and cells depends on the cell values of another volScalarField (sayY). i am able to change the value of X at the cells using

forAll(X, celli)
{ if (Y[celli] ==0)
{X[celli] =a;}
else
{X[celli]=b;}}

however i am unable to do the same for the patches of X
i.e if Y[celli] =0 where celli is any boundary cell then X[patchi] should be set to 'a' else it should be set to 'b'.something like this

forAll(X.boundaryField(), patchi)
{ //if (Y[celli] ==0) ,this represents any boundary cell value of field Y
{X.boundaryField()[patchi] =a;}
else
{X.boundaryField()[patchi]=b;}}

can someone can give a detailed code to accomplish this task?
i m new to openfoam. any kind of help is greatly appreciated. thanks in advance.

Last edited by Rocky4; October 28, 2012 at 23:47.
Rocky4 is offline   Reply With Quote

 


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 06:39.