View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000638OpenFOAM[All Projects] Bugpublic2012-08-29 23:002013-03-20 14:28
Reportermturcios 
Assigned Tomattijs 
PriorityhighSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
PlatformLinuxOSOpenSUSEOS Version11.4
Product Version2.1.x 
Target VersionFixed in Version 
Summary0000638: polyMesh::updateMesh(const mapPolyMesh&) fails to update pointFields
DescriptionI was testing the combination of motionSolvers and refinement and found that that the pointFields in the object registry aren't updated as they should be.
Steps To Reproduce1. Unpack and compile solver sprayDyMFoam
2. Unpack and compile library dynamicMotionSolverRefineFvMesh
3. Unpack and run sprayDyMFoam on aachenBombMoveRefine

You will notice that pointMotionUy is not mapped when updateMesh is called.
Additional InformationI tried to manually map the fields inside the dynamicMotionSolverRefineFvMesh::refine and ::unrefine functions by:

pointMesh motionUpdate(*this);
motionUpdate(map);

where map is the mapPolyMesh returned after the refinement (but it could be any topology change). Now the mapping is attempted, but fails with:

Not mapping point<Type>Field fieldName since originating mesh differs from that of mapper.

As pointed out in the following thread, this may be an issue with pointer inconsistency:

http://www.cfd-online.com/Forums/openfoam-programming-development/106469-mapping-pointfields-topology-changes.html [^]
TagsNo tags attached.
Attached Filesgz file icon aachenBombMoveRefine.tar.gz [^] (6,232 bytes) 2012-08-29 23:00
gz file icon sprayDyMFoam.tar.gz [^] (4,138 bytes) 2012-08-29 23:01
gz file icon dynamicMotionSolverRefineFvMesh.tar.gz [^] (9,227 bytes) 2012-08-29 23:01
? file icon setFieldsDict [^] (1,238 bytes) 2012-08-30 19:32 [Show Content]
? file icon topoSetDict [^] (10,146 bytes) 2012-08-30 19:32 [Show Content]
? file icon log.sprayDyMFoam [^] (86,957 bytes) 2012-08-31 19:37
gz file icon log.sprayDyMFoam.gz [^] (523,859 bytes) 2012-09-04 16:04

- Relationships

-  Notes
(0001645)
mattijs (manager)
2012-08-30 09:09

Can you try e.g. refineHexMesh? This should read and map pointScalarFields and pointVectorFields. Just create a blockMesh, create a cellSet and put a pointScalarField in the 0 directory.

     refineHexMesh <cellSet>
(0001653)
mattijs (manager)
2012-08-30 18:13

Just tried and refineHexMesh has the same problem. The pointMesh gets deleted before mapping occurs.
(0001655)
mturcios (reporter)
2012-08-30 18:43
edited on: 2012-08-30 19:33

I was just about to post this but you beat my to it. Early morning meeting. Let me know if there are any other tests I can run to help with this.

I don't know if this will help, but when trying to use setFields on a pointScalarField, I get that the field is not supported. Exact error message is:

--> FOAM Warning :
    From function setCellField::iNew::operator()(Istream& is)
    in file setFields.C at line 156
    field type pointScalarFieldValue not currently supported
--> FOAM Warning :
    From function setCellField::iNew::operator()(Istream& is)
    in file setFields.C at line 156
    field type pointMotionUy not currently supported

I don't know if this is simply a syntax error in the setFieldsDict, I've uploaded it and the topoSetDict I used to create the cellSet

(0001656)
mattijs (manager)
2012-08-31 11:48

In polyMeshClear.C can you try moving the pointMesh::Delete(*this) out of clearGeom() and clearAddressing() and into clearOut()? This will keep the pointMesh around during geometry and topology changes. It solves the refineHexMesh test but needs a bit more testing before I commit it.

2) correct, setFields does not support pointFields. Probably not hard to add. Do you see any use for it?
(0001667)
mturcios (reporter)
2012-08-31 19:37
edited on: 2012-08-31 19:40

Thanks, moving the call makes the mapping happen and the pointFields are mapped. The solver proceeeds for quite a few timesteps until the refinement engine performs an unrefinement, which leads to an error similar to the first time around:

--> FOAM FATAL ERROR:
Incompatible size before mapping. Field size: 42841 map size: 42917

    From function void MapInternalField<Type, MeshMapper, pointMesh>::operator()
(
    Field<Type>& field,
    const MeshMapper& mapper
) const
    in file lnInclude/MapPointField.H at line 79.

I think this may have to do with trying to do two consecutive topology change operations, as the refinement mapping alone seems to have no problems; I checked the created meshes and pointFields are created as they should be.

I don't know if this is still a problem with the polyMesh mapping or if it has to do with the way the dynamicRefine portions of the code do unrefinement. I've attached a complete log of the run.

(0001670)
mattijs (manager)
2012-09-04 16:03

I've pushed 91aaca36bd39bef47bc74803961d07db1160d99c which in addition to that pointMesh deletion moved to clearOut also uses pointMesh::New to construct a pointMesh. Your sprayDyMFoam now runs past unrefinement - it only maps pointMotionUy once (attached log).
(0001671)
mturcios (reporter)
2012-09-04 18:34
edited on: 2012-09-04 19:18

Thanks Mattijs. The mapping is working now. Interesting about the temperature dropping; even though I have some custom libraries that handle that, I wonder if this is related to the timestep shrinking issue; I know that with smaller mesh size with refinement and movement I'll get a smaller timestep, but down to 1e-20 or so seems a bit excessive. Some more tests, when I find anything conclusive I'll report back.

(0001676)
mturcios (reporter)
2012-09-06 20:19

This issue can now be closed; it turns out the refinement operation should be carried out before the movement operation to keep the time step from plummetting. Somehow refining after movement causes the velocity field to increase by a ridiculous amount.

I'm now going to learn how to play with my shiny new toy...thanks for the responsiveness!

- Issue History
Date Modified Username Field Change
2012-08-29 23:00 mturcios New Issue
2012-08-29 23:00 mturcios File Added: aachenBombMoveRefine.tar.gz
2012-08-29 23:01 mturcios File Added: sprayDyMFoam.tar.gz
2012-08-29 23:01 mturcios File Added: dynamicMotionSolverRefineFvMesh.tar.gz
2012-08-30 09:09 mattijs Note Added: 0001645
2012-08-30 18:13 mattijs Note Added: 0001653
2012-08-30 18:43 mturcios Note Added: 0001655
2012-08-30 19:31 mturcios Note Edited: 0001655 View Revisions
2012-08-30 19:32 mturcios File Added: setFieldsDict
2012-08-30 19:32 mturcios File Added: topoSetDict
2012-08-30 19:33 mturcios Note Edited: 0001655 View Revisions
2012-08-31 11:48 mattijs Note Added: 0001656
2012-08-31 19:37 mturcios Note Added: 0001667
2012-08-31 19:37 mturcios File Added: log.sprayDyMFoam
2012-08-31 19:40 mturcios Note Edited: 0001667 View Revisions
2012-09-04 16:03 mattijs Note Added: 0001670
2012-09-04 16:04 mattijs File Added: log.sprayDyMFoam.gz
2012-09-04 18:34 mturcios Note Added: 0001671
2012-09-04 19:10 mturcios Note Edited: 0001671 View Revisions
2012-09-04 19:18 mturcios Note Edited: 0001671 View Revisions
2012-09-06 20:19 mturcios Note Added: 0001676
2012-10-08 09:23 andy Status new => resolved
2012-10-08 09:23 andy Resolution open => fixed
2012-10-08 09:23 andy Assigned To => mattijs