Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding MaterialRealCMMAux and some other changes. #376

Merged
merged 6 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions doc/content/source/auxkernels/MaterialRealCMMAux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MaterialRealCMMAux

!syntax description /AuxKernels/MaterialRealCMMAux

## Description

`MaterialRealCMMAux` can be used to populate an `AuxVariable` with an element of a material property that is of type, ColumnMajorMatrix (CMM). In MASTODON, a common use case is accessing the deformation or force CMMs from link elements when the [`LinearSpring`](source/materials/LinearSpring.md) material or any of the seismic isolator materials (e.g., [`ComputeFPIsolatorElasticity`](source/materials/ComputeFPIsolatorElasticity.md)) is used. This `AuxKernel` and the corresponding `AuxVariable` should be block-restricted to blocks where the material property given by the `property` input parameter below is defined.

For example, the following input file syntax will create the AuxVariable field called `global_force_x` with the X direction force in the spring element modeled using the LinearSpring material. Users can look at the LinearSpring.C file in the source code to see that this material has several material properties such as "global_forces", "global_moments", etc. In the case of the linear spring material, the "global_forces" material property is a CMM of size 6x1 and stores the forces in the spring in the global co-ordinate system. The AuxKernel to make this calculation is listed below.

!listing test/tests/auxkernels/materialrealcmm/spring_static.i block=AuxKernels

In this input, the AuxKernel takes the element (0, 0) from the CMM material property named, "global_forces" in the linear spring material. (See LinearSpring.C for other material properties.) In this example, the linear spring material is only defined in block '0' and therefore this AuxKernel and AuxVariable are also restricted to this block. The element (0, 0) of the material property "global_forces" corresponds to the axial force in the spring. Currently, in order to know what each of the elements in a material property CMM correspond to, users will either have to go through the source code or reach out to one of the MASTODON developers [here](help/contact_us.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This information is very helpful to the users.


!syntax parameters /AuxKernels/MaterialRealCMMAux

!syntax inputs /AuxKernels/MaterialRealCMMAux

!syntax children /AuxKernels/MaterialRealCMMAux
49 changes: 49 additions & 0 deletions include/auxkernels/MaterialRealCMMAux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MASTODON */
/* */
/* (c) 2015 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/*************************************************/

#pragma once

// MOOSE includes
#include "MaterialAuxBase.h"

// Forward declarations
class MaterialRealCMMAux;

template <>
InputParameters validParams<MaterialRealCMMAux>();

/**
* AuxKernel for outputting a DenseMatrix<Real> material property component to an AuxVariable
*/
class MaterialRealCMMAux : public MaterialAuxBase<ColumnMajorMatrix>
{
public:
static InputParameters validParams();

/**
* Class constructor
* @param parameters The input parameters for this AuxKernel
*/
MaterialRealCMMAux(const InputParameters & parameters);

protected:
/// Returns the component of the tensor for output
virtual Real getRealValue() override;

/// The row index to output
unsigned int _row;

/// The column index to output
unsigned int _col;
};
10 changes: 5 additions & 5 deletions include/kernels/StressDivergenceSpring.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ class StressDivergenceSpring : public Kernel
std::vector<unsigned int> _rot_var;

/// Spring forces
const MaterialProperty<RealVectorValue> & _spring_forces_global;
const MaterialProperty<ColumnMajorMatrix> & _spring_forces_global;

/// Spring moments
const MaterialProperty<RealVectorValue> & _spring_moments_global;
const MaterialProperty<ColumnMajorMatrix> & _spring_moments_global;

/// Displacement stiffness matrix
const MaterialProperty<RankTwoTensor> & _kdd;
const MaterialProperty<ColumnMajorMatrix> & _kdd;

/// Rotation stiffness matrix
const MaterialProperty<RankTwoTensor> & _krr;
const MaterialProperty<ColumnMajorMatrix> & _krr;

/// Rotation stiffness matrix
const MaterialProperty<RankTwoTensor> & _total_global_to_local_rotation;
const MaterialProperty<ColumnMajorMatrix> & _total_global_to_local_rotation;
};

#endif // STRESSDIVERGENCESPRING_H
43 changes: 23 additions & 20 deletions include/materials/LinearSpring.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class LinearSpring : public Material
LinearSpring(const InputParameters & parameters);

protected:
/// Initialize stateful properties
virtual void initQpStatefulProperties() override;

/// Compute properties for each qp
virtual void computeQpProperties() override;

Expand Down Expand Up @@ -61,10 +64,10 @@ class LinearSpring : public Material
std::vector<unsigned int> _disp_num;

/// Deformations in the spring calculated at a time t in the spring local coordinates
MaterialProperty<RealVectorValue> & _deformations;
MaterialProperty<ColumnMajorMatrix> & _deformations;

/// Rotations in the spring calculated at a time t in the spring local coordinates
MaterialProperty<RealVectorValue> & _rotations;
MaterialProperty<ColumnMajorMatrix> & _rotations;

/// Axial stiffness of the spring (local x direction)
const VariableValue & _kx;
Expand All @@ -85,58 +88,58 @@ class LinearSpring : public Material
const VariableValue & _krz;

/// Global displacement at node 0 of the spring element
RealVectorValue _global_disp0; // node 0
ColumnMajorMatrix _global_disp0; // node 0

/// Global displacement at node 1 of the spring element
RealVectorValue _global_disp1; // node 1
ColumnMajorMatrix _global_disp1; // node 1

/// Global rotation at node 0 of the spring element
RealVectorValue _global_rot0; // node 0
ColumnMajorMatrix _global_rot0; // node 0

/// Global rotation at node 1 of the spring element
RealVectorValue _global_rot1; // node 1
ColumnMajorMatrix _global_rot1; // node 1

/// Local displacement at node 0 of the spring element
RealVectorValue _local_disp0; // node 0
ColumnMajorMatrix _local_disp0; // node 0

/// Local displacement at node 1 of the spring element
RealVectorValue _local_disp1; // node 1
ColumnMajorMatrix _local_disp1; // node 1

/// Local rotation at node 0 of the spring element
RealVectorValue _local_rot0; // node 0
ColumnMajorMatrix _local_rot0; // node 0

/// Local rotation at node 1 of the spring element
RealVectorValue _local_rot1; // node 1
ColumnMajorMatrix _local_rot1; // node 1

/// Spring forces in the local coordinate system
RealVectorValue _spring_forces_local;
ColumnMajorMatrix _spring_forces_local;

// Spring moments in the local coordinate system
RealVectorValue _spring_moments_local;
ColumnMajorMatrix _spring_moments_local;

/// Spring displacement stiffness matrix in the local coordinate system
RankTwoTensor _kdd_local;
ColumnMajorMatrix _kdd_local;

/// Spring rotational stiffness matrix in the local coordinate system
RankTwoTensor _krr_local;
ColumnMajorMatrix _krr_local;

/// Spring forces in the global coordinate system
MaterialProperty<RealVectorValue> & _spring_forces_global;
MaterialProperty<ColumnMajorMatrix> & _spring_forces_global;

/// Spring moments in the global coordinate system
MaterialProperty<RealVectorValue> & _spring_moments_global;
MaterialProperty<ColumnMajorMatrix> & _spring_moments_global;

/// Spring displacement stiffness matrix in the global coordinate system
MaterialProperty<RankTwoTensor> & _kdd;
MaterialProperty<ColumnMajorMatrix> & _kdd;

/// Spring rotational stiffness matrix in the global coordinate system
MaterialProperty<RankTwoTensor> & _krr;
MaterialProperty<ColumnMajorMatrix> & _krr;

/// Rotational transformation from global coordinate system to spring local configuration at t = 0
RankTwoTensor _original_global_to_local_rotation;
ColumnMajorMatrix _original_global_to_local_rotation;

/// Rotational transformation from global coordinate system to spring local configuration at any time
MaterialProperty<RankTwoTensor> & _total_global_to_local_rotation;
MaterialProperty<ColumnMajorMatrix> & _total_global_to_local_rotation;
};

#endif // LINEARSPRING_H
45 changes: 45 additions & 0 deletions src/auxkernels/MaterialRealCMMAux.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MASTODON */
/* */
/* (c) 2015 Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/* */
/* Prepared by Battelle Energy Alliance, LLC */
/* With the U. S. Department of Energy */
/* */
/* See COPYRIGHT for full restrictions */
/*************************************************/

#include "MaterialRealCMMAux.h"

registerMooseObject("MastodonApp", MaterialRealCMMAux);

defineLegacyParams(MaterialRealCMMAux);

InputParameters
MaterialRealCMMAux::validParams()
{
InputParameters params = MaterialAuxBase<>::validParams();
params.addClassDescription(
"Populate an auxiliary variable with an entry from a ColumnMajorMatrix material property.");
params.addParam<unsigned int>("row", 0, "The row component to consider for this kernel");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will the user know which row to use here?

params.addParam<unsigned int>("column", 0, "The column component to consider for this kernel");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to previous, how to know which column to use?

return params;
}

MaterialRealCMMAux::MaterialRealCMMAux(const InputParameters & parameters)
: MaterialAuxBase<ColumnMajorMatrix>(parameters),
_row(getParam<unsigned int>("row")),
_col(getParam<unsigned int>("column"))
{
}

Real
MaterialRealCMMAux::getRealValue()
{
if (_row >= _prop[_qp].n() || _col >= _prop[_qp].m())
mooseError("In ", name(), " the row or column parameter is out of bounds.");
return _prop[_qp](_row, _col);
}
10 changes: 5 additions & 5 deletions src/kernels/StressDivergenceSpring.C
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ StressDivergenceSpring::StressDivergenceSpring(const InputParameters & parameter
_disp_var(_ndisp),
_nrot(coupledComponents("rotations")),
_rot_var(_nrot),
_spring_forces_global(getMaterialPropertyByName<RealVectorValue>("global_forces")),
_spring_moments_global(getMaterialPropertyByName<RealVectorValue>("global_moments")),
_kdd(getMaterialPropertyByName<RankTwoTensor>("displacement_stiffness_matrix")),
_krr(getMaterialPropertyByName<RankTwoTensor>("rotation_stiffness_matrix")),
_spring_forces_global(getMaterialPropertyByName<ColumnMajorMatrix>("global_forces")),
_spring_moments_global(getMaterialPropertyByName<ColumnMajorMatrix>("global_moments")),
_kdd(getMaterialPropertyByName<ColumnMajorMatrix>("displacement_stiffness_matrix")),
_krr(getMaterialPropertyByName<ColumnMajorMatrix>("rotation_stiffness_matrix")),
_total_global_to_local_rotation(
getMaterialPropertyByName<RankTwoTensor>("total_global_to_local_rotation"))
getMaterialPropertyByName<ColumnMajorMatrix>("total_global_to_local_rotation"))
{
if (_component > 5)
mooseError("Error in StressDivergenceSpring block ",
Expand Down
6 changes: 4 additions & 2 deletions src/materials/ComputeLRIsolatorElasticity.C
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ ComputeLRIsolatorElasticity::validParams()
"Switch for modeling strength degradation due to lead core heating."); // Strength degradation
// due to heating
// Material properties
params.addRequiredParam<Real>("fy", "Yield stress of the bearing.");
params.addRequiredParam<Real>("alpha", "Yield displacement of the bearing.");
params.addRequiredParam<Real>("fy", "Yield strength of the bearing.");
params.addRequiredParam<Real>("alpha",
"Ratio of post-yield shear stiffness to the initial elastic shear "
"stiffness of the bearing. This is dimensionless");
params.addRequiredParam<Real>("G_rubber", "Shear modulus of rubber.");
params.addRequiredParam<Real>("K_rubber", "Bulk modulus of rubber.");
params.addRequiredParam<Real>("D1", "Diameter of lead core.");
Expand Down
32 changes: 25 additions & 7 deletions src/materials/LinearSpring.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ LinearSpring::LinearSpring(const InputParameters & parameters)
_ndisp(coupledComponents("displacements")),
_rot_num(3),
_disp_num(3),
_deformations(declareProperty<RealVectorValue>("deformations")),
_rotations(declareProperty<RealVectorValue>("rotations")),
_deformations(declareProperty<ColumnMajorMatrix>("deformations")),
_rotations(declareProperty<ColumnMajorMatrix>("rotations")),
_kx(coupledValue("kx")),
_ky(coupledValue("ky")),
_kz(coupledValue("kz")),
_krx(coupledValue("krx")),
_kry(coupledValue("kry")),
_krz(coupledValue("krz")),
_spring_forces_global(declareProperty<RealVectorValue>("global_forces")),
_spring_moments_global(declareProperty<RealVectorValue>("global_moments")),
_kdd(declareProperty<RankTwoTensor>("displacement_stiffness_matrix")),
_krr(declareProperty<RankTwoTensor>("rotation_stiffness_matrix")),
_spring_forces_global(declareProperty<ColumnMajorMatrix>("global_forces")),
_spring_moments_global(declareProperty<ColumnMajorMatrix>("global_moments")),
_kdd(declareProperty<ColumnMajorMatrix>("displacement_stiffness_matrix")),
_krr(declareProperty<ColumnMajorMatrix>("rotation_stiffness_matrix")),
_total_global_to_local_rotation(
declareProperty<RankTwoTensor>("total_global_to_local_rotation"))
declareProperty<ColumnMajorMatrix>("total_global_to_local_rotation"))
{
// Checking for consistency between length of the provided displacements and rotations vector
if (_ndisp != _nrot)
Expand All @@ -77,6 +77,24 @@ LinearSpring::LinearSpring(const InputParameters & parameters)
}
}

void
LinearSpring::initQpStatefulProperties()
{
_deformations[_qp].reshape(3, 1);
_rotations[_qp].reshape(3, 1);
_spring_forces_global[_qp].reshape(3, 1);
_spring_forces_global[_qp].zero();
_spring_moments_global[_qp].reshape(3, 1);
_kdd[_qp].reshape(3, 3);
_krr[_qp].reshape(3, 3);
_total_global_to_local_rotation[_qp].reshape(3, 3);
_original_global_to_local_rotation.reshape(3, 3);
_global_disp0.reshape(3, 1);
_global_disp1.reshape(3, 1);
_global_rot0.reshape(3, 1);
_global_rot1.reshape(3, 1);
}

void
LinearSpring::computeQpProperties()
{
Expand Down
Loading