CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Output cell face area from all patches (https://www.cfd-online.com/Forums/openfoam-programming-development/161293-output-cell-face-area-all-patches.html)

niko0807 October 21, 2015 11:31

Output cell face area from all patches
 
Dear Foamers,

I am trying to make my solver output the cell face area from all my boundary patches.

In createFields I have added

Code:

IOField<scalar> SfOut
(
    IOobject
    (
        "Sf",
        mesh.time().timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mesh.magSf().boundaryField()[1]
);

SfOut.write();

It outputs the correct values for patch number 1 during runtime like:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      scalarField;
    location    "200";
    object      Sf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


20
(
1e-07
1e-07
1e-07
1e-07
1e-07
1e-07
1e-07
1e-07
1e-07
1e-07
4.54238e-08
5.29882e-08
6.18123e-08
7.21058e-08
8.41136e-08
9.81209e-08
1.14461e-07
1.33522e-07
1.55757e-07
1.81695e-07
)


// ************************************************************************* //

I can see the values are correct for my first patch, but how do i loop through all patches and assign the values to each patch like the wallHeatFlux utility does it:

Code:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 3 -3 0 0 0 0];

internalField  uniform 0;

boundaryField
{
    outlet
    {
        type            cyclic;
    }
    inlet
    {
        type            cyclic;
    }
    bottomLeft
    {
        type            symmetry;
    }
    bottomRight
    {
        type            symmetry;
    }
    topLeft
    {
        type            symmetry;
    }
    topRight
    {
        type            symmetry;
    }
    cylLeft
    {
        type            calculated;
        value          nonuniform List<scalar>
60
(
-6069.48
-6117.97
-6190.55
-6273.09
-6361.34
-6458.12
-6559.21
-6668.83
-6784.17
-6906.63
-7034.82
-7170.15

.... and so on.

I need this, so I can sample the values and get the correct coordinates for each cell face area.

niko0807 October 23, 2015 09:03

Apperantly the writeCellCentres utility writes the cell face areas of type:

- patch
- wall

but not for type

- symmetry
- cyclic

Why is this the case, and how do I modify the tool, so it writes the areas for all boundaries?


All times are GMT -4. The time now is 13:34.