CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Spikes in Time-Plot of transient Sloshing Solution

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Leifheit

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2023, 04:32
Default Spikes in Time-Plot of transient Sloshing Solution
  #1
New Member
 
Join Date: Jul 2013
Posts: 21
Rep Power: 13
Leifheit is on a distinguished road
Hi everyone,


I am simulating water sloshing in a tank. An experiment has been conducted - the results can be found in various publications such as https://doi.org/10.1016/j.compfluid.2007.11.007 or https://link.springer.com/article/10...804-012-1137-y. Also, others have simulated the case using different software yielding good results.
For those that do not have access to the files, here a short explanation of the case:
- water sloshing in a 2D rectangular tank
- tank dimensions are height = 0.6m, width = 1.2m
- the tank is excited by an oscillating motion in direction of tank width
- movement is sinusoidal; amplitude is 0.015m, omega is 4.4752 rad/s
- pressure is recorded at multiple points in the tank
- fill height is 0.36 m

Before I post my case setup files etc, here a short explanation of how I am trying to simulate the case for now:
- laminar case (I want to go turbulent in the long run but laminar needs to run nicely first)
- interFoam for a multiphase VOF (air, water) simulation
- domain movement by means of solid body motion function oscillatingLinearMotion
- ddt Scheme is Euler
- grad Scheme is Gauss linear
- div Schemes: please take a look at file excerpt below
- initialized velocity in x-direction according to movement
- adjustable time step to keep Co ~ 0.5


Here are excerpts from the files I perceive to be relevant; if you miss anything please tell me and I will post it


controlDict:


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

application     interFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         50;

deltaT          0.002;

writeControl    adjustableRunTime;

writeInterval   2;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true; 

adjustTimeStep yes;

maxCo           0.5;

maxAlphaCo      0.5;

maxDeltaT       0.01;



functions{ 

    probes
    {
        type            probes;
        libs            ("libsampling.so");

        // Name of the directory for probe data
        name            probes;

        writeControl    timeStep;

        // Fields to be probed
        fields          (p);

        // Optional: interpolation scheme to use (default is cell)
        interpolationScheme cell;

        fixedLocations  false;

        probeLocations
        (
            (1.2 0.0 0.3)
            (1.2 0.0 0.426)
            (1.142 0.0 0.6)
        );
    }       
       
}  


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

ddtSchemes
{
    default         Euler;
}


gradSchemes
{
    default         Gauss linear;
}

divSchemes
{
    default         none;

    div(rhoPhi,U)   Gauss vanLeer;

    div(phi,alpha)  Gauss vanLeer;
    div(phirb,alpha)   Gauss interfaceCompression;

    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         corrected;
}


// ************************************************************************* //
fvSolution:


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

solvers
{
    "alpha.water.*"
    {
        nAlphaCorr      1;
        nAlphaSubCycles 1;        
        cAlpha          1.5;
        alphaOuterCorrectors yes;

        MULESCorr       yes;
        nLimiterIter    3;

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

    "pcorr.*"
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-5;
        relTol          0;
    }

    p_rgh
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-08;
        relTol          0.01;
    }

    p_rghFinal
    {
        solver          PCG;
        preconditioner
        {
            preconditioner  GAMG;
            tolerance       2e-09;
            relTol          0;
            nVcycles        2;
            smoother        DICGaussSeidel;
            nPreSweeps      2;
        }

        tolerance       2e-09;
        relTol          0;
        maxIter         20;
    }

    "(U).*"
    {
        solver          smoothSolver;
        smoother        symGaussSeidel;
        tolerance       1e-06;
        relTol          0;
        minIter         1;
    }
}

PIMPLE
{
    momentumPredictor   yes;
    nCorrectors 3;
    nOuterCorrectors    100;
    //nNonOrthogonalCorrectors 0;
    pRefPoint (0 0 0.6);
    pRefValue 0;   
    outerCorrectorResidualControl
    {
        U
        {
                tolerance  1e-4;
                relTol      0;
        }
        p
        {
                tolerance  1e-4;
                relTol      0;
        }
        p_rgh
        {
                tolerance  1e-4;
                relTol      0;
        }                        
     }       
}

relaxationFactors
{
    fields
    {
        p      0.3;
        pFinal   1;
    }
    equations
    {
        "U"     0.3;
        "(U)Final"   1;
    }
}


  // ************************************************************************* //
p_rgh file:


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

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

internalField   uniform 0;

boundaryField
{
    side1
    {
        type            fixedFluxPressure; 
    }

    side2
    {
        type            fixedFluxPressure;      
    }        

    bottom
    {
        type            fixedFluxPressure; 
    }

    top
    {
        type            fixedFluxPressure; 
    }    

    frontAndBack
    {
        type            empty;
    } 
}


// ************************************************************************* //
U file:


Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2112                                 |
|   \\  /    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.067128 0 0);

boundaryField
{
    side1
    {
        type            movingWallVelocity;
        value           uniform (0.067128 0 0);
    }

    side2
    {
        type            movingWallVelocity;
        value           uniform (0.067128 0 0);   
    }    
     

    bottom
    {
        type            movingWallVelocity;
        value           uniform (0.067128 0 0);
    }

    top
    {
        type            movingWallVelocity;
        value           uniform (0.067128 0 0);
    }    

    frontAndBack
    {
        type            empty;
    }    
}


// ************************************************************************* //
alpha.water file:

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

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    side1
    {
        type            zeroGradient;   
    }

    side2
    {
        type            zeroGradient;        
    }         

    bottom
    {
        type            zeroGradient;
    }

    top
    {
        type            zeroGradient;
    }    

    frontAndBack
    {
        type            empty;
    }
}


// ************************************************************************* //
Here is the Output from checkMesh:

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  10
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 10-e450dce21ea5
Exec   : checkMesh
Date   : Jan 23 2023
Time   : 08:34:52
Host   : CLEARED
PID    : 928
I/O    : uncollated
Case   : CLEARED
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0s

Mesh stats
    points:           31506
    internal points:  0
    faces:            62216
    internal faces:   30712
    cells:            15488
    faces per cell:   6
    boundary patches: 5
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     15488
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch               Faces    Points   Surface topology
    side1               88       178      ok (non-closed singly connected)
    side2               88       178      ok (non-closed singly connected)
    bottom              176      354      ok (non-closed singly connected)
    top                 176      354      ok (non-closed singly connected)
    frontAndBack        30976    31506    ok (non-closed singly connected)

Checking geometry...
    Overall domain bounding box (0 -0.1 0) (1.2 0.1 0.6)
    Mesh has 2 geometric (non-empty/wedge) directions (1 0 1)
    Mesh has 2 solution (non-empty) directions (1 0 1)
    All edges aligned with or perpendicular to non-empty directions.
    Boundary openness (-2.26879e-17 1.88098e-14 -2.12423e-16) OK.
    Max cell openness = 1.465e-16 OK.
    Max aspect ratio = 1.03019 OK.
    Minimum face area = 4.62542e-05. Maximum face area = 0.0014.  Face area magnitudes OK.
    Min volume = 9.25085e-06. Max volume = 9.8e-06.  Total volume = 0.144.  Cell volumes OK.
    Mesh non-orthogonality Max: 0 average: 0
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 1.30476e-13 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

 End
The pressure plot I get for the probe at (1.2 0.0 0.3) is given as an attachment. If the spikes were not present, results would match up reasonably well with the experiment

Also, residual plots of the end of the simulation (last 1000 lines of the output file) are given in the attachement. For further clarity, here are the last couple of iterations from the output file:


Code:
Courant Number mean: 0.0873681 max: 0.491744
Interface Courant Number mean: 0.00141919 max: 0.436737
deltaT = 0.000721168
Time = 50s

PIMPLE: Iteration 1
DICPCG:  Solving for pcorr, Initial residual = 1, Final residual = 9.54101e-06, No Iterations 286
time step continuity errors : sum local = 1.63964e-12, global = 1.22774e-16, cumulative = 4.33396e-13
smoothSolver:  Solving for alpha.water, Initial residual = 0.000465417, Final residual = 1.55265e-09, No Iterations 2
Phase-1 volume fraction = 0.601877  Min(alpha.water) = 1.24552e-07  Max(alpha.water) = 1
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.601877  Min(alpha.water) = 1.14085e-07  Max(alpha.water) = 1
smoothSolver:  Solving for Ux, Initial residual = 0.00088217, Final residual = 9.89521e-07, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.000999653, Final residual = 1.9488e-08, No Iterations 2
DICPCG:  Solving for p_rgh, Initial residual = 0.0457134, Final residual = 0.000413374, No Iterations 9
time step continuity errors : sum local = 2.82853e-05, global = 1.22492e-16, cumulative = 4.33519e-13
DICPCG:  Solving for p_rgh, Initial residual = 0.000763777, Final residual = 7.62554e-06, No Iterations 85
time step continuity errors : sum local = 5.5095e-07, global = 1.22566e-16, cumulative = 4.33641e-13
GAMGPCG:  Solving for p_rgh, Initial residual = 2.23129e-05, Final residual = 1.99164e-09, No Iterations 5
time step continuity errors : sum local = 1.34186e-10, global = 1.22444e-16, cumulative = 4.33764e-13


........



 PIMPLE: Iteration 8
smoothSolver:  Solving for alpha.water, Initial residual = 0.000411351, Final residual = 1.53598e-09, No Iterations 2
Phase-1 volume fraction = 0.601877  Min(alpha.water) = 1.24551e-07  Max(alpha.water) = 1
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.601877  Min(alpha.water) = 1.14317e-07  Max(alpha.water) = 1
smoothSolver:  Solving for Ux, Initial residual = 7.20231e-05, Final residual = 8.15403e-08, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 7.22743e-05, Final residual = 1.58703e-07, No Iterations 1
DICPCG:  Solving for p_rgh, Initial residual = 9.49839e-05, Final residual = 9.48353e-07, No Iterations 8
time step continuity errors : sum local = 6.49024e-08, global = 1.22356e-16, cumulative = 4.3609e-13
DICPCG:  Solving for p_rgh, Initial residual = 1.46942e-06, Final residual = 1.45553e-08, No Iterations 82
time step continuity errors : sum local = 1.04097e-09, global = 1.2232e-16, cumulative = 4.36212e-13
GAMGPCG:  Solving for p_rgh, Initial residual = 4.09335e-08, Final residual = 5.66621e-10, No Iterations 2
time step continuity errors : sum local = 3.93621e-11, global = 1.22389e-16, cumulative = 4.36335e-13
PIMPLE: Converged 
        Doing final iteration
PIMPLE: Iteration 9
smoothSolver:  Solving for alpha.water, Initial residual = 0.000411313, Final residual = 1.53734e-09, No Iterations 2
Phase-1 volume fraction = 0.601877  Min(alpha.water) = 1.24551e-07  Max(alpha.water) = 1
MULES: Correcting alpha.water
Phase-1 volume fraction = 0.601877  Min(alpha.water) = 1.14321e-07  Max(alpha.water) = 1
smoothSolver:  Solving for Ux, Initial residual = 0.000171374, Final residual = 7.1472e-07, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 0.000172324, Final residual = 3.90396e-08, No Iterations 2
DICPCG:  Solving for p_rgh, Initial residual = 0.00987837, Final residual = 9.7336e-05, No Iterations 8
time step continuity errors : sum local = 2.21655e-05, global = 1.22798e-16, cumulative = 4.36458e-13
DICPCG:  Solving for p_rgh, Initial residual = 0.000297428, Final residual = 2.74392e-06, No Iterations 80
time step continuity errors : sum local = 6.31496e-07, global = 1.22849e-16, cumulative = 4.3658e-13
GAMGPCG:  Solving for p_rgh, Initial residual = 2.4488e-05, Final residual = 2.67693e-10, No Iterations 4
time step continuity errors : sum local = 6.332e-11, global = 1.22822e-16, cumulative = 4.36703e-13
PIMPLE: Converged in 9 iterations
ExecutionTime = 34349.1 s  ClockTime = 34575 s

End

  Finalising parallel run
Finally, here is a list of things I have already tried:

- run simulation with very small fixed time step
- 2nd order time integration
- stricter tolerances for outer Iterations "outerCorrectorResidualControl" (did not converge in 100 iterations) ... should I try with 500?
- different relaxation factors
- turn off momentumPredictor


EDIT: Attached complete case for more clarity / providing missing information



Any hints on how to proceed would be highly appreciated!


Best Regards,


Leif
Attached Images
File Type: png Pressure.png (47.8 KB, 18 views)
File Type: png UxResidual.png (8.7 KB, 11 views)
File Type: png UzResidual.png (8.7 KB, 9 views)
File Type: png p_rgh.png (10.0 KB, 9 views)
Attached Files
File Type: zip godderidge_cfdonline.zip (11.0 KB, 0 views)

Last edited by Leifheit; January 23, 2023 at 05:19. Reason: Attached zip of complete case
Leifheit is offline   Reply With Quote

Old   January 24, 2023, 03:34
Default
  #2
New Member
 
Join Date: Jul 2013
Posts: 21
Rep Power: 13
Leifheit is on a distinguished road
Hey everyone,


I made considerable progress, although there is still room for improvement


Changing the divergence schemes entries from



Code:
divSchemes
{
    default         none;

    div(rhoPhi,U)   Gauss vanLeer;

    div(phi,alpha)  Gauss vanLeer;
    div(phirb,alpha)   Gauss interfaceCompression;

    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

to


Code:
divSchemes
{
    default         none;

    div(rhoPhi,U)   Gauss vanLeer;

    div(phi,alpha)  Gauss interfaceCompression vanLeer 1;

    div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}

resulted in a much cleaner pressure plot, see attachment. Will post updates if further improvement is made.
Attached Images
File Type: png Pressure.png (49.8 KB, 24 views)
lourencosm likes this.
Leifheit is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Extracting ParaView Data into Python Arrays Jeffzda ParaView 30 November 6, 2023 22:00
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 6, 2023 00:48
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 06:28
same geometry,structured and unstructured mesh,different behaviour. sharonyue OpenFOAM Running, Solving & CFD 13 January 2, 2013 23:40
plot over time fferroni OpenFOAM Post-Processing 7 June 8, 2012 08:56


All times are GMT -4. The time now is 21:07.