13 #include "libmesh/quadrature.h" 21 params.
addClassDescription(
"Userobject for calculating force and torque acting on a grain");
22 params.
addParam<MaterialPropertyName>(
"force_density",
"force_density",
"Force density material");
23 params.
addParam<UserObjectName>(
"grain_data",
"center of mass of grains");
25 params.
addCoupledVar(
"etas",
"Array of coupled order parameters");
32 _c_name(coupledName(
"c", 0)),
34 _dF_name(getParam<MaterialPropertyName>(
"force_density")),
37 derivativePropertyNameFirst(_dF_name, _c_name))),
38 _op_num(coupledComponents(
"etas")),
44 for (
unsigned int i = 0; i <
_op_num; ++i)
48 _dFdgradeta[i] = &getMaterialPropertyByName<std::vector<Real>>(
63 if (_fe_problem.currentlyComputingJacobian())
69 for (
unsigned int i = 0; i <
_op_num; ++i)
81 if (i == op_to_grains[
j])
84 for (
_qp = 0;
_qp < _qrule->n_points(); ++
_qp)
89 (_current_elem->vertex_average() - centroid).cross(
_dF[
_qp][
j]);
108 if (i == op_to_grains[
j])
111 for (
_qp = 0;
_qp < _qrule->n_points(); ++
_qp)
116 factor * (_current_elem->vertex_average() - centroid).cross(
_dFdc[
_qp][
j]);
124 compute_torque_jacobian_c(0);
126 compute_torque_jacobian_c(1);
128 compute_torque_jacobian_c(2);
132 for (
unsigned int i = 0; i <
_op_num; ++i)
136 if (
j == op_to_grains[
k])
139 for (
_qp = 0;
_qp < _qrule->n_points(); ++
_qp)
144 factor * (_current_elem->vertex_average() - centroid).cross(_grad_phi[_j][
_qp]);
146 factor * _grad_phi[_j][
_qp](0);
148 factor * _grad_phi[_j][
_qp](1);
150 factor * _grad_phi[_j][
_qp](2);
152 compute_torque_jacobian_eta(0);
154 compute_torque_jacobian_eta(1);
156 compute_torque_jacobian_eta(2);
175 if (_fe_problem.currentlyComputingJacobian())
178 for (
unsigned int i = 0; i <
_op_num; ++i)
187 for (
unsigned int i = 0; i <
_ncomp; ++i)
189 if (_fe_problem.currentlyComputingJacobian())
193 for (
unsigned int i = 0; i <
_op_num; ++i)
199 const std::vector<RealGradient> &
205 const std::vector<RealGradient> &
211 const std::vector<Real> &
216 const std::vector<std::vector<Real>> &
const GrainTrackerInterface & _grain_tracker
provide UserObject for calculating grain volumes and centers
ComputeGrainForceAndTorque(const InputParameters ¶meters)
std::vector< Real > _force_torque_c_jacobian_store
vector storing jacobian of grain force and torque values
This class defines the interface for the GrainTracking objects.
This class provides interface for extracting the forces and torques computed in other UserObjects...
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const
static InputParameters validParams()
virtual void executeJacobian(unsigned int jvar)
virtual const std::vector< RealGradient > & getForceValues() const
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
const std::vector< double > y
std::vector< std::vector< Real > > _force_torque_eta_jacobian_store
virtual std::size_t getTotalFeatureCount() const =0
Returns a number large enough to contain the largest ID for all grains in use.
const MaterialProperty< std::vector< RealGradient > > & _dF
virtual const std::vector< unsigned int > & getVarToFeatureVector(dof_id_type elem_id) const =0
Returns a list of active unique feature ids for a particular element.
virtual void threadJoin(const UserObject &y)
std::vector< RealGradient > _torque_values
std::vector< const MaterialProperty< std::vector< Real > > * > _dFdgradeta
virtual Point getGrainCentroid(unsigned int grain_id) const =0
Returns the centroid for the given grain number.
This class is here to get the force and torque acting on a grain.
virtual const std::vector< RealGradient > & getTorqueValues() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObject("PhaseFieldApp", ComputeGrainForceAndTorque)
static InputParameters validParams()
std::vector< unsigned int > _vals_var
MaterialPropertyName _dF_name
material property that provides force density
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
unsigned int _op_num
no. of order parameters
const MaterialProperty< std::vector< RealGradient > > & _dFdc
material property that provides jacobian of force density with respect to c
std::vector< VariableName > _vals_name
virtual const std::vector< Real > & getForceCJacobians() const
virtual void initialize()
static const std::string k
std::vector< Real > _force_torque_store
vector storing grain force and torque values