|
[Sponsors] |
Unequal Mesh Volumes in Cells of the Same Size? (mesh.V()) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 8, 2020, 16:50 |
Unequal Mesh Volumes in Cells of the Same Size? (mesh.V())
|
#1 |
New Member
Mohammad Khojastehmehr
Join Date: Jul 2020
Posts: 20
Rep Power: 6 |
Hey everybody, I came across a strange case.
I generated a mesh with blockMesh in which all cells are the same size: Code:
convertToMeters 0.000508; vertices ( (0 0 0) (100 0 0) (100 40 0) (0 40 0) (0 0 40) (100 0 40) (100 40 40) (0 40 40) ); blocks ( hex (0 1 2 3 4 5 6 7) (100 1 1) simpleGrading (1 1 1) ); Code:
if (mesh.V()[0] == mesh.V()[2]){ std :: cout <<"Yes"<< std::endl; }else{ std :: cout <<"No"<< std::endl; } std :: cout <<mesh.V()[0] - mesh.V()[2]<< std::endl; Code:
No 2.64698e-23 Code:
Yes 0 |
|
November 8, 2020, 22:28 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
The difference is , which is very small.
I think you should not be comparing floating point umbers directly, as you have here: Code:
if (mesh.V()[0] == mesh.V()[2]) { std :: cout <<"Yes"<< std::endl; } |
|
November 9, 2020, 14:38 |
|
#3 |
New Member
Mohammad Khojastehmehr
Join Date: Jul 2020
Posts: 20
Rep Power: 6 |
Thank you for your answer! Do you know why some are exactly equal, but some are slightly different?
|
|
November 9, 2020, 17:45 |
|
#4 |
Senior Member
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 16 |
||
Tags |
blockmesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[mesh manipulation] How to write cellSet for different regions in constant/polyMesh/sets | Struggle_Achieve | OpenFOAM Meshing & Mesh Conversion | 3 | June 17, 2019 10:29 |
[snappyHexMesh] Number of cells in mesh don't match with size of cellLevel | colinB | OpenFOAM Meshing & Mesh Conversion | 14 | December 12, 2018 09:07 |
[snappyHexMesh] sHM layer process keeps getting killed | MBttR | OpenFOAM Meshing & Mesh Conversion | 4 | August 15, 2016 04:21 |
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found | piprus | OpenFOAM Installation | 22 | February 25, 2010 14:43 |
Problems in compiling paraview in Suse 10.3 platform | chiven | OpenFOAM Installation | 3 | December 1, 2009 08:21 |