From d79db77e067cd369ed49fc6bed41270c89bac869 Mon Sep 17 00:00:00 2001 From: Andrew E Slaughter Date: Mon, 15 Jan 2018 16:46:25 -0700 Subject: [PATCH] Create transfer for controlling layered material (refs #107) --- include/controls/LayeredMaterialControl.h | 31 +++++++ src/base/MastodonApp.C | 6 ++ src/controls/LayeredMaterialControl.C | 27 ++++++ src/materials/LinearSoilMaterial.C | 2 + test/tests/controls/gold/layer_control_out.e | Bin 0 -> 27888 bytes test/tests/controls/layer_control.i | 84 +++++++++++++++++++ test/tests/controls/tests | 13 +++ 7 files changed, 163 insertions(+) create mode 100644 include/controls/LayeredMaterialControl.h create mode 100644 src/controls/LayeredMaterialControl.C create mode 100644 test/tests/controls/gold/layer_control_out.e create mode 100644 test/tests/controls/layer_control.i create mode 100644 test/tests/controls/tests diff --git a/include/controls/LayeredMaterialControl.h b/include/controls/LayeredMaterialControl.h new file mode 100644 index 0000000000..96f2bf234d --- /dev/null +++ b/include/controls/LayeredMaterialControl.h @@ -0,0 +1,31 @@ +#ifndef LAYEREDMATERIALCONTROL_H +#define LAYEREDMATERIALCONTROL_H + +// MOOSE includes +#include "Control.h" + +// Forward Declarations +class LayeredMaterialControl; + +template <> +InputParameters validParams(); + +/** + * A control for changing parameters associated with layer ids. + */ +class LayeredMaterialControl : public Control +{ +public: + LayeredMaterialControl(const InputParameters & parameters); + +protected: + virtual void execute() override; + + /// The values of the parameter to control + const std::vector & _current_values; + + /// The values to use from this control + const std::vector & _control_values; +}; + +#endif diff --git a/src/base/MastodonApp.C b/src/base/MastodonApp.C index a14acce1fb..d95e57efed 100644 --- a/src/base/MastodonApp.C +++ b/src/base/MastodonApp.C @@ -45,6 +45,9 @@ #include "ResponseSpectraCalculator.h" #include "HousnerSpectrumIntensity.h" +// Controls +#include "LayeredMaterialControl.h" + // Testing #include "TestLayeredMaterialInterface.h" @@ -123,6 +126,9 @@ MastodonApp::registerObjects(Factory & factory) registerVectorPostprocessor(ResponseSpectraCalculator); registerVectorPostprocessor(HousnerSpectrumIntensity); + // Controls + registerControl(LayeredMaterialControl); + // Testing registerMaterial(TestLayeredMaterialInterfaceDocString); registerKernel(TestLayeredMaterialInterfaceTypeError); diff --git a/src/controls/LayeredMaterialControl.C b/src/controls/LayeredMaterialControl.C new file mode 100644 index 0000000000..8e631893bc --- /dev/null +++ b/src/controls/LayeredMaterialControl.C @@ -0,0 +1,27 @@ +// Mastodon includes +#include "LayeredMaterialControl.h" + +template <> +InputParameters +validParams() +{ + InputParameters params = validParams(); + params.addRequiredParam("parameter", "The name of the parameter to control."); + params.addRequiredParam>("values", "The values to replace on the specified material object."); + return params; +} + +LayeredMaterialControl::LayeredMaterialControl(const InputParameters & parameters) + : Control(parameters), + _current_values(getControllableValue>("parameter")), + _control_values(getParam>("values")) +{ + if (_current_values.size() != _control_values.size()) + mooseError("The layer values specified in the ", name(), " Control object and the values being controlled must be the same size."); +} + +void +LayeredMaterialControl::execute() +{ + setControllableValue>("parameter", _control_values); +} diff --git a/src/materials/LinearSoilMaterial.C b/src/materials/LinearSoilMaterial.C index ca7ed2b5bf..90dec543da 100644 --- a/src/materials/LinearSoilMaterial.C +++ b/src/materials/LinearSoilMaterial.C @@ -21,6 +21,8 @@ validParams() params.addClassDescription("Material for computing the shear wave speed " "and minimum element size as a function " "of shear modulus and density."); + + params.declareControllable("shear_modulus density"); return params; } diff --git a/test/tests/controls/gold/layer_control_out.e b/test/tests/controls/gold/layer_control_out.e new file mode 100644 index 0000000000000000000000000000000000000000..79b8d6af2e16673c91deb52385f2300f09216342 GIT binary patch literal 27888 zcmeHQPjlS172h=fB*$r*riUDQKqr|=I;rH{wIxfQZevB3UA3~5#)>bV4$CF65^FBG zLvn4&mtOk;dhF!XnO=J6p@$xN=%I%m`w{XD+HcVQejvF^?vh+$#WdE$m{}17fgd06 z9v&Wn2Wa=s-EXy8t(Wk-g5Nv5y3#YkC~&+J+_hRiz;A_VuH#9>e}UgC1AiRwir;GF z3?&N45pI&8@_Xix`C0yTZ#*J{o4tK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