CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Adding adaptive mesh refinement to the forwardStep tutorial

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By michielm
  • 3 Post By owayz
  • 1 Post By Bojan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2012, 06:59
Question Adding adaptive mesh refinement to the forwardStep tutorial
  #1
New Member
 
Brendan Gray
Join Date: Jul 2012
Location: Johannesburg, South Africa
Posts: 3
Rep Power: 14
AlphaSheep is on a distinguished road
I am busy trying to work out how to do adaptive mesh refinement and coarsening to the forwardStep tutorial case in order to resolve the mesh around the shock wave, but am having some difficulties.

I am using the rhoCentralDyMFoam solver, and have copied the dynamicMeshDict from the damBreakWithObstacle case under the interDyMFoam solver. I've changed the field from alpha1 to p for now (I'll be changing this to normalised density gradient once I get it working).

When I try to run the case, I get the following error.

Code:
--> FOAM FATAL IO ERROR: 
keyword solver is undefined in dictionary "/home/asp/OpenFOAM/asp-2.1.1/run/phd/forwardStep/constant/dynamicMeshDict"

file: /home/asp/OpenFOAM/asp-2.1.1/run/phd/forwardStep/constant/dynamicMeshDict from line 18 to line 73.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 400.

FOAM exiting
Obviously, it expects a solver, which the damBreakWithObstacle case didn't. There must be some fundamental differences that I'm not seeing between the way rhoCentralDyMFoam and interDyMFoam read dynamicMeshDict. Anyway, out of desparation, I added a line "solver none" to see how it would react (hoping it would at least give a list of available solvers). I got the following output

Code:
Selecting motion solver: none


--> FOAM FATAL ERROR: 
solver table is empty

    From function motionSolver::New(const polyMesh& mesh)
    in file motionSolver/motionSolver.C at line 94.

FOAM exiting
I also tried adding the line "dynamicFvMeshLib "libtopoChangerFvMesh.so";", but this had no effect.

Has anyone managed to get this running succesfully? Any help would be appreciated.
AlphaSheep is offline   Reply With Quote

Old   October 12, 2012, 11:41
Default
  #2
Member
 
Michiel
Join Date: Oct 2010
Location: Delft, Netherlands
Posts: 97
Rep Power: 16
michielm is on a distinguished road
I can't find any tutorial on the solver you are using, but if i use the floatingObject case and select 'solver none', i get this:

Code:
Selecting motion solver: none


--> FOAM FATAL ERROR: 
Unknown solver type none

Valid solver types are:

7
(
displacementComponentLaplacian
displacementInterpolation
displacementLaplacian
displacementLayeredMotion
displacementSBRStress
velocityComponentLaplacian
velocityLaplacian
)


    From function motionSolver::New(const polyMesh& mesh)
    in file motionSolver/motionSolver.C at line 106.

FOAM exiting
amuzeshi likes this.
michielm is offline   Reply With Quote

Old   October 12, 2012, 12:49
Default
  #3
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 128
Rep Power: 17
owayz is on a distinguished road
Send a message via MSN to owayz
Hallo Grey,
Your post is very interesting. Many people have been trying to do adaptive mesh refinement and many are successful. I think you should look at the damBreak tutorial. Where the mesh motion solver is dynamicRefineFvMesh.
There mesh is refined on the basis of Simulation parameter alpha (which is actually kind of phase identifier). So basically only the surface between two phases is refined.
If you want to to it for the shock waves you need to select a parameter (to refine shock wave region) on the basis of that parameter you will refine your mesh.
In shock waves there are sudden velocity jumps across shock waves. May be you can use the gradient of velocity as a refinement criteria. But a simulation with shocks and additionally with mesh refinement should be very expensive.
Anyhow I think damBreak is the best place for you to start understanding mesh motion regarding refinement.
Regards,
Awais
owayz is offline   Reply With Quote

Old   October 12, 2012, 15:13
Default
  #4
New Member
 
Brendan Gray
Join Date: Jul 2012
Location: Johannesburg, South Africa
Posts: 3
Rep Power: 14
AlphaSheep is on a distinguished road
Thank you michiel. I was hoing for a list like that. Perhaps there is some library I need to define other than libtopochangerfvmesh.so. I will try see what I can find.

The dam break tutorial is the one that I have been basing all of my work off, but the rhoCentralDyMFoam solver seems to work differently. We typically use the normalised density gradient to resolve the shock waves both in Fluent and in an in-house solver, and I plan on using the same in OpenFOAM.
AlphaSheep is offline   Reply With Quote

Old   October 15, 2012, 12:09
Default
  #5
New Member
 
Brendan Gray
Join Date: Jul 2012
Location: Johannesburg, South Africa
Posts: 3
Rep Power: 14
AlphaSheep is on a distinguished road
I've spent quite a bit of time on this, but I haven't made much progress. From what I can tell, the 7 solver types available in the floatingObject case come from "libfvMotionSolvers.so" used in conjunction with dynamicMotionSolverFvMesh.

After some digging around in the OpenFOAM folder, I found the platforms/linuxGccDPOpt/lib folder, which contains several shared libraries. Scanning through, I found "libfvMotionSolvers.so", along with a "libdynamicFvMesh.so" and the "libtopoChangerFvMesh.so" that's called in the sample dynamicMeshDict in the src/dynamicFvMesh/dynamicRefineFvMesh folder.

I've tried various combinations of both of these, but neither provide any solvers.

This is not surprising, since from what I can can tell from the damBreakWithObstacle case (which I can run perfectly), dynamicRefineFvMesh does not need any motion solver. For some reason, rhoCentralDyMFoam always insists on one (even with staticFvMesh), whereas interDyMFoam only needs one to be defined if the mesh actually moves.

Has anyone managed to incorporate automatic mesh refinement into any of the tutorial cases of the rhoCentralDyMFoam solver (or other suitable compressible solver)?
AlphaSheep is offline   Reply With Quote

Old   December 2, 2012, 04:47
Default sonicdyMFoam automatic mesh refinement based on pressure field
  #6
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14
Bojan is on a distinguished road
Hi friend!
I've managed to implement automatic mesh refinement using sonicdyMFoam slover based on pressure field. Actually, I made a trick, but it showed the logical results. If you are still interested in that, I can write with more details. I performed simulation over OneraM6 wing with the aim of capturing shock wave.
Bojan is offline   Reply With Quote

Old   December 23, 2012, 00:24
Default
  #7
New Member
 
Join Date: Dec 2012
Posts: 3
Rep Power: 13
Lantiantiger is on a distinguished road
I'd love to hear some details.
Lantiantiger is offline   Reply With Quote

Old   December 23, 2012, 05:07
Default Implementing mesh refiniment in sonicDyMFoam
  #8
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14
Bojan is on a distinguished road
Actually, there are three things that you must provide in order to run your simulation successfully. These three things are located in System, Constant and 0 folders. If you run a parallel simulation, you'll have processor1, processor2, .., processorX folders, and there you will have to specify the same data as you specify in System, Constant and 0. In Constant folder you must have dynamicMeshDict file (my example):

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

dynamicFvMesh dynamicRefineFvMesh;

motionSolverLibs ("libfvMotionSolvers.so");

solver velocityComponentLaplacian x;

diffusivity directional ( 200 1 0 );

dynamicRefineFvMeshCoeffs
{
// How often to refine
refineInterval 0.001; //1;
// Field to be refinement on
field p;
// Refine field inbetween lower..upper
lowerRefineLevel 0.001;
upperRefineLevel 0.999;
// If value < unrefineLevel unrefine
unrefineLevel 10;
// Have slower than 2:1 refinement
nBufferLayers 1;
// Refine cells only up to maxRefinement levels
maxRefinement 200; //2;
// Stop refinement if maxCells reached
maxCells 300000;
// Flux field and corresponding velocity field. Fluxes on changed
// faces get recalculated by interpolating the velocity. Use 'none'
// on surfaceScalarFields that do not need to be reinterpolated.
correctFluxes
(
(phi Urel)
(phiAbs U)
(phiAbs_0 U_0)
(nHatf none)
(rho*phi none)
(ghf none)
);
// Write the refinement level as a volScalarField
dumpLevel true;
}
// ************************************************** *********************** //

As you can see, when you use sonicDyMFoam you must specify the solver you use for dynamic mesh. It forces you to put the following data in fvSchemes and fvSolution located in the System folder. In fvSchemes file you must have (located in laplacianSchemes dict):

laplacian(diffusivity,cellMotionU) Gauss linear corrected;

In fvSolution you are supposed to have something like:


cellMotionUx
{
solver GAMG;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
}

I give you the whole fvSolution file bellow:

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

solvers
{
p
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-08;
relTol 0;
}

rho
{
solver PCG;
preconditioner DIC;
tolerance 1e-05;
relTol 0;
}

"(U|e|R)"
{
$p;
tolerance 1e-05;
relTol 0;
}

"(k|epsilon)"
{
$p;
tolerance 1e-08;
relTol 0;
}

nuTilda
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
}

cellMotionUx
{
solver GAMG;
preconditioner DILU;
tolerance 1e-08;
relTol 0.1;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
}

}

PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 2;
}


relaxationFactors
{
fields
{
p 0.3;
}
equations
{
U 0.7;
k 0.7;
epsilon 0.7;
R 0.7;
nuTilda 0.7;
}

}
// ************************************************** *********************** //


And finally, in 0 folder, you must have pointMotionUx file which is as follows:

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

dimensions [0 1 -1 0 0 0 0];

internalField uniform 0;

boundaryField
{
wing
{
type fixedValue;
value uniform 0;
}

symmetry
{
type symmetryPlane;
}

lateral
{
type fixedValue;
value uniform 0;
}

top
{
type fixedValue;
value uniform 0;
}

outlet
{
type fixedValue;
value uniform 0;
}

bottom
{
type fixedValue;
value uniform 0;
}

inlet
{
type fixedValue;
value uniform 0;
}
}

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



As I mentioned above that I made a trick, you'll see that the trick is in making boundary (wing) to move, but obviously you can set this motion to zero, as I did. So, I specified the solver, I have the mesh refinement based on pressure filed and I have zero motion boundary.


What is your opinion about that?


Regards!
amolrajan likes this.
Bojan is offline   Reply With Quote

Old   December 19, 2013, 05:32
Default
  #9
kjw
New Member
 
Krzysztof Wołosz
Join Date: Oct 2010
Location: Poland
Posts: 15
Rep Power: 16
kjw is on a distinguished road
Did your trick works?
Because I had no results using your method.
Could you post a screenshot of you final mesh?

Regards
kjw is offline   Reply With Quote

Old   December 20, 2013, 05:45
Default
  #10
New Member
 
Bojan Sekutkovski
Join Date: Oct 2012
Posts: 19
Rep Power: 14
Bojan is on a distinguished road
Actually, it seemed to work, but it didn't... There is a problem with the compressible flows and the automatic mesh refinement. I'm using OpenFOAM-1.6-ext now, and I'm satisfied with it. I managed to overcome the need to refine the mesh by making it in another way. Since I'm using LES methods, in order to simulate wake development after body in right way, I performed the another trick. As I'm making mesh in Ansys, I import (from CATIA) one part that consists the two bodies (or more if there is a need). The first body (around wing) consists of very fine mesh/uniform, and the outer body slightly increases the cells size with the distance increase in the directions to the boundary. This method enabled overcoming the problems with computer resources when performing remeshing (on large domains), and I got the desired fully developed flow after body (wing). I'm planing to perform FSI simulations as I validate the code, so if I find that I have to use remeshing later (just in case of large wing/body deflections), I'll have to make it possible to perform remeshing....
Bojan is offline   Reply With Quote

Old   August 3, 2019, 15:40
Default Adding adaptive mesh refinement to the forwardStep tutorial
  #11
New Member
 
Svetikscono
Join Date: Aug 2019
Location: Russia
Posts: 2
Rep Power: 0
Svetikscono is on a distinguished road
Send a message via ICQ to Svetikscono Send a message via AIM to Svetikscono Send a message via Yahoo to Svetikscono Send a message via Skype™ to Svetikscono
theWord ver 5.0.0.1450 on win 10 ver 1709 build 16299.98
I am trying to create a new dictionary. Now when I try to create a new entry as a child to the current one the caption is greyed. Anyone else having the same issue?

!
Svetikscono is offline   Reply With Quote

Reply

Tags
adaptive mesh refinement, dynamicmeshdict, rhocentraldymfoam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 18:12
[snappyHexMesh] Boundary layer in a pipe Clementhuon OpenFOAM Meshing & Mesh Conversion 6 March 12, 2012 13:41
Adaptive mesh refinement in two-phase flow (Wigley Hull) jantheron OpenFOAM 6 October 7, 2011 13:59
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43


All times are GMT -4. The time now is 06:50.