CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Naming blocks in blockMesh (https://www.cfd-online.com/Forums/openfoam/88638-naming-blocks-blockmesh.html)

balkrishna May 23, 2011 01:22

Naming blocks in blockMesh
 
Hi ,

How do i name blocks in a blockMeshDict file ? For example ,
a line of my blockMesh reads as follows :
Code:

blocks
(
hex (0 1 2 3 12 13 14 15) (20 1 20) simpleGrading (1 1 1)
...
)

How do i give it a name ? Something like "Region 1" ?
Also how do i output the average of this region at every timestep ?

Thanks .

MartinB May 23, 2011 03:09

For the first question: you can do it like this:

hex (0 1 2 3 12 13 14 15) Region_1 (20 1 20) simpleGrading (1 1 1)

Martin

balkrishna May 23, 2011 03:10

Thanks ... How do i output the average of some value , say: gas holdup ,in this region at every timestep ?

gschaider May 24, 2011 07:18

Quote:

Originally Posted by balkrishna (Post 308813)
Thanks ... How do i output the average of some value , say: gas holdup ,in this region at every timestep ?

I'm not aware of a way to do this with "standard"-OpenFOAM. I like to do that kind of calculation with swak4Foam (but I'm a bit biased in that respect)

Bernhard May 24, 2011 08:02

Quote:

Originally Posted by balkrishna (Post 308813)
Thanks ... How do i output the average of some value , say: gas holdup ,in this region at every timestep ?

I think there is a volume average that you can use in the functions subdictionary using the sampling library, or, if you want to calculate it afterwards, you can probably just use the sample utility.

balkrishna June 28, 2011 08:50

I figured out a way to do the same . The code for the same is as follows :
Code:

{
    const scalarField& V = mesh.V();

    forAll(mesh.cellZones(), czi)
    {
        const labelList& cellLabels = mesh.cellZones()[czi];
        //      const volScalarField& alpha = phasea.alpha() ;
       
        scalar phaseVolume = 0;
        scalar zoneVol = 0;
        forAll(cellLabels, cli)
          {
            label celli = cellLabels[cli];
            phaseVolume += alpha[celli]*V[celli];
            zoneVol += V[celli] ;
          }
       
        reduce(phaseVolume, sumOp<scalar>());

        Info<< " phase volume in zone " << mesh.cellZones()[czi].name() << " of volume  " << zoneVol << " " <<phaseVolume << endl ;
           
       
    }
}

This works perfectly fine in serial runs , however in parallel runs it gives absurd answers . For eg : in parallel runs it outputs the value of the zoneVol (the volume of the zone ) as 0 while in the serial runs it outputs the correct volume values .

Can anyone help me out with this ?

MartinB June 28, 2011 08:58

Hi,

you must use the reduce command for the zoneVol, too:
Code:

              ...
              zoneVol += V[celli] ;
          }
        reduce(zoneVol, sumOp<scalar>()); // <--------
        reduce(phaseVolume, sumOp<scalar>());

Martin

balkrishna June 28, 2011 09:03

Thanks a lot .....


All times are GMT -4. The time now is 21:28.