https://mooseframework.inl.gov
AntitrappingCurrent.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 "AntitrappingCurrent.h"
11 
13 
16 {
18  params.addClassDescription(
19  "Kernel that provides antitrapping current at the interface for alloy solidification");
20  return params;
21 }
22 
24  : CoupledSusceptibilityTimeDerivative(parameters), _grad_v(coupledGradient("v"))
25 {
26 }
27 
28 Real
30 {
31  const Real norm_sq = _grad_v[_qp].norm_sq();
33  return 0.0;
34 
35  return _F[_qp] * _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] / std::sqrt(norm_sq);
36 }
37 
38 Real
40 {
41  const Real norm_sq = _grad_v[_qp].norm_sq();
43  return 0.0;
44 
45  return _dFdu[_qp] * _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] /
46  std::sqrt(norm_sq);
47 }
48 
49 Real
51 {
52  const Real norm_sq = _grad_v[_qp].norm_sq();
54  return 0.0;
55 
56  // get the coupled variable jvar is referring to
57  const unsigned int cvar = mapJvarToCvar(jvar);
58 
59  if (jvar == _v_var)
60  return (_F[_qp] * _dv_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] +
61  _F[_qp] * _v_dot[_qp] * _grad_test[_i][_qp] * _grad_phi[_j][_qp] -
62  _F[_qp] * _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _grad_v[_qp] *
63  _grad_phi[_j][_qp] / norm_sq +
64  _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] *
65  (*_dFdarg[cvar])[_qp]) /
66  std::sqrt(norm_sq);
67 
68  return _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp] /
69  std::sqrt(norm_sq);
70 }
AntitrappingCurrent(const InputParameters &parameters)
static constexpr Real TOLERANCE
std::vector< const MaterialProperty< Real > * > _dFdarg
function derivatives w.r.t. coupled variables
const VariableGradient & _grad_v
registerMooseObject("PhaseFieldApp", AntitrappingCurrent)
This calculates a modified coupled time derivative that multiplies the time derivative of a coupled v...
virtual Real computeQpResidual()
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _dFdu
function derivative w.r.t. the kernel variable
auto norm_sq(const T &a) -> decltype(std::norm(a))
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
void addClassDescription(const std::string &doc_string)
This calculates a modified coupled time derivative that multiplies the time derivative of a coupled v...
virtual Real computeQpJacobian()
const MaterialProperty< Real > & _F
The function multiplied by the coupled time derivative.