https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GlobalDisplacementAux.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
12
13// MOOSE includes
14#include "Assembly.h"
15#include "SystemBase.h"
16#include "RankTwoTensor.h"
17
19
22{
25 "AuxKernel to visualize the displacements generated by the global strain tensor");
26 params.addCoupledVar("scalar_global_strain",
27 "Scalar variable providing global strain components");
28 params.addCoupledVar("displacements", "The name of the displacement variables");
29 params.addRequiredParam<unsigned int>("component",
30 "The displacement component to consider for this kernel");
31 params.addParam<bool>(
32 "output_global_displacement", false, "Option to output global displacement only");
33 params.addRequiredParam<UserObjectName>("global_strain_uo",
34 "The name of the GlobalStrainUserObject");
35 params.addParam<Point>("reference_point",
36 Point(0, 0, 0),
37 "The coordinate of the center/fixed point of the simulation");
38
39 // Default this object to get executed before the displaced mesh update.
40 // This way the AuxVars set by this object can be used as mesh displacements.
41 params.set<ExecFlagEnum>("execute_on") = EXEC_PRE_DISPLACE;
42
43 return params;
44}
45
47 : AuxKernel(parameters),
48 _scalar_global_strain(coupledScalarValue("scalar_global_strain")),
49 _component(getParam<unsigned int>("component")),
50 _output_global_disp(getParam<bool>("output_global_displacement")),
51 _pst(dynamic_cast<const GlobalStrainUserObjectInterface &>(
52 getUserObjectBase("global_strain_uo"))),
53 _periodic_dir(_pst.getPeriodicDirections()),
54 _ref_point(parameters.get<Point>("reference_point")),
55 _dim(_mesh.dimension()),
56 _ndisp(coupledComponents("displacements")),
57 _disp(coupledValues("displacements"))
58{
59 if (!isNodal())
60 paramError("variable", "GlobalDisplacementAux must be used on a nodal auxiliary variable");
61
62 if (_component >= _dim)
63 paramError("component",
64 "The component ",
66 " does not exist for ",
67 _dim,
68 " dimensional problems");
69}
70
71Real
73{
74 RankTwoTensor strain;
76
77 for (unsigned int dir = 0; dir < _dim; ++dir)
78 if (!_periodic_dir(dir))
79 for (unsigned int var = 0; var < _ndisp; ++var)
80 strain(dir, var) = 0.0;
81
82 const RealVectorValue & global_disp = strain * ((*_current_node) - _ref_point);
83
85 return global_disp(_component);
86 else
87 return global_disp(_component) + (*_disp[_component])[_qp];
88}
registerMooseObject("SolidMechanicsApp", GlobalDisplacementAux)
const ExecFlagType EXEC_PRE_DISPLACE
void ErrorVector unsigned int
static InputParameters validParams()
const VectorValue< bool > & _periodic_dir
const std::vector< const VariableValue * > _disp
Displacement variables.
const unsigned int _component
Component of the displacement vector.
const unsigned int _ndisp
Number of displacement variables.
virtual Real computeValue() override
GlobalDisplacementAux(const InputParameters &parameters)
static InputParameters validParams()
const VariableValue & _scalar_global_strain
This class provides interface for extracting the periodic directions, residual, and jacobian values f...
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void addCoupledVar(const std::string &name, const std::string &doc_string)
void paramError(const std::string &param, Args... args) const
void fillFromScalarVariable(const VariableValue &scalar_variable)