1

Previous: paraFoam Up: Test case: Backward-Facing-Step Next: Evaluating mass flow at

This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.

Evaluating pressure coefficient $ C_p$ at the top wall of the channel

    • $ C_p$ pressure coefficient is in general4.1:

     

    $\displaystyle C_{p} = \frac{p - p_{\infty}}{\frac{1}{2}\rho_{\infty} U_{\infty}^{2}}$(4.1)

     

     

    • We are going to evaluate pressure coefficient at the boundary, specifically at the UpperWall patch.
    • It means we need to know value of pressure $ p$ at the boundary.
    • We use OpenFOAM post-processing functionality for sampling value of pressure.
    • The postProcess utility employs function object framework.
    • We use function object surfaceFieldValue.
    • An example of using this function object can be seen in its header file

      # cat $FOAM_SRC/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.H

       

    • We create a new file called sampleUpperPatch in system directory.
    • (It can be done for example by command # touch system/sampleUpperPatch . The ‘touch’ command creates an empty text file. Use mcedit, or other text editor, to add following text to the file.)
      type            surfaceFieldValue;
      libs            ("libfieldFunctionObjects.so");
      
      writeControl    writeTime;
      writeFields     true;
      
      surfaceFormat   raw;
      regionType      patch;
      name            upperWall;
      
      operation       none;
      
      fields
      (
          p
      );
      

       

    • We would like to sample field ‘p’ at the regionType ‘patch’ with name ‘upperWall’. The data will be stored in raw format.
    • The function object can be launched from case directory:

      # cd $FOAM_RUN/pitzDaily

      # postProcess -func sampleUpperPatch

       

    • Output is following:
      /*---------------------------------------------------------------------------*\
      | =========                 |                                                 |
      | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
      |  \\    /   O peration     | Version:  dev                                   |
      |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
      |    \\/     M anipulation  |                                                 |
      \*---------------------------------------------------------------------------*/
      Build  : dev-e2ccbbbb
      Exec   : postProcess -func sampleUpperPatch
      Date   : Jun 16 2017
      Time   : 12:00:00
      Host   : $HOSTNAME
      PID    : $$
      Case   : $FOAM_RUN/pitzDaily
      nProcs : 1
      sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
      fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
      allowSystemOperations : Allowing user-supplied system call operations
      
      // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
      Create time
      
      Create mesh for time = 0
      
      surfaceFieldValue sampleUpperPatch:
          total faces  = 223
          total area   = 0.00031106
      
      
      Time = 0
      
      Reading fields:
          volScalarFields: p
      
      Executing functionObjects
      
      
      Time = 100
      
      Reading fields:
          volScalarFields: p
      
      Executing functionObjects
      
      
      Time = 200
      
      Reading fields:
          volScalarFields: p
      
      Executing functionObjects
      
      
      Time = 287
      
      Reading fields:
          volScalarFields: p
      
      Executing functionObjects
      
      
      End
      

    • In test case directory is directory postProcessing containing new folder sampleUpperPatch, look inside:
      # cd ./postProcessing
      # ls

       

      sampleUpperPatch  sets
      
      # cd ./sampleUpperPatch
      # ls

       

      surface
      

      # cd ./surface
      # ls

       

      0  100  200  287
      

      # cd ./287
      # ls

      patch_upperWall.raw  p_patch_upperWall.raw
      
    • Look at file data:
      # more ./p_patch_upperWall.raw
      # p  FACE_DATA 223
      #  x  y  z  p
      -0.0198086 0.0254 0 -1.90829
      -0.0182574 0.0254 0 -3.67105
      -0.0167681 0.0254 0 -4.67569
      -0.0153384 0.0254 0 -4.97477
      -0.0139658 0.0254 0 -5.12385
      -0.012648 0.0254 0 -5.26736
      -0.0113829 0.0254 0 -5.38125
      -0.0101683 0.0254 0 -5.46206
      

    • For plotting $ C_p$ at top wall channel we use e.g. an open-source program gnuplot
    • $ {\textcolor{blue}{\mathsf {In \ Linux: }}}$ Run gnuplot:
      # gnuplot
    • $ {\textcolor{red}{\mathsf {In \ Windows: }}}$ Run gnuplot outside of terminal. Use File > Change Directory and navigate to the location of file p_upperWallData.raw and confirm with OK.
    • In gnuplot environment type command:
      gnuplot> plot './p_patch_upperWall.raw' using 1:($4/(0.5*100)) with lines
    • $ p_{\infty} = 0\ m^2s^{-2},\ U_{\infty} = 10.0\ m\,s^{-1}$
openfoam tutorial backward facing step pitzDaily Cp pressure

Figure: $ C_p$ at the top wall, Backward-Facing-Step OpenFOAM tutorial