CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Assigning objects to cells (

Hisham August 9, 2011 05:35

Assigning objects to cells

I want to develop a class that defines material behaviour for a stress analysis solver. I need to assign an object to each finite volume.

Also, I need to extract numerical values from tensor/vector/scalar field (for each cell), use them inside the object functions then return these values to a variable field (a tensor field) (during the time step loop).

How is it possible to loop the control volumes?

I would appreciate it if I get help on how to do that or where to look for answers.


gunnar2 August 9, 2011 14:30

Hello Hisham,
I am not sure if I understand your question.

This should work:


YourObjectType someValue;
GeometricField< YourObjectType, fvPatchField, fvMesh > field=...;
for (int i=0;i<field.size();i++){

Hisham August 17, 2011 10:32

Thanks a lot for your reply

Can you elaborate more or at least, can you guide me to where I can learn more

All times are GMT -4. The time now is 09:14.