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/)
-   -   Flow around a square cylinder (https://www.cfd-online.com/Forums/openfoam-solving/238447-flow-around-square-cylinder.html)

daylen September 13, 2021 19:30

Flow around a square cylinder
 
Hi, im a beginner at cfd, im trying to simulate flow around a square cylinder in 2d, for this i used as template motorbike, is there a better template for this?, i have to use k-omega sst, steady state and simple algorithm, i made a blockMeshDict, but i donīt know what to do next, i get the following error:

blockMeshDict:
Code:

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

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

convertToMeters 0.01;

vertices
(
    (0 0 0) // 0
    (40 0 0) // 1
    (40 40 0) // 2
    (0  40 0) // 3
    (0 0 1) // 4
    (40 0 1) // 5
    (40 40 1) // 6
    (0 40 1) // 7
    (17.5 17.5 0) // 8
    (22.5 17.5 0) // 9
    (22.5 22.5 0) // 10
    (17.5 22.5 0) // 11
    (17.5 17.5 1) // 12
    (22.5 17.5 1) // 13
    (22.5 22.5 1) // 14
    (17.5 22.5 1) // 15
);

blocks
(
    hex (0 1 9 8 4 5 13 12) (10 10 1) simpleGrading (1 1 1)
    hex (1 2 10 9 5 6 14 13) (10 10 1) simpleGrading (1 1 1)
    hex (11 10 2 3 15 14 6 7) (10 10 1) simpleGrading (1 1 1)
    hex (0 8 11 3 4 12 15 7) (10 10 1) simpleGrading (1 1 1)
);

edges
(
);

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

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

p:
Code:

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

#include        "include/initialConditions"

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

internalField  uniform $pressure;

boundaryField
{
    //- Set patchGroups for constraint patches
    #includeEtc "caseDicts/setConstraintTypes"

    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value          $internalField;
    }

    lowerWall
    {
        type            zeroGradient;
    }

    motorBikeGroup
    {
        type            zeroGradient;
    }

    #include "include/frontBackUpperPatches"
}

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

running simpleFoam error:

Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  9
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 9-12bcf7429695
Exec  : simpleFoam
Date  : Sep 13 2021
Time  : 18:21:36
Host  : "Mint19"
PID    : 9624
I/O    : uncollated
Case  : /home/gabriel/OpenFOAM/gabriel-9/run/motorBike_1
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 mesh for time = 0


SIMPLE: No convergence criteria found

Reading field p



--> FOAM FATAL IO ERROR:
inconsistent patch and patchField types for
    patch type empty and patchField type slip

file: /home/gabriel/OpenFOAM/gabriel-9/run/motorBike_1/0/p/boundaryField/frontAndBack from line 16 to line 16.

    From function static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]
    in file /home/ubuntu/OpenFOAM/OpenFOAM-9/src/finiteVolume/lnInclude/fvPatchFieldNew.C at line 157.

FOAM exiting


daylen September 13, 2021 22:12

so i combined the motorbike with the tutorial from https://www.youtube.com/watch?v=Udt3RhkbgKw, now i have to analyze the results but for now it kinda works.


Cheers.

saidc. September 14, 2021 05:16

Hi Gabriel,


Please try change this #include "include/frontBackUpperPatches" to this


frontAndBack
{
type empty;
}


Because your patch type is empty but you set the bc as slip condition. In motorbike tutorial, that patch is not empty it is defined as face. By the way, I think it's always better to start with a pitzDaily.


Kind regards,
Said.


All times are GMT -4. The time now is 18:35.