|
[Sponsors] |
How can I access to a volTensorField elements? urgent!!! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 14, 2013, 05:34 |
How can I access to a volTensorField elements? urgent!!!
|
#1 |
Senior Member
|
Hi everybody,
I want to access to elements of a volTensorField. any body knows how can I do that? thanks, Mostafa |
|
May 14, 2013, 07:27 |
|
#2 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23 |
Hi Mostafa,
This is from the top of my head so don't know if it's fully correct but it might help you in the right direction. Sepose T is the name of the tensorField: Code:
forAll(T,cellI) { const Tensor& t = T[cellI]; // The components: scalar txx = t.xx(); scalar txy = t.xy(); ... } L |
|
May 14, 2013, 07:33 |
|
#3 |
Senior Member
|
thank you Lieven,
It's just for a Tensor not a volTensorField. I tried it before but it said that volTensorField has no member named ‘yy’. again thank you. Mostafa |
|
May 14, 2013, 08:37 |
|
#4 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23 |
Hi Mostafa,
I don't really understand your post. First you say that it's not a volTensorField but only a tensor, and next you say that the error states "volTensorField has no member named 'yy'". I hope you can see the contradiction in this and clarify it for me... Cheers, L |
|
May 14, 2013, 09:31 |
|
#5 | |
Senior Member
|
Quote:
I meant that what you said is applicable for Tensor type and when I used it for volTensorField it didn't work. a question: what is the meaning of cellI in your post? Code:
const Tensor& t=T[cellI] |
||
May 14, 2013, 09:41 |
|
#6 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23 |
That's why I put it inside the forAll-loop so that it would loop over each cell (hence the meaning of CellI).
Just found out that the easier way to get the whole field immediately is (e.g. for component xy): Code:
scalarField Txy = T.component(tensor::XY); L |
|
May 14, 2013, 17:28 |
|
#7 |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18 |
A volTensorField is comprised of both internal values as well as boundary values assigned to patch faces.
I'm assuming you need to get to the internal field, this is how you do it: Code:
const tensorField& myTenF = myVolTensorField.internalField(); forAll(myTenF,cellI) { tensor t = myTenF[cellI]; scalar txx = t.xx(); scalar txy = t.xy(); //etc... } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Operate on volScalarField as whole v access elements | adhiraj | OpenFOAM | 2 | November 29, 2012 13:35 |
Urgent: Attempt to access un-allocated densityLe | devesh.baghel | STAR-CCM+ | 0 | July 19, 2011 03:44 |
Diagonal elements of a volTensorField | CpCaniggia | OpenFOAM Running, Solving & CFD | 1 | September 23, 2010 12:06 |
Urgent! Access violation of UDF using VOF | Rucy | FLUENT | 0 | January 9, 2006 05:01 |
CFX4.3 -build analysis form | Chie Min | CFX | 5 | July 13, 2001 00:19 |