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

Problems with divergence for 2D simulation in simpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 27, 2016, 09:57
Post Problems with divergence for 2D simulation in simpleFoam
  #1
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
Hi,

I'm a new to openfoam, and I'm trying to run a 2D simulation around an ellipse. I have an o-grid type structured mesh which features boundary layer refinements. I imported the mesh from GMSH, and it worked fine. I have setup a case, my simulation is a steady simulation so I'm using simpleFoam. The continuity equation and nuTilda start diverging after a few iterations. I'm completely new to openfoam, so my knowledge of fvschemes, fvsolutions etc is limited. I guess there is an issue with my boundary conditions or fvschemes, and I'm unable to figure this out. Any suggestions I can get are appreciated.

Case details:
v = 127 m/s
turbulence is on with SA model

My case files are attached. Thanks in advance for your time.
Attached Images
File Type: jpg mesh.jpg (95.2 KB, 17 views)
Attached Files
File Type: gz 0.tar.gz (508 Bytes, 3 views)
File Type: gz system.tar.gz (994 Bytes, 4 views)
File Type: gz constant.tar.gz (386 Bytes, 4 views)
kush_vidyarthi is offline   Reply With Quote

Old   October 27, 2016, 21:12
Default
  #2
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19
tas38 is on a distinguished road
Does checkMesh run without any errors?
tas38 is offline   Reply With Quote

Old   October 28, 2016, 04:06
Default
  #3
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
Hi Troy,
Thanks for your reply.
The checkMesh utility gives errors on 2 accounts. First is for high aspect ratio elements. I can't do anything about that because I have a boundary layer mesh. Or if I can, I'm all ears. Second is for non orthogonal elements. I'm not sure what to do with those. I have tried to isolate the bad elements using foamToVtk utility. The high aspect ratio and non orthogonal elements occur in the vicinity of the elliptical geometry.

checkMesh output
"Build : 4.1-1e03d68d4f4e
Exec : checkMesh
Date : Oct 28 2016
Time : 08:58:03
Host : "kushagra-Z510"
PID : 3903
Case : /home/kushagra/cfd_run
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
points: 177600
internal points: 0
faces: 353424
internal faces: 175824
cells: 88208
faces per cell: 6
boundary patches: 5
point zones: 0
face zones: 0
cell zones: 1

Overall number of cells of each type:
hexahedra: 88208
prisms: 0
wedges: 0
pyramids: 0
tet wedges: 0
tetrahedra: 0
polyhedra: 0

Checking topology...
Boundary definition OK.
Cell to face addressing OK.
Point usage OK.
Upper triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
Patch Faces Points Surface topology
back 88208 88800 ok (non-closed singly connected)
ellipse 592 1184 ok (non-closed singly connected)
inlet 296 594 ok (non-closed singly connected)
front 88208 88800 ok (non-closed singly connected)
outlet 296 594 ok (non-closed singly connected)

Checking geometry...
Overall domain bounding box (-2 -2 0) (2 2 0.001)
Mesh has 2 geometric (non-empty/wedge) directions (1 1 0)
Mesh has 2 solution (non-empty) directions (1 1 0)
All edges aligned with or perpendicular to non-empty directions.
Boundary openness (2.25229e-20 6.19854e-21 -1.13184e-16) OK.
***High aspect ratio cells found, Max aspect ratio: 1032.16, number of cells 12
<<Writing 12 cells with high aspect ratio to set highAspectRatioCells
Minimum face area = 1.4591e-11. Maximum face area = 0.00550701. Face area magnitudes OK.
Min volume = 1.4591e-14. Max volume = 5.50701e-06. Total volume = 0.0125655. Cell volumes OK.
Mesh non-orthogonality Max: 89.7922 average: 28.8203
*Number of severely non-orthogonal (> 70 degrees) faces: 4852.
Non-orthogonality check OK.
<<Writing 4852 non-orthogonal faces to set nonOrthoFaces
Face pyramids OK.
Max skewness = 0.500997 OK.
Coupled point location match (average 0) OK.

Failed 1 mesh checks.

End"

I have also attached the foamToVTK screenshots for high aspect ratio cells and non-orthogonal faces. Any pointers on how to deal with this, whether re-meshing, or adjusting fvschemes etc. would be appreciated.
Attached Images
File Type: png non-orthofaces.png (133.0 KB, 20 views)
File Type: png highARcells.png (126.1 KB, 14 views)
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 12:55
Default
  #4
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19
tas38 is on a distinguished road
Please post a zoomed-in view of the mesh in the region of the solid surface boundary.
tas38 is offline   Reply With Quote

Old   October 28, 2016, 13:26
Default
  #5
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
I'm not quite sure you are referring to a zoomed in view of which surface boundary. Do you mean the boundary layer mesh?
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 13:27
Default
  #6
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
If it is boundary layer you want to see, then it is not clearly visible since the first layer distance in 5e-6 meters
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 13:31
Default
  #7
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
The zoomed in view of the mesh is attached. Its pretty fine since I'm attempting a boundary layer mesh. The first layer distance from the wall is 5e-6 meters
Attached Images
File Type: jpg mesh1.jpg (78.2 KB, 25 views)
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 13:32
Default
  #8
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19
tas38 is on a distinguished road
Yes. The aspect ratio and orthogonality errors thrown by checkMesh appear to be isolated to the boundary layer mesh and/or the interfacial region between the boundary mesh and the surrounding mesh. Whether you provide the zoomed-in view of the mesh or not, it appears that the mesh needs to adjusted in order to have the best chance to get a convergent solution.
tas38 is offline   Reply With Quote

Old   October 28, 2016, 13:36
Default
  #9
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
Okay. What can I do to reduce the errors? Should I do away with the boundary layer all together? Or is there a work-around which will allow me to preserve the boundary layer and still get a solution?
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 13:40
Default
  #10
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19
tas38 is on a distinguished road
Your grid is not included in the posted files. Can you post this as I am trying to run your case to see where the error my reside.
tas38 is offline   Reply With Quote

Old   October 28, 2016, 13:47
Default
  #11
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
The grid files were actually too large to post. I used gmsh, so the script is as follows:

//Script to generate o-grid mesh arround ellipse
Geometry.Tolerance = 1e-12;

//Reference points
Point(1) = {0,0,0,0.01};
Point(2) = {-0.02,0,0,0.01};
Point(3) = {0.02,0,0,0.01};

//Ellipse points

Point(4) = {-0.0375,0,0,0.01};
Point(5) = {-0.0265165042945,0.00331456303681,0,0.01};
Point(6) = {0,0.0046875,0,0.01};
Point(7) = {0.0265165042945,0.00331456303681,0,0.01};
Point(8) = {0.0375,0,0,0.01};
Point(9) = {0.0265165042945,-0.00331456303681,0,0.01};
Point(10) = {0,-0.0046875,0,0.01};
Point(11) = {-0.0265165042945,-0.00331456303681,0,0.01};

//Ellipse curves

Ellipse(1)= {4,1,2,5};
Ellipse(2)= {5,1,2,6};
Ellipse(3)= {6,1,3,7};
Ellipse(4)= {7,1,3,8};
Ellipse(5)= {8,1,3,9};
Ellipse(6)= {9,1,2,10};
Ellipse(7)= {10,1,2,11};
Ellipse(8)= {11,1,2,4};

//Domain points

Point(12) = {-2,0,0,0.01};
Point(13) = {-1.41421356237,1.41421356237,0,0.01};
Point(14) = {0,2,0,0.01};
Point(15) = {1.41421356237,1.41421356237,0,0.01};
Point(16) = {2,0,0,0.01};
Point(17) = {1.41421356237,-1.41421356237,0,0.01};
Point(18) = {0,-2,0,0.01};
Point(19) = {-1.41421356237,-1.41421356237,0,0.01};

//Domain curves

Circle(9)= {12,1,13};
Circle(10)= {13,1,14};
Circle(11)= {14,1,15};
Circle(12)= {15,1,16};
Circle(13)= {16,1,17};
Circle(14)= {17,1,18};
Circle(15)= {18,1,19};
Circle(16)= {19,1,12};

//Block lines

Line(17)= {4,12};
Line(18)= {5,13};
Line(19)= {6,14};
Line(20)= {7,15};
Line(21)= {8,16};
Line(22)= {9,17};
Line(23)= {10,18};
Line(24)= {11,19};

//Surfaces

Line Loop(25)= {1,18,-9,-17};
Plane Surface(26)= {25};
Line Loop(27)= {2,19,-10,-18};
Plane Surface(28)= {27};
Line Loop(29)= {3,20,-11,-19};
Plane Surface(30)= {29};
Line Loop(31)= {4,21,-12,-20};
Plane Surface(32)= {31};
Line Loop(33)= {5,22,-13,-21};
Plane Surface(34)= {33};
Line Loop(35)= {6,23,-14,-22};
Plane Surface(36)= {35};
Line Loop(37)= {7,24,-15,-23};
Plane Surface(38)= {37};
Line Loop(39)= {8,17,-16,-24};
Plane Surface(40)= {39};

//Division of lines

Transfinite Line {1,9,4,12,5,13,8,16} = 50 Using Progression 1;
Transfinite Line {2,10,3,11,6,14,7,15} = 100 Using Progression 1;
Transfinite Line {17:24} = 150 Using Progression 1.1;

//Transfinite surfaces

Transfinite Surface {26} = {4,12,13,5} Right;
Transfinite Surface {28} = {5,13,14,6} Right;
Transfinite Surface {30} = {6,14,15,7} Right;
Transfinite Surface {32} = {7,15,16,8} Right;
Transfinite Surface {34} = {8,16,17,9} Right;
Transfinite Surface {36} = {9,17,18,10} Right;
Transfinite Surface {38} = {10,18,19,11} Right;
Transfinite Surface {40} = {11,19,12,4} Right;

Recombine Surface{26,28,30,32,34,36,38,40};

Mesh.Smoothing = 2;

//Extrude 2D to 3D

s1[] = Extrude {0, 0, 0.001} {Surface{26}; Layers{1}; Recombine;};
s2[] = Extrude {0, 0, 0.001} {Surface{28}; Layers{1}; Recombine;};
s3[] = Extrude {0, 0, 0.001} {Surface{30}; Layers{1}; Recombine;};
s4[] = Extrude {0, 0, 0.001} {Surface{32}; Layers{1}; Recombine;};
s5[] = Extrude {0, 0, 0.001} {Surface{34}; Layers{1}; Recombine;};
s6[] = Extrude {0, 0, 0.001} {Surface{36}; Layers{1}; Recombine;};
s7[] = Extrude {0, 0, 0.001} {Surface{38}; Layers{1}; Recombine;};
s8[] = Extrude {0, 0, 0.001} {Surface{40}; Layers{1}; Recombine;};

//Physical Surfaces

Physical Surface("front") = {s1[0],s2[0],s3[0],s4[0],s5[0],s6[0],s7[0],s8[0]};
Physical Surface("back") = {26, 28, 30, 32, 34, 36, 38, 40};
Physical Surface("inlet") = {s1[4],s2[4],s7[4],s8[4]};
Physical Surface("outlet") = {s3[4],s4[4],s5[4],s6[4]};
Physical Surface("ellipse") = {s1[2],s2[2],s3[2],s4[2],s5[2],s6[2],s7[2],s8[2]};
Physical Volume("fluid") = {s1[1],s2[1],s3[1],s4[1],s5[1],s6[1],s7[1],s8[1]};

//Boundary Layer

Field[1] = BoundaryLayer;
Field[1].FacesList = {s1[2],s2[2],s3[2],s4[2],s5[2],s6[2],s7[2],s8[2]};
Field[1].hfar = 0.05;
Field[1].hwall_n = 0.000005;
Field[1].thickness = 0.01;
Field[1].ratio = 1.1;
Field[1].AnisoMax = 10;
Field[1].Quads = 1;
Field[1].IntersectMetrics = 0;
BoundaryLayer Field = 1;

This is a .geo file for gmsh. Thanks
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 14:57
Default
  #12
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19
tas38 is on a distinguished road
Just post an external link to the requisite files. Dropbox or google drive maybe. I do not have gmsh installed.
tas38 is offline   Reply With Quote

Old   October 28, 2016, 15:47
Default
  #13
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
Here you are:

https://drive.google.com/drive/folde...W8?usp=sharing
kush_vidyarthi is offline   Reply With Quote

Old   October 28, 2016, 17:49
Default
  #14
Senior Member
 
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19
tas38 is on a distinguished road
I had to make a couple of minor adjustments to get your case to run in OF 2.3.0. It looks to me that your issue lies in the quality of the mesh as even after one iteration, the solution is beginning to diverge. The aspect ratio of the mesh needs to be reduced, especially at regions where the radius of curvature is smaller.

Here is a link to an image of the leading edge of the solid body.

https://www.dropbox.com/s/9kmz819jqbumxf2/img.pdf?dl=0

The plot is of velocity magnitude. For this case, I have lowered the freestream velocity to 1 m/s and changed the flow to laminar (no turbulence model). After a single iteration, the velocity within the cells adjacent to the solid body all begin to exceed 1 m/s, i.e. the solution is diverging.
tas38 is offline   Reply With Quote

Old   October 31, 2016, 13:12
Default
  #15
New Member
 
Kushagra Vidyarthi
Join Date: Aug 2016
Posts: 9
Rep Power: 10
kush_vidyarthi is on a distinguished road
Alright. Thanks for your inputs. I'll try to work on reducing the aspect ratio.
kush_vidyarthi is offline   Reply With Quote

Reply


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
SimpleFoam crashes after restarting simulation fedez91 OpenFOAM Running, Solving & CFD 18 September 4, 2016 09:59
Problems in water-air flow simulation bybygary Fluent Multiphase 2 April 29, 2014 16:12
Divergence problem Smaras FLUENT 13 February 21, 2013 06:03
Fan simulation divergence ayothicfd CFX 18 July 20, 2012 06:53
solution divergence in periodic simulation aqstax FLUENT 1 February 27, 2012 02:50


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