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/)
-   -   [mesh manipulation] How to combine dynamic mesh and static mesh (https://www.cfd-online.com/Forums/openfoam-meshing/134902-how-combine-dynamic-mesh-static-mesh.html)

chery1986 May 6, 2014 22:28

How to combine dynamic mesh and static mesh
 
Is it possible to combine the dynamic mesh and static mesh in one simulation case?

I want to use dynamic mesh based on dynamicMotionSolverFvMesh according to the prescribed motion of boundary in one part of the computational domain. At the same time, static mesh are wanted in the other side part of the computational domain because I need to use porous material etc. over there.

Is there any solution for my requirement? How shall I define dynamicMeshDict and blockMeshDict? If not possible, is there any alternatives for this problem?

mturcios777 May 7, 2014 14:10

One possibility is to set the point motion diffusivity to zero in the region you don't want to move.

chery1986 July 3, 2014 23:45

Thank you, can you provide the method to define different diffusivity coefficients in different regions?

Quote:

Originally Posted by mturcios777 (Post 490457)
One possibility is to set the point motion diffusivity to zero in the region you don't want to move.


chery1986 July 4, 2014 02:00

This is the setting I'm using right now, can you give suggestions how to change it?



dynamicFvMesh dynamicMotionSolverFvMesh;

motionSolverLibs ("libfvMotionSolvers.so");

solver velocityLaplacian;

velocityLaplacianCoeffs
{
diffusivity motionDirectional (10 10 0);
}


Quote:

Originally Posted by mturcios777 (Post 490457)
One possibility is to set the point motion diffusivity to zero in the region you don't want to move.


mturcios777 July 4, 2014 12:24

For all motionSolvers, you can change the diffusivity to "file", which is a surfaceScalarField in the constant directory that provides the face diffusivity. You will need to create this yourself. This is your only option if you are using velocityLaplacian.

If you are using displacement motion solvers, you can specify an additional "frozenPointsZone" that is the name of a pointZone for non-moving points. This is probably the easiest, but is restricted to displacement motion solvers.

chery1986 July 29, 2014 03:58

thanks for your reply

I have switched to displacement motion solvers, but still don't get how to define a frozenPointsZone as you suggested.

Do you mean create a pointZone file in polymesh folder, and define the frozenPointsZone inside of it like

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

1
(
frozenPointsZone
{
type pointZone;
pointLabels List<label>
83646
(
48
49
50
51
.......

Or, do you mean create another file named frozenPointsZone under polymesh folder and define the points inside?


Quote:

Originally Posted by mturcios777 (Post 500127)
For all motionSolvers, you can change the diffusivity to "file", which is a surfaceScalarField in the constant directory that provides the face diffusivity. You will need to create this yourself. This is your only option if you are using velocityLaplacian.

If you are using displacement motion solvers, you can specify an additional "frozenPointsZone" that is the name of a pointZone for non-moving points. This is probably the easiest, but is restricted to displacement motion solvers.


mturcios777 August 5, 2014 14:14

You should define the points as a pointZone with whatever name you want them to have, then add the keyword frozenPointsZone to your dynamicMeshDict with the name of pointZone you want frozen.

chery1986 August 6, 2014 02:46

Thanks you. However, I follow your instructions, but still cannot succeed.

The dynamicMeshDict file is

FoamFile
{
version 2.0;
format binary;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

//dynamicFvMesh staticFvMesh;

dynamicFvMesh dynamicMotionSolverFvMesh;

motionSolverLibs ("libfvMotionSolvers.so");


solver displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity inverseDistance (inlet);

}
frozenPointsZone farfield;



The pointZone file is

FoamFile
{
version 2.0;
format ascii;
class regIOobject;
location "constant/polyMesh";
object pointZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

1
(
farfield
{
type pointZone;
pointLabels List<label>
83646
(
48
49
50
51
52
53
......

Any further suggestions?

Quote:

Originally Posted by mturcios777 (Post 504522)
You should define the points as a pointZone with whatever name you want them to have, then add the keyword frozenPointsZone to your dynamicMeshDict with the name of pointZone you want frozen.


mturcios777 August 6, 2014 12:13

You need to put the frozenPointsZone inside the displacementLaplacianCoeffs, as that is where the solver is looking for it. Try that and let me know if there are any error messages.

chery1986 August 7, 2014 04:47

the interDyMFoam is still running as the frozenPointsZone has not been defined

Quote:

Originally Posted by mturcios777 (Post 504684)
You need to put the frozenPointsZone inside the displacementLaplacianCoeffs, as that is where the solver is looking for it. Try that and let me know if there are any error messages.


mturcios777 August 7, 2014 12:09

Sorry, I think I was unclear. Your dictionary should look like:

Code:

FoamFile
{
version 2.0;
format binary;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

//dynamicFvMesh staticFvMesh;

dynamicFvMesh dynamicMotionSolverFvMesh;

motionSolverLibs ("libfvMotionSolvers.so");


solver displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity inverseDistance (inlet);
frozenPointsZone farfield;
}


chery1986 August 8, 2014 01:37

I believe that is exactly what I have done

FoamFile
{
version 2.0;
format binary;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

//dynamicFvMesh staticFvMesh;
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");

solver displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity inverseDistance (inlet);
frozenPointsZone farfield;
}

The simulation runs smoothly, but the points hasn't been frozen.


Quote:

Originally Posted by mturcios777 (Post 504895)
Sorry, I think I was unclear. Your dictionary should look like:

Code:

FoamFile
{
version 2.0;
format binary;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

//dynamicFvMesh staticFvMesh;

dynamicFvMesh dynamicMotionSolverFvMesh;

motionSolverLibs ("libfvMotionSolvers.so");


solver displacementLaplacian;
displacementLaplacianCoeffs
{
diffusivity inverseDistance (inlet);
frozenPointsZone farfield;
}



mturcios777 August 8, 2014 12:32

That's odd. If you turn on the debug option for fvMotionSolvers in the global controlDict, you should get a message that re-states the motionsolver diffusivity and frozenPointsZone. Can you tell me what message you get with the debug option activated?

wxtwalkee October 18, 2014 23:14

I did exactly as you have done, and the mesh points still moved. So I want know whether you have solved this problem.
Thank U.

Michael@UW July 23, 2020 14:32

Quote:

Originally Posted by mturcios777 (Post 505095)
That's odd. If you turn on the debug option for fvMotionSolvers in the global controlDict, you should get a message that re-states the motionsolver diffusivity and frozenPointsZone. Can you tell me what message you get with the debug option activated?


Hi mturcios777,
I wonder if you have a case working with "frozenPointZone". I cannot find any cases in the tutorials folder.

I have searched a few posts. It seems no one gets this option work. The source code shows it will not change the displacement if "frozenPointZone" exists in dynamicMeshDict, but the points still move. I confrim the fixed points desired in paraview and the existence of the file "constant/polyMesh/pointZones".

The output has nothing to do with 'frozenPointZone" when the debug option is switched on as shown below:
Code:

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

Overriding DebugSwitches according to controlDict
    dynamicMotionSolverFvMesh 2;

    fvMotionSolver (unregistered)
Create mesh for time = 0

Selecting dynamicFvMesh dynamicOversetFvMesh
Selecting motion solver: displacementLaplacian
Applying solid body motion to entire mesh
--> FOAM Warning :
    From const Foam::HashTable<Foam::List<int> >& Foam::polyBoundaryMesh::groupPatchIDs() const
    in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 510
    Removed patchGroup 'wall' which clashes with patch 1 of the same name.
Selecting motion diffusion: uniform
Selecting motion solver: multiSolidBodyMotionSolver
Applying solid body motion to entire mesh
Selecting solid-body motion function tabulated6DoFMotion
Applying solid body motion tabulated6DoFMotion to 564 points of cellZone movingZone1

PIMPLE: no residual control data found. Calculations will employ 10 corrector loops

The dynamicMeshDict is set up as below:

HTML Code:

                motionSolverLibs ("libfvMotionSolvers.so");
                solver displacementLaplacian;
                displacementLaplacianCoeffs
                //solver        velocityLaplacian;
                //velocityLaplacianCoeffs
                {
                        diffusivity  uniform;
                        //frozenDiffusion no;
                        frozenPointsZone fixedPoints;
                }

By the way, I am using OpenFOAM v2006.

Anyone share your experience?

Regards,
Michael

victor13165 May 19, 2021 08:33

how to setup frozenPointsZone with displacementLaplacian
 
Hello,

Might be a bit late, but maybe it can help somebody.

In the case I am using, I have managed to use frozenPointsZone by doing the following:

1. Create a pointZone in your topoSetDict dictionary. As an example, mine looks like this:
Code:

xsep 1.0;

actions
(
      //First, define a pointSet
    {
        name    fixedZonePointSet;
        type    pointSet;
        action  new;
        source  boxToPoint;
        box ($xsep -1.0 -1.0) (30.0 1.0 3.0);
    }



      //Convert existing pointSet to pointZone.
      //This is the one you want to be using for your frozenPointsZone

    {
        name    fixedZone;
        type    pointZoneSet;
        action  new;
        source  setToPointZone;
        set    fixedZonePointSet;
    }

);

2. Add the pointZone to your dynamicMeshDict using the frozenPointsZone parameter:

Code:

dynamicFvMesh      dynamicMotionSolverFvMesh;
motionSolverLibs    (fvMotionSolvers);

solver              displacementLaplacian;

displacementLaplacianCoeffs
{
    diffusivity quadratic inverseDistance (leftwall);
  frozenPointsZone fixedZone;  //Here! Make sure it's inside the brackets
}

This worked for me. However, if you want to check that the solver recognizes your pointZone, you can have a look in this file:


$FOAM_SRC/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C


At line 96, you can see the following code :

Code:

frozenPointsZone_
(
        coeffDict().found("frozenPointsZone")
      ? fvMesh_.pointZones().findZoneID
        (
            coeffDict().get<word>("frozenPointsZone")
        )
      : -1
)

Which means that the solver will look for your pointZone next to the "frozenPointsZone" parameter in your dynamicMeshDict. If the pointZone does not exist, frozenPointsZone_ will simply be set to -1. A few lines below (line 115), you can see this :

Code:

if (debug)
{
            Info<< "displacementLaplacianFvMotionSolver:" << nl
            << "    diffusivity      : " << diffusivityPtr_().type() << nl
            << "    frozenPoints zone : " << frozenPointsZone_ << endl;
 }

If you comment the "if" statement, when you start your solver (simpleFoam, etc...) you will be able to see the value of your frozenPointsZone. If it is set to -1, it means that somehow your pointZone is not correctly set up. The value that is printed is supposed to be the zone ID.

As an example, this is what it looks like for me, when my pointZone is correctly set up:


Code:

Create time

Create mesh for time = 0

Selecting dynamicFvMesh dynamicMotionSolverFvMesh
Selecting motion solver: displacementLaplacian
Applying solid body motion to entire mesh
Selecting motion diffusion: exponential
Selecting motion diffusion: inverseDistance
Selecting patchDistMethod meshWave
displacementLaplacianFvMotionSolver:
    diffusivity      : quadratic
    frozenPoints zone : 1

I hope this helps. Please let me know if you want an example case that works.

Cheers,


Victor

AliVali April 21, 2022 01:47

Quote:

Originally Posted by victor13165 (Post 804174)
Hello,

Might be a bit late, but maybe it can help somebody.

In the case I am using, I have managed to use frozenPointsZone by doing the following:

1. Create a pointZone in your topoSetDict dictionary. As an example, mine looks like this:
Code:

xsep 1.0;

actions
(
      //First, define a pointSet
    {
        name    fixedZonePointSet;
        type    pointSet;
        action  new;
        source  boxToPoint;
        box ($xsep -1.0 -1.0) (30.0 1.0 3.0);
    }



      //Convert existing pointSet to pointZone.
      //This is the one you want to be using for your frozenPointsZone

    {
        name    fixedZone;
        type    pointZoneSet;
        action  new;
        source  setToPointZone;
        set    fixedZonePointSet;
    }

);

2. Add the pointZone to your dynamicMeshDict using the frozenPointsZone parameter:

Code:

dynamicFvMesh      dynamicMotionSolverFvMesh;
motionSolverLibs    (fvMotionSolvers);

solver              displacementLaplacian;

displacementLaplacianCoeffs
{
    diffusivity quadratic inverseDistance (leftwall);
  frozenPointsZone fixedZone;  //Here! Make sure it's inside the brackets
}

This worked for me. However, if you want to check that the solver recognizes your pointZone, you can have a look in this file:


$FOAM_SRC/fvMotionSolver/fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C


At line 96, you can see the following code :

Code:

frozenPointsZone_
(
        coeffDict().found("frozenPointsZone")
      ? fvMesh_.pointZones().findZoneID
        (
            coeffDict().get<word>("frozenPointsZone")
        )
      : -1
)

Which means that the solver will look for your pointZone next to the "frozenPointsZone" parameter in your dynamicMeshDict. If the pointZone does not exist, frozenPointsZone_ will simply be set to -1. A few lines below (line 115), you can see this :

Code:

if (debug)
{
            Info<< "displacementLaplacianFvMotionSolver:" << nl
            << "    diffusivity      : " << diffusivityPtr_().type() << nl
            << "    frozenPoints zone : " << frozenPointsZone_ << endl;
 }

If you comment the "if" statement, when you start your solver (simpleFoam, etc...) you will be able to see the value of your frozenPointsZone. If it is set to -1, it means that somehow your pointZone is not correctly set up. The value that is printed is supposed to be the zone ID.

As an example, this is what it looks like for me, when my pointZone is correctly set up:


Code:

Create time

Create mesh for time = 0

Selecting dynamicFvMesh dynamicMotionSolverFvMesh
Selecting motion solver: displacementLaplacian
Applying solid body motion to entire mesh
Selecting motion diffusion: exponential
Selecting motion diffusion: inverseDistance
Selecting patchDistMethod meshWave
displacementLaplacianFvMotionSolver:
    diffusivity      : quadratic
    frozenPoints zone : 1

I hope this helps. Please let me know if you want an example case that works.

Cheers,


Victor

Thanks Victor, you post was really helpful. I was expecting to get a better performance by freezing a some part of my mesh. However, I see no speed up, and the combination of dynamic mesh with forzen points is about 2% slower. Do you have the same experience?

be_inspired October 25, 2023 00:55

Do you know the debug switch name to be activated without the need to modify the code? I have generated the point zone but the points are still moved
Thanks a lot


All times are GMT -4. The time now is 05:41.