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

getter/setter function for the velocity nodes in a simple Cartesian grid

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Bernhard

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2013, 06:19
Default getter/setter function for the velocity nodes in a simple Cartesian grid
  #1
ooo
Member
 
Join Date: Feb 2012
Posts: 49
Rep Power: 14
ooo is on a distinguished road
I would like to set/get the velocity of the nodes of a simple Cartesian grid by a simple loop to be able to do some interpolation of them(and put the interpolated value into an user-defined vector!)
For example i would like to store/change the velocity by these kind of loops :

for (indices i = 1 ; i < ... ; ++i) {
u(indices of a particular node) = 0 ; //Setting value...
double a = u(indices of a particular node);} //Getting value...


I would appreciate if you tell me how can i find the index of nodes.
For example, this code(mesh.findCell(point(x, y, z)); ) gives the index of the nearest cell, but i need to have an overview of the index of all cells(e.g to be able to iterate through them with a for loop).
Also i don't know whether with the below code, can i SET the velocity of the index? or it is just a getter function? : U.mesh().C()[Index].x();
ooo is offline   Reply With Quote

Old   December 6, 2013, 07:45
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
What do you exactly want?

Anyhow, you might be looking for the forAll loop that comes with OpenFOAM. Structure looks something like this

Code:
 forAll(U, cellI)
 { 
    U[cellI] = ...
 }
ooo likes this.
Bernhard 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
[Other] mesh airfoil NACA0012 anand_30 OpenFOAM Meshing & Mesh Conversion 13 March 7, 2022 17:22
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 06:42
Velocity Under-relaxation in SIMPLE type methods Matt U. Main CFD Forum 6 July 4, 2005 05:29
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 02:13
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 18:04.