Open roystgnr opened 7 years ago
I've all but given up on using the nodal behavior of the FeatureFloodCount
object. I'm pretty sure it (flood_type = NODAL) currently doesn't work in parallel at all (even on ReplicatedMesh), and I don't have anyone beating down my door to make it work. The use case for this "topologically connected thingy finder" is all element based and seems much more robust that way.
That doesn't mean that we shouldn't fix the libMesh function and document it, but don't let the current usage in that object drive any requirements for you. I'm half tempted to just remove that code path.
On another note, I'd love to actually test this whole FeatureFloodCount and GrainTracker on a massive problem in the (nearish-)future and get another publication out on it. I'd like to put you on there as an author since a lot of the mesh capability is yours. I tested the GrainTracker on about 6000 grains in 3D and it worked perfectly on ReplicatedMesh back in May but that took an enormous amount of memory. At the time, the DistributedMesh support just wasn't there yet so I didn't even try it. I think we're pretty close to making that all work.
I've all but given up on using the nodal behavior of the FeatureFloodCount object. I'm pretty sure it currently doesn't work in parallel at all (even on ReplicatedMesh)
Well, it doesn't with 2 processors and AMR on, at least.
I'd like to put you on there as an author since a lot of the mesh capability is yours.
I'd also like that!
At the time, the DistributedMesh support just wasn't there yet so I didn't even try it. I think we're pretty close to making that all work.
Could you point me towards tests which I should prioritize running with DistributedMesh? I've been looking at simpler cases first, which is the right way to go long-term to get the whole modules/ test suite sweeping cleanly on --distributed-mesh, but which will just leave me bogged down with "Needs renumbering disabled to pass with DistributedMesh" and "fails on ReplicatedMesh in parallel" cases for a while before I get to any advanced stuff.
based on the special case behavior @jwpeterson added for EDGE2, EDGE3, and EDGE4, what we really want here is the closest nodes along an edge, not the vertex nodes.
That's definitely what somebody wanted in their 1D code for the middle node of EDGE3 elements... While I was at it, I figured I'd handle the EDGE4 in an analogous manner, but we can always redefine the 1D behavior if you want.
Does the central node of a QUAD9 element have any nodal neighbors under this definition? I'd think no...
Does the central node of a QUAD9 element have any nodal neighbors under this definition? I'd think no...
Gah, good question. I'd have said that it's the neighbor of each of the mid-edge nodes. Otherwise it'd be entirely unreachable by flood fill...
High Priority (at least for me): 2D (Hopefully already works): https://github.com/idaholab/moose/blob/devel/modules/phase_field/examples/grain_growth/grain_growth_2D_graintracker.i
3D (Might also work): https://github.com/idaholab/moose/blob/devel/modules/phase_field/examples/grain_growth/grain_growth_3D.i
The GrainTracker as you are aware is just a huge pain because it needs lots of overlapping information to succeed at finding the topological feature connections (which also makes it a really cool problem). I'm pretty sure that the distributed mesh stuff was working back earlier in the year as you can see from this input file (note the "num_ghosted_layers = 2" parameter in the mesh block). I remember thinking that I don't need any algebraic solution information beyond the normal single ghosting layer, but I do potentially need extra geometric layers for the halos since the grain tracker needs to be able to see when features are about to intersect (overlapping halo entities): https://github.com/idaholab/moose/blob/devel/modules/phase_field/test/tests/grain_tracker_test/grain_tracker_test_elemental.i
You can play with these input files quite a bit. You can scale the mesh up a bit and add more grains, as you do that you can adjust the wGB
parameter in the material: https://github.com/idaholab/moose/blob/devel/modules/phase_field/test/tests/grain_tracker_test/grain_tracker_test_elemental.i#L97.
Also, you shouldn't need more than 8 order parameters in 2D in probably ~25 in 3D. If you are interested in working on any of this let me know. It might already be there and I just need to get back to it as I have a few mostly written pubs sitting around that just need results now.
This is a great test input file. It runs super quickly and I turned on a ton of Auxiliary variables so you can actually see the halos in all their glorious blocky detail working: https://github.com/idaholab/moose/blob/devel/modules/phase_field/test/tests/grain_tracker_test/grain_tracker_remapping_test.i
The last crap that I did to this work was recognize that I didn't want to build my own coloring algorithm so I created a new UserObject (which is a derivative of FeatureFloodCount
called PolycrystalUserObjectBase
https://github.com/idaholab/moose/blob/devel/modules/phase_field/src/userobjects/PolycrystalUserObjectBase.C), which ties into all the graph coloring algorithms that happen to be built into PETSc for matrix row coloring. This allowed me to get rid of dumb back-tracking algorithm, and the poorly written "greedy" algorithm and use production quality code to do the hard part of coloring the grain structure with a small number of order parameters. OK - enough information dump. Just lots of geeky CS stuff going on here...
Copying @permcody since he's futzed with the MOOSE phase_field/src/postprocessors/FeatureFloodCount.C enough to be familiar with the use case that broke for me.
MeshTools::find_nodal_neighbors() has two problems:
1) It produces questionable results when operating on non-first-order geometric elements. The test for neighbors stops at the first encountered distinct node which shares an edge with the input node, and will thus miss any other nodes on the same edge. This would be a reasonable implementation of "find_vertex_neighbors()", because libMesh always orders vertex nodes before mid-edge nodes... but based on the special case behavior @jwpeterson added for EDGE2, EDGE3, and EDGE4, what we really want here is the closest nodes along an edge, not the vertex nodes.
2) With the current libMesh default ghosting, in AMR cases it doesn't do what FeatureFloodCount wants: giving a list of neighbors who are also semilocal. Imagine four equal-h-level QUAD4 elements meeting at a point, the "southwest" of which is then refined. Suppose the southeast quad has the same processor ID as the node. Then, on that processor we are guaranteed to have ghosted: the northeast element and the two adjacent out of the 4 southwest active elements. However, the southwest node of the northwest element (which is not currently guaranteed to be ghosted, since it isn't a side neighbor of the southeast, only a point neighbor!) does not belong to any of those. However, if the northwest element is geometrically ghosted (either because of a geometric ghosting functor which isn't also set as an algebraic ghosting functor, or just because we're on ReplicatedMesh), then find_nodal_neighbors will return that non-semilocal node.
I can probably work around this problem in MOOSE by simply testing for algebraic semilocality in the flood fill algorithm, but we should probably decide what the correct behavior in libMesh is, document it, and make find_nodal_neighbors() behave.