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 "MeltPoolHeatSource.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("MalamuteApp", MeltPoolHeatSource); 14 : 15 : InputParameters 16 12 : MeltPoolHeatSource::validParams() 17 : { 18 12 : InputParameters params = ADKernelValue::validParams(); 19 12 : params.addClassDescription( 20 : "Computes the laser heat source and heat loss in the melt pool heat equation"); 21 24 : params.addParam<FunctionName>( 22 24 : "laser_location_x", 0, "The laser center function of x coordinate."); 23 24 : params.addParam<FunctionName>( 24 24 : "laser_location_y", 0, "The laser center function of y coordinate."); 25 24 : params.addParam<FunctionName>( 26 24 : "laser_location_z", 0, "The laser center function of z coordinate."); 27 24 : params.addRequiredParam<FunctionName>("laser_power", "Laser power."); 28 24 : params.addRequiredParam<Real>("effective_beam_radius", "Effective beam radius."); 29 24 : params.addRequiredParam<Real>("absorption_coefficient", "Absorption coefficient."); 30 24 : params.addRequiredParam<Real>("heat_transfer_coefficient", "Heat transfer coefficient."); 31 24 : params.addRequiredParam<Real>("StefanBoltzmann_constant", "Stefan Boltzmann constant."); 32 24 : params.addRequiredParam<Real>("material_emissivity", "Material emissivity."); 33 24 : params.addRequiredParam<Real>("ambient_temperature", "Ambient temperature."); 34 24 : params.addRequiredParam<Real>("vaporization_latent_heat", "Latent heat of vaporization."); 35 24 : params.addRequiredParam<Real>("rho_l", "Liquid density."); 36 24 : params.addRequiredParam<Real>("rho_g", "Gas density."); 37 12 : return params; 38 0 : } 39 : 40 6 : MeltPoolHeatSource::MeltPoolHeatSource(const InputParameters & parameters) 41 : : ADKernelValue(parameters), 42 6 : _delta_function(getADMaterialProperty<Real>("delta_function")), 43 6 : _power(getFunction("laser_power")), 44 12 : _alpha(getParam<Real>("absorption_coefficient")), 45 12 : _Rb(getParam<Real>("effective_beam_radius")), 46 12 : _Ah(getParam<Real>("heat_transfer_coefficient")), 47 12 : _stefan_boltzmann(getParam<Real>("StefanBoltzmann_constant")), 48 12 : _varepsilon(getParam<Real>("material_emissivity")), 49 12 : _T0(getParam<Real>("ambient_temperature")), 50 6 : _laser_location_x(getFunction("laser_location_x")), 51 6 : _laser_location_y(getFunction("laser_location_y")), 52 6 : _laser_location_z(getFunction("laser_location_z")), 53 12 : _rho(getADMaterialProperty<Real>("rho")), 54 12 : _melt_pool_mass_rate(getADMaterialProperty<Real>("melt_pool_mass_rate")), 55 12 : _cp(getADMaterialProperty<Real>("specific_heat")), 56 12 : _Lv(getParam<Real>("vaporization_latent_heat")), 57 12 : _rho_l(getParam<Real>("rho_l")), 58 18 : _rho_g(getParam<Real>("rho_g")) 59 : { 60 6 : } 61 : 62 : ADReal 63 549600 : MeltPoolHeatSource::precomputeQpResidual() 64 : { 65 : Point p(0, 0, 0); 66 549600 : RealVectorValue laser_location(_laser_location_x.value(_t, p), 67 549600 : _laser_location_y.value(_t, p), 68 549600 : _laser_location_z.value(_t, p)); 69 : 70 549600 : ADReal r = (_ad_q_point[_qp] - laser_location).norm(); 71 : 72 1099200 : ADReal laser_source = 2 * _power.value(_t, p) * _alpha / (libMesh::pi * Utility::pow<2>(_Rb)) * 73 1648800 : std::exp(-2.0 * Utility::pow<2>(r / _Rb)); 74 : 75 1099200 : ADReal convection = -_Ah * (_u[_qp] - _T0); 76 : ADReal radiation = 77 1648800 : -_stefan_boltzmann * _varepsilon * (Utility::pow<4>(_u[_qp]) - Utility::pow<4>(_T0)); 78 : 79 549600 : ADReal heat_source = (convection + radiation + laser_source) * _delta_function[_qp]; 80 : 81 : // Phase change 82 549600 : heat_source += _melt_pool_mass_rate[_qp] * _delta_function[_qp] * _rho[_qp] * 83 549600 : (1.0 / _rho_g - 1.0 / _rho_l) * _cp[_qp] * _u[_qp] - 84 1099200 : _Lv * _melt_pool_mass_rate[_qp] * _delta_function[_qp]; 85 : 86 549600 : return -heat_source; 87 : }