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] Add / remove cell layers (dynamic mesh) (https://www.cfd-online.com/Forums/openfoam-meshing/129625-add-remove-cell-layers-dynamic-mesh.html)

ChristophGradl February 10, 2014 01:44

Add / remove cell layers (dynamic mesh)
 
Hello!
I am a beginner in OpenFoam and would be very glad to get some additional information for my questions.

I am studying dynamic mesh moving in OpenFoam. I want to add / remove mesh layers instead of changing the mesh size. I studied the movingConeTopo tutorial, but I am working with OpenFoam v.2.2, the tutorial was created with version 1.5.

Can somebody send me a tutorial case for add / remove cell layers or give me an idea of what the case should look like.

I tried:
1) set up a mesh with blockMesh
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
    (0 0 0)
    (1 0 0)
    (1 1 0)
    (0 1 0)
    (0 0 0.1)
    (1 0 0.1)
    (1 1 0.1)
    (0 1 0.1)
);

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

edges
(
);

boundary
(
    movingWall
    {
        type wall;
        faces
        (
            (2 6 5 1) // right
        );
    }
    fixedWalls
    {
        type wall;
        faces
        (
            (1 5 4 0) // bottom
            (3 7 6 2) //top
        );
    }
    inlet
    {
        type wall;
        faces
        (
        (0 4 7 3) // left
        );
    }

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

mergePatchPairs
(
);

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

2) dynamicMeshDict
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM Extend Project: Open Source CFD        |
|  \\    /  O peration    | Version:  1.6-ext                              |
|  \\  /    A nd          | Web:      www.extend-project.de                |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
motionSolverLibs ( "libfvMotionSolvers.so" );
dynamicFvMesh  movingConeTopoFvMesh;

movingConeTopoFvMeshCoeffs
{
motionVelAmplitude (-1 0.0 0);
motionVelPeriod 1e-6;

leftEdge 0;
leftObstacleEdge 0;
rightObstacleEdge 0.1;

left
{
minThickness 1e-4;
maxThickness 1e-3;
}

right
{
minThickness 1e-4;
maxThickness 1e-3;
}
}
// ************************************************************************* //

3) meshModifiers
Code:

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

1
(
right
{
type layerAdditionRemoval;
faceZoneName mWallSet;
minLayerThickness 0.00002;
maxLayerThickness 0.00005;
oldLayerThickness 0;
active true;
}


left
{
type layerAdditionRemoval;
faceZoneName minletSet;
minLayerThickness 0.00002;
maxLayerThickness 0.00005;
oldLayerThickness 0;
active false;
}
)

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

4) the faceZone are created with topoSet (topoSetDict)
Code:

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

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

actions
(
    // Heater
    {
        name    heater;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (0 0 0)(0.1 0.1 0.01);
        }
    }
    {
        name    heater1;
        type    cellZoneSet;
        action  new;
        source  setToCellZone;
        sourceInfo
        {
            set heater;          // name of cellSet
        }
    }
    {
        name    mWall;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name "movingWall";
        }
    }
    {
        name    mWall;
        type    faceSet;
        action  add;
        source  cellToFace;
        sourceInfo
        {
            set heater;
            option all;
        }
    }
    {
        name    mWallSet;
        type    faceZoneSet;
        action  new;
        source  setToFaceZone;
        sourceInfo
        {
            faceSet mWall;
        }
    }
   
        {
        name    minlet;
        type    faceSet;
        action  new;
        source  patchToFace;
        sourceInfo
        {
            name "inlet";
        }
    }
    {
        name    minletSet;
        type    faceZoneSet;
        action  new;
        source  setToFaceZone;
        sourceInfo
        {
            faceSet minlet;
        }
    }

);

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

I get an error, if i run my test case with pimpleDyMFoam

Code:

Create mesh for time = 0

Selecting dynamicFvMesh movingConeTopoFvMesh
Initial time:0 Initial curMotionVel_:(-0 0 0)
void movingConeTopoFvMesh::addZonesAndModifiers() : Zones and modifiers already present.  Skipping.
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::faceZone::operator()() const at ??:?
#4  Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(Foam::IOobject const&) at ??:?
#5  Foam::dynamicFvMesh::addIOobjectConstructorToTable<Foam::movingConeTopoFvMesh>::New(Foam::IOobject const&) at ??:?
#6  Foam::dynamicFvMesh::New(Foam::IOobject const&) at ??:?
#7 
 at ??:?
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9 
 at ??:?
Segmentation fault (core dumped)

Where can I find informations about add / remove celllayers in version 2.2? Maybe a tutorial case?

Best regards,
Christoph

challenger June 2, 2014 07:28

movingConeTopo tutorial
 
Hi Christoph,

I've currently started looking into this topic as well. I would like to know if you've managed to get anything out of it.

From what I've seen, the moving topo libraries have been marked redundant since 1.6 or 1.7 version and I did find a post from Prof. Jasak mentioniong the addLayer classes need to be implemented into whatever solver you're working on.

For the moment I cannot even seem to find the movingConeTopo tutorial, I would really appreciate it if you could post the tutorial with layer addition :)

Thanks.

ChristophGradl June 2, 2014 09:36

Hi!
You might want to check out foam-extend-3.0 (http://www.extend-project.de/the-extend-project) . In foam-extend the movingConeTopo tutorial can be found. It works only in foam-extend, maybe you can port it to OF 2.3.0.

The version of the library can be adapt to different setups by using the setSet command.

When I have time, I want to try to implement the library in OF 2.3. Maybe we can stay in contact and exchange our results.

Best regards,
Christoph

challenger June 16, 2014 07:23

1 Attachment(s)
Hi Christoph,

Thanks for the reply and sorry I could couldn't get back to you earlier.

I got Extends 3.0 installed and looked at the tutorial, finally. I am not sure where I'm heading with this because I'm trying to test out injection modelling and I might have to scrap the project if I don't progress within the next few weeks, otherwise I would also be interested in importing this to OpenFOAM 2+

I've attached an image from the tutorial I am working on, I'll try to post the tutorial when I have the computer with me. I'm trying to move the empty space from right to left, adding layers along the red line. This is supposed to signify an injector nozzle. The layer addition seems to work in a rectangular surface when the two thin mesh layers are defined as moving zones but not if I want it described as in the picutre with zone 1 moving and zone two being fixed, the patch between the two zones being my layer addition patch.

Do you have any idea for this? Do you know if sliding interface can be combined with layer addition?

Thanks, Ishan

(P.S. used a fake name because of company policy while doing my thesis, and I cannot find the option to change it back :) )

challenger June 20, 2014 09:44

3 Attachment(s)
basicWorking is movingConeTopo except for slight geometry modification.

fixedZone is the same as above where I have separated the movingZone into two parts. One that moves and one that is fixed, the moving layer is between these two sets and I would ideally like to produce the dynamic cell layer addition here.

sample2Dcase is my actual 2D example, where the solid body needs to move away from the cylinder side while introducing dynamic cell layer addition.

Is this even possible?

(All of these were created with OpenFOAM extends project 3.0)

will_ca November 5, 2014 13:33

Hi,
did you manage to do the cell layer addition? I'm trying to do something similar. Could you share how you did it?

challenger December 11, 2014 05:26

Unfortunately I couldn't go further than that.

Joe Wang September 7, 2017 12:03

Hi, Frank,
Hope you have figured it out. I have the same problem as you faced. Could you share a case as a tutorial if you have figured it out? Thank you.
Joe
Quote:

Originally Posted by challenger (Post 523436)
Unfortunately I couldn't go further than that.


mturcios777 September 7, 2017 14:27

For movingCone, you should have a look at the source code for it in src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C

This moving mesh class is very specific and requires that the faces you want to remove/add lie in a specific x plane, and that you are only moving in the x plane. If you want to do custom layerAR, you will need to make your on mesh class.

2538sukham April 8, 2021 04:08

Add/ remove cell layers
 
Now I found that the moving cell is actually as it is and it is only that the cell in front will be added or deleted according to the min and max thickness provided in the dynamicMeshDict. Is there any other way to deform the moving cell as well? Since the movingcell is a part of the computational domain, wont it affect the solution?


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