
[Sponsors] 
Solver crashing when water reaches specific part of geometry 

LinkBack  Thread Tools  Search this Thread  Display Modes 
August 12, 2019, 04:00 
Solver crashing when water reaches specific part of geometry

#1 
New Member
Mads Ivarson
Join Date: Jul 2019
Posts: 10
Rep Power: 2 
Hello!
I am running interFoam on OpenFOAM for Windows v1812. I am trying to simulate a river flowing over a small dam structure. The mesh is rather complicated, but after using snappyHexMesh and checkMesh, there are no errors. CheckMesh output: Checking geometry... Overall domain bounding box (61.5 12.8416 5.7553) (61.5 12.1276 6) Mesh has 3 geometric (nonempty/wedge) directions (1 1 1) Mesh has 3 solution (nonempty) directions (1 1 1) Boundary openness (6.09426e17 2.2781e18 6.66016e16) OK. Max cell openness = 4.12308e16 OK. Max aspect ratio = 7.84984 OK. Minimum face area = 0.00627443. Maximum face area = 3.92051. Face area magnitudes OK. Min volume = 0.00609986. Max volume = 6.2164. Total volume = 14660.8. Cell volumes OK. Mesh nonorthogonality Max: 58.5746 average: 17.1615 Nonorthogonality check OK. Face pyramids OK. Max skewness = 3.77688 OK. Coupled point location match (average 0) OK. Mesh OK. However, when i run interFoam, no matter which refinement level my mesh is at, the Courant number explodes around the time the water hits the dam. Increasing the inlet velocity makes the solver diverge sooner, as the water hits the dam earlier. This makes me expect that something has to be done with the dam geometry. I've been told earlier that interFoam is picky about the mesh, especially regarding skewness and orthogonality. I don't know which values I should aim for to make sure the mesh is good enough. Does anyone have any experience with similar cases, or have any suggestions how to move forward? Imgur album of geometry and Paraview results: https://imgur.com/a/9B8c4NQ Cheers! 

August 12, 2019, 06:48 

#2 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 304
Rep Power: 7 
Hi!
Can you share your fvSolution? And try with pure 1st order schemes, and if it is working you can go for higher order ones. I know you wrote the mest resolution, but I think this is really poor... What if you try to refine only around the dam. And what is your allowed max Co and alphaCo? Or are you using fixed time steps? 

August 12, 2019, 07:17 

#3 
New Member
Mads Ivarson
Join Date: Jul 2019
Posts: 10
Rep Power: 2 
Thanks for the reply!
Here is my fvSolutions: Code:
FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { "alpha.water.*" { nAlphaCorr 1; nAlphaSubCycles 1; cAlpha 1; MULESCorr yes; nLimiterIter 3; solver smoothSolver; smoother symGaussSeidel; tolerance 1e8; relTol 0; } pcorr { solver PCG; preconditioner { preconditioner GAMG; tolerance 1e5; relTol 0; smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; nFinestSweeps 2; cacheAgglomeration true; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; mergeLevels 1; } tolerance 1e5; relTol 0; maxIter 50; } p_rgh { solver GAMG; tolerance 5e9; relTol 0.01; smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; cacheAgglomeration true; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; mergeLevels 1; maxIter 50; }; p_rghFinal { $p_rgh; tolerance 5e9; relTol 0; } pcorrFinal { $pcorr; tolerance 5e9; relTol 0; } "(Ukepsilon).*" { solver smoothSolver; smoother symGaussSeidel; nSweeps 1; tolerance 1e6; relTol 0.1; }; } PIMPLE { momentumPredictor no; nCorrectors 2; nNonOrthogonalCorrectors 0; } relaxationFactors { fields { } equations { ".*" 1; } } Code:
FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSchemes; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ddtSchemes { default Euler; } gradSchemes { default Gauss linear; } divSchemes { div(rhoPhi,U) Gauss linearUpwind grad(U); div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss linear; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } wallDist { method meshWave; } I am using adjustableTimestep. maxCo is 0.9 and alphaCo is 0.5 

August 12, 2019, 07:29 

#4 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 304
Rep Power: 7 
So first of all you just using PISO not the PIMPLE algorithm. Try something like this: But you can modify mostly the residuals (probably you will have to tighten the tolerances but try with these for the first time) entry and the nOuterCorrrectors part. The first timesteps will be pretty slow (you will have a lot of outer loop, but as you go further you will need less and less.
Code:
PIMPLE { momentumPredictor no; nOuterCorrectors 50; nCorrectors 1; nNonOrthogonalCorrectors 0; correctPhi yes; moveMeshOuterCorrectors no; turbOnFinalIterOnly no; residualControl { U { tolerance 1e4; absTol 0; relTol 0; } p_rgh { tolerance 1e4; absTol 0; relTol 0; } k { tolerance 1e3; absTol 0; relTol 0; } epsilon { tolerance 1e3; absTol 0; relTol 0; } } } For U and alpha, you can use a Gauss upwind like for k and epsilon. This is a really diffusive scheme, but hell stable so it is good for a starting point. Refine: In snappyHexMesh you can define a box for example. And you can refine the mesh in that region if you don't have your dam in a separate stl file. 

August 12, 2019, 07:42 

#5 
New Member
Mads Ivarson
Join Date: Jul 2019
Posts: 10
Rep Power: 2 
Thank you for good input!
The reason the mesh is coarse is because I am currently working on a normal laptop. My aim was to make it work on a coarse mesh first, then transfer the case to a more powerful computer for the high resolution simulation. I do not need the river bed to be especially high res, the focal point is the dam. Therefore I will make sure to try and refine in a box just around the dam, like you said, to save some processing power! I implemented your suggestions and am now running the simulation. Forgive my PC for working slowly hehe. I will update when the run is finished. 

August 13, 2019, 03:42 

#6 
New Member
Mads Ivarson
Join Date: Jul 2019
Posts: 10
Rep Power: 2 
After running the simulation with the 1st order schemes and PIMPLE, the simulation still diverges before reaching the dam, it diverges around 11.7s into the run.
This time I also used refinementRegion in sHM to make the mesh around the dam extra fine. You were right in that the first steps take a bit longer, but after a bit it speeds up. I was hopeful that it would work this time, but unfortunalety not.. I will attach the relevant dictionaries. Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 2.1.0   \\ / A nd  Web: www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application interFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 40; deltaT 0.05; writeControl adjustableRunTime; writeInterval 0.1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable yes; adjustTimeStep yes; maxCo 0.9; maxAlphaCo 0.5; maxDeltaT 1; // ************************************************************************* // Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 2.1.0   \\ / A nd  Web: www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh true; snap true; //snap false; addLayers true; //addLayers false; // Geometry. Definition of all surfaces. All surfaces are of class // searchableSurface. // Surfaces are used //  to specify refinement for any mesh cell intersecting it //  to specify refinement for any mesh cell inside/outside/near //  to 'snap' the mesh boundary to the surface geometry { river.stl { type triSurfaceMesh; name river; } refinementBox { type searchableBox; min (34 12 4); max (38 12 6); } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // Refinement parameters // ~~~~~~~~~~~~~~~~~~~~~ // If local number of cells is >= maxLocalCells on any processor // switches from from refinement followed by balancing // (current method) to (weighted) balancing before refinement. maxLocalCells 1000000; // Overall cell limit (approximately). Refinement will stop immediately // upon reaching this number so a refinement level might not complete. // Note that this is the number of cells before removing the part which // is not 'visible' from the keepPoint. The final number of cells might // actually be a lot less. maxGlobalCells 4000000; // The surface refinement loop might spend lots of iterations refining just a // few cells. This setting will cause refinement to stop if <= minimumRefine // are selected for refinement. Note: it will at least do one iteration // (unless the number of cells to refine is 0) minRefinementCells 0; // Allow a certain level of imbalance during refining // (since balancing is quite expensive) // Expressed as fraction of perfect balance (= overall number of cells / // nProcs). 0=balance always. maxLoadUnbalance 0.10; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 1; // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by its edges. // This is a featureEdgeMesh, read from constant/triSurface for now. features (); // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies two levels for every surface. The first is the minimum level, // every cell intersecting a surface gets refined up to the minimum level. // The second level is the maximum level. Cells that 'see' multiple // intersections where the intersections make an // angle > resolveFeatureAngle get refined up to the maximum level. refinementSurfaces { river { // Surfacewise min and max refinement level level (2 2); } } // Resolve sharp angles resolveFeatureAngle 40; // Regionwise refinement // ~~~~~~~~~~~~~~~~~~~~~~ // Specifies refinement level for cells in relation to a surface. One of // three modes //  distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in // descending order. //  inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. //  outside. Same but cells outside. refinementRegions { refinementBox { mode inside; levels ((2 4)); } } // Mesh selection // ~~~~~~~~~~~~~~ // After refinement patches get added for all refinementSurfaces and // all cells intersecting the surfaces get put into these patches. The // section reachable from the locationInMesh is kept. // NOTE: This point should never be on a face, always inside a cell, even // after refinement. locationInMesh (0 0 0); // Whether any faceZones (as specified in the refinementSurfaces) // are only on the boundary of corresponding cellZones or also allow // freestanding zone faces. Not used if there are no faceZones. allowFreeStandingZoneFaces true; } // Settings for the snapping. snapControls { // Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 4; // Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 3.0; // Number of mesh displacement relaxation iterations. nSolveIter 70; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 20; // Highly experimental and wip: number of feature edge snapping // iterations. Leave out altogether to disable. // Do not use here since mesh resolution too low and baffles present nFeatureSnapIter 25; } // Settings for the layer addition. addLayersControls { // Are the thickness parameters below relative to the undistorted // size of the refined cell outside layer (true) or absolute sizes (false). relativeSizes true; // Per final patch (so not geometry!) the layer information layers { } // Expansion factor for layer mesh expansionRatio 1.0; // Wanted thickness of final added cell layer. If multiple layers // is the // thickness of the layer furthest away from the wall. // Relative to undistorted size of cell outside layer. // is the thickness of the layer furthest away from the wall. // See relativeSizes parameter. finalLayerThickness 0.3; // Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // Relative to undistorted size of cell outside layer. minThickness 0.3; // If points get not extruded do nGrow layers of connected faces that are // also not grown. This helps convergence of the layer addition process // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings // When not to extrude surface. 0 is flat surface, 90 is when two faces // make straight angle. featureAngle 60; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 1; // Number of smoothing iterations of interior mesh movement direction nSmoothNormals 3; // Smooth layer thickness over surface patches nSmoothThickness 10; // Stop layer growth on highly warped cells maxFaceThicknessRatio 0.5; // Reduce layer growth where ratio thickness to medial // distance is large maxThicknessToMedialRatio 0.3; // Angle used to pick up medial axis points // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x. minMedianAxisAngle 90; // Create buffer region for new layer terminations nBufferCellsNoExtrude 0; // Overall max number of layer addition iterations. The mesher will exit // if it reaches this number of iterations; possibly with an illegal // mesh. nLayerIter 50; } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { // Maximum nonorthogonality allowed. Set to 180 to disable. maxNonOrtho 65; //maxNonOrtho 180; // Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 20; maxInternalSkewness 3; // Max concaveness allowed. Is angle (in degrees) below which concavity // is allowed. 0 is straight face, <0 would be convex face. // Set to 180 to disable. maxConcave 80; //maxConcave 180; // Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to a sensible fraction of the smallest cell volume expected. // Set to very negative number (e.g. 1E30) to disable. minVol 1e13; // Minimum quality of the tet formed by the facecentre // and variable base point minimum decomposition triangles and // the cell centre. This has to be a positive number for tracking // to work. Set to very negative number (e.g. 1E30) to // disable. // <0 = inside out tet, // 0 = flat tet // 1 = regular tet minTetQuality 1e30; // Minimum face area. Set to <0 to disable. minArea 1; // Minimum face twist. Set to <1 to disable. dot product of face normal // and face centre triangles normal minTwist 0.05; // minimum normalised cell determinant // 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; // minFaceWeight (0 > 0.5) minFaceWeight 0.05; // minVolRatio (0 > 1) minVolRatio 0.01; //must be >0 for Fluent compatibility minTriangleTwist 1; // Advanced // Number of error distribution iterations nSmoothScale 4; // amount to scale back displacement at error points errorReduction 0.75; } // Advanced // Flags for optional output // 0 : only write final meshes // 1 : write intermediate meshes // 2 : write volScalarField with cellLevel for postprocessing // 4 : write current intersections as .obj files debug 0; // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1e6; // ************************************************************************* // Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 2.1.0   \\ / A nd  Web: www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSchemes; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ddtSchemes { default Euler; } gradSchemes { default Gauss linear; } divSchemes { div(rhoPhi,U) Gauss upwind; div(phi,alpha) Gauss upwind; div(phirb,alpha) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } wallDist { method meshWave; } // ************************************************************************* // Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 2.1.0   \\ / A nd  Web: www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { "alpha.water.*" { nAlphaCorr 1; nAlphaSubCycles 1; cAlpha 1; MULESCorr yes; nLimiterIter 3; solver smoothSolver; smoother symGaussSeidel; tolerance 1e8; relTol 0; } pcorr { solver PCG; preconditioner { preconditioner GAMG; tolerance 1e5; relTol 0; smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; nFinestSweeps 2; cacheAgglomeration true; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; mergeLevels 1; } tolerance 1e5; relTol 0; maxIter 50; } p_rgh { solver GAMG; tolerance 5e9; relTol 0.01; smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; cacheAgglomeration true; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; mergeLevels 1; maxIter 30; }; p_rghFinal { $p_rgh; tolerance 5e9; relTol 0; } pcorrFinal { $pcorr; tolerance 5e9; relTol 0; } "(Ukepsilon).*" { solver smoothSolver; smoother symGaussSeidel; nSweeps 1; tolerance 1e6; relTol 0.1; }; } PIMPLE { momentumPredictor no; nOuterCorrectors 50; nCorrectors 1; nNonOrthogonalCorrectors 0; correctPhi yes; moveMeshOuterCorrectors no; turbOnFinalIterOnly no; residualControl { U { tolerance 1e4; absTol 0; relTol 0; } p_rgh { tolerance 1e4; absTol 0; relTol 0; } k { tolerance 1e3; absTol 0; relTol 0; } epsilon { tolerance 1e3; absTol 0; relTol 0; } } } relaxationFactors { fields { } equations { ".*" 1; } } // ************************************************************************* // Image of mesh: https://imgur.com/a/TP6pI9K 

August 13, 2019, 03:55 

#7 
Senior Member
anonymous
Join Date: Jan 2016
Posts: 304
Rep Power: 7 
Bad news
Honestly the last guess what i should do is use some relaxation. Or you can try with 0.5 instead of 0.7 which will slows down the simulation a bit. Just try to continue the run from an earlier time step. From 78 sec for example, just be far from the diverged step. Code:
relaxationFactors { equations { "(Ukepsilonomega)" 0.7; ".*Final" 1; } } And next time if you have a crash, append the end of the log file too. It can contain some useful data. 

August 13, 2019, 03:58 

#8 
New Member
Mads Ivarson
Join Date: Jul 2019
Posts: 10
Rep Power: 2 
I will make an attempt!
Thank you for your help anyways, I really appreciate it! 

August 16, 2019, 11:19 

#9 
Senior Member
Paulo Vatavuk
Join Date: Mar 2009
Location: Campinas, Brasil
Posts: 188
Rep Power: 12 
Hi Mads,
In my experience with interFoam, the Courant number explodes because, at some region and at a certain time, the solver generates very high velocities. You can have a hint on where this region is located by saving the results just before the calculation diverges. Then looking at results you may notice some region with very high velocities. As I already comented in interFoam solver crash , the outlet boundary condition is a possible cause for this problem. Best Regards, Paulo 

Tags 
interfoam, ras, turbulent, volume of fluid 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Domain Reference Pressure and mass flow inlet boundary  AdidaKK  CFX  75  August 20, 2018 06:37 
[TGrid] Water Turbine meshed in TurboGrid: Geometry and Topology issues  ama294  ANSYS Meshing & Geometry  12  September 29, 2014 14:23 
Star cd esice solver error  ernarasimman  STARCD  2  September 12, 2014 01:01 
Mass imbalance problem in multiphase water and steam CFX case  Antech  CFX  0  February 19, 2014 06:46 
TwoPhase Buoyant Flow Issue  Miguel Baritto  CFX  4  August 31, 2006 13:02 