|
[Sponsors] |
Boundary conditions and solver settings for buoyantSimpleFoam |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
I'm trying to use buoyantSimpleFoam to "turn on" gravitational forces for an incompressible, laminar, isothermal pressure-driven flow but seem to be getting results inconsistent with simpleFoam even qualitatively with no mostly-uniform gradient of the pressure in the y-direction.
I understand that we can effectively gauge this away with using a modified definition of pressure for incompressible flow. (Driven cavity problem and https://en.wikipedia.org/wiki/Navier...pressible_flow). But I should be able to duplicate the results from simpleFoam with the correct settings and boundary conditions before moving to other properties like heat transfer and compressibility. My test case uses a 3d + symbol with flow running from top to bottom (in the y-direction) in the + with all the walls with no allowed flow. Any insight in how to properly set the BCs/solver properties would be greatly appreciated. Thanks for taking the time to read this. Here are the main files related to this. p: Code:
/*--------------------------------*- C++ -*----------------------------------*\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { yPosFace { type fixedValue; value 300; // 300 pascals } yNegFace { type fixedValue; value 0; } xPosFace { type zeroGradient; } xNegFace { type zeroGradient; } zPosFace { type zeroGradient; } zNegFace { type zeroGradient; } walls { type zeroGradient; } } // boundaryField // ************************************************************************* // p_rgh: Code:
/*--------------------------------*- C++ -*----------------------------------*\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { xPosFace { type zeroGradient; } xNegFace { type zeroGradient; } yPosFace { type zeroGradient; } yNegFace { type fixedValue; value 0; } zPosFace { type zeroGradient; } zNegFace { type zeroGradient; } walls { type zeroGradient; } } U: Code:
/*--------------------------------*- C++ -*----------------------------------*\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { xPosFace { type noSlip; } xNegFace { type noSlip; } yPosFace { type zeroGradient; } yNegFace { type zeroGradient; } zPosFace { type noSlip; } zNegFace { type noSlip; } walls { type noSlip; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 1 0 0 0]; internalField uniform 300; boundaryField { walls { type fixedValue; value uniform 300; // ~23 degC } xPosFace { type fixedValue; value uniform 300; // ~23 degC } xNegFace { type fixedValue; value uniform 300; // ~23 degC } yPosFace { type fixedValue; value uniform 300; // ~23 degC } yNegFace { type fixedValue; value uniform 300; // ~23 degC } zPosFace { type fixedValue; value uniform 300; // ~23 degC } zNegFace { type fixedValue; value uniform 300; // ~23 degC } } Code:
/*--------------------------------*- C++ -*----------------------------------*\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // convertToMeters 0.01; xCenterMin 1.720000e-04; xCenterMax 2.130000e-04; yCenterMin 1.720000e-04; yCenterMax 2.130000e-04; xLeftMin -2.000000e-03; xLeftMax 1.720000e-03; xRightMin 2.130000e-03; xRightMax 4.060000e-03; yTopMin 2.130000e-03; yTopMax 4.060000e-03; yBottomMin -2.000000e-03; yBottomMax 1.720000e-03; zMin -2.000000e-03 ; zMax 3.110000e-03 ; vertices ( ( $xCenterMin $yCenterMin $zMin) // 0 ( $xCenterMax $yCenterMin $zMin) // 1 ( $xCenterMax $yCenterMax $zMin) // 2 ( $xCenterMin $yCenterMax $zMin) // 3 ( $xCenterMin $yCenterMin $zMax) // 4 ( $xCenterMax $yCenterMin $zMax) // 5 ( $xCenterMax $yCenterMax $zMax) // 6 ( $xCenterMin $yCenterMax $zMax) // 7 // Left leg ($xLeftMin $yCenterMin $zMin) // 8 ($xLeftMin $yCenterMax $zMin) // 9 ($xLeftMin $yCenterMin $zMax) // 10 ($xLeftMin $yCenterMax $zMax) // 11 // Top leg ($xCenterMax $yTopMax $zMin) // 12 ($xCenterMin $yTopMax $zMin) // 13 ($xCenterMax $yTopMax $zMax) // 14 ($xCenterMin $yTopMax $zMax) // 15 // Right leg ($xRightMax $yCenterMin $zMin) // 16 ($xRightMax $yCenterMax $zMin) // 17 ($xRightMax $yCenterMin $zMax) // 18 ($xRightMax $yCenterMax $zMax) // 19 //Bottom leg ($xCenterMin $yBottomMin $zMin) // 20 ($xCenterMax $yBottomMin $zMin) // 21 ($xCenterMin $yBottomMin $zMax) // 22 ($xCenterMax $yBottomMin $zMax) // 23 ); blocks ( hex (0 1 2 3 4 5 6 7) (40 40 40) simpleGrading (1 1 1) // Center block of + // hex (8 0 3 9 10 4 7 11) (40 40 40) simpleGrading (1 1 1) // Left leg of + // hex (3 2 12 13 7 6 14 15) (40 40 40) simpleGrading (1 1 1) // Top leg of + // hex (1 16 17 2 5 18 19 6) (40 40 40) simpleGrading (1 1 1) // Right leg of + // hex (20 21 1 0 22 23 5 4) (40 40 40) simpleGrading (1 1 1) // Bottom leg of + ); edges ( ); boundary ( zPosFace { type wall; faces ( (4 5 6 7) // center (10 4 7 11) // left (7 6 14 15) // top (5 18 19 6) // right (22 23 5 4) // bottom ); } zNegFace { type wall; faces ( (3 2 1 0) // center (9 3 0 8) // left (2 3 13 12) // top (1 2 17 16) // right (0 1 21 20) // bottom ); } xPosFace { type wall; faces ( (16 17 19 18) // right ); } xNegFace { type wall; faces ( (10 11 9 8) // left ); } yPosFace { type patch; faces ( (12 13 15 14) // top ); } yNegFace { type patch; faces ( (20 21 23 22) // bottom ); } walls { type wall; faces ( (0 4 10 8) // left (9 11 7 3) // left (3 7 15 13) // top (2 12 14 6) // top (2 6 19 17) // right (1 16 18 5) // right (1 5 23 21) // bottom (20 22 4 0) // bottom ); } // centerDummyPatch // { // type wall; // faces // ( // (0 1 5 4) // to Bottom leg // (1 2 6 5) // to Right leg // // (4 7 3 0) // to Left leg // (2 3 7 6) // to Top leg // // ); // } ); Code:
FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // source1 { type fixedTemperatureConstraint; timeStart 0; // mode uniform; temperature 300; } fvSolution Code:
/*--------------------------------*- C++ -*----------------------------------*\ \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p_rgh { solver GAMG; tolerance 1e-7; relTol 0.01; smoother DICGaussSeidel; } "(U|h|k|epsilon|omega)" { solver PBiCGStab; preconditioner DILU; tolerance 1e-8; relTol 0.1; } } SIMPLE { momentumPredictor yes; // no; nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0; consistent yes; residualControl { p 1e-2; p_rgh 1e-4; U 1e-3; // possibly check turbulence fields "(k|epsilon|omega|f|v2)" 1e-3; } } relaxationFactors { fields { rho 0; // 1.0 in heatTransfer example ; p_rgh 0.3; // 0.7 in heatTransfer example; p 0.3; // 0.7 in heatTransfer example; } equations { U 0.7; h 0.7; "(k|epsilon|omega)" 0.7; } } // ************************************************************************* // momentumTransport: Code:
FoamFile { version 2.0; format ascii; class dictionary; object RASProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // simulationType RAS; RAS { model kEpsilon; //model kOmegaSST; turbulence off; //on; printCoeffs on; } thermophysicalProperties Code:
FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object thermophysicalProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // thermoType { type heRhoThermo; mixture pureMixture; transport const; thermo hConst; equationOfState rhoConst; specie specie; energy sensibleEnthalpy; } mixture { specie { molWeight 18; } thermodynamics { Cp 4183; // factor of 10^3 ? Hf 0; // -285.8; // 0; } transport { mu 900.0e-06; Pr 6.204; } equationOfState { rho 998; } } |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Just wanted to add that the link to download the boundary conditions in the old thread here is now dead.
When I attempt to copy the BCs from one of the heatTransfer tutorials that has the type of BC fixedFluxPressure with the value $internalField, the pressure blows up in the middle of the sample. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
I got some advice offline about p_rgh, but when I run the simulation, I m getting "striping" of the velocity field that seems to come from somewhat spurious starts. I simplified the geometry to just a rectangular slab (but in 3 pieces like in my original + shape), and like in the + geometry, these stripes seem to happen due to the block discretization. I made the geomerty a little coarser, but I'm still seeing the artifacts. It seems like the velocity is along the +/- Z boundary.
Is this likely to be under the solver settings in the fvSolution file or the BCs? If I set the relaxationFactor of U to 0.9, the simulation diverges, but at 0.8 is seems decent. Lower than 0.8, I still see the stripes. Is there an adaptive relaxationFactor method I should look into? p: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { yPosFace { type zeroGradient; } yNegFace { type fixedValue; value 0; } xPosFace { type zeroGradient; } xNegFace { type zeroGradient; } zPosFace { type zeroGradient; } zNegFace { type zeroGradient; } walls { type zeroGradient; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { xPosFace { type zeroGradient; // value $internalField; // type fixedFluxPressure; // value $internalField; } xNegFace { type zeroGradient; //type fixedFluxPressure; //value $internalField; } yPosFace { //type zeroGradient; //type fixedFluxPressure; //value $internalField; type fixedValue; value 360; } yNegFace { // type fixedFluxPressure; // value $internalField; type fixedValue; value 0; //value $internalField; } zPosFace { type zeroGradient; //type fixedFluxPressure; //value $internalField; } zNegFace { type zeroGradient; //type fixedFluxPressure; //value $internalField; } walls { type zeroGradient; //type fixedFluxPressure; //value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application buoyantSimpleFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 00; deltaT 1; writeControl timeStep; writeInterval 5; purgeWrite 0; writeFormat binary; // ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; functions { #includeFunc flowRatePatchpatches ( xNegFace xPosFace yNegFace yPosFace zNegFace zPosFace ); #includeFunc streamlines #includeFunc writeObjects(kEpsilon:G) // #includeFunc streamlines } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p_rgh { solver GAMG; tolerance 1e-7; relTol 0.01; smoother DICGaussSeidel; } p { solver PCG; preconditioner DIC; tolerance 1e-06; relTol 0.01; } // pFinal // { // $p; // relTol 0; // } U { solver smoothSolver; smoother symGaussSeidel; tolerance 1e-05; relTol 0; } "(h|k|epsilon|omega)" { solver PBiCGStab; preconditioner DILU; tolerance 1e-8; relTol 0.1; } } SIMPLE { momentumPredictor yes; // no; nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0; consistent yes; residualControl { p 1e-6; // 4 p_rgh 1e-6; // 4 U 1e-6; // 4 // possibly check turbulence fields "(k|epsilon|omega|f|v2)" 1e-3; } } relaxationFactors { fields { rho 0.3; p_rgh 0.3; p 0.3; } equations { U 0.8; // 0.9 diverges slowly h 0.8; // 0.9 "(k|epsilon|omega)" 0.7; // 0.9 // ".*" 0.9; // 0.9 is more stable but 0.95 more convergent } } // ************************************************************************* // Edit: Altering the U boundary conditions to more closely match those of a fixed U BC (like suggested in flow simulation with only delta pressure known) doesn't eliminate this issue. Last edited by JEBland; April 28, 2022 at 18:16. Reason: Added one more thing tried. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Even with a rectangular slab when reducing the + fracture to a rectangular slab. There is striping in the magnitude of the velocity. The two versions of pressure (p, p_rgh) very quickly establish the gradient, but the velocity never seems to converge.
How can one approach the velocity field from simpleFoam under the buoyantSimpleFoam with ideal conditions (isothermal, incompressible) blockMeshDict: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // convertToMeters 0.01; xCenterMin 1.720000e-04; xCenterMax 2.130000e-04; yCenterMin 1.720000e-04; yCenterMax 2.130000e-04; xLeftMin -2.000000e-03; xLeftMax 1.720000e-03; xRightMin 2.130000e-03; xRightMax 4.060000e-03; yTopMin 2.130000e-03; yTopMax 4.060000e-03; yBottomMin -2.000000e-03; yBottomMax 1.720000e-03; zMin -2.000000e-03 ; zMax 3.110000e-03 ; vertices ( ( $xCenterMin $yCenterMin $zMin) // 0 ( $xCenterMax $yCenterMin $zMin) // 1 ( $xCenterMax $yCenterMax $zMin) // 2 ( $xCenterMin $yCenterMax $zMin) // 3 ( $xCenterMin $yCenterMin $zMax) // 4 ( $xCenterMax $yCenterMin $zMax) // 5 ( $xCenterMax $yCenterMax $zMax) // 6 ( $xCenterMin $yCenterMax $zMax) // 7 // Left leg ($xLeftMin $yCenterMin $zMin) // 8 // ( 15 -4 -13) // Duplicate with center block // ( 15 4 -13) // Duplicate with center block ($xLeftMin $yCenterMax $zMin) // 9 ($xLeftMin $yCenterMin $zMax) // 10 // ( 15 -4 13) // Duplicate with center block // ( 15 4 13) // Duplicate with center block ($xLeftMin $yCenterMax $zMax) // 11 // Top leg // (-5 -4 -13) // Duplicate with center block // (15 -4 -13) // Duplicate with center block ($xCenterMax $yTopMax $zMin) // 12 ($xCenterMin $yTopMax $zMin) // 13 // ($xCenterMax $yTopMax $zMin) // 12 // ($xCenterMin $yTopMax $zMin) // 13 // (-5 -4 13) // Duplicate with center block // (15 -4 13) // Duplicate with center block 3 ($xCenterMax $yTopMax $zMax) // 14 ($xCenterMin $yTopMax $zMax) // 15 // ($xCenterMax $yTopMax $zMax) // 14 // ($xCenterMin $yTopMax $zMax) // 15 // Right leg // (-5 -4 -13) // Duplicate with center block ($xRightMax $yCenterMin $zMin) // 16 ($xRightMax $yCenterMax $zMin) // 17 // (-5 4 -13) // Duplicate with center block // (-5 -4 13) // Duplicate with center block ($xRightMax $yCenterMin $zMax) // 18 ($xRightMax $yCenterMax $zMax) // 19 // (-5 4 13) // Duplicate with center block //Bottom leg ($xCenterMin $yBottomMin $zMin) // 20 ($xCenterMax $yBottomMin $zMin) // 21 // ( 5 4 -13) // Duplicate with center block // (-5 4 -13) // Duplicate with center block ($xCenterMin $yBottomMin $zMax) // 22 ($xCenterMax $yBottomMin $zMax) // 23 // ( 5 4 13) // Duplicate with center block // (-5 4 13) // Duplicate with center block ); blocks ( hex (20 21 12 13 22 23 14 15) (15 100 100) simpleGrading (1 1 1) // Bottom leg of + ); edges ( ); boundary ( yPosFace { type patch; faces ( (12 13 15 14) // top ); } yNegFace { type patch; faces ( (20 21 23 22) // bottom ); } // (20 21 12 13 22 23 14 15) walls { type wall; faces ( (21 20 13 12) // nZ (22 23 14 15) // pZ // (22 23 14 15) // pZ // (12 14 23 21) // pX (20 22 15 13) // nX ); } ); // ************************************************************************* // fvSolution: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p_rgh { solver GAMG; tolerance 1e-7; relTol 0.01; smoother DICGaussSeidel; } // p // { // solver PCG; // preconditioner DIC; // tolerance 1e-06; // relTol 0.01; // } // // pFinal // { // $p; // relTol 0; // } U { solver smoothSolver; //smoother symGaussSeidel; smoother DILUGaussSeidel; tolerance 1e-05; relTol 0; } // "(k|h|epsilon|omega|f|v2)" // { // solver PBiCGStab; // preconditioner DILU; // tolerance 1e-8; // relTol 0.1; // } "(h|k|epsilon|omega)" { solver PBiCGStab; preconditioner DILU; tolerance 1e-8; relTol 0.1; } } SIMPLE { momentumPredictor yes; // no; nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0; consistent yes; residualControl { // p 1e-1; // 4 p_rgh 1e-2; // 4 U 1e-2; // 4 // possibly check turbulence fields "(k|epsilon|omega|f|v2)" 1e-3; } } relaxationFactors { fields { rho 0.3; p_rgh 0.3; // p 0.3; } equations { U 0.3; // 0.9 diverges slowly h 0.5; // 0.9 "(k|epsilon|omega)" 0.5; // 0.9 // ".*" 0.9; // 0.9 is more stable but 0.95 more convergent } } // ************************************************************************* // U (adapted to be normal to the input/output surfaces and to have zero gradient at the face): Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ 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 { xPosFace { type noSlip; } xNegFace { type noSlip; } yPosFace { // type zeroGradient; type directionMixed; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform (1 0 0 0 0 1); value uniform (0 0 0); } yNegFace { type zeroGradient; } zPosFace { type noSlip; } zNegFace { type noSlip; } walls { type noSlip; } } // ************************************************************************* // |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 ![]() |
Your pressure (0 Pa internal field) seems so small. Do you mean to make it atmospheric pressure? In simpleFoam, the flow is incompressible, so only pressure gradients are relevant. For compressible flow, e.g. buoyant solvers, the pressure, temperature and density are all linked (for example, see ideal gas law), so the absolute pressure must be used.
|
|
![]() |
![]() |
![]() |
![]() |
#6 | |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Quote:
Thanks for the reply. In short, yes, but I'm not entirely sure the effect when the density and temperature are fixed. Even so, when I adjust for that, there is still strong striping after 1000 iterations. p_rgh: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { yPosFace { type fixedValue; value 101685; // value 360; // gauge } yNegFace { type fixedValue; value 101325; } walls { type zeroGradient; } } // ************************************************************************* // p: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { yPosFace { type zeroGradient; } yNegFace { type zeroGradient; } walls { type zeroGradient; } } // ************************************************************************* // fvOptions: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object fvOptions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // source1 { type fixedTemperatureConstraint; timeStart 0; temperature 300; } // ************************************************************************* // thermophyiscalProperties: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object thermophysicalProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // thermoType { type heRhoThermo; mixture pureMixture; transport const; thermo hConst; equationOfState rhoConst; specie specie; energy sensibleEnthalpy; } mixture { specie { molWeight 18; } thermodynamics { Cp 4183; // factor of 10^3 ? Hf 0; } transport { mu 900.0e-06; Pr 6.204; } equationOfState { rho 998; } } // ************************************************************************* // |
||
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 ![]() |
I found an old case with buoyantPimpleFoam that reproduced same results as pimpleFoam for laminar flow in a 2D channel.
Here are the two pressure BCs. Also I had to reduce maxCo from 1 to 0.5 in the buoyant case. p Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 1e5; boundaryField { inlet { type calculated; value $internalField; } walls { type calculated; value $internalField; } ///outlets OUTLET_1 { type calculated; value $internalField; } frontAndBack { type empty; } } // ************************************************************************* // p_rgh Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 1e5; boundaryField { inlet { type fixedFluxPressure; gradient uniform 0; value uniform 1e5; } walls { type fixedFluxPressure; gradient uniform 0; value uniform 1e5; } ///outlets OUTLET_1 { type totalPressure; p0 uniform 1e5; value $internalField; } frontAndBack { type empty; } } // ************************************************************************* // |
|
![]() |
![]() |
![]() |
![]() |
#8 | |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Quote:
Thanks for copying that for me to see. When I try to do the same with my BCs given below, the simulation blows up, but more fundamentally I don't understand your boundary conditions. My inlet/outlet should have a fixed pressure difference across it, not necessarily just from the gravitational force, but a small difference in pressure at from inlet to outlet in addition to gravity. I've tried a few variations, but can't seem to get results that make sense, and either the solution diverges or maintains those stripes seen before. p: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 1e5; boundaryField { yPosFace // inlet { type calculated; value $internalField; } yNegFace // outlet { type calculated; value $internalField; } walls { type calculated; value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 1e5; // 101325; boundaryField { yPosFace // inlet { type fixedFluxPressure; gradient uniform 0; value uniform 1e5; // 101685; // // value 360; // gauge } walls { type fixedFluxPressure; gradient uniform 0; value uniform 1e5;// 101325; } yNegFace // outlet { type totalPressure; // fixedValue; p0 uniform 1e5; // 101325; value $internalField; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ 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 { yPosFace { type directionMixed; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform (1 0 0 0 0 1); value uniform (0 0 0); } yNegFace { type zeroGradient; } walls { type zeroGradient; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p_rgh { solver GAMG; tolerance 1e-7; relTol 0.01; smoother DICGaussSeidel; } U { solver smoothSolver; //smoother symGaussSeidel; smoother DILUGaussSeidel; tolerance 1e-05; relTol 0; } "(h|k|epsilon|omega)" { solver PBiCGStab; preconditioner DILU; tolerance 1e-8; relTol 0.1; } } SIMPLE { momentumPredictor yes; // no; nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0; consistent yes; residualControl { p_rgh 1e-4; // 4 U 1e-4; // 4 // possibly check turbulence fields "(k|epsilon|omega|f|v2)" 1e-3; } } relaxationFactors { fields { rho 0.3; p_rgh 0.3; } equations { U 0.3; // 0.9 diverges slowly h 0.5; // 0.9 "(k|epsilon|omega)" 0.5; // 0.9 // ".*" 0.9; // 0.9 is more stable but 0.95 more convergent } } // ************************************************************************* // |
||
![]() |
![]() |
![]() |
![]() |
#9 |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 ![]() |
Oh, actually I missed that part "pressure-driven" in your initial post. For pressure-driven flow, "zeroGradient" is not good for U inlet and outlet (I guess inlet and outlet are yPosFace and yNegFace from skimming your BCs quickly).
For pressure-driven (incompressible) flow, I found best results using "pressureInletVelocity" for an inlet and "pressureInletOutletVelocity" at the outlet (although I have tested reversed flow where the outlet becomes an inlet, and it performed well). This thread may be useful to you. |
|
![]() |
![]() |
![]() |
![]() |
#10 | |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Quote:
Thanks again. I'd tried some variants of this, but even implementing that, I still get that the solution is diverging. Attempting to start the initial velocity field in the -y direction didn't fix it either. Looking at the documentation on totalPressure, I'm not sure I fully understand why rho is required but phi and U are optional: https://www.openfoam.com/documentati...-pressure.html Adding the line Code:
rho rho; Could the issue be that my reference height for the gravitational field is in the middle of the sample instead of the top/bottom and I haven't explicitly told the solver to shift the zero of the potential energy function? p_rgh: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 1e5; boundaryField { yPosFace // inlet { type totalPressure; rho rho; // diverges with or without this line p0 uniform 100360; value 100360; // 360 gauge } walls { type fixedFluxPressure; gradient uniform 0; value uniform 1e5;// 101325; } yNegFace // outlet { type totalPressure; rho rho; // diverges with or without this line p0 uniform 1e5; // 0 Gauge //value $internalField; // diverges with either value as internalField or uniform pressure value uniform 1e5; } } // ************************************************************************* // U: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ 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 { yPosFace { type pressureInletUniformVelocity; value uniform (0 0 0); } yNegFace { type pressureInletOutletVelocity; value uniform (0 0 0); } walls { type zeroGradient; } } // ************************************************************************* // p: Code:
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 1e5; boundaryField { yPosFace // inlet { type calculated; value $internalField; } yNegFace // outlet { type calculated; value $internalField; } walls { type calculated; value $internalField; } } // ************************************************************************* // |
||
![]() |
![]() |
![]() |
![]() |
#11 | |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 ![]() |
Quote:
Did you mean for wall velocity to be zeroGradient..? |
||
![]() |
![]() |
![]() |
![]() |
#12 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Good question. I switched it to noSlip. I copied over an example from simpleFoam and reran - took 380 iterations on simpleFoam. Currently around 20,000 iterations with buoyantSimpleFoam to resolve the pressure to 2 decimal places and the velocity field to 3 decimal places. But it's at least plausible and giving the the same qualitative result. Looking at this thread: buoyantSimpleFoam and watertank it seems like maybe there's an issue with buoyantSimpleFoam for water instead of gases? I'm going to play around with ideas to make it converge in fewer iterations. Thanks for your help. Edit: Converged in 23850 to 2 decimal places in pressure in 3 in the velocity field. |
|
![]() |
![]() |
![]() |
![]() |
#13 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 5 ![]() |
Staring at this some more, I learned that I can use the fvOptions to limit the max and min pressures and velocities, but I can't limit p_rgh for stability. I also learned that I don't really understand the role of p and p_rgh in buoyantSimpleFoam.
From the p.Eqn and U.Eqn files of the buoyantSimpleFoam source code it seems like p is only used for determining the density, and that this is then turned back into p_rgh, then p_rgh is used in the calculations? Suppose instead of having the pressure at yMax > pressure at yMin in the sample above, I had it the other way around, how do I set up the BCs to know which direction the fluid will flow. If it's something I have to calculate, how can that be automated? It's simple enough for a flat bar aligned with the y-axis, but if there's an angle or a more complicated geometry, it's not as simple to calculate. Suppose I want to determine the left-right flow through a bar at various orientations (supposing that there's a reservoir on the righthand side to take/give water as needed so the calculation is a single fluid phase): Sample 1) / Sample 2) ___ Sample 3) \ If I have the lefthand side connected at some given pressure above 1atm, then the righthand side connected at 1atm+gravitational effect, how can that be incorporated if buoyantSimpleFoam ignores it? For instance, there will definitely be flow from left to right in 2 and 3, but the flow in sample 1 will depend on the if the pressure on the lefthand side can overcome the gravitational contribution - how can we determine if there will be backflow? |
|
![]() |
![]() |
![]() |
![]() |
#14 |
New Member
Guillaume Fontaine
Join Date: Jul 2014
Posts: 4
Rep Power: 12 ![]() |
Hi Jared, did you find some more explanation on this topic ? Thanks
Guillaume |
|
![]() |
![]() |
![]() |
Tags |
boundary condition, buoyantsimplefoam, gravity openfoam |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 60 | July 17, 2024 05:45 |
Fail to converge when solving with a fabricated solution | zizhou | FLUENT | 0 | March 22, 2021 06:33 |
Table bounds warnings at: END OF TIME STEP | CFXer | CFX | 4 | July 16, 2020 23:44 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 07:30 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 07:00 |