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

Cavity Tuturial Using gmsh - results not looking quite right

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 15, 2018, 15:35
Default Cavity Tuturial Using gmsh - results not looking quite right
  #1
New Member
 
Stone preston
Join Date: Oct 2017
Posts: 7
Rep Power: 9
stonepreston is on a distinguished road
Hey Everyone,


I just started using OpenFOAM and am still new to CFD in general. I am trying to get the cavity tutorial working using gmsh instead of blockMesh.



Here is my .geo file


Code:
// Gmsh project created on Fri Jun 15 11:49:11 2018
SetFactory("OpenCASCADE");
//+
//+
// Define variable to control mesh refinement
h = .01;
Point(1) = {0, 0, 0, h};
//+
Point(2) = {0.1, 0, 0, h};
//+
Point(3) = {0.1, 0.1, 0,h};
//+
Point(4) = {0, 0.1, 0, h};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 4};
//+
Line(4) = {4, 1};
//+
Line Loop(1) = {3, 4, 1, 2};
//+
Plane Surface(1) = {1};
//+
Transfinite Line {3, 1, 4, 2} = 21 Using Progression 1;
//+
Transfinite Surface {1};
//+
Recombine Surface {1};
//+
//+
//+
Extrude {0, 0, .005} {
  Surface{1}; Layers{1}; Recombine;
}
//+
Physical Surface("movingWall") = {2};
//+
Physical Surface("fixedWalls") = {3, 4, 5};
//+
Physical Surface("frontAndBack") = {6, 1};
//+
Physical Volume("fluid") = {1};
The mesh is 20 x 20 cells in the xy direction and 1 cell thick in the z direction. I made sure all the physical boundary names matched those used in the original cavity tutorial. An image of my mesh is attached.



I converted the gmsh .msh file to openFoam using



Code:
gmshToFoam cavity.msh
and it created all the mesh files inside the polyMesh directory. I then modified the boundary file to match that of the original tutorial. One thing I did notice was that this boundary files has a type field AND a physicalType field. Whats the difference between the 2? Nevertheless, here is my boundary file:


Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

3
(
    frontAndBack
    {
        type            empty;
        physicalType    empty;
        nFaces          800;
        startFace       760;
    }
    movingWall
    {
        type            wall;
        physicalType    wall;
        nFaces          20;
        startFace       1560;
    }
    fixedWalls
    {
        type            wall;
        physicalType    wall;
        nFaces          60;
        startFace       1580;
    }
)

// ************************************************************************* //
I then ran



Code:
icoFoam
In paraFoam, my results are quite different than the original tutorial. I have attached pictures of my pressure and velocity contours. The shape of the pressure contour is correct but the numbers do not match that of the original tutorial. The shape of the velocity contour is a bit off as well.



Any ideas what is going on?



Thanks
Attached Images
File Type: png velocityContour.png (56.7 KB, 8 views)
File Type: png pressureContour.png (22.5 KB, 7 views)
File Type: png mesh.png (20.5 KB, 6 views)
stonepreston is offline   Reply With Quote

Old   June 19, 2018, 10:54
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

In fact velocity fields are identical for blockMesh and Gmsh generated meshes. Absolute values of pressure are different, but it is difference, that matters/drives flow, and the difference is the same for both simulations (9.2 Pa). In fact, different distributions of pressure are caused by different locations of 0 Pa (which, by default, is in cell with ID = 0).

Since it is icoFoam and meshes are slightly different, I would not worry much about these result differences.

I ran simulations with OpenFOAM-plus 1806 pre-release. What version did you use?

Last edited by alexeym; June 19, 2018 at 13:08.
alexeym is offline   Reply With Quote

Old   June 19, 2018, 14:21
Default
  #3
New Member
 
Stone preston
Join Date: Oct 2017
Posts: 7
Rep Power: 9
stonepreston is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

In fact velocity fields are identical for blockMesh and Gmsh generated meshes. Absolute values of pressure are different, but it is difference, that matters/drives flow, and the difference is the same for both simulations (9.2 Pa). In fact, different distributions of pressure are caused by different locations of 0 Pa (which, by default, is in cell with ID = 0).

Since it is icoFoam and meshes are slightly different, I would not worry much about these result differences.

I ran simulations with OpenFOAM-plus 1806 pre-release. What version did you use?
I used OpenFOAM-5.0
stonepreston is offline   Reply With Quote

Old   June 19, 2018, 18:03
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well, I do not have 5.0 installed, but still the difference in pressure distributions are caused by different mesh cells numbering (and necessity to solve Poisson equation with pure Neumann BCs).

And as a side-note: it is not quite fair to compare interpolated point fields in ParaView (real velocity, for example, is located in the cell centres, so it is cell data in terms of ParaView). Use sample function object to extract data directly from simulation.
alexeym 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
Problem: Very long "write" time (~2h-3h) for results and transient results Shawn_A CFX 16 April 12, 2016 21:49
Weird results on Cavity and unstructured meshes x86_64leon OpenFOAM Running, Solving & CFD 12 March 1, 2016 20:44
Benchmark Results for Thermally driven cavity flow mihirmakwana6 Main CFD Forum 2 July 8, 2015 06:16
Buoyancydriven cavity results for comparision kar OpenFOAM 0 April 14, 2008 10:04
hx2h Cavity flow results ? sangrar Main CFD Forum 5 March 15, 2001 08:59


All times are GMT -4. The time now is 01:20.