CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   interFoam not holding waveform (https://www.cfd-online.com/Forums/openfoam-solving/253041-interfoam-not-holding-waveform.html)

treem22 November 21, 2023 12:04

interFoam not holding waveform
 
3 Attachment(s)
Fellow foamers,

I'm attempting to simulate wing in-ground effects on a 2D airfoil over an air-water interface. I want to assign a specific waveform to the interface, but the waveform is changing shape as it progresses through the domain. I recognize that the presence of the airfoil will affect the waveform shape, but I'm seeing waveform changes as soon as one period after the boundary, which is ~9 chord lengths upstream of the airfoil.

Picture1 shows the initial setup.

Picture2 shows the first period of the wave from the boundary condition and highlights an indentation at the wave peak.

Picture3 shows the first several periods and the change in waveform shape as it progresses through the domain.

Does anyone have ideas on how I can better control the waveform shape that reaches the airfoil?

Here are my pertinent input files:

controlDict
Code:

application      interFoam;

startFrom        latestTime; //startTime;

startTime          0.;

stopAt            nextWrite; //endTime;

endTime                  0.31896; // 60 periods (3x flow-throughs)

deltaT                  1e-6;

writeControl      adjustableRunTime;

writeInterval          2.658e-4; // 20 steps per period

purgeWrite          0;

writeFormat          binary;

writePrecision          6;

writeCompression  off;

timeFormat          general;

timePrecision          6;

runTimeModifiable yes;

adjustTimeStep          on;

maxCo                  3.;

maxAlphaCo          1.;

maxDeltaT        1.;

fvSchemes
Code:

ddtSchemes
{
    default        Euler;
}

gradSchemes
{
    default        Gauss linear;
    limitedGrad    cellLimited Gauss linear 1;
}

divSchemes
{
    div(rhoPhi,U)  Gauss linearUpwind grad(U);
    div(phi,alpha)  Gauss vanLeer;
    div(phirb,alpha) Gauss linear;
    div(phi,k)      Gauss linearUpwind limitedGrad;
    div(phi,omega)  Gauss linearUpwind limitedGrad;
    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default        Gauss linear corrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
}

wallDist
{
    method          meshWave;
}

fvSolution
Code:

solvers
{
    "alpha.water.*"
    {
        nAlphaCorr      3;
        nAlphaSubCycles 1;
        cAlpha          1;
        icAlpha        0;

        MULESCorr      yes;
        nLimiterIter    15;
        alphaApplyPrevCorr  yes;

        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance      1e-10;
        relTol          0;
        minIter        1;
    }

    "pcorr.*"
    {
        solver          GAMG;
        smoother        DIC;
        tolerance      1e-3;
        relTol          0;
    };

    p_rgh
    {
        solver          GAMG;
        smoother        DIC;
        tolerance      5e-8;
        relTol          0;
    };

    p_rghFinal
    {
        $p_rgh;
        relTol          0;
    }

    "(U|k|omega).*"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        nSweeps        1;
        tolerance      1e-7;
        relTol          0;
        minIter        1;
    };
}

PIMPLE
{
    momentumPredictor no;

    nOuterCorrectors 2;
    nCorrectors      2;
    nNonOrthogonalCorrectors 0;

    correctPhi      yes;
    moveMeshOuterCorrectors no;
    turbOnFinalIterOnly yes;
}

relaxationFactors
{
    equations
    {
        ".*" 1;
    }
}

cache
{
    grad(U);
}

0/U:
Code:

Umean  100;

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

internalField  uniform ($Umean 0 0);

boundaryField
{
        front_and_back
        {
                type  empty;
        }
        inlet
        {
                type            fixedValue;
                value          $internalField;
        }
        outlet
        {
                type            outletPhaseMeanVelocity;
                alpha          alpha.water;
                Umean          $Umean;
                value          $internalField;
        }
        top
        {
                type                pressureInletOutletVelocity;
                tangentialVelocity  $internalField;
                value              uniform (0 0 0);
        }
        bottom
        {
                type                pressureInletOutletVelocity;
                tangentialVelocity  $internalField;
                value              uniform (0 0 0);
        }
        wing
        {
                type  noSlip;
        }
}

0/p_rgh:
Code:

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

internalField  uniform 0;

boundaryField
{
        front_and_back
        {
                type  empty;
        }
        bottom
        {
                type  totalPressure;
                p0    uniform 0;
        }
        wing
        {
                type  fixedFluxPressure;
                value  $internalField;
        }
        outlet
        {
                type  zeroGradient;
        }
        top
        {
                type  totalPressure;
                p0    uniform 0;
        }
        inlet
        {
                type  fixedFluxPressure;
                value  $internalField;
        }
}

0/alpha.water:
Code:

dimensions      [0 0 0 0 0 0 0];

internalField  uniform 0;

boundaryField
{
        front_and_back
        {
                type  empty;
        }
        bottom
        {
                type        inletOutlet;
                inletValue  uniform 1;
                value      $internalField;
        }
        wing
        {
                type  zeroGradient;
        }
        outlet
        {
                type        variableHeightFlowRate;
                lowerBound  0;
                upperBound  1;
                value      $internalField;
        }
        top
        {
                type        inletOutlet;
                inletValue  $internalField;
                value      $internalField;
        }
        inlet
        {
                type  uniformFixedValue;
                value  $internalField;
                uniformValue
                {
                        type expression;
                        variables
                        (
                                "orig_h = -0.1329"
                                // wave amplitude
                                "a = 0.045"
                                // wave speed (match velocity inlet)
                                "Vg = 100"
                                // wavelength
                                "l = 0.5316"
                                // wave height
                                "eta = -a*cos(2*pi()*Vg*time()/l)"
                        );
                        expression
                        #{
                                // if the y position is less than or equal to
                                // the original water level plus the wave
                                // height then set the alpha value to 1; if not
                                // set the alpha value to 0
                                (pos().y() <= orig_h + eta) ? 1 : 0
                        #};
                }
        }
}

Any help is most appreciated!

Alczem November 22, 2023 03:28

Hey!


You could use the file waveProperties with the waveVelocity and waveAlpha boundary conditions to generate waves. They tend to be stable in my experience. There are some examples in the interFoam tutorials.


Other than that, maybe turning off the turbulence will help because turbulence will introduce dissipation depending on the scale of the simulation. And I always turn off alphaApplyPrevCorr in fvSolution, my simulations are more unstable more often than not (although I may be using it when it is not applicable). Just a thing that you could also try :)


And finally, if you use setFields, add an hRef file in constant with your initial water level. It helps with the water leaving properly at the outlet.


All times are GMT -4. The time now is 20:51.