CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [cfMesh] CfMesh Mesh Refinements (https://www.cfd-online.com/Forums/openfoam-community-contributions/153592-cfmesh-mesh-refinements.html)

snowygrouch May 29, 2015 15:16

CfMesh Mesh Refinements
 
Hi,
In this case we`re talking car external aero. For which I`ve basically
copied the "asmoOctree" cf-mesh standard example and adapted it to my STL geometry.

(pics attached)

I made separate STLs, car_body, ground, walls, inlet, outlet etc etc
then joined into one STL file with cat command, and in ASCII format
renamed the patches inside the single large STL.

I cant see any obvious solutions to this in the official documentation - although
I suspect that #1 is something to do with this "fms" filetype. But its not very
clear to me how I get to that from the starting point of ASCII STLs.

My questions (in decending order of importance)

1) I do not want the side and upper walls etc to have mesh refinements.
How do I stop these patches getting refined ?

(pic from cfmesh example also attached showing it how I wish my mesh to appear)

https://drive.google.com/file/d/0B7a...ew?usp=sharing

2) In snappy I can easily make an additional box shaped refinement area (inside of the outer boundary STL box) behind the car to catch the wake eddies, Can this be done in CF-Mesh too ?

https://drive.google.com/file/d/0B7a...ew?usp=sharing

3) In snappy I make alot of use of distance refinements, so I can say how far away from my car I want each level of refinement to extend. Possible in Cf ?

My cfmesh config file:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | cfMesh: A library for mesh generation          |
|  \\    /  O peration    |                                                |
|  \\  /    A nd          | Author: Franjo Juretic                        |
|    \\/    M anipulation  | E-mail: franjo.juretic@c-fields.com            |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version  2.0;
    format    ascii;
    class    dictionary;
    location  "system";
    object    meshDict;
}

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

surfaceFile "car_all.stl";

maxCellSize 0.3; //0.2

boundaryCellSize 0.03;//0.025

minCellSize 0.015; //0.0125

localRefinement
{
    car_body
    {
        cellSize 0.006; //0.005
    }
    car_wheels
    {
        cellSize 0.005; //0.0025
    }
    car_tyres
    {
        cellSize 0.005; //0.025
    }
}
 
// ************************************************************************* //

Thanks for your help !

Regards

snowygrouch May 29, 2015 18:56

progress
 
I managed to sort out most of this - not sure I`m doing in a very good way - but I solved the first one by making the boundary cell density identical to the max cell size. I think maybe not ideal but works.

The 2nd issue actually was in the manual, I just didnt look properly.

However would still be very nice to find out how to NOT get the corners of the "wind-tunnel" to have angle corner refinements added....thats the current un-solved one now (see image below).

https://drive.google.com/file/d/0B7a...ew?usp=sharing


Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | cfMesh: A library for mesh generation          |
|  \\    /  O peration    |                                                |
|  \\  /    A nd          | Author: Franjo Juretic                        |
|    \\/    M anipulation  | E-mail: franjo.juretic@c-fields.com            |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version  2.0;
    format    ascii;
    class    dictionary;
    location  "system";
    object    meshDict;
}

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

surfaceFile "car.fms"; //"car_all.stl"

maxCellSize 0.3; //0.2

boundaryCellSize 0.3;//0.03  //make same as maxCellSize to get rid of walls being refined

minCellSize 0.015; //0.0125

localRefinement
{
    ground
    {
        cellSize 0.025; //0.005
    }
    car_body
    {
        cellSize 0.006; //0.005
    }
    car_wheels
    {
        cellSize 0.005; //0.0025
    }
    car_tyres
    {
        cellSize 0.005; //0.025
    }
}
// Next section added by Calum to refine zone behind the car -not tested yet

objectRefinements //copied from text in official manual
{
    wake_refine //zone behind car to capture wake
    {
    type                box; //shape of zone
    cellSize                0.15; //wake cell size
    centre                (3 0 1.0); // xyz centre of box
    lengthX                10.0;
    lengthY                3.5;
    lengthZ                2.0;       
    }
}

// Next section added by Calum to add in viscous layers

boundaryLayers  //coped from example "singleorifice"
{
//    nLayers 3; //viscous layers to add

//    thicknessRatio 1.2; //1.0 > 1.3

//    maxFirstLayerThickness 0.0015; //meters

    patchBoundaryLayers
    {
        "car_body"
        {
            nLayers          3;

            thicknessRatio    1.2;

            maxFirstLayerThickness 0.0015;

            allowDiscontinuity 0;
        }

            "car_wheels"
        {
            nLayers          3;

            thicknessRatio    1.2;

            maxFirstLayerThickness 0.0015;

            allowDiscontinuity 0;
        }

            "car_tyres"
        {
            nLayers          3;

            thicknessRatio    1.2;

            maxFirstLayerThickness 0.0015;

            allowDiscontinuity 0;
        }
    }
}

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


franjo_j June 1, 2015 08:03

Hello,

cfMesh requires only two entries in meshDict, and these are surfaceFile, and maxCellSize. All other settings are optional. Therefore, you do not need boundaryCellSize entry if you do not need to refine the mesh at the boundary.
Refinement zones near corners and edges of the bounding box very likely come from the automatic refinement procedure activated by the minCellSize setting.
It is possible to use primitives i.e. (box, sphere, cone, line) as refinement sources. The syntax is documented in the manual.
Distance refinement is available, and is activated by specifying refinementThickness. Examples are provided in the manual. It is not parallelised in the version 1.0.1, and can be slow when the thickness is large. A new improved version shall be available soon.

Kind Regards,

Franjo

Matheus Marques March 19, 2020 22:42

Hello,

I'm a brazilian chemical Engineering student and actually I'm starting to use CFmesh and I saw in some CFD post that you had problema similar as mine.
I'm trying to make same refinement in each patch, but it looks like that when I use:

boundaryLayers
{
patchBoundaryLayers
{
patchName
{
nLayers 5;
thicknessRatio 1.1;
maxFirstLayerThickness 2;
}
}
}

It looks like that ALL my boundarys get the nLayers I chose for just one patch.
Do you know how can I solve this kind of problem?

The same looks like happen with

localRefinement
{
patchName1
{
cellSize 2
refinementThickness 0.5
}
patchName2
{
cellSize 0.5;
refinementThickness 0.5;
}
}

I chose one patch to have a specific cell size but the two patches get the size of the first localRefinement I did (cellSize 2).

Do you know how I can finish this problem?

Thank you!!!

franjo_j March 20, 2020 03:47

Quote:

Originally Posted by Matheus Marques (Post 762214)
Hello,

I'm a brazilian chemical Engineering student and actually I'm starting to use CFmesh and I saw in some CFD post that you had problema similar as mine.
I'm trying to make same refinement in each patch, but it looks like that when I use:

boundaryLayers
{
patchBoundaryLayers
{
patchName
{
nLayers 5;
thicknessRatio 1.1;
maxFirstLayerThickness 2;
}
}
}

It looks like that ALL my boundarys get the nLayers I chose for just one patch.
Do you know how can I solve this kind of problem?

The same looks like happen with

localRefinement
{
patchName1
{
cellSize 2
refinementThickness 0.5
}
patchName2
{
cellSize 0.5;
refinementThickness 0.5;
}
}

I chose one patch to have a specific cell size but the two patches get the size of the first localRefinement I did (cellSize 2).

Do you know how I can finish this problem?

Thank you!!!


Check the allowDiscontinuity option. It is described in the manual.

Matheus Marques March 20, 2020 06:28

Franjo, thank you to answer me!
I tried here this:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | cfMesh: A library for mesh generation |
| \\ / O peration | |
| \\ / A nd | Author: Franjo Juretic |
| \\/ M anipulation | E-mail: franjo.juretic@c-fields.com |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object meshDict;
}

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

surfaceFile "finalVersion.stl";

maxCellSize 5;

boundarLayers
{

patchBoundaryLayers
{
"Lateral.*"
{
nLayers 5;
thicknessRatio 1.2;
maxFirstLayerThickness 1;
allowDiscontinuity 0;
}

}
}

and after I changed allowDiscontinuity for 1 instead 0, but still does not work :(
I chose this patch and when I open paraView and did a slice to see the intern mesh, it looks like as anything has happend.

Matheus Marques March 20, 2020 06:44

Now with allowDiscontinuity 1, it looks like that anything happend. I did many slice cuts in my geometry and any layer has been showed :(
I really don't know how to solve this!!!

bennn March 27, 2020 08:49

Hi, maybe try the following :
remove maxFirstLayerThickness
add optimiseLayer
add the boundary layer on each patch one by one


All times are GMT -4. The time now is 09:26.