CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to loop through all the field? (https://www.cfd-online.com/Forums/openfoam-post-processing/62800-how-loop-through-all-field.html)

spwater March 20, 2009 04:21

How to loop through all the field?
 
In fact I am trying th get the value of one internal face, I am a freshman so i try to write a program to loop and to choose. Is there any method or utilities to do so? And is there any function to loop through all the field, not only the boundary. Thank you very much.

ngj March 20, 2009 04:38

Hi Shui Pei

You need to elaborate significantly on your question, because it is not entirely clear what you are trying to achieve.

Best regards,

Niels

spwater March 20, 2009 05:49

Hmm, now I have a mesh, I want to use my program to loop all the grids in the mesh and to judge with their position and then to output the data in specified position, can I?

ngj March 20, 2009 07:11

Hi

You could do something like this:

const vectorField & centers = mesh.C();
forAll(centers,ii)
{
if (<statement for your position>)
{
<Do what is needed>
}
}

Best regards,

Niels

spwater March 20, 2009 20:41

Thank you very much, it helps.
Quote:

Originally Posted by ngj (Post 210140)
Hi

You could do something like this:

const vectorField & centers = mesh.C();
forAll(centers,ii)
{
if (<statement for your position>)
{
<Do what is needed>
}
}

Best regards,

Niels



All times are GMT -4. The time now is 00:19.