unicfdlab / libAcoustics

libAcoustics - OpenFOAM library for far-field noise computation
140 stars 57 forks source link

The mean value of p_Fluct is not zero in VortexShed case #95

Open wuuyuan opened 1 year ago

wuuyuan commented 1 year ago

hi, I am running the VortexShed tutorial case in OpenFoam v20 and libacoustic in v20. But the p_Fluct of one observation point calculated by FWH method has non-zero mean value, which confuse me that the acoustic pressure should oscillate around the 0 rather than a non-zero value. how can I get the right value in this case?

here is the output .dat file and I used MATLAB to draw it:

image

as we can see that the point E1's p_Fluct has the non-zero mean value, it it right ?

wuuyuan commented 1 year ago

here is additional comment.

I also run my own flow_past_cylinder case to obtain the p_Fluct and the same situation occurs as well.

image

as you can see, the p_Fluct at $\theta=0$ has the mean value far away from 0, but the p_Fluct at $\theta=90$ has 0 mean value, which makes the directivity shown below:

image

however, when I use "p_fluct = p_fluct - mean(p_fluct)" in post-processing, the directivity could fit in the right image :

image image

And I am pretty sure that I set the internalField as 0 and I am using pimpleFoam solver in OpenFoam

wuuyuan commented 1 year ago

here is my case set:

p file

/--------------------------------- C++ -----------------------------------\ | ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: v2012 | | \ / A nd | Website: www.openfoam.com | | \/ M anipulation | | *---------------------------------------------------------------------------/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField { INLET { type zeroGradient;

}

OULET
{

    type            fixedValue;
    value           $internalField;

}

WALL
{
    type            zeroGradient;

}

CYLINDER
{
    type            zeroGradient;
}

FRONT
{
    type            empty;
}

BACK
{
    type            empty;
}

U file

/--------------------------------- C++ -----------------------------------\ | ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: v2012 | | \ / A nd | Website: www.openfoam.com | | \/ M anipulation | | *---------------------------------------------------------------------------/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0.3 0 0);

boundaryField { INLET { type fixedValue; value uniform (0.3 0 0);//0.3 } OULET { type zeroGradient;

}
WALL
{
    type        slip;
}

CYLINDER
{

    type        movingWallVelocity;
    value       uniform (0 0 0);

}

FRONT
{
    type            empty;
}

BACK
{
    type            empty;
}

fwhControl file

Farassat1A-Patch { type FfowcsWilliamsHawkings; formulationType Farassat1AFormulation;

include "commonSettings";

    patches      ();
    interpolationScheme cell;

    surfaces
    (

            CYLINDER
            {
                type            patch;
                patches         (CYLINDER);
                interpolate     false;
            }
    );
    cleanFreq       100;
    fixedResponseDelay true;
    responseDelay   0.01;
    nonUniformSurfaceMotion true;
    Ufwh    (.0 .0 .0);
    U0      (.0 .0 .0);

}

commonSetting file

libs ("libAcoustics.so");

    log             true;

    probeFrequency  1;

    timeStart       200;

    timeEnd         1000;

    writeFft        false;

    c0              1500;

    pName           p;

    pInf            0;//for pisoFoam

    rhoName         rho;

    rho             rhoInf;

    rhoInf          1000;

    CofR (0 0 0);

    observers
    {

        // r = 50
        N3_1
        {
            position (50 0 1);
            pRef 0.000020;
            fftFreq 1024;
        }

...

controlDict file

/--------------------------------- C++ -----------------------------------\ | ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: v2012 | | \ / A nd | Website: www.openfoam.com | | \/ M anipulation | | *---------------------------------------------------------------------------/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // //

application pimpleFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1000;

deltaT 5e-4;

writeControl adjustableRunTime;

writeInterval 0.1;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

adjustTimeStep yes;

maxCo 0.9;

functions {

include "fwhControl"

}

unicfdlab commented 1 year ago

The E1 point is located in near field and is needed to compare pressure with direct calculation. If you are using the pimple or piso algorithm you need to set pInf equal to 0. This tutorial was created to show how to use and configure libacoustics for similar problems. Library validation cases can be found in the Tests folder. You may also be interested in the answers to these questions: https://github.com/unicfdlab/libAcoustics/issues/75#issue-1213514406 https://github.com/unicfdlab/libAcoustics/issues/78#issue-1240059897

Regards, AE

wuuyuan commented 1 year ago

The E1 point is located in near field and is needed to compare pressure with direct calculation. If you are using the pimple or piso algorithm you need to set pInf equal to 0. This tutorial was created to show how to use and configure libacoustics for similar problems. Library validation cases can be found in the Tests folder. You may also be interested in the answers to these questions: #75 (comment) #78 (comment)

Regards, AE

thank you for replying, however, in the case that I have tried above, I have already set ping equal to 0, but the mean value of p_fluct at E1 is not equal to 0, what else can I do in the setting file?

and here is my setting of pInf in common setting:

image
unicfdlab commented 1 year ago

The library calculates the total pressure (p+p'). The static pressure is non zero because the FWH surface is located close to the body. If you want to determine SPL you need to determine the root mean square (RMS) pressure.

Regards, AE