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");
33 _c_name(coupledName(
"c", 0)),
35 _dF_name(getParam<MaterialPropertyName>(
"force_density")),
38 derivativePropertyNameFirst(_dF_name, _c_name))),
39 _op_num(coupledComponents(
"etas")),
45 for (
unsigned int i = 0; i <
_op_num; ++i)
49 _dFdeta[i] = &getMaterialPropertyByName<std::vector<RealGradient>>(
64 if (_fe_problem.currentlyComputingJacobian())
70 for (
unsigned int i = 0; i <
_op_num; ++i)
82 if (i == op_to_grains[
j])
85 for (
_qp = 0;
_qp < _qrule->n_points(); ++
_qp)
90 (_current_elem->vertex_average() - centroid).cross(
_dF[
_qp][
j]);
109 if (i == op_to_grains[
j])
112 for (
_qp = 0;
_qp < _qrule->n_points(); ++
_qp)
117 factor * (_current_elem->vertex_average() - centroid).cross(
_dFdc[
_qp][
j]);
125 compute_torque_jacobian_c(0);
127 compute_torque_jacobian_c(1);
129 compute_torque_jacobian_c(2);
133 for (
unsigned int i = 0; i <
_op_num; ++i)
137 if (
j == op_to_grains[
k])
140 for (
_qp = 0;
_qp < _qrule->n_points(); ++
_qp)
147 (_current_elem->vertex_average() - centroid).cross((*
_dFdeta[i])[
_qp][
k]);
155 compute_torque_jacobian_eta(0);
157 compute_torque_jacobian_eta(1);
159 compute_torque_jacobian_eta(2);
178 if (_fe_problem.currentlyComputingJacobian())
181 for (
unsigned int i = 0; i <
_op_num; ++i)
190 for (
unsigned int i = 0; i <
_ncomp; ++i)
192 if (_fe_problem.currentlyComputingJacobian())
202 const std::vector<RealGradient> &
208 const std::vector<RealGradient> &
214 const std::vector<Real> &
219 const std::vector<std::vector<Real>> &
virtual const std::vector< RealGradient > & getTorqueValues() const
const GrainTrackerInterface & _grain_tracker
provide UserObject for calculating grain volumes and centers
This class defines the interface for the GrainTracking objects.
static InputParameters validParams()
const MaterialProperty< std::vector< RealGradient > > & _dFdc
material property that provides jacobian of force density with respect to c
std::vector< const MaterialProperty< std::vector< RealGradient > > * > _dFdeta
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
This class is here to get the force and torque acting on a grain.
ComputeExternalGrainForceAndTorque(const InputParameters ¶meters)
virtual const std::vector< RealGradient > & getForceValues() const
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
virtual void threadJoin(const UserObject &y)
const std::vector< double > y
std::vector< std::vector< Real > > _force_torque_eta_jacobian_store
std::vector< RealGradient > _torque_values
MaterialPropertyName _dF_name
material property that provides force density
virtual std::size_t getTotalFeatureCount() const =0
Returns a number large enough to contain the largest ID for all grains in use.
const unsigned int _op_num
no. of order parameters
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.
std::vector< Real > _force_torque_c_jacobian_store
vector storing jacobian of grain force and torque values
registerMooseObject("PhaseFieldApp", ComputeExternalGrainForceAndTorque)
virtual const std::vector< Real > & getForceCJacobians() const
virtual Point getGrainCentroid(unsigned int grain_id) const =0
Returns the centroid for the given grain number.
std::vector< unsigned int > _vals_var
const MaterialProperty< std::vector< RealGradient > > & _dF
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
std::vector< VariableName > _vals_name
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
virtual void executeJacobian(unsigned int jvar)
static const std::string k
for(PetscInt i=0;i< nvars;++i)
std::vector< Real > _force_torque_store
vector storing grain force and torque values
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const
virtual void initialize()