From 1b96d731b858a0f39c81f6a9c1a0d30014644bc3 Mon Sep 17 00:00:00 2001 From: Jesse Carter Date: Wed, 14 Sep 2016 22:30:45 -0400 Subject: [PATCH] MaterialDiffusion takes a property name from input file, closes #21 --- include/kernels/MaterialDiffusion.h | 2 ++ src/kernels/MaterialDiffusion.C | 7 +++++-- .../circle_average_material_property.i | 2 +- .../points_from_inserter.i | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/kernels/MaterialDiffusion.h b/include/kernels/MaterialDiffusion.h index 20fc4474de..bf04082200 100644 --- a/include/kernels/MaterialDiffusion.h +++ b/include/kernels/MaterialDiffusion.h @@ -37,6 +37,8 @@ class MaterialDiffusion : public Diffusion virtual Real computeQpResidual(); virtual Real computeQpJacobian(); + std::string _diffusivity_name; + /** * This MooseArray will hold the reference we need to our * material property from the Material class diff --git a/src/kernels/MaterialDiffusion.C b/src/kernels/MaterialDiffusion.C index b1c697ff5b..246d777267 100644 --- a/src/kernels/MaterialDiffusion.C +++ b/src/kernels/MaterialDiffusion.C @@ -22,14 +22,17 @@ template<> InputParameters validParams() { InputParameters params = validParams(); + params.addRequiredParam("diffusivity_name", "Name of the material property for diffusion coefficient"); return params; } MaterialDiffusion::MaterialDiffusion(const InputParameters & parameters) : Diffusion(parameters), - _diffusivity(getMaterialProperty("diffusivity")) -{} + _diffusivity_name(getParam("diffusivity_name")), + _diffusivity(getMaterialProperty(_diffusivity_name)) +{ +} Real MaterialDiffusion::computeQpResidual() diff --git a/tests/userobjects/circle_average_material_property/circle_average_material_property.i b/tests/userobjects/circle_average_material_property/circle_average_material_property.i index c226aa97e4..43db2d12ed 100644 --- a/tests/userobjects/circle_average_material_property/circle_average_material_property.i +++ b/tests/userobjects/circle_average_material_property/circle_average_material_property.i @@ -14,7 +14,7 @@ [./diff] type = MaterialDiffusion variable = u - prop_name = diffusivity + diffusivity_name = diffusivity [../] [] diff --git a/tests/userobjects/circle_average_material_property/points_from_inserter.i b/tests/userobjects/circle_average_material_property/points_from_inserter.i index f9bdeb6538..9d6818e96d 100644 --- a/tests/userobjects/circle_average_material_property/points_from_inserter.i +++ b/tests/userobjects/circle_average_material_property/points_from_inserter.i @@ -30,7 +30,7 @@ [./mat_diff] type = MaterialDiffusion variable = u - prop_name = diffusivity + diffusivity_name = diffusivity [../] [./event_inserter_source]