idaholab / moose

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

Missing a check for materials on blocks when a material is added ONLY on a boundary #10285

Open permcody opened 6 years ago

permcody commented 6 years ago

Rationale

In MOOSE we have a BlockRestrictable and BoundaryRestrictable class which helps factor out all of the logic required to restrict objects to being active in only a portion of the domain. These classes are currently unaware of each other which requires a number of crazy workaround in the code. It also opens up holes for potential bugs, of which one has been found that is rather critical.

Description

Restricting a material to a boundary erroneously removes the block coverage check due to the fact that Boundary and Block restrictions are somewhat mutually exclusive. While several hacks exist in the framework to make Boundary aware of Block, it's not possible to make them both aware of each other during construction (where much of the current logic exists). The following input file produces an error when the commented line in the material is uncommented: (Supplied by Kevin Clarno).

[Mesh]
  type = GeneratedMesh
  dim = 2
  nx = 4
  ny = 4
  xmin = 0.0
  ymin = 0.0
  xmax = 1.0
  ymax = 1.0
[]

[Problem]
  coord_type = RZ
[]

[Variables]
  [./temp]
    initial_condition = 600.00
  [../]
[]

[Kernels]
  active = 'diff src'

  [./diff]
    type = HeatConduction
    variable = temp
  [../]

  [./src]
    type = HeatSource
    variable = temp
    value = 1000000000.
  [../]

[]

[Materials]
  [./clad_thermal]
    type = HeatConductionMaterial
    thermal_conductivity = 5.
#    boundary = right
  [../]
[]

[BCs]
  [./right]
    type = DirichletBC
    value = 566
    variable = temp
    boundary = right
  [../]

[]

[Executioner]
  type = Transient
  dt = 1
  num_steps = 1
  l_tol = 1.0e-12
  nl_abs_tol = 1.0e-8
  nl_rel_tol = 1.0e-8
  solve_type = 'PJFNK'
  line_search = 'none'
[]

[Outputs]
  [./console]
    type = Console
    output_linear = true
  [../]
[]

Impact

This has huge implications. This means that we allow calculations to continue which will access either uninitialized vectors, or stale vectors.

YaqiWang commented 6 years ago

Wow. As a reminder: even the coverage check is not completely done yet.

permcody commented 6 years ago

Now that we have the workaround in, I'm dropping the priority to normal.