Line data Source code
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 "AzimuthMagneticTimeDerivRZ.h" 11 : 12 : registerMooseObject("ElectromagneticsApp", AzimuthMagneticTimeDerivRZ); 13 : 14 : InputParameters 15 88 : AzimuthMagneticTimeDerivRZ::validParams() 16 : { 17 88 : InputParameters params = AuxKernel::validParams(); 18 88 : params.addClassDescription( 19 : "Computes the time derivative of the azimuthal component " 20 : "of the magnetic field assuming cylindrical electric field. The electric field can " 21 : "be supplied as a vector or scalar components."); 22 176 : params.addCoupledVar("Efield", "The electric field vector"); 23 176 : params.addCoupledVar("Efield_X", "The x-component of the electric field"); 24 176 : params.addCoupledVar("Efield_Y", "The y-component of the electric field"); 25 88 : return params; 26 0 : } 27 : 28 50 : AzimuthMagneticTimeDerivRZ::AzimuthMagneticTimeDerivRZ(const InputParameters & parameters) 29 : : AuxKernel(parameters), 30 50 : _is_efield_vector(isCoupled("Efield")), 31 76 : _is_efield_scalar(isCoupled("Efield_X") && isCoupled("Efield_Y")), 32 50 : _efield_curl(_is_efield_vector ? coupledCurl("Efield") : _vector_curl_zero), 33 50 : _efield_x_grad(_is_efield_scalar ? coupledGradient("Efield_X") : _grad_zero), 34 100 : _efield_y_grad(_is_efield_scalar ? coupledGradient("Efield_Y") : _grad_zero) 35 : { 36 50 : if (_is_efield_vector && _is_efield_scalar) 37 : { 38 2 : mooseError("Both a vector and scalar components of the electric field were provided! Please " 39 : "only choose one."); 40 : } 41 : 42 48 : if (!_is_efield_vector && !_is_efield_scalar) 43 : { 44 4 : mooseError("Neither a vector nor two scalar components of the electric field were provided! " 45 : "Please check the input parameters."); 46 : } 47 44 : } 48 : 49 : Real 50 21600 : AzimuthMagneticTimeDerivRZ::computeValue() 51 : { 52 21600 : if (_is_efield_vector) 53 : { 54 : /* NOTE: The curl for a axisymmetric cylindrical vector is equal and opposite to 55 : * the curl for 2D cartesian vector, such that: 56 : * curl u_z = - curl u_theta 57 : * For Faraday's law of induction, this means we use the positive Cartesian curl, 58 : * in place of the negative axisymmetric cylindrical curl. 59 : */ 60 10800 : return _efield_curl[_qp](2); 61 : } 62 : else 63 : { 64 10800 : return -(_efield_x_grad[_qp](1) - _efield_y_grad[_qp](0)); 65 : } 66 : }