CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Why doesnbt the macro forall work for the volVectorField variable (

siwen February 23, 2006 17:20

Hi, Everyone: I am a new u
Hi, Everyone:

I am a new user of OpenFoam. I am trying to use OpenFoam to model the axisymmetrical inductive plasma torch. In my computational domain, there are many different regions. In some regions I need to set the velocity to zero because they are solid. So after solving the momentum equations I use the following macro to set velocity to zero.
forAll(U, cellI)
if(((yb[cellI])>25e-3)||((xb[cellI]<0.05)&&(yb[celli]>0.019)&&(yb[cellI]<0.021)) )
U[cellI].component(vector::Y)=0.0; }

where the xb and yb are defined as:
const vectorField& centres = mesh.C();
scalarField xb = centres.component(vector::X);
scalarField yb = centres.component(vector::Y);
But this macro doesn't work. In the region I set the velocity to zero, they are not zero(very big value).

When I use "forall" micro to set temperature in some region it works very well.

Why doesn't the macro "forall" work for the volVectorField variable?
Can anyone help me to solve this problem?

Thank you very much!

Siwen Xue

mattijs February 24, 2006 04:46

The forAll macro works. Try
The forAll macro works.

Try printing out the value of U[cellI] after you have changed it to find your problem:

Pout<< U[cellI] << endl;

siwen February 24, 2006 16:27

Hi, Dr. Mattijs: Thank you
Hi, Dr. Mattijs:

Thank you very much for your prompt answer. I found the problem. It was the code in another file for the continuity (rho) equation which correct the velocity. And there the velocity is given another value. Now my program works very well.

Sorry I have another question to bother you! I worked on the axisymmetrical system. I create my geometry in 5 degree and I set both front and back surface as wedge. But OpenFoam solves vector form of momentum equation.
My question is what kind of component equations OpenFoam solve, the component equations in rectangular coordinate system or the component equations in cylindrical coordinate system?. They are quite different in the two coordinate system?

Thank you very much!

Siwen Xue

All times are GMT -4. The time now is 22:58.