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

Openfoam k epsislon simpleFOAM spiking k

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2025, 02:35
Exclamation Openfoam k epsislon simpleFOAM spiking k
  #1
New Member
 
Joseph
Join Date: Nov 2024
Posts: 7
Rep Power: 2
Joseph 27 is on a distinguished road
Hello,

Sorry for the long post, but I need help troubleshooting a CFD simulation.

I’m trying to simulate airflow in a classroom with students and tables. The classroom has:

3 inlets (vents on the roof),
3 outlets (also vents),
1 door, and
3 windows (considered as "walls" since they are closed).
The room dimensions are 3 x 5 x 8 meters. To avoid errors with ideasFoam, I modeled the humans as cylinders with a mouth. The cylinder bases are linked to the floor, and the tables are attached to the walls. When I created the mesh, the cylinder bases became part of the floor, and one face of each table was linked to the wall. This setup allowed ideasFoam to function without errors.

I refined the mesh multiple times, and checkMesh reports no issues.

Next, I used createBaffles to add face zones to the boundary file, as everything inside the box was initially added to the faceZones file, not boundary. Once the boundaries were correctly updated, I defined:

3 tables and 4 humans (excluding the mouth) as walls.
Inlets, outlets, and mouths as patches.
(This is a simplified test setup. Once it works, I plan to include all students and tables.)

After preparing everything, I ran simpleFoam with the setup. To ensure stability, I:

Reduced the time step (deltaT),
Adjusted relaxation factors, and
Tightened solver tolerances (resTol).
Unfortunately, the simulation crashed immediately.

When I changed the solver for p (pressure) to PCG, the simulation ran. It converged smoothly with a small time step (deltaT = 0.001) until 1.5 seconds. However, after this point, the bounding k starts to increase steadily, reaching unrealistic values (e.g., max: 9.38163e+07).

Do you have any insights into what I might be doing wrong?

Here are the files I used:

boundary
U
p
k
epsilon
nut
fvSolution
fvSchemes
controdict

Thank you in advance for your help!


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

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

internalField uniform 0;

boundaryField
{
floor
{
type nutkWallFunction;
value uniform 0;
}

walls
{
type nutkWallFunction;
value uniform 0;
}

ceiling
{
type nutkWallFunction;
value uniform 0;
}

inlet_door
{
type calculated;
value uniform 0;
}

windows
{
type zeroGradient;
}

inlets
{
type calculated;
value uniform 0;
}

outlets
{
type zeroGradient;
}

humans_master
{
type nutkWallFunction;
value uniform 0;
}

humans_slave
{
type nutkWallFunction;
value uniform 0;
}

mouths_master
{
type calculated;
value uniform 0;
}

mouths_slave
{
type calculated;
value uniform 0;
}

tables_master
{
type nutkWallFunction;
value uniform 0;
}

tables_slave
{
type nutkWallFunction;
value uniform 0;
}
}

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

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

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

internalField uniform 0.331;

boundaryField
{
floor
{
type epsilonWallFunction;
value uniform 0.0;
}

walls
{
type epsilonWallFunction;
value uniform 0.0;
}

ceiling
{
type epsilonWallFunction;
value uniform 0.0;
}

inlet_door
{
type zeroGradient;
}

windows
{
type zeroGradient;
}

inlets
{
type fixedValue;
value uniform 0.331;
}

outlets
{
type zeroGradient;
}

humans_master
{
type epsilonWallFunction;
value uniform 0.0;
}

humans_slave
{
type epsilonWallFunction;
value uniform 0.0;
}

mouths_master
{
type zeroGradient;
}

mouths_slave
{
type zeroGradient;
}

tables_master
{
type epsilonWallFunction;
value uniform 0.0;
}

tables_slave
{
type epsilonWallFunction;
value uniform 0.0;
}
}

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

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

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

internalField uniform 0.0258;

boundaryField
{
floor
{
type kqRWallFunction;
value uniform 0.0;
}

walls
{
type kqRWallFunction;
value uniform 0.0;
}

ceiling
{
type kqRWallFunction;
value uniform 0.0;
}

inlet_door
{
type zeroGradient;
}

windows
{
type zeroGradient;
}

inlets
{
type fixedValue;
value uniform 0.0258;
}

outlets
{
type zeroGradient;
}

humans_master
{
type kqRWallFunction;
value uniform 0.0;
}

humans_slave
{
type kqRWallFunction;
value uniform 0.0;
}

mouths_master
{
type zeroGradient;
}

mouths_slave
{
type zeroGradient;
}

tables_master
{
type kqRWallFunction;
value uniform 0.0;
}

tables_slave
{
type kqRWallFunction;
value uniform 0.0;
}
}

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

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

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

internalField uniform (0 0 0);

boundaryField
{
floor
{
type noSlip;
}

walls
{
type noSlip;
}

ceiling
{
type noSlip;
}

inlet_door
{
type zeroGradient;
}

windows
{
type zeroGradient;
}

inlets
{
type fixedValue;
value uniform (0 0 0.35);
}

outlets
{
type fixedValue;
value uniform (0 0 -0.35);
}

humans_master
{
type noSlip;
}

humans_slave
{
type noSlip;
}

mouths_master
{
type zeroGradient;
}

mouths_slave
{
type zeroGradient;
}

tables_master
{
type noSlip;
}

tables_slave
{
type noSlip;
}
}

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

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

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

internalField uniform 0;

boundaryField
{
floor
{
type zeroGradient;
}

walls
{
type zeroGradient;
}

ceiling
{
type zeroGradient;
}

inlet_door
{
type fixedValue; // Pressure reference point
value uniform 0;
}

windows
{
type zeroGradient;
}

inlets
{
type zeroGradient;
}

outlets
{
type zeroGradient;
}

humans_master
{
type zeroGradient;
}

humans_slave
{
type zeroGradient;
}

mouths_master
{
type zeroGradient;
}

mouths_slave
{
type zeroGradient;
}

tables_master
{
type zeroGradient;
}

tables_slave
{
type zeroGradient;
}
}

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

solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-5;
relTol 0.01;

}

pFinal
{
$p;
relTol 0;
}

"(U|k|epsilon)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-5;
relTol 0.01;
}

"(U|k|epsilon)Final"
{
$U;
relTol 0;
}
}

relaxationFactors
{
fields
{
p 0.2;
}
equations
{
U 0.3;
k 0.2;
epsilon 0.2;
}
}

PIMPLE
{
nNonOrthogonalCorrectors 2;
nCorrectors 2;

residualControl
{
p 1e-4;
U 1e-5;
"(k|epsilon)" 1e-5;
}
}


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

ddtSchemes
{
default steadyState;
}

gradSchemes
{
default Gauss linear;
}

divSchemes
{
default none;

div(phi,U) bounded Gauss upwind;
div(phi,k) bounded Gauss upwind;
div(phi,epsilon) bounded Gauss upwind;
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div(phi,nuTilda) Gauss upwind;

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

laplacianSchemes
{
default Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}


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

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

application simpleFoam;

solver incompressibleFluid;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 3;

deltaT 0.0005;

writeControl adjustableRunTime;

writeInterval 0.1;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

adjustTimeStep yes;

maxCo 5;

debug 1;

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

Example of the solution after 3s :

Time = 3s

smoothSolver: Solving for Ux, Initial residual = 0.00371234, Final residual = 6.68207e-06, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 0.00396574, Final residual = 1.20463e-05, No Iterations 2
smoothSolver: Solving for Uz, Initial residual = 0.00397317, Final residual = 1.27557e-05, No Iterations 2
DICPCG: Solving for p, Initial residual = 0.000101223, Final residual = 9.75821e-06, No Iterations 35
DICPCG: Solving for p, Initial residual = 3.88401e-05, Final residual = 9.83166e-06, No Iterations 21
DICPCG: Solving for p, Initial residual = 1.7923e-05, Final residual = 9.83142e-06, No Iterations 17
time step continuity errors : sum local = 3.33501e-05, global = 2.51784e-05
DICPCG: Solving for p, Initial residual = 8.00657e-05, Final residual = 9.98959e-06, No Iterations 35
DICPCG: Solving for p, Initial residual = 3.17717e-05, Final residual = 9.49924e-06, No Iterations 21
DICPCG: Solving for p, Initial residual = 1.54928e-05, Final residual = 9.994e-06, No Iterations 1
time step continuity errors : sum local = 3.37548e-05, global = 2.51818e-05, cumulative = 0.00310968
smoothSolver: Solving for epsilon, Initial residual = 0.00443172, Final residual = 8.7404e-07, No Iterations 2
smoothSolver: Solving for k, Initial residual = 0.00427727, Final residual = 2.12083e-06, No Iterations 2
bounding k, min: 1.82005e-16 max: 9.38163e+07 average: 62990.6
ExecutionTime = 8353.48 s ClockTime = 8355 s
Joseph 27 is offline   Reply With Quote

Reply

Tags
indoor air, k epsilon, openfaom

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Floating point exception when using simpleFoam for OpenFOAM '3 weeks' series jrr75166 OpenFOAM Running, Solving & CFD 0 August 6, 2024 09:58
fluxRequired OpenFoam Versions SimpleFoam Taylor Couette flow tutorial mörli OpenFOAM Running, Solving & CFD 0 April 9, 2019 11:50
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 14:24
simpleFoam crashes (CFDSupport port of OpenFOAM for Windows) mqsim OpenFOAM Running, Solving & CFD 5 June 30, 2016 02:31
Same SimpleFOAM Case converges with openFOAM 2.1 but diverges with openFOAM 2.0.1 alsdia OpenFOAM Running, Solving & CFD 3 October 22, 2012 11:25


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