View Issue Details

IDProjectCategoryView StatusLast Update
0002712OpenFOAMPatchpublic2017-10-27 15:28
ReporterfTheobald Assigned Tohenry  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAMD64OSGentoo LinuxOS VersionKernel 4.9.34
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.

Activities

fTheobald

2017-10-05 15:43

reporter  

tfd_mirrorMesh.tar.gz (5,142 bytes)

MattijsJ

2017-10-06 15:15

reporter  

MattijsJ

2017-10-06 15:16

reporter   ~0008826

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

fTheobald

2017-10-09 14:14

reporter  

testCase_ofFix.tar.gz (13,391 bytes)

fTheobald

2017-10-09 14:21

reporter   ~0008842

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

MattijsJ

2017-10-10 20:13

reporter  

MattijsJ

2017-10-10 20:14

reporter   ~0008855

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

fTheobald

2017-10-11 08:01

reporter   ~0008856

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

MattijsJ

2017-10-13 14:35

reporter   ~0008870

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

fTheobald

2017-10-16 13:53

reporter   ~0008876

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.
issue_pointLevel.png (78,721 bytes)   
issue_pointLevel.png (78,721 bytes)   

fTheobald

2017-10-16 14:10

reporter   ~0008877

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".

MattijsJ

2017-10-20 17:12

reporter  

MattijsJ

2017-10-20 17:14

reporter   ~0008916

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).

fTheobald

2017-10-23 14:56

reporter   ~0008921

The cell level and point level are being mirrored properly now. I am going to test the tool for more sophisticated test cases. There may some additional issues show up. In that case, I will open a new issue.

For now I would mark the subject as solved

henry

2017-10-27 15:28

manager   ~0008946

Resolved in OpenFOAM-5.x by commit 28fdc3c4e851fd0f036676385592239f021da83f

Resolved in OpenFOAM-dev by commit 19da21ed93703f2d94c3dacf81f85e076aaa86fc

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
2017-10-23 14:56 fTheobald Note Added: 0008921
2017-10-27 15:28 henry Assigned To => henry
2017-10-27 15:28 henry Status new => resolved
2017-10-27 15:28 henry Resolution open => fixed
2017-10-27 15:28 henry Fixed in Version => 5.x
2017-10-27 15:28 henry Note Added: 0008946