Hello:

Sorry for the longish email that follows, I tried to keep it as succinct as
possible.

tl;dr
Is there any way to alter EquationSystems::reinit() to not call
refine/coarsen_elements()? These calls prevent me from properly
reinitializing my new QoI class. Or, is there another way to use the
element refinement flags to identify elements that were just
refined/coarsened?

@pbauman pointed me to a GitHub PR
<https://github.com/libMesh/libmesh/pull/1080> discussion where it seems
that these refine/coarsen calls in ES::reinit() are not really necessary
anymore.

-----------------------------

I am currently working on implementing a new QoI in GRINS, but I am having
an issue with EquationSystems::reinit().

My new QoI is based on the GRINS::RayfireMesh class, which must be
reinitialized after every refine/coarsening. To fully integrate this, I am
adding hooks into GRINS::MultiphysicsSystem::reinit() that will call
reinit() on my QoI class.

I have a test case that follows this flow: assemble QoI, refine certain
elements, reinit the EquationSystems (which would also reinit my QoI),
assemble QoI again.

The reinit()
<https://github.com/grinsfem/grins/blob/master/src/qoi/src/rayfire_mesh.C#L160>
for RayfireMesh looks for an INACTIVE element with JUST_REFINED children in
order to refine its own internal 1D mesh.

The problem arises in that MeshRefinement::refine_elements() ends up
getting called *twice*, once in my test case and again in ES::reinit() (
https://github.com/libMesh/libmesh/blob/master/src/systems/equation_systems.C#L265
)

When refine_elements() is called the second time, it replaces all
JUST_REFINED flags with DO_NOTHING, breaking my RayfireMesh reinit function.

If I do not call refine_elements() in my test, and instead just flag the
elements and let the ES::reinit() do the refinement, then this
<https://github.com/libMesh/libmesh/blob/master/src/systems/equation_systems.C#L270>
IF
statement is skipped, and prolong_vectors() below it trips an assert.

​Perhaps I could alter how I am identifying the just refined elements? The
RayfireMesh map stores the IDs of main mesh elements along the 1D rayfire.
On reinit(), it looks for inactive elements, and then tries to determine if
they were refined or coarsened by looking at the refinement flags of its
children/parent. Would there be any other situation where an element would
go from ACTIVE to INACTIVE with DO_NOTHING children? I'm not sure how
robust of a check that would be.​

​I would appreciate any thoughts/insights/suggestions for ​how to address
this.

Thank you,
-- 
*~Tim Adowski*
------------------------------------------------------------------------------
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to