idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Smarter subdomain restricted LayeredBase behavior #8835

Open dschwen opened 7 years ago

dschwen commented 7 years ago

Description of the enhancement or error report

Specifying num_layers in an object derived form LayeredBase will set up a later structure that equally partitions the whole mesh based on _bounds member of MooseMesh. It would be nice if the bounds of only the subdomain set the UO is restricted to were used to set up the layers. Ping @gambka

Rationale for the enhancement or information for reproducing the error

This comes up when using layered averages on the fuel in a fuel pin problem.

Identified impact

Simplify use of layered user objects.

azihsan commented 6 years ago

just accessing this issue coming from moose group https://groups.google.com/forum/#!topic/moose-users/iHlCPDJ-ZCM

I need this capability for solving my problem, perhaps i could do something to add new UserObject for smarter subdomain.

But before that, since i am really new into the framework, could any give some short of hints to do this?

permcody commented 6 years ago

Algorithmically the steps would look something like this

  1. In your UserObject find the max/min coordinates of the subdomain in "initialSetup" a. Loop over all "active elements" i. For elements with desired subdomain ID, update max/min coordinates respectively b. Aggregate the max/min coordinates in parallel to find true max/min coordinates
  2. Calculate the layers as normal using the information from step 1.

Run as normal.

If you take a look at MooseMesh https://github.com/idaholab/moose/blob/devel/framework/src/mesh/MooseMesh.C

You can find the logic for how we calculate the max and min and other utility routines for figuring out bounds. It involves looping over all nodes/elements as you might expect. We do this for the whole mesh, but we've never bothered to enhance this logic to give us information. UserObjects have a routine that runs early (initialSetup) where you could run this kind of logic. If you have any questions, let us know!

azihsan commented 6 years ago

Hi Cody,

thank you for the answer, it is clear now what i should do. I'll let you know if i have some doubts concerning this.

gambka commented 6 years ago

I still have a use for this capability so it is nice to see some work on this.