Skip to content

Commit

Permalink
Merge branch 'ded_mass' into 'devel'
Browse files Browse the repository at this point in the history
Add powder addition kernel

Closes #35

See merge request idaholab/malamute!12
  • Loading branch information
cticenhour committed Oct 19, 2022
2 parents b95477b + 3801cfa commit 145b86a
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/content/bib/malamute.bib
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ @book{madhusadana1996
publisher = {Springer-Verlag},
year = {1996}
}

@article{Morville2012,
author = {Morville,Simon and Carin,Muriel and Peyre,Patrice and Gharbi,Myriam and Carron,Denis and Le Masson,Philippe and Fabbro,Rémy },
title = {2D longitudinal modeling of heat transfer and fluid flow during multilayered direct laser metal deposition process},
journal = {Journal of Laser Applications},
volume = {24},
number = {3},
pages = {032008},
year = {2012},
doi = {10.2351/1.4726445}
}



22 changes: 22 additions & 0 deletions doc/content/source/kernels/LevelSetPowderAddition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# LevelSetPowderAddition

!syntax description /Kernels/LevelSetPowderAddition

## Description

In the level set evolution equation, the free surface growth velocity due to the powder addition is given as [!citep](Morville2012),

\begin{equation}
V_p = N_p \frac{{\eta}_p D_m}{{\rho}_0 \pi r_p^2}\exp\left(-N_p\frac{r^2}{r_p^2}\right),
\end{equation}
where $N_p$ and $r_P$ are the constriction coefficient and the standard deviation of the gaussian distribution. The $r$ is the radial distance. The $\eta_p$ is the powder catchment efficiency. The $\rho_0$ is the powder density. The $D_m$ is the mass powder rate.

## Example Input Syntax

!listing test/tests/melt_pool_mass/mass.i block=Kernels/level_set_mass

!syntax parameters /Kernels/LevelSetPowderAddition

!syntax inputs /Kernels/LevelSetPowderAddition

!syntax children /Kernels/LevelSetPowderAddition
53 changes: 53 additions & 0 deletions include/kernels/LevelSetPowderAddition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2022, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/

#pragma once

#include "ADKernelValue.h"

/**
* This class computes the powder addition to the melt pool.
*/
class LevelSetPowderAddition : public ADKernelValue
{
public:
static InputParameters validParams();

LevelSetPowderAddition(const InputParameters & parameters);

protected:
ADReal precomputeQpResidual() override;

/// Delta function
const ADMaterialProperty<Real> & _delta_function;

/// Function of laser location in x coordinate
const Function & _laser_location_x;

/// Function of laser location in x coordinate
const Function & _laser_location_y;

/// Function of laser location in x coordinate
const Function & _laser_location_z;

/// Mass addition rate
const Real _mass_rate;

/// Mass addition gaussian radius
const Real _mass_radius;

/// Mass addition gaussian scale
const Real _mass_scale;

/// Powder density
const Real _rho_p;

/// powder catchment efficiency
const Real _eta_p;
};
66 changes: 66 additions & 0 deletions src/kernels/LevelSetPowderAddition.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2022, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/

#include "LevelSetPowderAddition.h"
#include "Function.h"

registerMooseObject("MalamuteApp", LevelSetPowderAddition);

InputParameters
LevelSetPowderAddition::validParams()
{
InputParameters params = ADKernelValue::validParams();
params.addClassDescription("Computes the powder addition to the melt pool");
params.addParam<FunctionName>(
"laser_location_x", 0, "The laser center function of x coordinate.");
params.addParam<FunctionName>(
"laser_location_y", 0, "The laser center function of y coordinate.");
params.addParam<FunctionName>(
"laser_location_z", 0, "The laser center function of z coordinate.");
params.addRequiredParam<Real>("mass_rate", "Mass rate.");
params.addRequiredParam<Real>("mass_radius", "Mass gaussian radius.");
params.addParam<Real>("mass_scale", 1, "Mass gaussian scale.");
params.addRequiredParam<Real>("powder_density", "Powder density.");
params.addParam<Real>("eta_p", 1.0, "Powder catchment efficiency.");
return params;
}

LevelSetPowderAddition::LevelSetPowderAddition(const InputParameters & parameters)
: ADKernelValue(parameters),
_delta_function(getADMaterialProperty<Real>("delta_function")),
_laser_location_x(getFunction("laser_location_x")),
_laser_location_y(getFunction("laser_location_y")),
_laser_location_z(getFunction("laser_location_z")),
_mass_rate(getParam<Real>("mass_rate")),
_mass_radius(getParam<Real>("mass_radius")),
_mass_scale(getParam<Real>("mass_scale")),
_rho_p(getParam<Real>("powder_density")),
_eta_p(getParam<Real>("eta_p"))
{
}

ADReal
LevelSetPowderAddition::precomputeQpResidual()
{
Point p(0, 0, 0);
RealVectorValue laser_location(_laser_location_x.value(_t, p),
_laser_location_y.value(_t, p),
_laser_location_z.value(_t, p));

ADReal r = (_ad_q_point[_qp] - laser_location).norm();

ADReal power_feed = 0;

if (r <= _mass_radius)
power_feed = _mass_scale * _eta_p * _mass_rate *
std::exp(-_mass_scale * Utility::pow<2>(r / _mass_radius)) / _rho_p / libMesh::pi /
Utility::pow<2>(_mass_radius);

return _delta_function[_qp] * power_feed;
}
Binary file added test/tests/melt_pool_mass/gold/mass_out.e
Binary file not shown.
86 changes: 86 additions & 0 deletions test/tests/melt_pool_mass/mass.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[Mesh/gen]
type = GeneratedMeshGenerator
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 40
ny = 40
elem_type = QUAD4
[]

[ICs]
[ls_ic]
type = FunctionIC
function = ls_exact
variable = ls
[]
[]

[Variables]
[ls]
[]
[grad_ls]
family = LAGRANGE_VEC
[]
[]

[Functions/ls_exact]
type = LevelSetOlssonPlane
epsilon = 0.04
point = '0.5 0.5 0'
normal = '0 1 0'
[]

[Kernels]
[level_set_time]
type = ADTimeDerivative
variable = ls
[]

[level_set_mass]
type = LevelSetPowderAddition
laser_location_x = '0.5 + t'
laser_location_y = '0.5'
powder_density = 6000
eta_p = 1
mass_scale = 1
mass_radius = 0.2
mass_rate = 1000
variable = ls
[]

[grad_ls]
type = VariableGradientRegularization
regularized_var = ls
variable = grad_ls
[]
[]

[Materials]
[delta]
type = LevelSetDeltaFunction
level_set_gradient = grad_ls
[]
[]

[Preconditioning]
[SMP]
type = SMP
full = true
solve_type = 'NEWTON'
[]
[]

[Executioner]
type = Transient
solve_type = NEWTON
dt = 1e-2
nl_abs_tol = 1e-12
num_steps = 2
[]

[Outputs]
exodus = true
[]
10 changes: 10 additions & 0 deletions test/tests/melt_pool_mass/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Tests]
issues = '#35'
[mass]
type = 'Exodiff'
input = 'mass.i'
exodiff = 'mass_out.e'
design = 'LevelSetPowderAddition.md'
requirement = 'The system shall evolve the level set variable field with the velocity due to the powder addition.'
[]
[]

0 comments on commit 145b86a

Please sign in to comment.