-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathElectronBeamHeatSource.cc
More file actions
72 lines (61 loc) · 2.15 KB
/
Copy pathElectronBeamHeatSource.cc
File metadata and controls
72 lines (61 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* Copyright (c) 2020 - 2022, the adamantine authors.
*
* This file is subject to the Modified BSD License and may not be distributed
* without copyright and license information. Please refer to the file LICENSE
* for the text and further information on this license.
*/
#include <ElectronBeamHeatSource.hh>
#include <instantiation.hh>
#include <types.hh>
#include <deal.II/base/memory_space.h>
namespace adamantine
{
template <int dim, typename MemorySpaceType>
ElectronBeamHeatSource<dim, MemorySpaceType>::ElectronBeamHeatSource(
BeamHeatSourceProperties const &beam,
ScanPath<MemorySpaceType> const &scan_path)
: _beam(beam), _scan_path(scan_path)
{
}
template <int dim, typename MemorySpaceType>
void ElectronBeamHeatSource<dim, MemorySpaceType>::update_time(double time)
{
static const double log_01 = std::log(0.1);
_beam_center = this->_scan_path.value(time);
double segment_power_modifier = this->_scan_path.get_power_modifier(time);
_alpha =
-this->_beam.absorption_efficiency * this->_beam.max_power *
segment_power_modifier * log_01 /
(dealii::numbers::PI * this->_beam.radius_squared * this->_beam.depth);
}
template <int dim, typename MemorySpaceType>
double ElectronBeamHeatSource<dim, MemorySpaceType>::value(
dealii::Point<dim> const &point, double const height) const
{
double const z = point[axis<dim>::z] - height;
if ((z + this->_beam.depth) < 0.)
{
return 0.;
}
else
{
double const distribution_z = -3. * std::pow(z / this->_beam.depth, 2) -
2. * (z / this->_beam.depth) + 1.;
double xpy_squared =
std::pow(point[axis<dim>::x] - _beam_center[axis<dim>::x], 2);
if (dim == 3)
{
xpy_squared +=
std::pow(point[axis<dim>::y] - _beam_center[axis<dim>::y], 2);
}
static const double log_01 = std::log(0.1);
// Electron beam heat source equation
double heat_source =
_alpha * std::exp(log_01 * xpy_squared / this->_beam.radius_squared) *
distribution_z;
return heat_source;
}
}
} // namespace adamantine
INSTANTIATE_DIM_DEVICE(ElectronBeamHeatSource)
INSTANTIATE_DIM_HOST(ElectronBeamHeatSource)