LCOV - code coverage report
Current view: top level - src/kernels - LevelSetPowderAddition.C (source / functions) Hit Total Coverage
Test: idaholab/malamute: 0e4c8a Lines: 37 38 97.4 %
Date: 2025-08-02 07:01:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "LevelSetPowderAddition.h"
      11             : #include "Function.h"
      12             : 
      13             : registerMooseObject("MalamuteApp", LevelSetPowderAddition);
      14             : 
      15             : InputParameters
      16           2 : LevelSetPowderAddition::validParams()
      17             : {
      18           2 :   InputParameters params = ADKernelValue::validParams();
      19           2 :   params.addClassDescription("Computes the powder addition to the melt pool");
      20           4 :   params.addParam<FunctionName>(
      21           4 :       "laser_location_x", 0, "The laser center function of x coordinate.");
      22           4 :   params.addParam<FunctionName>(
      23           4 :       "laser_location_y", 0, "The laser center function of y coordinate.");
      24           4 :   params.addParam<FunctionName>(
      25           4 :       "laser_location_z", 0, "The laser center function of z coordinate.");
      26           4 :   params.addRequiredParam<Real>("mass_rate", "Mass rate.");
      27           4 :   params.addRequiredParam<Real>("mass_radius", "Mass gaussian radius.");
      28           4 :   params.addParam<Real>("mass_scale", 1, "Mass gaussian scale.");
      29           4 :   params.addRequiredParam<Real>("powder_density", "Powder density.");
      30           4 :   params.addParam<Real>("eta_p", 1.0, "Powder catchment efficiency.");
      31           2 :   return params;
      32           0 : }
      33             : 
      34           1 : LevelSetPowderAddition::LevelSetPowderAddition(const InputParameters & parameters)
      35             :   : ADKernelValue(parameters),
      36           1 :     _delta_function(getADMaterialProperty<Real>("delta_function")),
      37           1 :     _laser_location_x(getFunction("laser_location_x")),
      38           1 :     _laser_location_y(getFunction("laser_location_y")),
      39           1 :     _laser_location_z(getFunction("laser_location_z")),
      40           2 :     _mass_rate(getParam<Real>("mass_rate")),
      41           2 :     _mass_radius(getParam<Real>("mass_radius")),
      42           2 :     _mass_scale(getParam<Real>("mass_scale")),
      43           2 :     _rho_p(getParam<Real>("powder_density")),
      44           3 :     _eta_p(getParam<Real>("eta_p"))
      45             : {
      46           1 : }
      47             : 
      48             : ADReal
      49      115200 : LevelSetPowderAddition::precomputeQpResidual()
      50             : {
      51             :   Point p(0, 0, 0);
      52      115200 :   RealVectorValue laser_location(_laser_location_x.value(_t, p),
      53      115200 :                                  _laser_location_y.value(_t, p),
      54      115200 :                                  _laser_location_z.value(_t, p));
      55             : 
      56      115200 :   ADReal r = (_ad_q_point[_qp] - laser_location).norm();
      57             : 
      58      115200 :   ADReal power_feed = 0;
      59             : 
      60      115200 :   if (r <= _mass_radius)
      61       14492 :     power_feed = _mass_scale * _eta_p * _mass_rate *
      62       28984 :                  std::exp(-_mass_scale * Utility::pow<2>(r / _mass_radius)) / _rho_p / libMesh::pi /
      63       28984 :                  Utility::pow<2>(_mass_radius);
      64             : 
      65      230400 :   return _delta_function[_qp] * power_feed;
      66             : }

Generated by: LCOV version 1.14