CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   internalField nonuniform <List>; (http://www.cfd-online.com/Forums/openfoam-pre-processing/75385-internalfield-nonuniform-list.html)

Panagioto April 23, 2010 12:29

internalField nonuniform <List>;
 
Hi everybody!
How do I make the list for
internalField nonuniform
<List>;? this is for the 0/pd directory in interFoam


tsikroria0 July 14, 2011 17:05

Even I want to implement nonuniform internal fiels for pressure... Can anyone tell me how the cell numbering is set in OpenFOAM?

mu.e.nash August 26, 2011 15:19

Quote:

Originally Posted by tsikroria0 (Post 316176)
Even I want to implement nonuniform internal fiels for pressure... Can anyone tell me how the cell numbering is set in OpenFOAM?

hi all,
the numbering begin in x-direction then y-direction then z-direction
eg.
//loop for changing z
for(int i=0;i<NocellsZ;i++)
{//loop for changing y
for(int j=0;j<NocellsY;j++)
{//loop for changing x
for(int k=0;k<NocellsX;k++)
{
//put the value here
}
}
}

gschaider August 28, 2011 19:38

Quote:

Originally Posted by mu.e.nash (Post 321823)
hi all,
the numbering begin in x-direction then y-direction then z-direction
eg.
//loop for changing z
for(int i=0;i<NocellsZ;i++)
{//loop for changing y
for(int j=0;j<NocellsY;j++)
{//loop for changing x
for(int k=0;k<NocellsX;k++)
{
//put the value here
}
}
}

I'm afraid: No. This would work for only a blockMesh with one block (and even there OpenFOAM wouldn't voluntarily give you the NocellsX/Y/Z (it doesn'T know it as this kind of information doesn't make sense for a polyhedral mesh)

@tsikroria0: if you WANT to program it in C++ have a look how utilities like engineSwirl and setFields do it. If you just want to set the field and go on: search for funkySetFields

mu.e.nash August 28, 2011 20:12

yes i have tried my code on one block, but i made a c++ program outside OpenFoam to read the output of blockMesh and assign the value of my internal field to the centers of cells by changing the files in "0" directory by using:
internalField nonuniform List<scalar>
'No.ofOverallCells'
(
//data entered here
)
;

if there is another way to doing so for multiple blocks please tell me that way.

gschaider August 30, 2011 06:52

Quote:

Originally Posted by mu.e.nash (Post 321986)
yes i have tried my code on one block, but i made a c++ program outside OpenFoam to read the output of blockMesh and assign the value of my internal field to the centers of cells by changing the files in "0" directory by using:
internalField nonuniform List<scalar>
'No.ofOverallCells'
(
//data entered here
)
;

if there is another way to doing so for multiple blocks please tell me that way.

Your previous example worked for one block because blockMesh HAPPENS to number cells that way. The pricinciple is extendible for more than one block, but be warned that this might break at any time (if the implementation of blockMesh changes)

For the general case if you don't want to do use the OpenFOAM-API your best guess is to let an OF-program write out the cell centers of the mesh and your program reads that in and acts accordingly

mu.e.nash August 30, 2011 07:06

how is that???

gschaider August 30, 2011 08:29

Quote:

Originally Posted by mu.e.nash (Post 322232)
how is that???

Because OpenFOAM is a code for general polyhdra (I think I invested more time in this vacuous (but correct) answer than you did in the formulation of your question)

heksel8i August 20, 2013 14:06

Hey!

I would like to have a nonuniform initial condition. I have a arbitrary boundary and I know the flow values in the boundary cells/faces. Apparently I could use interiorfield: nonuniform and give the values as a list (x,y,z,value). But because I want to start the simulation with these values and the mesh is not created by blockmesh, I have no idea about the order of the list-values in nonuniform condition.

I tried to check but swak4foam and setFields seem to be for analytical expressions but I want to work with a truly existing list?

Any ideas?

gschaider August 20, 2013 16:12

Quote:

Originally Posted by heksel8i (Post 446943)
Hey!

I would like to have a nonuniform initial condition. I have a arbitrary boundary and I know the flow values in the boundary cells/faces. Apparently I could use interiorfield: nonuniform and give the values as a list (x,y,z,value). But because I want to start the simulation with these values and the mesh is not created by blockmesh, I have no idea about the order of the list-values in nonuniform condition.

I tried to check but swak4foam and setFields seem to be for analytical expressions but I want to work with a truly existing list?

Any ideas?

Try timeVaryingMappedFixedValue


All times are GMT -4. The time now is 01:35.