CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   How can I write selective additional fields using functionObjects? (http://www.cfd-online.com/Forums/openfoam/90055-how-can-i-write-selective-additional-fields-using-functionobjects.html)

fpmhadi June 29, 2011 12:31

How can I write selective additional fields using functionObjects?
 
Hi everybody,

I want to have the positions of cell centers (x,y,z) as out put in my time directories. I know that the utility "writeCellCenters" do what I want, but I prefer to get them automatically.

I searched and found out that functionObjects are capable of doing so. I found from

http://openfoamwiki.net/index.php/Co...unctionObjects

that the type writeAdditionalFields is exactly what I want. I found this example in their documentations:

Code:

functions
(
    writeEnthalpy
    {
        functionObjectLibs  ("libsimpleFunctionObjects.so");
        type                writeAdditionalFields;
        fieldNames          ( h mu );
        after 0.1;
    }
);

But now I do not know how to use it to get x, y and z positions of cell centers of my mesh.

Any help is appreciated.

nimasam June 30, 2011 02:51

can i ask you, why? is ur mesh moving ? if its fixed why do u need to have them in each time step?
however maybe you can add something like to ur solver and compile it:

volVectorField cellCenter //add
(
IOobject
(
"cellCenter",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh.Cp()
);

fpmhadi June 30, 2011 10:31

Hi Nima,

Thanks for your hint.

Actually I do not want to have my grid in every time step. That would be fine to have the grid in all time directories although it's not necessary for me now.

You are right. It's possible to obtain the mesh changing the solver, but I do not want to do so.

Fatemeh

fpmhadi July 14, 2011 17:41

Hi,

I want to be more specific about my question posted on June 29th.

About using that example I found in functionObject documentations; there are two points:
  1. I do not know where the keyword "writeEnthalpy" has come from. How can I find one suitable for writing cell positions?
  2. I have the same question about fieldNames "h mu". How can I have a suitable fieldName for cell centers?
Thanks,
Fatemeh


All times are GMT -4. The time now is 04:36.