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

Modifying boundaryfield of a volscalar field

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

Reply
 
LinkBack Thread Tools 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: 5
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.
hawkeye321 is offline   Reply With Quote

Old   February 13, 2013, 09:48
Default
  #2
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
im curious if it is on boundary, why dont you set it up from dictionary?
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   February 13, 2013, 10:24
Default
  #3
Member
 
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 33
Rep Power: 5
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... Accessing all cells that are next to a wall

Hope it helps

greetings
nlinder is offline   Reply With Quote

Old   February 15, 2013, 03:45
Default
  #4
Member
 
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5
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 Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
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
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   February 15, 2013, 06:01
Default
  #6
Member
 
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 33
Rep Power: 5
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

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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Is good initial guess field is neccessary ? mmkr825 OpenFOAM 5 October 17, 2012 12:58
problems after decomposing for running alessio.nz OpenFOAM 5 April 20, 2011 08:44
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 22:59.