|March 12, 2011, 16:50||
Accessing a vector in a volVectorField by cell label
Join Date: Mar 2009
Posts: 47Rep Power: 8
Given a volVectorField how can I access the vector corresponding to a given cell label? Simple question, but I couldn't figure it out so far. For example I want to access the value of U at a boundary as defined in 0/U how can I do that?
Also as far as I can see the underlying data structure of volVectorField is a linked list, is that correct? I don't understand how the mapping of the cell labels to the physical data such as U and V works.
thx for any help!
|March 12, 2011, 17:43||
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,660Rep Power: 25
Let me try answering you questions, as I understand them. Accessing an internal value is done as:
label celli(100); vector uCell = U[celli];
To access the values on a boundary, you need to get a reference to the boundary field. This is done in the following way:
label patchID = mesh.boundaryMesh().whichPatchID("myBoundaryName"); vectorField & Uw = U.boundaryField()[patchID];
scalar u = U[celli].x(); scalar v = U[celli].y(); scalar w = U[celli].z();
scalarField u = U.component(0); scalarField v = U.component(1); scalarField w = U.component(2);
|January 15, 2012, 06:48||
Accessing vector components
Join Date: Jun 2009
Posts: 28Rep Power: 8
I am wondering if you can help me on the following problem:
The velocity vector components can be accessed using U.componet(0), U.componet(1), U.componet(2). I intend to add a constant to velocity Y component during the iteration. Initially I tried:
U.component(1) += constant;
The outcome shows that (Obviously) U has not been changed. Is it possible to define constant as a vector and add it to the velocity vector? how should it be written?
|Thread||Thread Starter||Forum||Replies||Last Post|
|FvMatrix coefficients||shrina||OpenFOAM Running, Solving & CFD||10||October 3, 2013 14:38|
|Cells with t below lower limit||Purushothama||CD-adapco||2||May 31, 2010 21:58|
|accessing upstream cell - UDF||bohis||FLUENT||0||April 7, 2008 05:12|
|Trimmed cell and embedded refinement mesh conversion issues||michele||OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ...||2||July 15, 2005 04:15|
|Warning 097-||AB||CD-adapco||6||November 15, 2004 05:41|