diff --git a/framework/src/base/FEProblemBase.C b/framework/src/base/FEProblemBase.C index 9a425f7cbb94..bce229b621c9 100644 --- a/framework/src/base/FEProblemBase.C +++ b/framework/src/base/FEProblemBase.C @@ -4691,7 +4691,7 @@ FEProblemBase::checkProblemIntegrity() // Check material properties on blocks and boundaries checkBlockMatProps(); - // checkBoundaryMatProps(); + checkBoundaryMatProps(); // Check that material properties exist when requested by other properties on a given block const auto & materials = _all_materials.getActiveObjects(); diff --git a/framework/src/bcs/IntegratedBC.C b/framework/src/bcs/IntegratedBC.C index 144cfeffa4f7..ac56659bf0b8 100644 --- a/framework/src/bcs/IntegratedBC.C +++ b/framework/src/bcs/IntegratedBC.C @@ -54,7 +54,7 @@ IntegratedBC::IntegratedBC(const InputParameters & parameters) : BoundaryCondition(parameters, false), // False is because this is NOT nodal RandomInterface(parameters, _fe_problem, _tid, false), CoupleableMooseVariableDependencyIntermediateInterface(this, false), - MaterialPropertyInterface(this), + MaterialPropertyInterface(this, boundaryIDs()), _current_elem(_assembly.elem()), _current_elem_volume(_assembly.elemVolume()), _current_side(_assembly.side()), diff --git a/test/include/bcs/MatTestNeumannBC.h b/test/include/bcs/MatTestNeumannBC.h index b99a8f579890..f82779fd10ee 100644 --- a/test/include/bcs/MatTestNeumannBC.h +++ b/test/include/bcs/MatTestNeumannBC.h @@ -35,7 +35,7 @@ class MatTestNeumannBC : public NeumannBC const std::string _prop_name; - const MaterialProperty * _value; + const MaterialProperty & _value; }; #endif /* MATTESTNEUMANNBC_H */ diff --git a/test/src/bcs/MatTestNeumannBC.C b/test/src/bcs/MatTestNeumannBC.C index a36e1a4b7195..8df4b856053e 100644 --- a/test/src/bcs/MatTestNeumannBC.C +++ b/test/src/bcs/MatTestNeumannBC.C @@ -25,18 +25,14 @@ validParams() } MatTestNeumannBC::MatTestNeumannBC(const InputParameters & parameters) - : NeumannBC(parameters), _prop_name(getParam("mat_prop")) + : NeumannBC(parameters), + _prop_name(getParam("mat_prop")), + _value(getMaterialProperty("mat_prop")) { - if (hasBoundaryMaterialProperty(_prop_name)) - _value = &getMaterialPropertyByName(_prop_name); - - else - mooseError( - "The material property ", _prop_name, " is not defined on all boundaries of this object"); } Real MatTestNeumannBC::computeQpResidual() { - return -_test[_i][_qp] * (*_value)[_qp]; + return -_test[_i][_qp] * _value[_qp]; } diff --git a/test/tests/materials/boundary_material/boundary_check.i b/test/tests/materials/boundary_material/boundary_check.i new file mode 100644 index 000000000000..9c90d2d1471e --- /dev/null +++ b/test/tests/materials/boundary_material/boundary_check.i @@ -0,0 +1,49 @@ +[Mesh] + type = GeneratedMesh + dim = 2 + nx = 10 + ny = 10 +[] + +[Variables] + [./u] + [../] +[] + +[Kernels] + [./diff] + type = Diffusion + variable = u + [../] +[] + +[BCs] + [./bc_left] + type = MatTestNeumannBC + variable = u + boundary = left + mat_prop = 'prop' + [../] + [./right] + type = DirichletBC + variable = u + boundary = right + value = 1 + [../] +[] + +[Problem] + type = FEProblem + solve = false +[] + +[Executioner] + type = Steady + solve_type = 'PJFNK' + petsc_options_iname = '-pc_type -pc_hypre_type' + petsc_options_value = 'hypre boomeramg' +[] + +[Outputs] + exodus = true +[] diff --git a/test/tests/materials/boundary_material/tests b/test/tests/materials/boundary_material/tests index f97c96fc8a50..14dab8e0d8fb 100644 --- a/test/tests/materials/boundary_material/tests +++ b/test/tests/materials/boundary_material/tests @@ -12,4 +12,10 @@ input = 'elem_aux_bc_on_bnd.i' exodiff = 'elem_aux_bc_on_bnd_out.e' [../] + + [boundary_check] + type = RunException + input = 'boundary_check.i' + expect_err = "Material property 'mat_prop', requested by 'bc_left' is not defined on boundary left" + [] []