LCOV - code coverage report
Current view: top level - src/materials - LevelSetThermalMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/malamute: 0e4c8a Lines: 44 45 97.8 %
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 "LevelSetThermalMaterial.h"
      11             : 
      12             : registerMooseObject("MalamuteApp", LevelSetThermalMaterial);
      13             : 
      14             : InputParameters
      15          20 : LevelSetThermalMaterial::validParams()
      16             : {
      17          20 :   InputParameters params = ADMaterial::validParams();
      18          20 :   params.addClassDescription("Computes thermal properties in melt pool heat equations");
      19          40 :   params.addRequiredCoupledVar("temperature", "Temperature variable");
      20          40 :   params.addRequiredParam<Real>("c_g", "Gas specific heat.");
      21          40 :   params.addRequiredParam<Real>("c_s", "Solid specific heat.");
      22          40 :   params.addRequiredParam<Real>("c_l", "Liquid specific heat.");
      23          40 :   params.addRequiredParam<Real>("k_g", "Gas heat conductivity.");
      24          40 :   params.addRequiredParam<Real>("k_s", "Solid conductivity.");
      25          40 :   params.addRequiredParam<Real>("k_l", "Liquid conductivity.");
      26          40 :   params.addRequiredParam<Real>("solidus_temperature", "Solidus temperature.");
      27          40 :   params.addRequiredParam<Real>("latent_heat", "Latent heat.");
      28          20 :   return params;
      29           0 : }
      30             : 
      31          15 : LevelSetThermalMaterial::LevelSetThermalMaterial(const InputParameters & parameters)
      32             :   : ADMaterial(parameters),
      33          15 :     _temp(adCoupledValue("temperature")),
      34          30 :     _heaviside_function(getADMaterialProperty<Real>("heaviside_function")),
      35          15 :     _h(declareADProperty<Real>("enthalpy")),
      36          15 :     _k(declareADProperty<Real>("thermal_conductivity")),
      37          15 :     _cp(declareADProperty<Real>("specific_heat")),
      38          30 :     _c_g(getParam<Real>("c_g")),
      39          30 :     _c_s(getParam<Real>("c_s")),
      40          30 :     _c_l(getParam<Real>("c_l")),
      41          30 :     _k_g(getParam<Real>("k_g")),
      42          30 :     _k_s(getParam<Real>("k_s")),
      43          30 :     _k_l(getParam<Real>("k_l")),
      44          30 :     _latent_heat(getParam<Real>("latent_heat")),
      45          30 :     _solidus_temperature(getParam<Real>("solidus_temperature")),
      46          30 :     _f_l(getADMaterialProperty<Real>("liquid_mass_fraction")),
      47          30 :     _f_s(getADMaterialProperty<Real>("solid_mass_fraction")),
      48          30 :     _g_l(getADMaterialProperty<Real>("liquid_volume_fraction")),
      49          45 :     _g_s(getADMaterialProperty<Real>("solid_volume_fraction"))
      50             : {
      51          15 : }
      52             : 
      53             : void
      54      490800 : LevelSetThermalMaterial::computeQpProperties()
      55             : {
      56      490800 :   ADReal delta_l = (_c_s - _c_l) * _solidus_temperature + _latent_heat;
      57             : 
      58      981600 :   ADReal f_l = _f_l[_qp] * (1 - _heaviside_function[_qp]);
      59      981600 :   ADReal f_s = _f_s[_qp] * (1 - _heaviside_function[_qp]);
      60     1472400 :   ADReal c_m = (f_s * _c_s + f_l * _c_l) * (1 - _heaviside_function[_qp]);
      61     1963200 :   ADReal k_m = 1.0 / (_g_s[_qp] / _k_s + _g_l[_qp] / _k_l);
      62      981600 :   ADReal h_m = c_m * _temp[_qp] + f_l * (1 - _heaviside_function[_qp]) * delta_l;
      63      490800 :   ADReal h_g = _c_g * _temp[_qp];
      64             : 
      65     1472400 :   _h[_qp] = (1 - _heaviside_function[_qp]) * h_m + _heaviside_function[_qp] * h_g;
      66     1472400 :   _k[_qp] = (1 - _heaviside_function[_qp]) * k_m + _heaviside_function[_qp] * _k_g;
      67     1472400 :   _cp[_qp] = (1 - _heaviside_function[_qp]) * c_m + _heaviside_function[_qp] * _c_g;
      68      490800 : }

Generated by: LCOV version 1.14