CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   How to implement time-varying boundary conditions in an enclosed cylinder (https://www.cfd-online.com/Forums/openfoam-pre-processing/227006-how-implement-time-varying-boundary-conditions-enclosed-cylinder.html)

Alejandro-FA May 14, 2020 06:29

How to implement time-varying boundary conditions in an enclosed cylinder
 
Hi, I've been working with OpenFOAM for the past few weeks. The goal of my project is to simulate a viscoelastic fluid in a closed cylinder, in which the top and bottom face are moving up and down with a sinusoidal and coherent motion (when the bottom face moves up, the top face goes up too, and vice versa). You could think that the bottom face is moved by a motor, and that the top face is connected to the bottom one.

Said so, I'm having trouble establishing the appropriate pressure boundary conditions. So far, my blockMeshDict looks like this:

Code:

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

convertToMeters 1;

radius      0.025;
radiusNeg  -0.025;
box        0.010;
boxNeg    -0.010;
zMax        0.50;
zMin      -0.50;

nR          7;
nZ          20;

verbose no;

geometry
{
    cylinder
    {
        // Axis point at the start i Axis point at the end i Cylinder radius
        type      searchableCylinder;
        point1    (0 0 -1);
        point2    (0 0  1);
        radius    $radius;
    }
}


// Scaling factor for the vertex coordinates
scale 1;

// List of vertex coordinates
vertices
(
    // Inner
    ($boxNeg $boxNeg $zMin)
    ($box    $boxNeg $zMin)
    ($boxNeg $box    $zMin)
    ($box    $box    $zMin)

    // Outer block points
    project ($radiusNeg $radiusNeg $zMin) (cylinder)
    project ($radius    $radiusNeg $zMin) (cylinder)
    project ($radiusNeg $radius    $zMin) (cylinder)
    project ($radius    $radius    $zMin) (cylinder)

    // Inner
    ($boxNeg $boxNeg $zMax)
    ($box    $boxNeg $zMax)
    ($boxNeg $box    $zMax)
    ($box    $box    $zMax)

    // Outer block points
    project ($radiusNeg $radiusNeg $zMax) (cylinder)
    project ($radius    $radiusNeg $zMax) (cylinder)
    project ($radiusNeg $radius    $zMax) (cylinder)
    project ($radius    $radius    $zMax) (cylinder)
);

// Ordered list of vertex labels and mesh size
// ($nR $nR $nZ) numbers of cells in each direction
// simpleGrading cell expansion ratios
//The shape is always hex since the blocks are always hexahedra.
blocks
(

    // Arc 3D inferior
    hex ( 4  5  1  0 12 13  9  8) ($nR $nR $nZ) simpleGrading (1 1 1)
    // Arc 3D esquerra
    hex ( 4  0  2  6 12  8 10 14) ($nR $nR $nZ) simpleGrading (1 1 1)
    // Arc 3D dret
    hex ( 1  5  7  3  9 13 15 11) ($nR $nR $nZ) simpleGrading (1 1 1)
    // Arc 3D superior
    hex ( 2  3  7  6 10 11 15 14) ($nR $nR $nZ) simpleGrading (1 1 1)
    // Rectangle interior
    hex ( 0  1  3  2  8  9 11 10) ($nR $nR $nZ) simpleGrading (1 1 1)
);

edges
(

    project  4  5 (cylinder)
    project  7  5 (cylinder)
    project  6  7 (cylinder)
    project  4  6 (cylinder)
    project 12 13 (cylinder)
    project 13 15 (cylinder)
    project 12 14 (cylinder)
    project 14 15 (cylinder)
);

boundary
(
 
  inlet
    {
      type patch;
      faces
      (
            (0 1 5 4)
            (1 3 7 5)
            (2 6 7 3)
            (0 4 6 2)
            (0 2 3 1)
           
           
        );
    }
   
 
   
    outlet
    {
        type patch;
        faces
        (
            (8 12 13 9)
            (9 13 15 11)
            (10 11 15 14)
            (8 10 14 12)
            (8 9 11 10)
           
        );
    }   
   
    walls
    {
        type wall;
        faces
        (
            (4 5 13 12)
            (4 12 14 6)
            (5 7 15 13)
            (6 14 15 7)
           
        );
    }
   

);

mergePatchPairs
(
);
   
// ************************************************************************* //

My 0/U file looks like this:
Code:

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

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

internalField  uniform (0 0 0);

boundaryField
{
    inlet
    {
        type uniformFixedValue;
        uniformValue sine;
        uniformValueCoeffs
        {
            amplitude 0.00742;
            scale    (0 0 1);
            frequency 5.9;
            start    0;
            level    (0 0 0);
        }
    }

    outlet
    {
        type uniformFixedValue;
        uniformValue sine;
        uniformValueCoeffs
        {
            amplitude 0.00742;
            scale    (0 0 1);
            frequency 5.9;
            start    0;
            level    (0 0 0);
        }
    }
       
 
    walls
    {
        type noSlip; 
    }

}


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

And my 0/p file looks like this:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  7.0                                  |
|  \\  /    A nd          | Website:  https://openfoam.org                  |
|    \\/    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            fixedFluxExtrapolatedPressure;
    }
 
    walls
    {
        type            zeroGradient;     
    }

    outlet
    {
        type            fixedFluxExtrapolatedPressure;     
    }


}


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

I have tried using fixedFluxPressure, fixedFluxExtrapolatedPressure, zeroGradient for one face and fixedValue for the other one, and combinations of all of them. But the problem is always the same one. I can't understand why, but when I view the pressure with paraView, one of the faces has an oscillating pressure (expected), but the other one has a fixed pressure value (with value 0).

Is there something that I'm doing wrong? Should not the pressure have an oscillating behavior on both faces? If anyone has any idea of how I could implement the aforementioned system and what I am doing wrong, I would very much appreciate it.

(By the way, I am using rheoTool in order to implement a viscoelastic Giesekus fluid: https://github.com/fppimenta/rheoTool).


All times are GMT -4. The time now is 16:25.