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 + cyclicAMI of an open channel (river) (https://www.cfd-online.com/Forums/openfoam-solving/255624-interfoam-cyclicami-open-channel-river.html)

clarinha April 20, 2024 10:48

InterFoam + cyclicAMI of an open channel (river)
 
3 Attachment(s)
Hi everyone,

I am trying to simulate free-surface flow over a river. The riverbed is very detailed, obtained from high-resolution topographic data. The mesh resolution is 2 mm across the domain. The idea is to run a range of velocities and flow depths, with which I will obtain drag and friction factor exerted by the riverbed. I would like to simulate the river reach only, without adding a channel upstream to allow flow development. I am also interested in capturing the free surface distortions caused by the bed topography once the flow is stabilised.

For this purpose, I am using interFoam and cyclicAMI at the inlet and outlet. The turbulence model is RNG k-epsilon. For the sake of the simulation, the bed slope is 2 degrees.

The issue with the simulation is that water (alpha.water > 0.5) and, thus, the free surface are not being correctly “mapped” from outlet to inlet, though the patches show similar values of the variables, which is strange. As a result, the water level is near zero near the inlet because water does not recycle from the outlet. I have tried both createPatchDict and the manual editing of the boundary file to implement cyclicAMI. I use setFieldsDict to define the initial water volume. Please find attached some relevant files. If it’s something related to the implementation of the cyclicAMI or another misstep, I’d be happy if you could help me identify the possible cause, and I’m also happy to provide further details of the model.

Cheers,
Clarinha


Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2306                                  |
|  \\  /    A nd          | Website:  www.openfoam.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    arch        "LSB;label=32;scalar=64";
    class      polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

6
(
    inlet
    {
        type            cyclicAMI;
        neighbourPatch        outlet;
        transform        translational;
        separationVector        (2.01876947 0 -0.07049698);
        nFaces          1596;
        startFace      1923927;
    }
    outlet
    {
        type            cyclicAMI;
        neighbourPatch        inlet;
        transform        translational;
        separationVector        (-2.01876947 0 0.07049698);
        nFaces          1560;
        startFace      1925523;
    }
    top
    {
        type            patch;
        nFaces          46056;
        startFace      1927083;
    }
    leftWall
    {
        type            wall;
        inGroups        1(wall);
        nFaces          5633;
        startFace      1973139;
    }
    rightWall
    {
        type            wall;
        inGroups        1(wall);
        nFaces          5797;
        startFace      1978772;
    }
    bed
    {
        type            wall;
        inGroups        1(wall);
        nFaces          46288;
        startFace      1984569;
    }
)

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


Code:

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

boundaryField
{
    "(inlet|outlet)"
    {
        type                cyclicAMI;
    }
    top
    {
        type                totalPressure;
        p0                uniform 0;
    }
    "(leftWall|rightWall|bed)"
    {
        type                fixedFluxPressure;
    }

}


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


Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v2306                                |
|  \\  /    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
{
    "(leftWall|rightWall|bed)"
    {
        type            zeroGradient;
    }
    top
    {
        type            inletOutlet;
        inletValue        uniform 0;
        value                uniform 0;               
    }
    "(inlet|outlet)"
    {
        type                cyclicAMI;
    }

}

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


VRN April 22, 2024 05:59

Hello Clarinha,

This is unfortunately a know shortcoming in the formulation of the interFoam solver. The problem arises because the solver uses a single pressure system for simplicity; combining the static and hydrostatic pressure to give the modified pressure (p_rgh). In the solver algorithm, the modified pressure equation is solved.

When you have a cyclic boundary where the two boundaries are at different heights (physically) there is a pressure jump across the boundaries due to the different values of h at either sides of the boundary, leading to unphysical behaviours.

Some workarounds have been suggested in previous discussions in the community forums (Ref thread https://www.cfd-online.com/Forums/sh...d.php.), but I have not tried to implement them so cannot comment on their accuracy.

Good luck!


All times are GMT -4. The time now is 05:09.