CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Other] How is aspect ratio computed? (https://www.cfd-online.com/Forums/openfoam-meshing/148862-how-aspect-ratio-computed.html)

musahossein February 20, 2015 22:28

How is aspect ratio computed?
 
Quote:

Originally Posted by wyldckat (Post 531934)
Quick answer:

AFAIK, it has not changed. At least not up and including to OpenFOAM 2.3.x.


AFAIK, yes.

Bruno:

Rather than start a new thread, I would appreciate it if you could please tell me how the aspect ratio in openfoam is computed. The reason I ask is that I ran checkMesh on a model and I received a warning that says:
Code:

Checking geometry...
    Overall domain bounding box (-1 -0.0125 -0.1) (1 0.0125 0.1)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-6.21778e-19 -4.02704e-16 -9.53145e-19) OK.
 ***High aspect ratio cells found, Max aspect ratio: 1333.33, number of cells 15000
  <<Writing 15000 cells with high aspect ratio to set highAspectRatioCells
    Minimum face area = 1e-06. Maximum face area = 0.00133333.  Face area magnitudes OK.
    Min volume = 6.66667e-07. Max volume = 6.66667e-07.  Total volume = 0.01.  Cell volumes OK.
    Mesh non-orthogonality Max: 0 average: 0
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 3.75e-09 OK.
    Coupled point location match (average 0) OK.

Failed 1 mesh checks.

I have a tank that has the length of 2m, width (in and out of the paper) 0.025m and fluid depth of 0.1m. I have a mesh 50x100x3. So the number of cells is 15000. So cell length in the long direction is 2/50=0.04; length in the short direction is 0.025/3=0.00833. What it the aspect ratio in this case? I believe the aspect ratio may be one reason I get error such as prefpoint cannot be found. Any help will be greatly appreciated. Thanks as always.

wyldckat February 21, 2015 10:26

Greetings musahossein,

I've moved your post from here: http://www.cfd-online.com/Forums/ope...structpar.html - because that thread is not of the same topic you're asking about here.

As for aspect ratio: https://openfoamwiki.net/index.php/C...ut_explanation
Quote:

  • Aspect ratio
    Ratio between the longest and the shortest edges - 1.0 is the best.

Oh, OK, now I see why you ask. I've now updated the wiki page.

-----------
edit: I had quoted I had updated on the wiki, but it became larger for each iteration. Therefore, I've removed the quote.
-----------

Therefore, in your case would be:
Code:

2 x 0.2 x 0.025 (m) vs 50 x 100 x 3 (cells) =>
=> 2/50 x 0.2/100 x 0.025/3 = 0.04 x 0.002 x 0.008333

min face area = 0.001 x 0.008333 = 1.6666e-5
max face area = 0.04 x 0.002 = 8e-5

OK, looks like you're not completely aware of the real specifications of your mesh. You probably are not using a uniform mesh.

Anyway, the maximum cell aspect ratio in your case clearly seems to be:
(Maximum face area)/(Minimum face area) = 0.00133333/1e-06 = 1333.33

-------------
edit: Looks like I misinterpreted a detail... it was not the lengths that needs to be measured, it was the face areas of the bounding box of the cell. Therefore:
Code:

0.04 x 0.002 = 8e-5
0.002 x 0.008333 = 1.6666e-5
0.04 x 0.008333 =  0.00033332

(1/6) x (8e-5 + 1.6666e-5 + 0.00033332) / (6.6664e-7^(2/3)) = 0.939093

Nope, it still doesn't add up.

-------------

Best regards,
Bruno

musahossein February 21, 2015 11:05

How is aspect ratio computed?
 
Quote:

Originally Posted by wyldckat (Post 532775)
Greetings musahossein,

I've moved your post from here: http://www.cfd-online.com/Forums/ope...structpar.html - because that thread is not of the same topic you're asking about here.

As for aspect ratio: https://openfoamwiki.net/index.php/C...ut_explanation
Oh, OK, now I see why you ask. I've now updated the wiki page and it now reads this:
Therefore, in your case would be:
Code:

2 x 0.2 x 0.025 (m) vs 50 x 100 x 3 (cells) =>
=> 2/50 x 0.2/100 x 0.025/3 = 0.04 x 0.002 x 0.008333

min face area = 0.001 x 0.008333 = 1.6666e-5
max face area = 0.04 x 0.002 = 8e-5

OK, looks like you're not completely aware of the real specifications of your mesh. You probably are not using a uniform mesh.

Anyway, the maximum cell aspect ratio in your case clearly seems to be:
(Maximum face area)/(Minimum face area) = 0.00133333/1e-06 = 1333.33

Best regards,
Bruno

I am not sure where the 0.2 comes from. Are you assuming that to be the height of the box (i.e. double the depth of fluid)?. Also, the minimum face area that you compute is 1.6666e-5. But shouldnt it be 8.3333e-6? In that case the ratio will be 0.00008/0.00000833=4.81? Please correct me if I am wrong.

wyldckat February 21, 2015 11:12

Quote:

Originally Posted by musahossein (Post 532782)
I am not sure where the 0.2 comes from.

Comes from here:
Quote:

Originally Posted by musahossein (Post 532734)
Code:

    Overall domain bounding box (-1 -0.0125 -0.1) (1 0.0125 0.1)

Quote:

Originally Posted by musahossein (Post 532782)
Please correct me if I am wrong.

I can only guess you're using blockMesh to create this mesh!? If this is the case, then please provide at least the part that defines the vertexes and the blocks, from "blockMeshDict".

musahossein February 21, 2015 14:55

How is aspect ratio computed?
 
Quote:

Originally Posted by wyldckat (Post 532783)
Comes from here:



I can only guess you're using blockMesh to create this mesh!? If this is the case, then please provide at least the part that defines the vertexes and the blocks, from "blockMeshDict".

Ok. I think I finally fixed it. Here is the blockmesh file:

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}

convertToMeters 1;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

  (-1.00  -0.10 -0.0125) // Vertex back lower left corner = 0
 ( 1.00  -0.10 -0.0125) // Vertex back lower right corner= 1
 ( 1.00  0.10 -0.0125) // Vertex back upper right corner= 2
 (-1.00  0.10 -0.0125) // Vertex back upper left corner = 3

 (-1.00  -0.10  0.0125) // Vertex front lower left corner = 4
 ( 1.00  -0.10  0.0125) // Vertex front lower right corner= 5
 ( 1.00    0.10  0.0125) // Vertex front upper right corner= 6
 (-1.00    0.10  0.0125) // Vertex front upper left corner = 7

);

blocks
(
    // block0
    hex (0 1 2 3 4 5 6 7)
        (50 50 5)

    simpleGrading (1 1 1)
);

//patches
boundary
(
    lowerWall
    {
          type patch;
          faces
        (
        (0 1 5 4)
        );
    }
   
    rightWall
    {
          type patch;
          faces
        (
    (1 2 6 5)
        );
    }

    atmosphere
    {
        type patch;
          faces
        (
    (2 3 7 6)
        );
    }
   
    leftWall
    {
          type patch;
          faces
        (
    (0 4 7 3)
        );
    }

  frontAndBack
  {
      type patch;
        faces
        (
        (4 5 6 7)
    (0 3 2 1)
    );
  }
   
);

The checkMesh also gives the correct results (granted that the mesh is very course, but it gives a good basis):

Code:

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

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:          15606
    faces:            40500
    internal faces:  34500
    cells:            12500
    faces per cell:  6
    boundary patches: 5
    point zones:      0
    face zones:      0
    cell zones:      0

Overall number of cells of each type:
    hexahedra:    12500
    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                 
    lowerWall          250      306      ok (non-closed singly connected) 
    rightWall          250      306      ok (non-closed singly connected) 
    atmosphere          250      306      ok (non-closed singly connected) 
    leftWall            250      306      ok (non-closed singly connected) 
    frontAndBack        5000    5202    ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (-1 -0.1 -0.0125) (1 0.1 0.0125)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-7.96769e-19 -1.78715e-18 2.57945e-17) OK.
    Max cell openness = 8.47033e-17 OK.
    Max aspect ratio = 10 OK.
    Minimum face area = 2e-05. Maximum face area = 0.0002.  Face area magnitudes OK.
    Min volume = 8e-07. Max volume = 8e-07.  Total volume = 0.01.  Cell volumes OK.
    Mesh non-orthogonality Max: 0 average: 0
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 3.125e-09 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

Does this make sense? If you have any suggestions, I look forward to them, Thanks again.

musahossein February 21, 2015 15:14

the pesky PrefPoint Problem
 
I fixed the mesh, and checked it in paraFoam, Also performed a checkMesh and it looks everything is ok. However when I do a parallel run, I get the following error right after domain decomposition saying that the pRefPoint 0,0,0.0124 was found on 2 domains. How can I ensure that the prefpoint is in one domain only? My decomposition in parallel is 3x2x1 (3 processors in the x direction, 2 processors in the y direction and 1 processor in the z direction). The axes are in carteseian coordinates with the x-y plane parallel to the paper and z axis normal to it.

Commence parallel processing
Code:

[0] [1]
[1]
[1] --> FOAM FATAL IO ERROR:
[1] Unable to set reference cell for field p
    Reference point pRefPoint (0 0 0.0124) found on 2 domains (should be one)
[2]
[2]
[2] --> FOAM FATAL IO ERROR:
[2] Unable to set reference cell for field p
    Reference point pRefPoint (0 0 0.0124) found on 2 domains (should be one)
[2]
[2]
[2] file: IOstream.PIMPLE from line [3]
[3]
[3] --> FOAM FATAL IO ERROR:
[3] Unable to set reference cell for field p
    Reference point pRefPoint (0 0 0.0124) found on 2 domains (should be one)
[3]
[3]
[3] file: [4]
[4]
[4] --> FOAM FATAL IO ERROR:
[4] Unable to set reference cell for field p
    Reference point pRefPoint (0 0 0.0124) found on 2 domains (should be one)
[4]
[4]
[4] file: IOstream.PIMPLE from line 0 to line 0.
[4] [5]
[5]
[5] --> FOAM FATAL IO ERROR:
[5] Unable to set reference cell for field p
    Reference point pRefPoint (0 0 0.0124) found on 2 domains (should be one)
[5]
[5]
[5] file: IOstream.PIMPLE from line 0 to line 0.
[5]
[5]    From function [1]
[1]
[1] file: IOstream.PIMPLE from line 0 to line 0.
[1]
[1]    From function void Foam::setRefCell
(
    const volScalarField&,
    const volScalarField&,
    const dictionary&,
    label& scalar&,
    bool
)
[1]    in file cfdTools/general/findRefCell/findRefCell.C at line 105.
[1]
FOAM parallel run exiting
[1]
0 to line 0.


wyldckat February 22, 2015 08:39

Greetings musahossein,

Quote:

Originally Posted by musahossein (Post 532800)
Does this make sense?

Not to me, because:
  1. The "blockMeshDict" you provided is broken, since it's missing the beginning of the vertexes block.
  2. It's no longer the very first problem you reported.

Quote:

Originally Posted by musahossein (Post 532800)
If you have any suggestions, I look forward to them, Thanks again.

All I can think of is that you're not being careful enough with all of the details when using OpenFOAM. And that can eventually lead you into problems that no one will be able to help you.

Quote:

Originally Posted by musahossein (Post 532801)
However when I do a parallel run, I get the following error right after domain decomposition saying that the pRefPoint 0,0,0.0124 was found on 2 domains. How can I ensure that the prefpoint is in one domain only?

See the (new) FAQ entry "Post-processing sub-domains (parallel/decomposed cases) in ParaView": http://openfoamwiki.net/index.php/FA...29_in_ParaView

Good luck! Best regards,
Bruno

musahossein February 22, 2015 09:13

Quote:

Originally Posted by wyldckat (Post 532862)
Greetings musahossein,


Not to me, because:
  1. The "blockMeshDict" you provided is broken, since it's missing the beginning of the vertexes block.
  2. It's no longer the very first problem you reported.


All I can think of is that you're not being careful enough with all of the details when using OpenFOAM. And that can eventually lead you into problems that no one will be able to help you.


See the (new) FAQ entry "Post-processing sub-domains (parallel/decomposed cases) in ParaView": http://openfoamwiki.net/index.php/FA...29_in_ParaView

Good luck! Best regards,
Bruno

wyldckat: here is the blockMesh that I have modified. I am not sure what you meant by "begining of the vertexes block". Please let me know what you mean.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.0.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}

convertToMeters 1;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// x is parallel to paper; y is vert up, z is in and out of paper

 (-0.250 -0.60 -0.25) // Vertex back lower left corner = 0
 ( 0.250 -0.60 -0.25) // Vertex back lower right corner= 1
 ( 0.250  0.30 -0.25) // Vertex back upper right corner= 2
 (-0.250  0.30 -0.25) // Vertex back upper left corner = 3

 ( -0.250 -0.60 0.25) // Vertex front lower left corner = 4
 (  0.250 -0.60 0.25) // Vertex front lower right corner= 5
 (  0.250  0.30 0.25) // Vertex front upper right corner= 6
 ( -0.250  0.30 0.25) // Vertex front upper left corner = 7

);

blocks
(
    // block0
    hex (0 1 2 3 4 5 6 7)
    (50 50 2)
    simpleGrading (1 1 1)
);

//patches
boundary
(
    lowerWall
    {
          type patch;
          faces
        (
        (0 1 5 4)
        );
    }
   
    rightWall
    {
          type patch;
          faces
        (
    (1 2 6 5)
        );
    }

    atmosphere
    {
        type patch;
          faces
        (
    (2 3 7 6)
        );
    }
   
    leftWall
    {
          type patch;
          faces
        (
    (0 4 7 3)
        );
    }

  frontAndBack
  {
      type patch;
        faces
        (
        (4 5 6 7)
    (0 3 2 1)
    );
  }
   
);

// ************************************************************************* //

Is this, in your opinion a complete description or am I missing something? Please let me know.

musahossein February 22, 2015 10:36

prepoint error
 
I noted that the prefpoint error comes up, when the OpenFOAM has crashed as the numerical analysis has gotten haywire. In my case, I have coupled a structural code with OpenFOAM. The structural code calculates a displacement which is then processed by OpenFoam and provides wall pressures for the tank. This pressure / force is then sent back to the structural code for computing dispalcements. This is done at every time step. I noted that when the acceleration starts to get very large, OpenFOAM crashes and issues the prefPoint error as the last gasp. So I dont think that the prefpoint error is really an error, but a consequence of a numerical meltdown due to very large accelerations. But I would still like to hear your comments on the latest blockMeshDict file that sent you. I am checking the mesh and the aspect ratio as well as checking the mesh in ParaFOAM to ensure that what I see is what I intended.

I look forward to your comment. Thanks again.

wyldckat February 22, 2015 11:51

Please follow the instructions given here: Posting code and output with [CODE]

As for the problem, here's an excerpt of what you posted:
Quote:

Code:

convertToMeters 1;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// x is parallel to paper; y is vert up, z is in and out of paper

 (-0.250 -0.60 -0.25) // Vertex back lower left corner = 0


For comparison, here's the same location for the file "blockMeshDict" from the tutorial "incompressible/icoFoam/cavity":
Code:

convertToMeters 0.1;

vertices
(
    (0 0 0)

Notice anything missing in your file?

As for "vertexes": http://en.wikipedia.org/wiki/Vertex

musahossein February 22, 2015 12:13

Quote:

Originally Posted by wyldckat (Post 532883)
Please follow the instructions given here: Posting code and output with [CODE]

As for the problem, here's an excerpt of what you posted:
For comparison, here's the same location for the file "blockMeshDict" from the tutorial "incompressible/icoFoam/cavity":
Code:

convertToMeters 0.1;

vertices
(
    (0 0 0)

Notice anything missing in your file?

As for "vertexes": http://en.wikipedia.org/wiki/Vertex

Oh No. Ok now I am really going to beat myself with a stick! cant believe I missed it.


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