1

Previous: Instant convergence monitoring during Up: Gnuplot – convergence monitoring Next: Aerodynamic coefficients and

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

44 Instant convergence monitoring during computation

  • Convergence can be watched instantly using small script for Gnuplot

     

  • Suitable for immediate convergence watching

     

  • Create new bash script e.g. writeResiduals.sh:

     

    #!/bin/sh
    
    cat log.simpleFoam | grep Ux | cut -d' ' -f9 | tr -d ',' >  residualsUx.dat
    cat log.simpleFoam | grep Uy | cut -d' ' -f9 | tr -d ',' >  residualsUy.dat
    cat log.simpleFoam | grep Uz | cut -d' ' -f9 | tr -d ',' >  residualsUz.dat
    

     

  • Cygwin therefore OpenFOAM for Windows supports only files in Unix format (i.e. with \n for newlines as opposed to the DOS/Windows \r \n newline). If there is a problem with running script writeResiduals.sh add following line into your script just after the #! line

     

    (set -o igncr) 2>/dev/null && set -o igncr; # this comment is required
    

     

  • Create new file e.g. residuals.gp:

     

    # Gnuplot script file for plotting data from file "log"
    set title "Convergence process"
    set xlabel "Iterations"
    set ylabel "Reziduals"
    set logscale y
    
    plot 'residualsUx.dat' title 'u', \
         'residualsUy.dat' title 'v', \
         'residualsUz.dat' title 'w' 
    pause mouse
    

     

  • Run writeResiduals.sh, which creates data files with residuals
    # bash writeResiduals.sh

     

  • Run residuals.gp, by opening the script file in gnuplot program
openfoam tutorial motor bike residuals 1

Figure: OpenFOAM tutorial motor bike. Velocity residuals during computation.

File blockMeshDict

  • Let us go through the file:
    # less $FOAM_RUN/icoFoam/cavity/constant/polyMesh/blockMeshDict
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.2.1                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        object      blockMeshDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
  • Header of OpenFOAM file
    convertToMeters 0.1;
    
  • Parameter convertToMeters allows the whole mesh scaling

     

    vertices        
    (
        (0 0 0)
        (1 0 0)
        (1 1 0)
        (0 1 0)
        (0 0 0.1)
        (1 0 0.1)
        (1 1 0.1)
        (0 1 0.1)
    );
    
  • In section vertices there are written coordinates (points) of blocks of the mesh

     

    blocks          
    (
        hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)
    );
    
  • In section blocks there are defined all blocks of the mesh; hex(0 1 2 3 4 5 6 7) (20 20 1) means hexahedral of eight vertices (0-7) according to order in vertices. The block is divided into 20 x 20 x 1 cells
  • Parameter simpleGrading allows refinement setting in directions (x y z)
    (1 1 1) = means uniform distribution in all directions

     

    edges           
    (
    );
    
  • In section edges there are defined edges connecting block vertices
  • If not specified otherwise, blockMesh uses lines

     

    boundary
    (
        movingWall
        {
            type wall;
            faces
            (
                (3 7 6 2)
            );
        }
        fixedWalls
        {
            type wall;
            faces
            (
                (0 4 7 3)
                (2 6 5 1)
                (1 5 4 0)
            );
        }
        frontAndBack
        {
            type empty;
            faces
            (
                (0 3 2 1)
                (4 5 6 7)
            );
        }
    );
    
  • In section patches there are defined types of boundaries

     

    mergePatchPairs 
    (
    );
    
    // ************************************************************************* //
    
  • In section mergePatchPairs there are defined boundaries to be merged
  • Basic types of boundaries in OpenFOAM are shown in following table:
    boundary typepurpose
    patchgeneral boundary
    symmetryPlanesymmetry
    emptyempty, useful for 2D computations
    wedgeaxis symmetry
    cycliccyclic (periodic) boundary
    wallwall
    processorinter-processor boundary (parallel computations)

 

Previous: Clipped boundary is hub Up: Input parameters Next: Usage
This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.

Advanced parameters

The remaining parameters are in the advanced section and can be shown by clicking on the button with a wheel sign next to the search field in the panel Properties. The number parameters “Resolution”, “Tolerance” and “Iterations” are internal control parameters that influence precision and speed of the filter. “Resolution” is a approximately the number of control points along the hub and shroud patches. Raising the number of control points can increase the resolution of the approximated patches. “Tolerance” is proportional to the allowed absolute error in determination of point’s transformed coordinates $ (m, t, \zeta)$. The number should generally be smaller than the typical distance between two points in the original mesh. “Iterations” is the iteration limit set for determination of the transformed coordinates. It should not be necessary to raise the default value, unless an extremely fine mesh is being transformed. The field “Extension Points” is only used when “Snap internal points” is unchecked. It determines which sampled points of the boundary patches are used to extrapolate the patches. The number must be and integer greater than zero. If “1” is given, then only the tail of each patch is used to extrapolate their direction. If larger number is given, then the extrapolation runs in a more averaged direction. If “Snap internal points” is checked, no extrapolation is done and points outside the area bounded by hub and shroud are simply left with some extremal $ m$-coordinate. The check box “Remove split cells” (default: on) determines whether the cells that are split by unwrapping are to be removed or kept. Removing these cells allows ParaView to display the unwrapped mesh correctly; otherwise it looks as if there was no internal mesh. However, for special meshes this leads to a crash. In such cases, unchecking is an option. The option “Normalize patches” makes sure that the transformed hub and shroud patches will be of unit size in the $ \xi$ (i.e. $ z$) direction. This allows easy construction of the blade-to-blade view , but it may not be desired for the overall view. If this option is unchecked, the hub will still be normalized to unit size, but the transformed shroud will keep its ratio with respect to the hub. Finally, the “Debug output” option produces additional text information as a txt files in the working directory, which can be used to explore internal mechanisms of the filter, particularly the construction of the $ m$$ \xi$ ($ y$$ z$) contour which is then used to transform the whole mesh.