Line data Source code
1 : /****************************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* */ 4 : /* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */ 5 : /* */ 6 : /* Copyright 2021 - 2024, Battelle Energy Alliance, LLC */ 7 : /* ALL RIGHTS RESERVED */ 8 : /****************************************************************************/ 9 : 10 : #include "ADVelocityGaussianHeatSource.h" 11 : 12 : registerMooseObject("MalamuteApp", ADVelocityGaussianHeatSource); 13 : 14 : InputParameters 15 12 : ADVelocityGaussianHeatSource::validParams() 16 : { 17 12 : InputParameters params = ADGaussianHeatSourceBase::validParams(); 18 24 : params.addParam<Real>( 19 24 : "x0", 0, "The x component of the initial center of the heating spot, speed unit is [mm/ms]."); 20 24 : params.addParam<Real>( 21 24 : "y0", 0, "The y component of the initial center of the heating spot, speed unit is [mm/ms]."); 22 24 : params.addParam<Real>( 23 24 : "z0", 0, "The z component of the initial center of the heating spot, speed unit is [mm/ms]."); 24 : 25 24 : params.addParam<FunctionName>( 26 : "function_vx", 27 : "0", 28 : "The function of x component of the center of the heating spot moving speed"); 29 24 : params.addParam<FunctionName>( 30 : "function_vy", 31 : "0", 32 : "The function of y component of the center of the heating spot moving speed"); 33 24 : params.addParam<FunctionName>( 34 : "function_vz", 35 : "0", 36 : "The function of z component of the center of the heating spot moving speed"); 37 : 38 12 : params.addClassDescription("Gaussian heat source whose center moves with a specified velocity."); 39 : 40 12 : return params; 41 0 : } 42 : 43 9 : ADVelocityGaussianHeatSource::ADVelocityGaussianHeatSource(const InputParameters & parameters) 44 : : ADGaussianHeatSourceBase(parameters), 45 9 : _prev_time(0), 46 9 : _x_prev(getParam<Real>("x0")), 47 18 : _y_prev(getParam<Real>("y0")), 48 18 : _z_prev(getParam<Real>("z0")), 49 9 : _function_vx(getFunction("function_vx")), 50 9 : _function_vy(getFunction("function_vy")), 51 18 : _function_vz(getFunction("function_vz")) 52 : { 53 9 : } 54 : 55 : void 56 282800 : ADVelocityGaussianHeatSource::computeHeatSourceCenterAtTime(Real & x, 57 : Real & y, 58 : Real & z, 59 : const Real & time) 60 : { 61 282800 : Real delta_t = time - _prev_time; 62 282800 : if (delta_t > 0.0) 63 : { 64 60 : const static Point dummy; 65 60 : _vx = _function_vx.value(time, dummy); 66 60 : _vy = _function_vy.value(time, dummy); 67 60 : _vz = _function_vz.value(time, dummy); 68 : 69 60 : x = _x_prev + _vx * delta_t; 70 60 : y = _y_prev + _vy * delta_t; 71 60 : z = _z_prev + _vz * delta_t; 72 : 73 : // march forward time 74 60 : _prev_time = time; 75 : // update position 76 60 : _x_prev += _vx * delta_t; 77 60 : _y_prev += _vy * delta_t; 78 60 : _z_prev += _vz * delta_t; 79 : } 80 : else 81 : { 82 282740 : x = _x_prev; 83 282740 : y = _y_prev; 84 282740 : z = _z_prev; 85 : } 86 282800 : } 87 : 88 : void 89 5050 : ADVelocityGaussianHeatSource::computeHeatSourceMovingSpeedAtTime(const Real & /*time*/) 90 : { 91 5050 : _scan_speed = std::sqrt(_vx * _vx + _vy * _vy + _vz * _vz); 92 5050 : }