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/)
-   -   [snappyHexMesh] snappyHexMesh: problems with layers (https://www.cfd-online.com/Forums/openfoam-meshing/102942-snappyhexmesh-problems-layers.html)

giulio.topazio June 6, 2012 15:21

snappyHexMesh: problems with layers
 
Hi Foamers.
I'm a beginner of OpenFoam.I'm trying to simulate an internal airflow of an airbox in a racing car. I exported the geometry in .stl ad i'm trying to mesh with snappyHexMesh.At present i'm in trouble because i can't understand why snappy doesn't add layers!
Any suggestion is really appreciated
Here the snappyHexMeshDict
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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// non ho capito perchè ma pare che questi tre siano sempre true.
castellatedMesh true;
snap            true;
addLayers      true;


geometry  // devo dichiarare tutte le geometria che userò
{
    sistema_aspirazione.stl 
    {
        type triSurfaceMesh;
        name sistema_aspirazione;
    }

    Box  // regione di delimitazione
    {
        type searchableBox;  // ?? searchableBox ?? cos'è?e che significano quei numeri?
        min (-500.0 -500.0 -500.0);  // forse sono i 2 punti opposti che ci definiscono il box??
        max ( 500.0  500.0 500.0);  // definire qst cubo vuol dire forse fare a meno della mesh di
                              // background definita in blockMeshDict
    }
    Box_restrictor  // regione di delimitazione
    {
        type searchableBox; 
        min (-280.0 290.0 -20.0); 
        max ( -87.0  400.0 20.0); 
    }
    Box_plenum // regione di delimitazione
    {
        type searchableBox; 
        min (-141.0 -106.0 -185.0); 
        max ( 86.0  -3.0 185.0); 
    }
};



castellatedMeshControls
{

 
    maxLocalCells 100000;  // maxLocalCells deve essere < maxGlobalCells
                          // maxLocalCells è il max num di celle per
                          // processore durante il "raffinamento" della mesh


    maxGlobalCells 2000000;  // maxGlobalCells è il limite(approssimato) oltre
                            // il quale il raffinamento della mesh si ferma.
                            // N.B. questo numero comprende tutte le celle
                            // prima dell'eliminazione.


    minRefinementCells 10;  // se minRefinementCells >= numero di celle da affinare
                            // questo parametro stoppa il processo.


    maxLoadUnbalance 0.10;  // ?????



    nCellsBetweenLevels 1;  // numero di strati tra 2 diversi livelli


    // Dovrei riuscire a estrarre le features da .stl in una file featureEdgeMesh
    // utilizzando il comando:
    // surfaceFeatureExtract -includedAngle 150 sistema_aspirazione.stl features
    // Non riesco perchè mi da il seguente errore:
    // Feature line extraction is only valid on closed manifold surfaces.
    // Surface            : "sistema_aspirazione.stl"
    // Output feature set : "features"
    // Al momento pare che lo legga direttamente da constant/triSurface
    features
    (
        //{
        //    file "sistema_aspirazione.eMesh";
        //    level 2;
        //}
    );




    // Per ogni superficie bisogna stabilire 2 livelli: un minimo ed un massimo.
    // Ogni cella che interseca una superficie viene affinata con il livello minimo.
    // Ogni cella che invece "vede" un intersezione il cui angolo è>resolveFeatureAngle
    // viene affinata con il livello massimo. resolveFeatureAngle definisce un valore
    // in gradi dell'angolo limite.

    refinementSurfaces
    {
        sistema_aspirazione
        {
         
            level (4 5);
        }
    }

    resolveFeatureAngle 30;


    // Le celle che giacciono entro uno specificato volume possono essere
    // ulteriormente affinate con una delle seguenti modalità:
    // -inside: affina le celle interne al volume;
    // -outside: affina le celle esterne al volume;
    // -distance: affina le celle le celle ad una certa distanza dalla superficie.
    // La modalità deve essere inserita col seguente formato:
    // levels (<distanza> <livello>). Nel caso in cui si opti per inside(o outside)
    // va comunque inserita l'entrata <distanza> anche se verrà ignorata.
    refinementRegions
    {
      /*  Box
        {
            mode inside;
            levels ((1.0 5));  // la prima entrata (1.0) verrà ignorata
        }
        Box_restrictor  // vorrei infittire la mesh sul restrictor
        {
            mode inside;
            levels ((1.0 6));  // la prima entrata (1.0) verrà ignorata
        } */
        sistema_aspirazione
        {
            mode distance;
            levels ((1.0 6) (4.0 5) (8.0 3)); 
        }
    }


    // Il vettore locationInMesh ci identifica un punto interno alla regione
    // (delimitata da una superficie chiusa) da meshare.
    // N.B. Questo vettore deve puntare all'interno di una cella e mai su
    // una faccia.
    locationInMesh (50.11 -20.11 0.11);

    // NON HO CAPITO DI CHE STIAMO A PARLÀ QUI!!!
    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces true;
}


    // In questa parte si definiscono i parametri per eliminare le
    // frastagliature della mesh.
snapControls
{

    nSmoothPatch 3;  // numero di iterazioni della levigatura prima di trovare
                    // corrispondenza tra le superfici

    tolerance 4.0;  //rapporto tra la distanza a cui i putni vengono annessi
                    // alla superficie e la lunghezza max del bordo(localmente)

   
    nSolveIter 0;  // numero di iterazioni di mitigazione dello spostamento
                  // della mesh


    nRelaxIter 5;  // numero max di iterazione di rilassamento della superficie

}



  // A questo punto la mesh può ulteriormente essere migliorata introducendo
  // degli strati di celle allineati con la superficie di confine.
addLayersControls
{

    // I parametri di spessore sottostanti sono relativi alle celle indeformate(true)
    // o sono in valore assoluto(false)?
    relativeSizes true;

    // devo definire i layers che voglio introdurre

      layers
    {
        sistema_aspirazione_OBJ
        {
            nSurfaceLayers 5;
        }
    }


    expansionRatio 1.1;  // fattore di espansione per i layers

    finalLayerThickness 1e-3;  // spessore delle celle del layer
                              // N.B. fa attenzione al parametro relativeSizes
                              // per vedere se le misure sono assolute o relative

    minThickness 1e-4;  // spessore minimo delle celle del layer
                      // N.B. fa attenzione al parametro relativeSizes
                      // per vedere se le misure sono assolute o relative


    nGrow 10;  // non ho capito cos è ma dicono che aiuti a convergere il processo
              // di aggiunta dei layers


    featureAngle 60;  // angolo oltre il quale non vengono estruse le superfici


    nRelaxIter 3;  // numero max di iterazioni di rilassamento
                  // N.B. può anche fermarsi prima se la mesh è ok

    nSmoothSurfaceNormals 3;  // numero di iterazioni di levigatura delle normali
                              // alle superfici
 
    nSmoothNormals 3;  // numero di iterazioni di levigatura delle direzioni
                      // di cosa???

    nSmoothThickness 10; // ????

    maxFaceThicknessRatio 0.5;  // blocca la crescita sulla cella più deformata

    maxThicknessToMedialRatio 0.3;  // riduce la crescita dei layer qnd qst parametro è grande

    minMedianAxisAngle 90;  // ???

    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 non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 65;

    //- Max skewness allowed. Set to <0 to disable.
    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    //- 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;

    //- 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 1e-13;

    //- Minimum quality of the tet formed by the face-centre
    //  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 1e-30;

    //- 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.02;

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

    //- minFaceWeight (0 -> 0.5)
    minFaceWeight 0.02;

    //- 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 1e-6;


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


lovecraft22 June 6, 2012 19:25

Why do you have sistema_aspirazione_OBJ instead of sistema_aspirazione for the layers?

giulio.topazio June 7, 2012 05:16

Because i called my .stl solid OBJ!
I try to explain better: i saw on others snappyHexMeshDict that usually the user defines the patch of .stl surface adding OBJECT(no matter if i write OBJECT or OBJ or PIPPO..it's just a "name") in the first line in the .stl file next to "solid".
I emphasize: i'm a beginner! :P
Is that wrong?
p.s. at the moment i'm not in my place.This evening i'll try and i'll let you know if changing what you have suggested works!
Thanks a lot
Giulio

lovecraft22 June 7, 2012 05:44

You haven't defined that name anywhere…

What you have is the following:

Code:

sistema_aspirazione.stl 
    {
        type triSurfaceMesh;
        name sistema_aspirazione;
    }

Meaning your geometry's patch name being "sistema_aspirazione" and not "sistema_aspirazione_OBJ"

So for the layers to be added on your patch you need:

Code:

layers
    {
        sistema_aspirazione
        {
            nSurfaceLayers 5;
        }
    }

What you mention about editing the stl file directly and adding something next to solid is different from what you need: that's used to have different regions (with different names) in a .stl file. Those regions can be recognized by snappy but that's something different from what your aiming at here.

giulio.topazio June 8, 2012 11:04

Ok.Thank you!The problem still exists but you open my mind! :D
I realize that snappy recognizes just a patch named "sistema_aspirazione_solid"! So i changed the name of my patch but the addition of the layers is still a failure.While on the terminal i read that the layers have been added, by paraFoam i see that have not been added.
Any ideas?
I've got another question: I want the mesh face is getting thicker as you get closer to the surface.
Is that right?
Quote:

sistema_aspirazione
{
mode distance;
levels ((1.0 6) (4.0 5) (8.0 3));
}
Thanks a lot for your help.
Giulio

lovecraft22 June 8, 2012 11:16

Yes, that should do the job.

About the layers, I think some of your settings are wrong, such as this one:

Code:

finalLayerThickness 1e-3;
Meaning you have the furthest layers from the wall being 0.001 times the height of the nearest non-layer cell… that's probably too small so, since you also set a layer expansions, you may end up with 0 thickness layers.

Also, have a look for the word "layer" in your sHM log as I think it may have not done the layers at all.

I would suggest you to try these settings here that worked for some of my cases. If you want to change something, do that with one parameter at a time to see the effects of each and also remember to clean the case before running snappy again.

Quote:

addLayersControls
{
relativeSizes true;

layers
{
sistema_aspirazione_patch0
{
nSurfaceLayers 3;
}
}

expansionRatio 1.2;

finalLayerThickness 0.3;

minThickness 0.1;

nGrow 0;

featureAngle 30;

nRelaxIter 3;

nSmoothSurfaceNormals 1;

nSmoothNormals 3;

nSmoothThickness 10;

maxFaceThicknessRatio 0.5;

maxThicknessToMedialRatio 0.3;

minMedianAxisAngle 90;

nBufferCellsNoExtrude 0;

nLayerIter 50;
}
(note, I added patch0 at the end of sistema_aspirazione as you may need that).

giulio.topazio June 9, 2012 04:43

3 Attachment(s)
Thank you so much lovecraft22! Now i can actually see that the layers have been added.But i still have others duobts.
This
Quote:

relativeSizes true;
means that we refer all the size below to the undeformated cells.How can i know the real absolute size of the undeformated cells?That is: if i want the nearest layer surface thickness to be of 1 mm, how can i manage?
I see that the mesh is very irregular and the surface presents different refinement zones.What's going wrong in the code?
The layers addition involves just the 99.3% of the surface, not 100%, and this is not good because i've critical zones where there's no layers!(e.g. throat section of the restrictor).
In addition the layers seem to have different dimensions.How is it possible?
Below the code:
Code:

addLayersControls
{

    // I parametri di spessore sottostanti sono relativi alle celle indeformate(true)
    // o sono in valore assoluto(false)?
    relativeSizes true;

    // devo definire i layers che voglio introdurre

      layers
    {
        sistema_aspirazione_solid
        {
            nSurfaceLayers 8;
        }
    }


    expansionRatio 1.2;  // fattore di espansione per i layers

    finalLayerThickness 0.3;  // spessore delle celle finali del layer rispetto alle iniziali
                              // N.B. fa attenzione al parametro relativeSizes
                              // per vedere se le misure sono assolute o relative

    minThickness 0.1;  // spessore minimo delle celle del layer
                      // N.B. fa attenzione al parametro relativeSizes
                      // per vedere se le misure sono assolute o relative


    nGrow 0;  // non ho capito cos è ma dicono che aiuti a convergere il processo
              // di aggiunta dei layers ... MI DICE:  POCO DOPO AVER SCRITTO LA MESH PER t=0.01
              // --> FOAM Warning :
              // From function layerParameters::layerParameters(..)
              // in file autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C at line 297
              // The nGrow parameter effect has changed with respect to 1.6.x.
              // Please set nGrow=0 for 1.6.x behaviour.



    featureAngle 30;  // angolo oltre il quale non vengono estruse le superfici


    nRelaxIter 3;  // numero max di iterazioni di rilassamento
                  // N.B. può anche fermarsi prima se la mesh è ok

    nSmoothSurfaceNormals 1;  // numero di iterazioni di levigatura delle normali
                              // alle superfici
 
    nSmoothNormals 3;  // numero di iterazioni di levigatura delle direzioni
                      // di cosa???

    nSmoothThickness 10; // ????

    maxFaceThicknessRatio 0.5;  // blocca la crescita sulla cella più deformata

    maxThicknessToMedialRatio 0.3;  // riduce la crescita dei layer qnd qst parametro è grande

    minMedianAxisAngle 90;  // ???

    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;
}


lovecraft22 June 9, 2012 05:45

I think you should probably try and increase your mesh resolution to see if you can get the layers everywhere.

giulio.topazio June 9, 2012 06:39

Quote:

I think you should probably try and increase your mesh resolution to see if you can get the layers everywhere.
Do you mean the level of surface refinement or the level of the mesh?
Anyway i'll try and i let you know.
Again thanks for your invaluable help

lovecraft22 June 9, 2012 06:42

This:

Code:

sistema_aspirazione
        {
         
            level (4 5);
        }

I'd bring it to level (5 6)

giulio.topazio June 9, 2012 08:12

Now i'm setting up finer levels
Code:

    refinementSurfaces
    {
        sistema_aspirazione
        {
         
            level (10 13);
        }
    }

but there is no improvement! (is there upper limits for levels?)i'm(quite)sure that the .stl is all right because i checked with ADMesh
What about this?
Quote:

How can i know the real absolute size of the undeformated cells?That is: if i want the nearest layer surface thickness to be of 1 mm, how can i manage?


Here the latest code.
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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// non ho capito perchè ma pare che questi tre siano sempre true.
castellatedMesh true;
snap            true;
addLayers      true;


geometry  // devo dichiarare tutte le geometria che userò
{
    sistema_aspirazione.stl 
    {
        type triSurfaceMesh;
        name sistema_aspirazione;
    }

    Box  // regione di delimitazione
    {
        type searchableBox;  // ?? searchableBox ?? cos'è?e che significano quei numeri?
        min (-500.0 -500.0 -500.0);  // forse sono i 2 punti opposti che ci definiscono il box??
        max ( 500.0  500.0 500.0);  // definire qst cubo vuol dire forse fare a meno della mesh di
                              // background definita in blockMeshDict
    }
    Box_restrictor  // regione di delimitazione
    {
        type searchableBox; 
        min (-280.0 290.0 -20.0); 
        max ( -87.0  400.0 20.0); 
    }
    Box_plenum // regione di delimitazione
    {
        type searchableBox; 
        min (-141.0 -106.0 -185.0); 
        max ( 86.0  -3.0 185.0); 
    }
};



castellatedMeshControls
{

 
    maxLocalCells 100000;  // maxLocalCells deve essere < maxGlobalCells
                          // maxLocalCells è il max num di celle per
                          // processore durante il "raffinamento" della mesh


    maxGlobalCells 2000000;  // maxGlobalCells è il limite(approssimato) oltre
                            // il quale il raffinamento della mesh si ferma.
                            // N.B. questo numero comprende tutte le celle
                            // prima dell'eliminazione.


    minRefinementCells 10;  // se minRefinementCells >= numero di celle da affinare
                            // questo parametro stoppa il processo.


    maxLoadUnbalance 0.10;  // ?????



    nCellsBetweenLevels 1;  // numero di strati tra 2 diversi livelli


    // Dovrei riuscire a estrarre le features da .stl in una file featureEdgeMesh
    // utilizzando il comando:
    // surfaceFeatureExtract -includedAngle 150 sistema_aspirazione.stl features
    // Non riesco perchè mi da il seguente errore:
    // Feature line extraction is only valid on closed manifold surfaces.
    // Surface            : "sistema_aspirazione.stl"
    // Output feature set : "features"
    // Al momento pare che lo legga direttamente da constant/triSurface
    features
    (
        //{
        //    file "sistema_aspirazione.eMesh";
        //    level 2;
        //}
    );




    // Per ogni superficie bisogna stabilire 2 livelli: un minimo ed un massimo.
    // Ogni cella che interseca una superficie viene affinata con il livello minimo.
    // Ogni cella che invece "vede" un intersezione il cui angolo è>resolveFeatureAngle
    // viene affinata con il livello massimo. resolveFeatureAngle definisce un valore
    // in gradi dell'angolo limite.

    refinementSurfaces
    {
        sistema_aspirazione
        {
         
            level (10 13);
        }
    }

    resolveFeatureAngle 30;


    // Le celle che giacciono entro uno specificato volume possono essere
    // ulteriormente affinate con una delle seguenti modalità:
    // -inside: affina le celle interne al volume;
    // -outside: affina le celle esterne al volume;
    // -distance: affina le celle le celle ad una certa distanza dalla superficie.
    // La modalità deve essere inserita col seguente formato:
    // levels (<distanza> <livello>). Nel caso in cui si opti per inside(o outside)
    // va comunque inserita l'entrata <distanza> anche se verrà ignorata.
    refinementRegions
    {
        Box
        {
            mode inside;
            levels ((1.0 11));  // la prima entrata (1.0) verrà ignorata
        } 
        Box_restrictor  // vorrei infittire la mesh sul restrictor
        {
            mode inside;
            levels ((1.0 12));  // la prima entrata (1.0) verrà ignorata
        }
      /* sistema_aspirazione
        {
            mode distance;
            levels ((8.0 7) (10.0 5)); 
          } */
    }


    // Il vettore locationInMesh ci identifica un punto interno alla regione
    // (delimitata da una superficie chiusa) da meshare.
    // N.B. Questo vettore deve puntare all'interno di una cella e mai su
    // una faccia.
    locationInMesh (50.11 -20.11 0.11);

    // NON HO CAPITO DI CHE STIAMO A PARLÀ QUI!!!
    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces true;
}


    // In questa parte si definiscono i parametri per eliminare le
    // frastagliature della mesh.
snapControls
{

    nSmoothPatch 3;  // numero di iterazioni della levigatura prima di trovare
                    // corrispondenza tra le superfici

    tolerance 4.0;  //rapporto tra la distanza a cui i punti vengono annessi
                    // alla superficie e la lunghezza max del bordo(localmente)

   
    nSolveIter 0;  // numero di iterazioni di mitigazione dello spostamento
                  // della mesh


    nRelaxIter 5;  // numero max di iterazione di rilassamento della superficie

}



  // A questo punto la mesh può ulteriormente essere migliorata introducendo
  // degli strati di celle allineati con la superficie di confine.
addLayersControls
{

    // I parametri di spessore sottostanti sono relativi alle celle indeformate(true)
    // o sono in valore assoluto(false)?
    relativeSizes true;

    // devo definire i layers che voglio introdurre

      layers
    {
        sistema_aspirazione_solid
        {
            nSurfaceLayers 8;
        }
    }


    expansionRatio 1.2;  // fattore di espansione per i layers

    finalLayerThickness 0.3;  // spessore delle celle finali del layer rispetto alle iniziali
                              // N.B. fa attenzione al parametro relativeSizes
                              // per vedere se le misure sono assolute o relative

    minThickness 0.1;  // spessore minimo delle celle del layer
                      // N.B. fa attenzione al parametro relativeSizes
                      // per vedere se le misure sono assolute o relative


    nGrow 0;  // non ho capito cos è ma dicono che aiuti a convergere il processo
              // di aggiunta dei layers ... MI DICE:  POCO DOPO AVER SCRITTO LA MESH PER t=0.01
              // --> FOAM Warning :
              // From function layerParameters::layerParameters(..)
              // in file autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C at line 297
              // The nGrow parameter effect has changed with respect to 1.6.x.
              // Please set nGrow=0 for 1.6.x behaviour.



    featureAngle 30;  // angolo oltre il quale non vengono estruse le superfici


    nRelaxIter 3;  // numero max di iterazioni di rilassamento
                  // N.B. può anche fermarsi prima se la mesh è ok

    nSmoothSurfaceNormals 1;  // numero di iterazioni di levigatura delle normali
                              // alle superfici
 
    nSmoothNormals 3;  // numero di iterazioni di levigatura delle direzioni
                      // di cosa???

    nSmoothThickness 10; // ????

    maxFaceThicknessRatio 0.5;  // blocca la crescita sulla cella più deformata

    maxThicknessToMedialRatio 0.3;  // riduce la crescita dei layer qnd qst parametro è grande

    minMedianAxisAngle 90;  // ???

    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 non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 65;

    //- Max skewness allowed. Set to <0 to disable.
    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    //- 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;

    //- 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 1e-13;

    //- Minimum quality of the tet formed by the face-centre
    //  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 1e-30;

    //- 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.02;

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

    //- minFaceWeight (0 -> 0.5)
    minFaceWeight 0.02;

    //- 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 1e-6;


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


giulio.topazio June 9, 2012 09:07

Now i'm setting up finer levels
Code:

    refinementSurfaces
    {
        sistema_aspirazione
        {
         
            level (10 13);
        }
    }

but there is no improvement! (is there upper limits for levels?)i'm(quite)sure that the .stl is all right because i checked with ADMesh
What about this?
Quote:

How can i know the real absolute size of the undeformated cells?That is: if i want the nearest layer surface thickness to be of 1 mm, how can i manage?


Here the latest code.
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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// non ho capito perchè ma pare che questi tre siano sempre true.
castellatedMesh true;
snap            true;
addLayers      true;


geometry  // devo dichiarare tutte le geometria che userò
{
    sistema_aspirazione.stl 
    {
        type triSurfaceMesh;
        name sistema_aspirazione;
    }

    Box  // regione di delimitazione
    {
        type searchableBox;  // ?? searchableBox ?? cos'è?e che significano quei numeri?
        min (-500.0 -500.0 -500.0);  // forse sono i 2 punti opposti che ci definiscono il box??
        max ( 500.0  500.0 500.0);  // definire qst cubo vuol dire forse fare a meno della mesh di
                              // background definita in blockMeshDict
    }
    Box_restrictor  // regione di delimitazione
    {
        type searchableBox; 
        min (-280.0 290.0 -20.0); 
        max ( -87.0  400.0 20.0); 
    }
    Box_plenum // regione di delimitazione
    {
        type searchableBox; 
        min (-141.0 -106.0 -185.0); 
        max ( 86.0  -3.0 185.0); 
    }
};



castellatedMeshControls
{

 
    maxLocalCells 100000;  // maxLocalCells deve essere < maxGlobalCells
                          // maxLocalCells è il max num di celle per
                          // processore durante il "raffinamento" della mesh


    maxGlobalCells 2000000;  // maxGlobalCells è il limite(approssimato) oltre
                            // il quale il raffinamento della mesh si ferma.
                            // N.B. questo numero comprende tutte le celle
                            // prima dell'eliminazione.


    minRefinementCells 10;  // se minRefinementCells >= numero di celle da affinare
                            // questo parametro stoppa il processo.


    maxLoadUnbalance 0.10;  // ?????



    nCellsBetweenLevels 1;  // numero di strati tra 2 diversi livelli


    // Dovrei riuscire a estrarre le features da .stl in una file featureEdgeMesh
    // utilizzando il comando:
    // surfaceFeatureExtract -includedAngle 150 sistema_aspirazione.stl features
    // Non riesco perchè mi da il seguente errore:
    // Feature line extraction is only valid on closed manifold surfaces.
    // Surface            : "sistema_aspirazione.stl"
    // Output feature set : "features"
    // Al momento pare che lo legga direttamente da constant/triSurface
    features
    (
        //{
        //    file "sistema_aspirazione.eMesh";
        //    level 2;
        //}
    );




    // Per ogni superficie bisogna stabilire 2 livelli: un minimo ed un massimo.
    // Ogni cella che interseca una superficie viene affinata con il livello minimo.
    // Ogni cella che invece "vede" un intersezione il cui angolo è>resolveFeatureAngle
    // viene affinata con il livello massimo. resolveFeatureAngle definisce un valore
    // in gradi dell'angolo limite.

    refinementSurfaces
    {
        sistema_aspirazione
        {
         
            level (10 13);
        }
    }

    resolveFeatureAngle 30;


    // Le celle che giacciono entro uno specificato volume possono essere
    // ulteriormente affinate con una delle seguenti modalità:
    // -inside: affina le celle interne al volume;
    // -outside: affina le celle esterne al volume;
    // -distance: affina le celle le celle ad una certa distanza dalla superficie.
    // La modalità deve essere inserita col seguente formato:
    // levels (<distanza> <livello>). Nel caso in cui si opti per inside(o outside)
    // va comunque inserita l'entrata <distanza> anche se verrà ignorata.
    refinementRegions
    {
        Box
        {
            mode inside;
            levels ((1.0 11));  // la prima entrata (1.0) verrà ignorata
        } 
        Box_restrictor  // vorrei infittire la mesh sul restrictor
        {
            mode inside;
            levels ((1.0 12));  // la prima entrata (1.0) verrà ignorata
        }
      /* sistema_aspirazione
        {
            mode distance;
            levels ((8.0 7) (10.0 5)); 
          } */
    }


    // Il vettore locationInMesh ci identifica un punto interno alla regione
    // (delimitata da una superficie chiusa) da meshare.
    // N.B. Questo vettore deve puntare all'interno di una cella e mai su
    // una faccia.
    locationInMesh (50.11 -20.11 0.11);

    // NON HO CAPITO DI CHE STIAMO A PARLÀ QUI!!!
    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces true;
}


    // In questa parte si definiscono i parametri per eliminare le
    // frastagliature della mesh.
snapControls
{

    nSmoothPatch 3;  // numero di iterazioni della levigatura prima di trovare
                    // corrispondenza tra le superfici

    tolerance 4.0;  //rapporto tra la distanza a cui i punti vengono annessi
                    // alla superficie e la lunghezza max del bordo(localmente)

   
    nSolveIter 0;  // numero di iterazioni di mitigazione dello spostamento
                  // della mesh


    nRelaxIter 5;  // numero max di iterazione di rilassamento della superficie

}



  // A questo punto la mesh può ulteriormente essere migliorata introducendo
  // degli strati di celle allineati con la superficie di confine.
addLayersControls
{

    // I parametri di spessore sottostanti sono relativi alle celle indeformate(true)
    // o sono in valore assoluto(false)?
    relativeSizes true;

    // devo definire i layers che voglio introdurre

      layers
    {
        sistema_aspirazione_solid
        {
            nSurfaceLayers 8;
        }
    }


    expansionRatio 1.2;  // fattore di espansione per i layers

    finalLayerThickness 0.3;  // spessore delle celle finali del layer rispetto alle iniziali
                              // N.B. fa attenzione al parametro relativeSizes
                              // per vedere se le misure sono assolute o relative

    minThickness 0.1;  // spessore minimo delle celle del layer
                      // N.B. fa attenzione al parametro relativeSizes
                      // per vedere se le misure sono assolute o relative


    nGrow 0;  // non ho capito cos è ma dicono che aiuti a convergere il processo
              // di aggiunta dei layers ... MI DICE:  POCO DOPO AVER SCRITTO LA MESH PER t=0.01
              // --> FOAM Warning :
              // From function layerParameters::layerParameters(..)
              // in file autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C at line 297
              // The nGrow parameter effect has changed with respect to 1.6.x.
              // Please set nGrow=0 for 1.6.x behaviour.



    featureAngle 30;  // angolo oltre il quale non vengono estruse le superfici


    nRelaxIter 3;  // numero max di iterazioni di rilassamento
                  // N.B. può anche fermarsi prima se la mesh è ok

    nSmoothSurfaceNormals 1;  // numero di iterazioni di levigatura delle normali
                              // alle superfici
 
    nSmoothNormals 3;  // numero di iterazioni di levigatura delle direzioni
                      // di cosa???

    nSmoothThickness 10; // ????

    maxFaceThicknessRatio 0.5;  // blocca la crescita sulla cella più deformata

    maxThicknessToMedialRatio 0.3;  // riduce la crescita dei layer qnd qst parametro è grande

    minMedianAxisAngle 90;  // ???

    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 non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 65;

    //- Max skewness allowed. Set to <0 to disable.
    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    //- 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;

    //- 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 1e-13;

    //- Minimum quality of the tet formed by the face-centre
    //  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 1e-30;

    //- 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.02;

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

    //- minFaceWeight (0 -> 0.5)
    minFaceWeight 0.02;

    //- 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 1e-6;


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

P.S. I noticed that the layers change sizes at zone of the surface with different refinement...do you think that the problem could be in the .stl?

lovecraft22 June 9, 2012 09:45

I dont' think the problem to be the stl. The layers always come out with some region where they are missing unfortunately…

giulio.topazio June 9, 2012 09:59

Quote:

Originally Posted by lovecraft22 (Post 365597)
I dont' think the problem to be the stl. The layers always come out with some region where they are missing unfortunately…

Isn't this a problem for the simulation?
What do you think about the quality of my mesh?Just an opinion..isn't too irregular(bulk,layers..)?
Thanks for your kindness
Giulio

lovecraft22 June 9, 2012 10:11

From the first image you posted I can see there's too much of a difference between two closed regions on the mesh of the external surface. From the other images there's also a bog different between the cells by the surface and the ones by the center line.

giulio.topazio June 9, 2012 13:56

lovecraft what about decomposeParDict?I've got an Intel Processor i5 3,0Ghz!How can i set my decomposeParDict?
Thank you
Giulio
P.S. i see the icon "send a message via Skype to lovecraft22"...can i contact you(I would not be annoying)?

lovecraft22 June 9, 2012 14:04

You need to chose a decomposition method along with a number of subdomains in your decomposeParDict, run blockMesh then decomposePar then snappyHexMesh (or whatever you need to run in parallel) using mpirun.

giulio.topazio June 10, 2012 04:26

I ask you some questions again:
Quote:

How can i know the real absolute size of the undeformated cells?That is: if i want the nearest layer surface thickness to be of 1 mm, how can i manage?
Then:how is possible that i can't get uniform dimensions of the surface's faces even if i set the same refiniment level(for both the maximum to the minimum)?
Code:

    refinementSurfaces
    {
        sistema_aspirazione
        {
         
            level (10 10);
        }
    }

Here my decomposeParDict.Please take a look.
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      decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

numberOfSubdomains 4;

method          simple;

simpleCoeffs
{
    n              ( 2 2 1 );
    delta          0.001;
}

hierarchicalCoeffs
{
    n              ( 1 1 1 );
    delta          0.001;
    order          xyz;
}

manualCoeffs
{
    dataFile        "";
}

distributed          no;

roots                ();


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

I'll never stop thanking :)

P.s. i realized that my .stl is composed of 13 parts!!!!I can't understand...
Code:



ADMesh version 0.95, Copyright (C) 1995, 1996 Anthony D. Martin
ADMesh comes with NO WARRANTY.  This is free software, and you are welcome to
redistribute it under certain conditions.  See the file COPYING for details.
Opening sistema_aspirazione.stl
Checking exact...
All facets connected.  No nearby check necessary.
No unconnected need to be removed.
No holes need to be filled.
Checking normal directions...
Checking normal values...
Calculating volume...
Verifying neighbors...

================= Results produced by ADMesh version 0.95 ================
Input file        : sistema_aspirazione.stl
File type          : ASCII STL file
Header            : solid
============== Size ==============
Min X = -277.976990, Max X =  87.710800
Min Y = -252.340500, Max Y =  406.810089
Min Z = -185.000000, Max Z =  185.000000
========= Facet Status ========== Original ============ Final ====
Number of facets                : 1159538              1159538
Facets with 1 disconnected edge  :    0                  0
Facets with 2 disconnected edges :    0                  0
Facets with 3 disconnected edges :    0                  0
Total disconnected facets        :    0                  0
=== Processing Statistics ===    ===== Other Statistics =====
Number of parts      :    13        Volume  :  2261425.500000
Degenerate facets    :    0
Edges fixed          :    0
Facets removed        :    0
Facets added          :    0
Facets reversed      :    0
Backwards edges      :    0
Normals fixed        :    0



All times are GMT -4. The time now is 16:11.