2017-10-22 00:14 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002712OpenFOAMPatchpublic2017-10-20 17:14
ReporterfTheobald 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformAMD64OSGentoo LinuxOS VersionKernel 4.9.34
Product Version5.x 
Target VersionFixed in Version 
Summary0002712: snappyHexMesh + mirrorMesh not adaptive meshing ready
DescriptionFor adaptive mesh refinement - e. g. with pimpleDyMFoam - the files cellLevel and PointLevel in the constant/polyMesh folder are necessary in order to recognize a pre refined mesh, like meshes created with snappyHexMesh. Without this files pimpleDyMFoam-refiner does not touch non-hex-cells (i. e. face number deviating from six I guess).

mirrorMesh mirrors just the plain mesh (points, faces, cells), so that adaptive mesh refinement is not possible in this case.

I have modified the code of mirrorMesh (see attached), so that it is doing what I want, but it does either look nice nor will the other files in constant/polyMesh being mirrored (which might be interesting for someone).

I would really appreciate, if this functionality made it in the official OpenFOAM code.

Best regards,
Florian
Steps To Reproduce1. create a mesh with snappyHexMesh (files cellLevel and pointLevel are being created)
2. mirror the mesh
3. start pimpleDyMFoam

=> pimpleDyMFoam crashes and complains about different number of cells/points from mesh and cellLevel/pointLevel file. After deleting the files, pimpleDyMFoam will run, but all cells now have cellLevel=0 and all non-pure-hex-cells are being written to protectedCells file, i. e. don't get refined.

 
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0008826

MattijsJ (reporter)

Could you try with attached hack of mirrorMesh (mirrorMesh_with_maps)? Or upload a simple ready-made mesh to try it on.

~0008842

fTheobald (reporter)

Have tried with your mirrorMesh_with_maps, but quits with error:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 5.x-e4c205229198
Exec : mirrorMesh_with_maps -overwrite
Date : Oct 09 2017
Time : 15:13:50
...
I/O : uncollated
Case : .../testCase_ofFix
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

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

Mirroring points. Old points: 13179 New points: 25995
Mirroring faces. Old faces: 33368 New faces: 66424
Mirroring patches. Old patches: 6 New patches: 5
Mirroring cells. Old cells: 10152 New cells: 20304
Mirroring cell shapes.

Creating new mesh
Reading hexRef8 data : cellLevel
Reading hexRef8 data : pointLevel
Reading hexRef8 data : level0Edge
Writing mirrored mesh
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigSegv::sigHandler(int) at ??:?
#2 ? in "/lib64/libc.so.6"
#3 Foam::mapPolyMesh::mapPolyMesh(Foam::polyMesh const&, int, int, int, Foam::List<int> const&, Foam::List<Foam::objectMap> const&, Foam::List<int> const&, Foam::List<Foam::objectMap> const&, Foam::List<Foam::objectMap> const&, Foam::List<Foam::objectMap> const&, Foam::List<int> const&, Foam::List<Foam::objectMap> const&, Foam::List<Foam::objectMap> const&, Foam::List<Foam::objectMap> const&, Foam::List<Foam::objectMap> const&, Foam::List<int> const&, Foam::List<int> const&, Foam::List<int> const&, Foam::HashSet<int, Foam::Hash<int> > const&, Foam::List<Foam::List<int> > const&, Foam::List<Foam::List<int> > const&, Foam::List<Foam::List<int> > const&, Foam::List<Foam::List<int> > const&, Foam::List<Foam::List<int> > const&, Foam::Field<Foam::Vector<double> > const&, Foam::List<int> const&, Foam::List<int> const&, Foam::autoPtr<Foam::Field<double> > const&) at ??:?
#4 ? at ??:?
#5 __libc_start_main in "/lib64/libc.so.6"
#6 ? at ??:?
./run_mesh: line 14: 47608 Segmentation fault mirrorMesh_with_maps -overwrite


=> I have used the uploaded case testCase_ofFix.tar.gz. It seems the error occurs after "mMesh.write();" in mirrorMesh.C

~0008855

MattijsJ (reporter)

It was accessing a zero-sized list since I'm creating the minimum mapping construct. Try above version 2.

~0008856

fTheobald (reporter)

Version 2 generates the refinement files, but in an unexpected behaviour:

1. If the 0 folder exists (with or without any files), neither "mirrorMesh_with_maps" nor "mirrorMesh_with_maps -overwrite" generates the files, just the plain mesh is mirrored

2. If no 0 folder exists, "mirrorMesh_with_maps" results in the same situation as 1.

3. If no 0 folder exists, "mirrorMesh_with_maps -overwrite" generates the refinement files in 0/polyMesh rather than in constant/polyMesh

The expected behaviour is:
1. The existence of a 0 folder should not be of importance, existing files should be overridden
2. "mirrorMesh_with_maps" should generate the refinement files in 0/polyMesh
3. "mirrorMesh_with_maps -overwrite" should generate the refinement files in constant/polyMesh

~0008870

MattijsJ (reporter)

This version (check size, should be 11925 bytes) writes correctly
- with or without -overwrite
- with or without 0

~0008876

fTheobald (reporter)

Files are written properly now, but the pointLevel is somehow messed up.

If I start "pimpleDyMFoam" with "mirrorMesh_with_maps-3", the following error occurs:

Create time

Create mesh for time = 0

Selecting dynamicFvMesh dynamicRefineFvMesh


--> FOAM FATAL ERROR:
PointLevel is not consistent across coupled patches.
point:25567 coord:(6.4 0.0939279 0) has level 1 whereas the coupled point has level 0

    From function void Foam::hexRef8::checkRefinementLevels(Foam::label, const labelList&) const
    in file polyTopoChange/polyTopoChange/hexRef8/hexRef8.C at line 4923.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::hexRef8::checkRefinementLevels(int, Foam::List<int> const&) const at ??:?
#3 Foam::hexRef8::hexRef8(Foam::polyMesh const&, bool) at ??:?
#4 Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(Foam::IOobject const&) at ??:?
#5 Foam::dynamicFvMesh::addIOobjectConstructorToTable<Foam::dynamicRefineFvMesh>::New(Foam::IOobject const&) at ??:?
#6 Foam::dynamicFvMesh::New(Foam::IOobject const&) at ??:?
#7 ? at ??:?
#8 __libc_start_main in "/lib64/libc.so.6"
#9 ? at ??:?
Aborted

I added a picture of the issue => "issue_pointLevel.png". It seems "mirrorMesh_with_maps-3" mirrors the pointLevel and then sets all old pointLevels to zero. With cellLevel everything seems to be correct.

~0008877

fTheobald (reporter)

Edit to picture "issue_pointLevel.png":

Shown are inlet (left) and outlet (right) patches of the mirrored mesh. The top picture is the mesh produced with "mirrorMesh_with_maps-3" and the bottom is the one produced with "tfd_mirrorMesh", which mirrors "pointLevel" equal to "points".

~0008916

MattijsJ (reporter)

Would it be possible to test with the uploaded new mirrorMesh_with_maps_20171020.tgz? It was missing the map for the original points (so that is why you were seeing 0 level).
+Notes

-Issue History
Date Modified Username Field Change
2017-10-05 15:43 fTheobald New Issue
2017-10-05 15:43 fTheobald File Added: tfd_mirrorMesh.tar.gz
2017-10-06 15:15 MattijsJ File Added: mirrorMesh_with_maps.tgz
2017-10-06 15:16 MattijsJ Note Added: 0008826
2017-10-09 14:14 fTheobald File Added: testCase_ofFix.tar.gz
2017-10-09 14:21 fTheobald Note Added: 0008842
2017-10-10 20:13 MattijsJ File Added: mirrorMesh_with_maps-2.tgz
2017-10-10 20:14 MattijsJ Note Added: 0008855
2017-10-11 08:01 fTheobald Note Added: 0008856
2017-10-13 14:35 MattijsJ File Added: mirrorMesh_with_maps-3.tgz
2017-10-13 14:35 MattijsJ Note Added: 0008870
2017-10-16 13:53 fTheobald File Added: issue_pointLevel.png
2017-10-16 13:53 fTheobald Note Added: 0008876
2017-10-16 14:10 fTheobald Note Added: 0008877
2017-10-20 17:12 MattijsJ File Added: mirrorMesh_with_maps_20171020.tgz
2017-10-20 17:14 MattijsJ Note Added: 0008916
+Issue History