https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ConstantGrainForceAndTorque.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
11
13
16{
18 params.addClassDescription("Userobject for calculating force and torque acting on a grain");
19 params.addParam<std::vector<Real>>("force", "force acting on grains");
20 params.addParam<std::vector<Real>>("torque", "torque acting on grains");
21 return params;
22}
23
26 GeneralUserObject(parameters),
27 _F(getParam<std::vector<Real>>("force")),
28 _M(getParam<std::vector<Real>>("torque")),
29 _grain_num(_F.size() / 3),
30 _ncomp(6 * _grain_num),
31 _force_values(_grain_num),
32 _torque_values(_grain_num)
33{
34}
35
36void
38{
39 unsigned int total_dofs = _subproblem.es().n_dofs();
40 for (unsigned int i = 0; i < _grain_num; ++i)
41 {
42 _force_values[i](0) = _F[3 * i + 0];
43 _force_values[i](1) = _F[3 * i + 1];
44 _force_values[i](2) = _F[3 * i + 2];
45 _torque_values[i](0) = _M[3 * i + 0];
46 _torque_values[i](1) = _M[3 * i + 1];
47 _torque_values[i](2) = _M[3 * i + 2];
48 }
49
51 {
52 _c_jacobians.assign(6 * _grain_num * total_dofs, 0.0);
54 for (unsigned int i = 0; i < _grain_num; ++i)
55 _eta_jacobians[i].assign(6 * _grain_num * total_dofs, 0.0);
56 }
57}
58
59const std::vector<RealGradient> &
64
65const std::vector<RealGradient> &
70
71const std::vector<Real> &
76
77const std::vector<std::vector<Real>> &
registerMooseObject("PhaseFieldApp", ConstantGrainForceAndTorque)
This class is here to get the force and torque acting on a grain.
virtual const std::vector< RealGradient > & getTorqueValues() const
ConstantGrainForceAndTorque(const InputParameters &parameters)
virtual const std::vector< Real > & getForceCJacobians() const
std::vector< RealGradient > _torque_values
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
std::vector< std::vector< Real > > _eta_jacobians
virtual const std::vector< RealGradient > & getForceValues() const
std::vector< Real > _M
Applied torque on particles, size should be 3 times no. of grains.
std::vector< Real > _F
Applied force on particles, size should be 3 times no. of grains.
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const
static InputParameters validParams()
This class provides interface for extracting the forces and torques computed in other UserObjects.
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)
const bool & currentlyComputingJacobian() const
virtual libMesh::EquationSystems & es()=0
SubProblem & _subproblem
FEProblemBase & _fe_problem
std::size_t n_dofs() const