Skip to content

Commit

Permalink
Work toward getting boundary material properties check working
Browse files Browse the repository at this point in the history
  • Loading branch information
aeslaughter committed Sep 13, 2017
1 parent b8b25fd commit 65b7a13
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 11 deletions.
2 changes: 1 addition & 1 deletion framework/src/base/FEProblemBase.C
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion framework/src/bcs/IntegratedBC.C
Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion test/include/bcs/MatTestNeumannBC.h
Expand Up @@ -35,7 +35,7 @@ class MatTestNeumannBC : public NeumannBC

const std::string _prop_name;

const MaterialProperty<Real> * _value;
const MaterialProperty<Real> & _value;
};

#endif /* MATTESTNEUMANNBC_H */
12 changes: 4 additions & 8 deletions test/src/bcs/MatTestNeumannBC.C
Expand Up @@ -25,18 +25,14 @@ validParams<MatTestNeumannBC>()
}

MatTestNeumannBC::MatTestNeumannBC(const InputParameters & parameters)
: NeumannBC(parameters), _prop_name(getParam<std::string>("mat_prop"))
: NeumannBC(parameters),
_prop_name(getParam<std::string>("mat_prop")),
_value(getMaterialProperty<Real>("mat_prop"))
{
if (hasBoundaryMaterialProperty<Real>(_prop_name))
_value = &getMaterialPropertyByName<Real>(_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];
}
49 changes: 49 additions & 0 deletions 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
[]
6 changes: 6 additions & 0 deletions test/tests/materials/boundary_material/tests
Expand Up @@ -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"
[]
[]

0 comments on commit 65b7a13

Please sign in to comment.