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

Modifying boundaryfield of a volscalar field

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By hawkeye321
  • 2 Post By nlinder

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2013, 12:20
Default Modifying boundaryfield of a volscalar field
  #1
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14
hawkeye321 is an unknown quantity at this point
Hi FOAMERS
Can any one please let me know how can I modify the values of a volscalarfield (say variable) at boundaries? I have tried

forAll (variable.boundaryField(), facei)
{
variable.boundaryField()[facei] = modifiedvalue
}

but it does not modify all values at the boundary, and It is not clear for me which faces are modified by this loop.
siamak 60 likes this.
hawkeye321 is offline   Reply With Quote

Old   February 13, 2013, 09:48
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
im curious if it is on boundary, why dont you set it up from dictionary?
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   February 13, 2013, 10:24
Default
  #3
Member
 
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 35
Rep Power: 14
nlinder is on a distinguished road
Hi Mahdi,

You need to tell on which patch you want to change the variables:
Code:
forAll (mesh.boundary(), patchI) {
    if (mesh.boundary()[patchI].name() == "desiredName") // Now it only searches for a name, maybe the type, e.g. wall or whatever, would be better
        {
            wallPatchID = patchI;
 
            forAll(variable.boundaryField()[wallPatchID], facei)
            {
                 //do your stuff
            }
        }
}
BTW: You can also have a look at this thread... http://www.cfd-online.com/Forums/ope...next-wall.html

Hope it helps

greetings
ztdep and siamak 60 like this.
nlinder is offline   Reply With Quote

Old   February 15, 2013, 03:45
Default
  #4
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14
hawkeye321 is an unknown quantity at this point
nimasam: I don't have any boundary condition for some of my variables

nlinder: Thanks for the answer.
By the way, do yo know the best way to set the values of a volScalarField (lets say, X) to the values interpolated from the adjacent cell centers?
hawkeye321 is offline   Reply With Quote

Old   February 15, 2013, 04:18
Default
  #5
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
however i think, if you define your field to construct from IO dictionay then, you can apply ur BC easier,
However somewhere i saw internalBoundaryField(),i guess it was in geometricField class which return cell values adjacent to BC
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   February 15, 2013, 06:01
Default
  #6
Member
 
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 35
Rep Power: 14
nlinder is on a distinguished road
Why not just interpolate(). It will interpolated from the faces which "include" the information of the adjacent cells!? Or did I misunderstood what you are looking for?
nlinder 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 05:49
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Is good initial guess field is neccessary ? mmkr825 OpenFOAM 5 October 17, 2012 13:58
Modifying pressure field in CFX akultane CFX 2 January 13, 2010 15:42
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


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