www.mooseframework.org
AntitrappingCurrent.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<CoupledSusceptibilityTimeDerivative>();
19  params.addClassDescription(
20  "Kernel that provides antitrapping current at the interface for alloy solidification");
21  return params;
22 }
23 
24 AntitrappingCurrent::AntitrappingCurrent(const InputParameters & parameters)
25  : CoupledSusceptibilityTimeDerivative(parameters), _grad_v(coupledGradient("v"))
26 {
27 }
28 
29 Real
31 {
32  const Real norm_sq = _grad_v[_qp].norm_sq();
33  if (norm_sq < libMesh::TOLERANCE)
34  return 0.0;
35 
36  return _F[_qp] * _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] / std::sqrt(norm_sq);
37 }
38 
39 Real
41 {
42  const Real norm_sq = _grad_v[_qp].norm_sq();
43  if (norm_sq < libMesh::TOLERANCE)
44  return 0.0;
45 
46  return _dFdu[_qp] * _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] /
47  std::sqrt(norm_sq);
48 }
49 
50 Real
52 {
53  const Real norm_sq = _grad_v[_qp].norm_sq();
54  if (norm_sq < libMesh::TOLERANCE)
55  return 0.0;
56 
57  // get the coupled variable jvar is referring to
58  const unsigned int cvar = mapJvarToCvar(jvar);
59 
60  if (jvar == _v_var)
61  return (_F[_qp] * _dv_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] +
62  _F[_qp] * _v_dot[_qp] * _grad_test[_i][_qp] * _grad_phi[_j][_qp] -
63  _F[_qp] * _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _grad_v[_qp] *
64  _grad_phi[_j][_qp] / norm_sq +
65  _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] *
66  (*_dFdarg[cvar])[_qp]) /
67  std::sqrt(norm_sq);
68 
69  return _v_dot[_qp] * _grad_v[_qp] * _grad_test[_i][_qp] * _phi[_j][_qp] * (*_dFdarg[cvar])[_qp] /
70  std::sqrt(norm_sq);
71 }
AntitrappingCurrent::computeQpJacobian
virtual Real computeQpJacobian()
Definition: AntitrappingCurrent.C:40
CoupledSusceptibilityTimeDerivative::_dFdarg
std::vector< const MaterialProperty< Real > * > _dFdarg
function derivatives w.r.t. coupled variables
Definition: CoupledSusceptibilityTimeDerivative.h:44
validParams< AntitrappingCurrent >
InputParameters validParams< AntitrappingCurrent >()
Definition: AntitrappingCurrent.C:16
CoupledSusceptibilityTimeDerivative::_F
const MaterialProperty< Real > & _F
The function multiplied by the coupled time derivative.
Definition: CoupledSusceptibilityTimeDerivative.h:38
registerMooseObject
registerMooseObject("PhaseFieldApp", AntitrappingCurrent)
AntitrappingCurrent.h
CoupledSusceptibilityTimeDerivative
This calculates a modified coupled time derivative that multiplies the time derivative of a coupled v...
Definition: CoupledSusceptibilityTimeDerivative.h:25
AntitrappingCurrent::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
Definition: AntitrappingCurrent.C:51
AntitrappingCurrent::AntitrappingCurrent
AntitrappingCurrent(const InputParameters &parameters)
Definition: AntitrappingCurrent.C:24
AntitrappingCurrent::_grad_v
const VariableGradient & _grad_v
Definition: AntitrappingCurrent.h:34
AntitrappingCurrent::computeQpResidual
virtual Real computeQpResidual()
Definition: AntitrappingCurrent.C:30
validParams< CoupledSusceptibilityTimeDerivative >
InputParameters validParams< CoupledSusceptibilityTimeDerivative >()
Definition: CoupledSusceptibilityTimeDerivative.C:16
CoupledSusceptibilityTimeDerivative::_dFdu
const MaterialProperty< Real > & _dFdu
function derivative w.r.t. the kernel variable
Definition: CoupledSusceptibilityTimeDerivative.h:41
AntitrappingCurrent
This calculates a modified coupled time derivative that multiplies the time derivative of a coupled v...
Definition: AntitrappingCurrent.h:24