|
[Sponsors] |
getter/setter function for the velocity nodes in a simple Cartesian grid |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 6, 2013, 07:19 |
getter/setter function for the velocity nodes in a simple Cartesian grid
|
#1 |
Member
Join Date: Feb 2012
Posts: 49
Rep Power: 14 |
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(); |
|
December 6, 2013, 08:45 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
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] = ... } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] mesh airfoil NACA0012 | anand_30 | OpenFOAM Meshing & Mesh Conversion | 13 | March 7, 2022 18:22 |
ParaView for OF-1.6-ext | Chrisi1984 | OpenFOAM Installation | 0 | December 31, 2010 07:42 |
Velocity Under-relaxation in SIMPLE type methods | Matt U. | Main CFD Forum | 6 | July 4, 2005 06:29 |
Variables Definition in CFX Solver 5.6 | R P | CFX | 2 | October 26, 2004 03:13 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 10:11 |