|
[Sponsors] |
February 12, 2013, 12:20 |
Modifying boundaryfield of a volscalar field
|
#1 |
Member
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14 |
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. |
|
February 13, 2013, 09:48 |
|
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
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) |
|
February 13, 2013, 10:24 |
|
#3 |
Member
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 35
Rep Power: 14 |
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 } } } Hope it helps greetings |
|
February 15, 2013, 03:45 |
|
#4 |
Member
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 14 |
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? |
|
February 15, 2013, 04:18 |
|
#5 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
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) |
|
February 15, 2013, 06:01 |
|
#6 |
Member
Nicklas Linder
Join Date: Jul 2012
Location: Germany
Posts: 35
Rep Power: 14 |
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?
|
|
|
|
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 |