CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Problems with mass flow rate, pressure and velocity average values (https://www.cfd-online.com/Forums/openfoam-post-processing/177393-problems-mass-flow-rate-pressure-velocity-average-values.html)

LucasCosta September 12, 2016 09:49

Problems with mass flow rate, pressure and velocity average values
 
Hi people, I'm new in OpenFoam and a I have some problems, I want to know the pressure and velocity average, and the mass flow rate in a surface. This surface is an stl file, and I made it a faceZone using snappyHexMesh.

Code:


// Which of the steps to run
castellatedMesh true;    // make basic mesh ?
snap            true;    // decide to snap back to surface ?
addLayers      false;  // decide to add viscous layers ?


geometry // Load in STL files here
{

        TuboVenture.stl
        {
                type triSurfaceMesh;
                name venture;
        }
        areaSaidaVenture.stl
        {
                type triSurfaceMesh;
                name saida;
        }
       
        areaEntradaVenture.stl
        {
                type triSurfaceMesh;
                name entrada;
       
        }

};

castellatedMeshControls
{
    maxLocalCells 2500000;  //max cells per CPU core
    maxGlobalCells 10000000; //max cells to use before mesh deletion step
    minRefinementCells 10;  //was 0 - zero means no bad cells are allowed during refinement stages
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 4;  // expansion factor between each high & low refinement zone

    features // taken from STL from each .eMesh file created by "SurfaceFeatureExtract" command
    (
              {
                    file "TuboVenture.eMesh";
                        level 5;
          }
          {
                    file "areaEntradaVenture.eMesh";
                        level 5;
          }
                  {
                    file "areaSaidaVenture.eMesh";
                        level 5;
          }
               
    );

    refinementSurfaces // Surface-wise min and max refinement level
    {
                venture
                {
                        level (2 3);
                       
                        patchInfo
                        {
                                type wall;
                        }
                       
               
                }

                saida
                {
                        level (1 2);
                               
                        faceZone    saidaV;
            cellZone    saidaV;
            cellZoneInside inside;

            boundary    saidaV;
                }

               
                entrada
                {
                        level (1 2);
                               
                        faceZone    entradaV;
            cellZone    entradaV;
            cellZoneInside inside;

            boundary    entradaV;
                }
                       

    } 


    resolveFeatureAngle 30;  // Resolve sharp angles // Default 30
       
    refinementRegions        // In descending levels of fine-ness
    {

        }
       
    locationInMesh (-9.12 -2.11 -2.14);  //to decide which side of mesh to keep **
       
    allowFreeStandingZoneFaces true;
}


// Settings for the snapping.
snapControls
{
    nSmoothPatch 5;
    tolerance 4.0;
    nSolveIter 150;
    nRelaxIter 8;
    nFeatureSnapIter 10; // default is 10
   
// New settings from openfoam 2.2 onwards for SHMesh

implicitFeatureSnap false; // default is false - detects without doing surfaceFeatureExtract
explicitFeatureSnap true; // default is true
multiRegionFeatureSnap true; // deafault is false - detects features between multiple surfaces

}


// Settings for the layer addition.
addLayersControls //add the PATCH names from inside the STL file so STLpatchName_insideSTLName
{
    relativeSizes false; // was true
    layers
    {
        visc_main
                {nSurfaceLayers 3;} // was 3
        visc_refine_1
                {nSurfaceLayers 3;} // was 3
        visc_refine_2
                {nSurfaceLayers 3;} // was 3
    }

    expansionRatio 1.3;
    finalLayerThickness 0.00016; //was 0.00016
    minThickness 0.00008; //was 0.00008
    nGrow 0; // was 1


    // Advanced settings

    featureAngle 80; // was 70 //- When not to extrude surface. 0 is flat, 90 is right angle.
    nRelaxIter 3;  //- Max# of snapping relaxation iter. Should stop before upon reaching a correct mesh.
    nSmoothSurfaceNormals 1;  // Number of smoothing iterations of surface normals
    nSmoothNormals 3; // Number of smoothing iterations of interior mesh movement direction
    nSmoothThickness 10;  // Smooth layer thickness over surface patches
    maxFaceThicknessRatio 0.5; // Stop layer growth on highly warped cells
    maxThicknessToMedialRatio 0.3; // Reduce layer growth where ratio thickness to medial distance is large
    minMedianAxisAngle 130;  // Angle used to pick up medial axis points
    nBufferCellsNoExtrude 0;  // Create buffer region for new layer terminations
    nLayerIter 50; // Overall max number of layer addition iterations
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 70;
    minFlatness 0.5;
    minVol 1e-13;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;

    // Advanced

    nSmoothScale 4;
    errorReduction 0.75;
}

// Advanced

debug 0;


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1E-6;


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

After that I configurate my controlDict in this way

Code:


application    simpleFoam;

startFrom      startTime;

startTime      1000;

stopAt          endTime;

endTime        2000;

deltaT          1;

writeControl    timeStep;

writeInterval  100;

purgeWrite      0;

writeFormat    binary;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision  6;

runTimeModifiable true;


functions
{
    massFlow
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled        true;
        outputControl  timeStep;
        outputInterval  1;

        // Output to log&file (true) or to file only
        log            true;

        // Output field values as well
        valueOutput    false;

        // Type of source: patch/faceZone/sampledSurface
        source          faceZone;

        // if patch or faceZone: name of patch or faceZone
        sourceName      entradaV;

        // Operation: areaAverage/sum/weightedAverage ...
        operation      sum;

        surfaceFormat  stl;

        fields
        (
            phi
        );
    } 

  surfaceRegion1
{
    type            surfaceRegion;
    libs ("libfieldFunctionObjects.so");
    log            yes;
        writeArea                yes;
    writeFields    true;
    surfaceFormat  none;
    regionType      faceZone;
    name            saidaV;
    operation      average;
    fields
    (
        p
        phi
        U
    );
}
    surfaceRegion2
{
    type            surfaceRegion;
    libs ("libfieldFunctionObjects.so");
    log            yes;
        writeArea                yes;
    writeFields    true;
    surfaceFormat  none;
    regionType      faceZone;
    name            entradaV;
    operation      sum;
    fields
    (
        p
        phi
        U
    );
}
}


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

My geometry is this :

http://imgur.com/byToNs0

it's an external simulation through a circular pipe, and the blue lines in this view are my surfaces that I want to made the measures.

When I ran the simulation it goes ok, by I don't get any values that I want in the postProcessor folder, Can anyone help me?


Thanks for the attention and sorry if it's a silly doubt.

PositronCascade September 13, 2016 11:27

Hello, maybe it is silly question but your start time says 1000. Do you have the results for 1000th step? Maybe it can be a problem if you try to start from the zeroth step. For taking an average, I use ParaView. By using slice and clip functions of it, it is very easy to draw the point of interest. After doing this, if you use integrateVariables filter, then you can obtain the average quantities by dividing integral value to the area.

LucasCosta September 14, 2016 14:07

Quote:

Originally Posted by PositronCascade (Post 617771)
Hello, maybe it is silly question but your start time says 1000. Do you have the results for 1000th step? Maybe it can be a problem if you try to start from the zeroth step. For taking an average, I use ParaView. By using slice and clip functions of it, it is very easy to draw the point of interest. After doing this, if you use integrateVariables filter, then you can obtain the average quantities by dividing integral value to the area.

Hi, thank you for your attention. The start time point isn't a problem, because I'm using the results from other simulation with a coarse mesh, so my initial data is em the 1000 folder. The problem for the calculation in paraView is how i select my cellZones in paraview to use the integrateVariables?


best regards


All times are GMT -4. The time now is 19:58.