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/)
-   -   Mach number in openFOAM (https://www.cfd-online.com/Forums/openfoam-post-processing/122770-mach-number-openfoam.html)

Alhasan August 27, 2013 17:50

Mach number in openFOAM
 
Dear all,

i have done a RANS simulation using KWSST model with temperature.

now i want to see the mach fields around my aircraft so, when i type Mach its asking for thermophysicalProperties ?

so has any body used the Mach function in openFOAM and how does this work what is this thermophysicalproperties ? i dunno what are the values within that mean.

it will be very helpful if someone tells me what is happening :)

Thanks,
Hasan.:confused:

immortality August 28, 2013 04:08

which solver do you use?

Alhasan August 28, 2013 04:11

boutantboussiqsimplefoam

please temme if i have to use some thing else.. :)

immortality August 28, 2013 04:58

I haven't used this solver,tell me whats your case to run exactly.
and put the error you get.but it seems that a field that is needed for Mach utility isn't there in time folders.
what files are there in your time folders?

Alhasan August 28, 2013 13:07

K, Kappat, Nut, T, P, P_rgh, Omega, U

and i want to know what are the things that is gonna be there in the thermodynamics properties ! folder and how do i find these things that i need for mach

when i put
R 287;
Cp 1005;
Cv 716;
Hf 0; (i dunno whats Hf) just got from some where !! don rem where do i need it ?

its saying unknown value for 287
just what should be there on thermodynamics properties i wanna know :)

Thanks for your time

Hasan K.J.

immortality August 28, 2013 15:22

its Mach utility code.send your case to have a look into it if you could.
Code:

Application
    Mach

Description
    Calculates and optionally writes the local Mach number from the velocity
    field U at each time.

    The -nowrite option just outputs the max value without writing the field.

\*---------------------------------------------------------------------------*/

#include "calc.H"
#include "fluidThermo.H"

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

void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
    bool writeResults = !args.optionFound("noWrite");

    IOobject Uheader
    (
        "U",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ
    );

    IOobject Theader
    (
        "T",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ
    );

    // Check U and T exists
    if (Uheader.headerOk() && Theader.headerOk())
    {
        autoPtr<volScalarField> MachPtr;

        volVectorField U(Uheader, mesh);

        if
        (
            IOobject
            (
                "thermophysicalProperties",
                runTime.constant(),
                mesh
            ).headerOk()
        )
        {
            // thermophysical Mach
            autoPtr<fluidThermo> thermo
            (
                fluidThermo::New(mesh)
            );

            volScalarField Cp(thermo->Cp());
            volScalarField Cv(thermo->Cv());

            MachPtr.set
            (
                new volScalarField
                (
                    IOobject
                    (
                        "Ma",
                        runTime.timeName(),
                        mesh
                    ),
                    mag(U)/(sqrt((Cp/Cv)*(Cp - Cv)*thermo->T()))
                )
            );
        }
        else
        {
            // thermodynamic Mach
            IOdictionary thermoProps
            (
                IOobject
                (
                    "thermodynamicProperties",
                    runTime.constant(),
                    mesh,
                    IOobject::MUST_READ_IF_MODIFIED,
                    IOobject::NO_WRITE
                )
            );

            dimensionedScalar R(thermoProps.lookup("R"));
            dimensionedScalar Cv(thermoProps.lookup("Cv"));

            volScalarField T(Theader, mesh);

            MachPtr.set
            (
                new volScalarField
                (
                    IOobject
                    (
                        "Ma",
                        runTime.timeName(),
                        mesh
                    ),
                    mag(U)/(sqrt(((Cv + R)/Cv)*R*T))
                )
            );
        }

        Info<< "Mach max : " << max(MachPtr()).value() << endl;

        if (writeResults)
        {
            MachPtr().write();
        }
    }
    else
    {
        Info<< "    Missing U or T" << endl;
    }

    Info<< "\nEnd\n" << endl;
}


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


Alhasan August 28, 2013 15:37

R R [0 -2 2 0 0 ] 287;
Cp Cp [0 -2 2 0 0 ] 1005;
Cv Cv [0 -2 2 0 0 ] 716;
Hf Hf [0 0 0 0 0 ]; this one is not needed.... supposedly lol.. dint know where i even got that from

I just kept playing around and it worked... with the above values, thanks for your initiative to help :) :)

- i have small Question what does this [0 -2 2 0 0 ] mean..? when i Put [0 0 0 0 0] for all it dint work by some shear luck i copy pasted something and it worked, i know there are called dimensions are some thing :)

can u please explain if u know what it is, coz i have sorted out the problem by luck i wanna know what it is :)

Thanks

immortality August 28, 2013 16:22

Hi
see about dimensions in guide in doc folder of OpenFOAM.there its explained.in some solvers you should add dimensions too.I haven't worked with the solver you said.


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