https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MomentBalancing.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
10#include "MomentBalancing.h"
11
12// MOOSE includes
14#include "Material.h"
15#include "MooseVariable.h"
16#include "PermutationTensor.h"
17#include "RankFourTensor.h"
18#include "RankTwoTensor.h"
19
21
24{
26 params.addClassDescription("Balance of momentum for three-dimensional Cosserat media, notably in "
27 "a Cosserat layered elasticity model.");
28 params.addRequiredRangeCheckedParam<unsigned int>(
29 "component",
30 "component<3",
31 "An integer corresponding to the direction the variable this "
32 "kernel acts in. (0 for x, 1 for y, 2 for z)");
33 params.addParam<std::string>(
34 "appended_property_name", "", "Name appended to material properties to make them unique");
35 params.addRequiredCoupledVar("Cosserat_rotations", "The 3 Cosserat rotation variables");
36 params.addRequiredCoupledVar("displacements", "The 3 displacement variables");
37 params.set<bool>("use_displaced_mesh") = false;
38
39 return params;
40}
41
43 : Kernel(parameters),
44 _stress(getMaterialProperty<RankTwoTensor>("stress" +
45 getParam<std::string>("appended_property_name"))),
46 _Jacobian_mult(getMaterialProperty<RankFourTensor>(
47 "Jacobian_mult" + getParam<std::string>("appended_property_name"))),
48 _component(getParam<unsigned int>("component")),
49 _nrots(coupledComponents("Cosserat_rotations")),
50 _wc_var(_nrots),
51 _ndisp(coupledComponents("displacements")),
52 _disp_var(_ndisp)
53{
54 if (_nrots != 3)
55 mooseError("MomentBalancing: This Kernel is only defined for 3-dimensional simulations so 3 "
56 "Cosserat rotation variables are needed");
57 for (unsigned i = 0; i < _nrots; ++i)
58 _wc_var[i] = coupled("Cosserat_rotations", i);
59
60 if (_ndisp != 3)
61 mooseError("MomentBalancing: This Kernel is only defined for 3-dimensional simulations so 3 "
62 "displacement variables are needed");
63 for (unsigned i = 0; i < _ndisp; ++i)
64 _disp_var[i] = coupled("displacements", i);
65
66 // Following check is necessary to ensure the correct Jacobian is calculated
67 if (_wc_var[_component] != _var.number())
68 mooseError("MomentBalancing: The variable for this Kernel must be equal to the Cosserat "
69 "rotation variable defined by the \"component\" and the \"Cosserat_rotations\" "
70 "parameters");
71}
72
73Real
75{
76 Real the_sum = 0.0;
77 for (const auto j : make_range(Moose::dim))
78 for (const auto k : make_range(Moose::dim))
79 the_sum += PermutationTensor::eps(_component, j, k) * _stress[_qp](j, k);
80 return _test[_i][_qp] * the_sum;
81}
82
83Real
89
90Real
92{
93 // What does 2D look like here?
94 for (unsigned v = 0; v < _ndisp; ++v)
95 if (jvar == _disp_var[v])
98
99 // What does 2D look like here?
100 for (unsigned v = 0; v < _nrots; ++v)
101 if (jvar == _wc_var[v])
104
105 return 0.0;
106}
const double v
registerMooseObject("SolidMechanicsApp", MomentBalancing)
void ErrorVector unsigned int
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0) const
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
void addRequiredCoupledVar(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)
unsigned int _qp
unsigned int _j
unsigned int _i
MooseVariable & _var
const VariablePhiValue & _phi
const VariableTestValue & _test
static InputParameters validParams()
const VariablePhiGradient & _grad_phi
This Kernel computes epsilon_ijk * stress_jk (sum over j and k) "i" is called _component in this clas...
std::vector< unsigned int > _wc_var
the moose variable numbers for the Cosserat rotation degrees of freedom
const unsigned int _nrots
const MaterialProperty< RankTwoTensor > & _stress
the stress tensor (not the moment stress) at the quad-point.
MomentBalancing(const InputParameters &parameters)
const MaterialProperty< RankFourTensor > & _Jacobian_mult
d(stress tensor)/(d strain tensor) Here strain_ij = grad_j disp_i + epsilon_ijk * wc_k
const unsigned int _component
The Kernel computes epsilon_{component j k}*stress_{j k}.
virtual Real computeQpJacobian()
virtual Real computeQpResidual()
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
std::vector< unsigned int > _disp_var
the moose variable numbers for the displacements
static InputParameters validParams()
const unsigned int _ndisp
void mooseError(Args &&... args) const
unsigned int number() const
Real momentJacobian(const RankFourTensor &r4t, unsigned int i, unsigned int k, Real test, const RealGradient &grad_phi)
This is used for the moment-balancing kernel eps_ijk*stress_jk*test, when varied wrt u_k Jacobian ent...
Real momentJacobianWC(const RankFourTensor &r4t, unsigned int i, unsigned int k, Real test, Real phi)
This is used for the moment-balancing kernel eps_ijk*stress_jk*test, when varied wrt w_k (the cossera...
static constexpr std::size_t dim
int eps(unsigned int i, unsigned int j)