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/)
-   -   pimpleFoam - Flow across an oscillating cylinder simulation crashing (https://www.cfd-online.com/Forums/openfoam-solving/220261-pimplefoam-flow-across-oscillating-cylinder-simulation-crashing.html)

iceman53y August 31, 2019 16:42

pimpleFoam - Flow across an oscillating cylinder simulation crashing
 
Hi,

I am an openFoam newbie. So please be kind.

I am trying to determine the lift and drag coefficients of an oscillating cylinder located inside a bundle of static cylinders.

This what I have done so far:

1. I have created a geometry and mesh through GMSH and exported to OpenFoam using gmshToFoam. My meshing strategy was to have a structured mesh close to the cylinders that I want to monitor and the rest of the domain has an unstructured mesh.
2. I used a pointDisplacement method to oscillate the cylinder that I wanted to oscillate. I used the displacementLaplacian solver for my dynamicmeshDict.
3. Setup my boundary conditions, in the U and P files. (shared at the bottom of the post)
4. I setup my fvSolution and fvschemes files using a tutorial I found online for an oscillating object. I donot fully understand these files and I feel the problem lies here.

My simulation seems to run fine for some time. The time depends on the size of the mesh and the frequency of the oscillating cylinder. The finer the mesh , the smaller the time the simulation is able to run. The courant number starts to increase gradually, till it explodes or the timestep size decreases to very very low values that the simulation gets stuck. My drag coefficients start to increase exponentially as well when the courant number increases.
I have tried to increase the mesh size, decrease the frequency and amplitude of the oscillating cylinder. I get results that are ok for some time then eventually the courant number starts to increase.

My folder files are larger than the limit of this forum. So I'm sharing a downloadable link below, Additionally at the end of this post I have copied some of my files files.

https://drive.google.com/file/d/1U7m...ew?usp=sharing

Appreciate if someone can take a look and let me know what I am doing wrong.

Oh yes, I am using the pimplefoam solver for this application.

This is what my polyMesh boundary file and the U, P and pointDisplacement files look like.

Quote:

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

12
(
Frontandback
{
type empty;
physicalType empty;
inGroups 1(empty);
nFaces 31380;
startFace 25646;
}
Tube_NW
{
type patch;
physicalType patch;
nFaces 56;
startFace 57026;
}
Tube_W
{
type patch;
physicalType patch;
nFaces 56;
startFace 57082;
}
Tube_NE
{
type patch;
physicalType patch;
nFaces 56;
startFace 57138;
}
Tube_C
{
type patch;
physicalType patch;
nFaces 56;
startFace 57194;
}
Tube_SW
{
type patch;
physicalType patch;
nFaces 56;
startFace 57250;
}
Tube_E
{
type patch;
physicalType patch;
nFaces 56;
startFace 57306;
}
Tube_SE
{
type patch;
physicalType patch;
nFaces 56;
startFace 57362;
}
Wall
{
type patch;
physicalType patch;
nFaces 300;
startFace 57418;
}
Outlet
{
type zeroGradient;
physicalType zeroGradient;
inGroups 1(zeroGradient);
nFaces 23;
startFace 57718;
physicalType zeroGradient;
}
Inlet
{
type patch;
physicalType patch;
nFaces 23;
startFace 57741;
}
Remaining_tubes
{
type patch;
physicalType patch;
nFaces 528;
startFace 57764;
}
)

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

Quote:

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

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

internalField uniform (2 0 0);

boundaryField
{
Frontandback
{
type empty;
}
Tube_NW
{
type fixedValue;
value uniform (0 0 0);
}
Tube_W
{
type fixedValue;
value uniform (0 0 0);
}
Tube_NE
{
type fixedValue;
value uniform (0 0 0);
}
Tube_C
{
type movingWallVelocity;
value uniform (0 0 0);
}
Tube_SW
{
type fixedValue;
value uniform (0 0 0);
}
Tube_E
{
type fixedValue;
value uniform (0 0 0);
}
Tube_SE
{
type fixedValue;
value uniform (0 0 0);
}
Wall
{
type fixedValue;
value uniform (0 0 0);
}
Outlet
{
type zeroGradient;
}
Inlet
{
type fixedValue;
value uniform (0.1 0 0);
}
Remaining_tubes
{
type fixedValue;
value uniform (0 0 0);
}
}


// ************************************************** *********************** //
Quote:

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

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

internalField uniform 0;

boundaryField
{
Frontandback
{
type empty;
}
Tube_NW
{
type zeroGradient;
}
Tube_W
{
type zeroGradient;
}
Tube_NE
{
type zeroGradient;
}
Tube_C
{
type zeroGradient;
}
Tube_SW
{
type zeroGradient;
}
Tube_E
{
type zeroGradient;
}
Tube_SE
{
type zeroGradient;
}
Wall
{
type zeroGradient;
}
Outlet
{
type fixedValue;
value uniform 0;
}
Inlet
{
type zeroGradient;
}
Remaining_tubes
{
type zeroGradient;
}
}


// ************************************************** *********************** //
Quote:

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

dimensions [0 1 0 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
Frontandback
{
type empty;
}
Tube_NW
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Tube_W
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Tube_NE
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Tube_C
{
type oscillatingDisplacement;
omega 69.934;
amplitude ( 0.002 0 0 );
value uniform ( 0 0 0 );
}
Tube_SW
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Tube_E
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Tube_SE
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Wall
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Outlet
{
type zeroGradient;
}
Inlet
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
Remaining_tubes
{
type uniformFixedValue;
value uniform (0 0 0);
uniformValue constant (0 0 0);
}
}


// ************************************************** *********************** //
Following is my dynamicMeshDict

Quote:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dynamicFvMesh dynamicMotionSolverFvMesh;

motionSolverLibs ( "libfvMotionSolvers.so" );

solver displacementLaplacian;


displacementLaplacianCoeffs
{
diffusivity inverseDistance 1(Tube_C);
}
//Trying to oscillate Tube_C here




// ************************************************** *********************** //
Following is the fvSolution file.

Quote:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
pcorrFinal
{
solver GAMG;
tolerance 0.02;
relTol 0;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration no;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}

p
{
solver GAMG;
tolerance 0;
relTol 0.01;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration no;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}

pFinal
{
$p;
tolerance 1e-06;
relTol 0;
}

U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
}

UFinal
{
$U;
tolerance 1e-05;
relTol 0;
}

cellMotionUx
{
solver PCG;
preconditioner DIC;
tolerance 1e-08;
relTol 0;
}
cellMotionUxFinal
{
solver PCG;
preconditioner DIC;
tolerance 1e-08;
relTol 0;
}

"cellDisplacement.*"
{
solver GAMG;
tolerance 1e-5;
relTol 0;
smoother GaussSeidel;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}

}

PIMPLE
{
correctPhi yes;
nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0;
pRefCell 1001;
pRefValue 0;
}

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

// ************************************************** *********************** //
Thank you.

iceman53y September 5, 2019 22:42

Fixed it.

Embarrassing error :)

dduque November 27, 2019 05:13

So, what was the error ??


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