forked from idaholab/malamute
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rosenthal temperature source model idaholab#63
- Loading branch information
1 parent
f3a3ae8
commit 11e2fc1
Showing
7 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
doc/content/source/materials/RosenthalTemperatureSource.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Rosenthal temperature source material | ||
|
||
!syntax description /Materials/RosenthalTemperatureSource | ||
|
||
## Description | ||
|
||
This material implements the Rosenthal equation for meltpool geometry [!cite](Rosenthal1946). The temperature profile is defined as: | ||
\begin{equation} | ||
T(x,r)=T_0 + \frac{\lambda P}{2 \pi k_T r} \exp\left[{- \frac{V(r+x)}{2 \alpha}}\right], | ||
\end{equation} | ||
where $T_0$ is the ambient temperature, $P$ is the laser power, $\lambda$ is the power absorption coefficient, $k_T$ is the thermal conductivity, $\alpha$ is the thermal diffusivity, and $V$ is the scanning velocity. Here, $r$ is the radial distance from the heat source defined as $r = \sqrt{x^2+y^2+z^2}$, where x, y, z, are the positional coordinates within the moving reference frame. The laser heat source is assumed to move in x direction such that the position x is updated with $(x-x_0-Vt)$, where $x_0$ is the initial position coordinate at $t=0$. | ||
|
||
The meltpool depth and width is calculated as follows: | ||
|
||
\begin{equation} | ||
D \approx \sqrt{\frac{2 \lambda P}{ \pi e \rho C_p V (T_m-T_0)}}\, , | ||
\end{equation} | ||
\begin{equation} | ||
W = 2 D, | ||
\end{equation} | ||
where $T_m$ is the melting temperature, $\rho$ is the density, and $C_p$ is the specific heat. | ||
|
||
## Example Input Syntax | ||
|
||
!listing test/tests/melt_pool_geometry/rosenthal_temp_source.i block=Materials/meltpool | ||
|
||
!syntax parameters /Materials/RosenthalTemperatureSource | ||
|
||
!syntax inputs /Materials/RosenthalTemperatureSource | ||
|
||
!syntax children /Materials/RosenthalTemperatureSource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/****************************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* */ | ||
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */ | ||
/* */ | ||
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include "Material.h" | ||
|
||
/** | ||
* Rosenthal temperature distribution. | ||
*/ | ||
template <bool is_ad> | ||
class RosenthalTemperatureSourceTempl : public Material | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
RosenthalTemperatureSourceTempl(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual void computeQpProperties() override; | ||
|
||
/// Laser power | ||
const Real _P; | ||
/// Scanning velocity | ||
const Real _V; | ||
/// Ambient temperature away from the surface | ||
const Real _T0; | ||
/// Melting temperature | ||
const Real _Tm; | ||
/// Initial heat source location | ||
const Real _x0; | ||
|
||
const GenericMaterialProperty<Real, is_ad> & _thermal_conductivity; | ||
const GenericMaterialProperty<Real, is_ad> & _specific_heat; | ||
const GenericMaterialProperty<Real, is_ad> & _density; | ||
const GenericMaterialProperty<Real, is_ad> & _absorptivity; | ||
|
||
GenericMaterialProperty<Real, is_ad> & _thermal_diffusivity; | ||
GenericMaterialProperty<Real, is_ad> & _temp_source; | ||
GenericMaterialProperty<Real, is_ad> & _meltpool_depth; | ||
GenericMaterialProperty<Real, is_ad> & _meltpool_width; | ||
}; | ||
|
||
typedef RosenthalTemperatureSourceTempl<false> RosenthalTemperatureSource; | ||
typedef RosenthalTemperatureSourceTempl<true> ADRosenthalTemperatureSource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/****************************************************************************/ | ||
/* DO NOT MODIFY THIS HEADER */ | ||
/* */ | ||
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */ | ||
/* */ | ||
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */ | ||
/* ALL RIGHTS RESERVED */ | ||
/****************************************************************************/ | ||
|
||
#include "RosenthalTemperatureSource.h" | ||
|
||
registerMooseObject("HeatConductionApp", RosenthalTemperatureSource); | ||
registerMooseObject("HeatConductionApp", ADRosenthalTemperatureSource); | ||
|
||
template <bool is_ad> | ||
InputParameters | ||
RosenthalTemperatureSourceTempl<is_ad>::validParams() | ||
{ | ||
InputParameters params = Material::validParams(); | ||
params.addClassDescription("Computes the thermal profile following the Rosenthal equation"); | ||
params.addParam<MaterialPropertyName>( | ||
"thermal_conductivity", "thermal_conductivity", "Property name of the thermal conductivity"); | ||
params.addParam<MaterialPropertyName>( | ||
"specific_heat", "specific_heat", "Property name of the specific heat"); | ||
params.addParam<MaterialPropertyName>("density", "density", "Property name of the density"); | ||
params.addParam<MaterialPropertyName>( | ||
"absorptivity", "absorptivity", "Property name of the power absorption coefficient"); | ||
params.addRequiredParam<Real>("power", "Laser power"); | ||
params.addRequiredParam<Real>("velocity", "Scanning velocity"); | ||
params.addParam<Real>( | ||
"ambient_temperature", 300, "Ambient temparature far away from the surface"); | ||
params.addRequiredParam<Real>("melting_temperature", "Melting temparature of the material"); | ||
params.addParam<Real>("initial_position", 0.0, "Initial coordiate of the heat source"); | ||
return params; | ||
} | ||
template <bool is_ad> | ||
RosenthalTemperatureSourceTempl<is_ad>::RosenthalTemperatureSourceTempl( | ||
const InputParameters & parameters) | ||
: Material(parameters), | ||
_P(getParam<Real>("power")), | ||
_V(getParam<Real>("velocity")), | ||
_T0(getParam<Real>("ambient_temperature")), | ||
_Tm(getParam<Real>("melting_temperature")), | ||
_x0(getParam<Real>("initial_position")), | ||
_thermal_conductivity(getGenericMaterialProperty<Real, is_ad>("thermal_conductivity")), | ||
_specific_heat(getGenericMaterialProperty<Real, is_ad>("specific_heat")), | ||
_density(getGenericMaterialProperty<Real, is_ad>("density")), | ||
_absorptivity(getGenericMaterialProperty<Real, is_ad>("absorptivity")), | ||
_thermal_diffusivity(declareGenericProperty<Real, is_ad>("thermal_diffusivity")), | ||
_temp_source(declareGenericProperty<Real, is_ad>("temp_source")), | ||
_meltpool_depth(declareGenericProperty<Real, is_ad>("meltpool_depth")), | ||
_meltpool_width(declareGenericProperty<Real, is_ad>("meltpool_width")) | ||
{ | ||
} | ||
|
||
template <bool is_ad> | ||
void | ||
RosenthalTemperatureSourceTempl<is_ad>::computeQpProperties() | ||
{ | ||
const Real & x = _q_point[_qp](0); | ||
const Real & y = _q_point[_qp](1); | ||
const Real & z = _q_point[_qp](2); | ||
|
||
// Moving heat source and distance | ||
Real x_t = x - _x0 - _V * _t; | ||
Real r = std::sqrt(x_t * x_t + y * y + z * z); | ||
|
||
_thermal_diffusivity[_qp] = _thermal_conductivity[_qp] / (_specific_heat[_qp] * _density[_qp]); | ||
|
||
_temp_source[_qp] = _T0 + (_absorptivity[_qp] * _P) / | ||
(2.0 * libMesh::pi * _thermal_conductivity[_qp] * r) * | ||
std::exp(-_V / (2.0 * _thermal_diffusivity[_qp]) * (r + x_t)); | ||
if (_temp_source[_qp] > _Tm) | ||
_temp_source[_qp] = _Tm; | ||
|
||
_meltpool_depth[_qp] = | ||
std::sqrt((2.0 * _absorptivity[_qp] * _P) / (std::exp(1.0) * libMesh::pi * _density[_qp] * | ||
_specific_heat[_qp] * (_Tm - _T0) * _V)); | ||
|
||
_meltpool_width[_qp] = 2.0 * _meltpool_depth[_qp]; | ||
} | ||
|
||
template class RosenthalTemperatureSourceTempl<false>; | ||
template class RosenthalTemperatureSourceTempl<true>; |
4 changes: 4 additions & 0 deletions
4
test/tests/melt_pool_geometry/gold/rosenthal_temp_source_out.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
time,meltpool_depth,meltpool_width | ||
0,0,0 | ||
0.1,0.0001520055760675,0.00030401115213499 | ||
0.2,0.0001520055760675,0.00030401115213499 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 2 | ||
xmax = 2.0 | ||
ymin = -1 | ||
ymax = 1 | ||
nx = 2 | ||
ny = 2 | ||
[] | ||
|
||
[Variables] | ||
[temp] | ||
initial_condition = 393 | ||
[] | ||
[] | ||
|
||
[AuxVariables] | ||
[temp_src] | ||
order = FIRST | ||
family = MONOMIAL | ||
[] | ||
[] | ||
|
||
[AuxKernels] | ||
[temp_src] | ||
type = ADMaterialRealAux | ||
variable = temp_src | ||
property = temp_source | ||
[] | ||
[] | ||
|
||
[Kernels] | ||
[time] | ||
type = ADHeatConductionTimeDerivative | ||
variable = temp | ||
[] | ||
[heat_conduct] | ||
type = ADHeatConduction | ||
variable = temp | ||
thermal_conductivity = thermal_conductivity | ||
[] | ||
[] | ||
|
||
[Materials] | ||
[heat] | ||
type = ADHeatConductionMaterial | ||
specific_heat = 500 | ||
thermal_conductivity = 20 | ||
[] | ||
[density] | ||
type = ADGenericConstantMaterial | ||
prop_names = 'density' | ||
prop_values = '8000' | ||
[] | ||
[meltpool] | ||
type = ADRosenthalTemperatureSource | ||
power = 1000 | ||
velocity = 2.0 | ||
absorptivity = 1.0 | ||
melting_temperature = 1660 | ||
ambient_temperature = 393 | ||
[] | ||
[] | ||
|
||
[Postprocessors] | ||
[meltpool_depth] | ||
type = ADElementAverageMaterialProperty | ||
mat_prop = meltpool_depth | ||
[] | ||
[meltpool_width] | ||
type = ADElementAverageMaterialProperty | ||
mat_prop = meltpool_width | ||
[] | ||
[] | ||
|
||
[Preconditioning] | ||
[full] | ||
type = SMP | ||
full = true | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Transient | ||
solve_type = NEWTON | ||
|
||
nl_rel_tol = 1e-6 | ||
nl_abs_tol = 1e-6 | ||
|
||
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package' | ||
petsc_options_value = 'preonly lu superlu_dist' | ||
|
||
l_max_its = 100 | ||
|
||
# end_time = 20 | ||
num_steps = 2 | ||
dt = 0.1 | ||
dtmin = 1e-4 | ||
[] | ||
|
||
[Outputs] | ||
exodus = true | ||
csv = true | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Tests] | ||
issues = '#63' | ||
[rosenthal_temp] | ||
type = 'Exodiff' | ||
input = 'rosenthal_temp_source.i' | ||
exodiff = 'rosenthal_temp_source_out.e' | ||
abs_zero = 1e-8 | ||
design = 'RosenthalTemperatureSource.md' | ||
requirement = 'MALAMUTE shall provide analytical expression for meltpool geometry and corresponding temperature profile' | ||
[] | ||
[rosenthal_depth] | ||
type = 'CSVDiff' | ||
input = 'rosenthal_temp_source.i' | ||
csvdiff = 'rosenthal_temp_source_out.csv' | ||
abs_zero = 1e-8 | ||
design = 'RosenthalTemperatureSource.md' | ||
requirement = 'MALAMUTE shall provide analytical expression for meltpool depth and width' | ||
[] | ||
[] |