- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Why doesnbt the macro forall work for the volVectorField variable**
(*https://www.cfd-online.com/Forums/openfoam-solving/60314-why-doesnbt-macro-forall-work-volvectorfield-variable.html*)

Hi, Everyone:
I am a new uHi, 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) { U[cellI].component(vector::Z)=0.0; if(((yb[cellI])>25e-3)||((xb[cellI]<0.05)&&(yb[celli]>0.019)&&(yb[cellI]<0.021)) ) { U[cellI].component(vector::X)=0.0; 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 |

The forAll macro works.
TryThe forAll macro works.
Try printing out the value of U[cellI] after you have changed it to find your problem: Pout<< U[cellI] << endl; |

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 09:56. |