CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   accessing to parameters of a volVectorField (https://www.cfd-online.com/Forums/openfoam-programming-development/101750-accessing-parameters-volvectorfield.html)

sasookey May 13, 2012 09:58

accessing to parameters of a volVectorField
 
hi I want to access the parameters of a volVectorField I try this:
forAll( p,celli){
if ( p[celli] < 1.e-5 )
{
...

}
}

it works for a volScalarField but I want to do something on u a volVectorField that has ux , uy , uz ,when (ux < 1.e-5 ) and I don't know how to do this? thanks to help me.

sasookey May 13, 2012 14:33

luckily I can solve my problem first I try this:
forAll(U , celli){
if (U[celli] < vector(1.e-5 , 1.e-5 , 1.e-5) )
{
.......
}
}

and it works, later I use this trick:

volScalarField UU = U.component(0); // gives me Ux
foaAll(UU , celli){
if (UU [celli] < 1.e-5 ) // check if Ux smaller than 1.e-5
{
..........
}
}

and it works!:eek:


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