1

Previous: Instant convergence monitoring during Up: Test case: motorBike Next: Function probe

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

Aerodynamic coefficients 90 and 91

  • Aerodynamic coefficients 90 and 91 can be evaluated by adding additional functions to controlDict file
  • Configuration file controlDict is extended:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  dev                                   |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        object      controlDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    application     simpleFoam;
    
    startFrom       latestTime;
    
    startTime       0;
    
    stopAt          endTime;
    
    endTime         500;
    
    deltaT          1;
    
    writeControl    timeStep;
    
    writeInterval   100;
    
    purgeWrite      0;
    
    writeFormat     binary;
    
    writePrecision  6;
    
    writeCompression uncompressed;
    
    timeFormat      general;
    
    timePrecision   6;
    
    runTimeModifiable true;
    
    functions
    {
        #include "streamLines"
        #include "cuttingPlane"
        #include "forceCoeffs"
    }
    
    
    
    // ************************************************************************* //
    
  • Object libs and includes of files streamLines and cuttingPlane can be deleted for this time. File forceCoeffs reads as follows:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  dev                                   |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    
    forceCoeffs1
    {
        type            forceCoeffs;
    
        libs            ("libforces.so");
    
        writeControl    timeStep;
        timeInterval    1;
    
        log             yes;
    
        patches         (motorBikeGroup);
        rho             rhoInf;      // Indicates incompressible
        rhoInf          1;           // Redundant for incompressible
        liftDir         (0 0 1);
        dragDir         (1 0 0);
        CofR            (0.72 0 0);  // Axle midpoint on ground
        pitchAxis       (0 1 0);
        magUInf         20;
        lRef            1.42;        // Wheelbase length
        Aref            0.75;        // Estimated
        /*
        binData
        {
            nBin        20;          // output data into 20 bins
            direction   (1 0 0);     // bin direction
            cumulative  yes;
        }
        */
    }
    

  • forceCoeffs1 computes coefficients $ C_l$ and $ C_d$ in direction liftDir and dragDir, data are saved after each time step in directory postProcessing/forceCoeffs1

  • Easy Gnuplot script named e.g. plotCdCl displays $ C_l$ and $ C_d$ development:
    # Gnuplot script file for plotting data from file "forceCoeffs.dat"
    set title "Convergence process"
    set xlabel "Iterations"
    set ylabel "Aerodynamics Coefficients"
    plot [ ][-0.2:0.8]\
          "postProcessing/forceCoeffs1/0/forceCoeffs.dat" using 1:3 title 'Cd', \
          "postProcessing/forceCoeffs1/0/forceCoeffs.dat" using 1:4 title 'Cl'
    pause mouse
    
  • Run the script:
    # gnuplot plotCdCl
openfoam tutorial motor bike cd cl

Figure: OpenFOAM tutorial motor bike. 90 and 91 development during computation