applications/mp-melt-pool/cases/laser_melting_simonds/laser_melting_simonds.hpp Source File

Developer Documentation: applications/mp-melt-pool/cases/laser_melting_simonds/laser_melting_simonds.hpp Source File
Developer Documentation
laser_melting_simonds.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <deal.II/base/exceptions.h>
4#include <deal.II/base/function.h>
5#include <deal.II/base/function_signed_distance.h>
6#include <deal.II/base/point.h>
7#include <deal.II/base/table_handler.h>
8#include <deal.II/base/tensor_function.h>
9
10#include <deal.II/distributed/shared_tria.h>
11#include <deal.II/distributed/tria.h>
12
13#include <deal.II/grid/grid_generator.h>
14#include <deal.II/grid/grid_refinement.h>
15#include <deal.II/grid/manifold_lib.h>
16
20
21#include <filesystem>
22#include <fstream>
23#include <iostream>
24#include <memory>
25#include <string>
26#include <vector>
27
28#include "../../melt_pool_case.hpp"
29
31{
32 using namespace dealii;
33
40 inline static double width = 600e-6;
41
48 inline static double height_substrate = 430e-6; // m
49
56 inline static double height_gas = 170e-6;
57
60 inline static double delta_h = 20e-6;
61
63 inline static double T_initial_top = 298; // K
64
66 inline static double T_initial_bottom = T_initial_top;
67
69 inline static double inflow_velocity = 0.1;
70
72 inline static double outlet_pressure = 0.0;
73
75 inline static double inflow_temperature = T_initial_top;
76
83 inline static double eps_prefactor = 2.0;
84
96 template <int dim>
97 class InflowVelocity : public Function<dim>
98 {
99 public:
106
115 double
116 value(const Point<dim> &p, const unsigned int component) const override;
117 };
118
131 template <int dim>
132 class InitialLevelSet : public dealii::Function<dim>
133 {
134 public:
142 InitialLevelSet(const double eps,
143 const LevelSet::LevelSetType level_set_type = LevelSet::LevelSetType::tanh);
144
154 double
155 value(const dealii::Point<dim> &p, const unsigned int component) const override;
156
157 private:
159 const dealii::Functions::SignedDistance::Plane<dim> distance_plane;
160
162 const double eps;
163
165 const LevelSet::LevelSetType level_set_type;
166 };
167
177 template <int dim>
178 class InitialConditionTemperature : public Function<dim>
179 {
180 public:
190 const double T_initial_top,
191 const double y_min,
192 const double y_max);
193
203 double
204 value(const Point<dim> &p, const unsigned int component) const override;
205
207 const double T_initial_bottom;
208
210 const double T_initial_top;
211
213 const double y_min;
214
216 const double grad_T;
217 };
218
245 template <int dim, typename Number, typename CaseClass>
246 class SimulationLaserMeltingSimonds : public CaseClass
247 {
248 private:
250 std::vector<unsigned int> cell_repetitions;
251
253 unsigned int n_local_refinement = 0;
254
257
260
263
266
268 Point<dim> bottom_left;
269
271 Point<dim> top_right;
272
274 mutable std::ofstream file_conservation_variables;
275
277 mutable int n_time_step = 0;
278
280 mutable TableHandler output_table;
281
282 public:
289 SimulationLaserMeltingSimonds(std::string parameter_file, const MPI_Comm mpi_communicator);
290
302 bool
303 add_case_specific_parameters(dealii::ParameterHandler &prm) override;
304
312 void
314
326 void
327 set_boundary_conditions() override;
328
336 void
337 set_field_conditions() override;
338
350 void
352 [[maybe_unused]] const GenericDataOut<dim, Number> &generic_data_out) const final;
353 };
354} // namespace MeltPoolDG::Simulation::LaserMeltingSimonds
A generic utility for managing simulation output data in the MeltPoolDG context.
Definition generic_data_out.hpp:32
Prescribed inflow velocity profile.
Definition laser_melting_simonds.hpp:98
InflowVelocity()
Construct the inflow velocity function.
Definition laser_melting_simonds.templates.hpp:18
double value(const Point< dim > &p, const unsigned int component) const override
Evaluate the inflow velocity.
Definition laser_melting_simonds.templates.hpp:26
Linear initial temperature profile in the vertical direction.
Definition laser_melting_simonds.hpp:179
const double y_min
Lower vertical coordinate of the domain.
Definition laser_melting_simonds.hpp:213
const double T_initial_bottom
Initial temperature at the bottom boundary.
Definition laser_melting_simonds.hpp:207
double value(const Point< dim > &p, const unsigned int component) const override
Evaluate the initial temperature.
Definition laser_melting_simonds.templates.hpp:97
const double T_initial_top
Initial temperature at the top boundary.
Definition laser_melting_simonds.hpp:210
const double grad_T
Vertical temperature gradient.
Definition laser_melting_simonds.hpp:216
Initial level-set function for the horizontal substrate-gas interface.
Definition laser_melting_simonds.hpp:133
double value(const dealii::Point< dim > &p, const unsigned int component) const override
Evaluate the initial level-set field.
Definition laser_melting_simonds.templates.hpp:64
const double eps
Interface thickness parameter for regularized level-set fields.
Definition laser_melting_simonds.hpp:162
const dealii::Functions::SignedDistance::Plane< dim > distance_plane
Signed-distance representation of the initial planar interface.
Definition laser_melting_simonds.hpp:159
const LevelSet::LevelSetType level_set_type
Selected level-set representation.
Definition laser_melting_simonds.hpp:165
Simulation setup for the Simonds laser-melting benchmark.
Definition laser_melting_simonds.hpp:247
std::ofstream file_conservation_variables
Output stream for conservation-variable postprocessing.
Definition laser_melting_simonds.hpp:274
Point< dim > bottom_left
Lower-left corner of the computational domain.
Definition laser_melting_simonds.hpp:268
Point< dim > local_refinement_1_top_right
Upper-right point of the first local refinement box.
Definition laser_melting_simonds.hpp:259
unsigned int n_local_refinement
Number of additional local refinement cycles.
Definition laser_melting_simonds.hpp:253
void set_field_conditions() override
Attach initial conditions for all active fields.
Definition laser_melting_simonds.templates.hpp:408
Point< dim > local_refinement_2_bottom_left
Lower-left point of the second local refinement box.
Definition laser_melting_simonds.hpp:262
int n_time_step
Counter for postprocessing calls.
Definition laser_melting_simonds.hpp:277
void create_spatial_discretization() override
Create the triangulation and initial spatial discretization.
Definition laser_melting_simonds.templates.hpp:190
bool add_case_specific_parameters(dealii::ParameterHandler &prm) override
Declare simulation-specific parameters.
Definition laser_melting_simonds.templates.hpp:116
Point< dim > top_right
Upper-right corner of the computational domain.
Definition laser_melting_simonds.hpp:271
void do_postprocessing(const GenericDataOut< dim, Number > &generic_data_out) const final
Perform simulation-specific postprocessing.
Definition laser_melting_simonds.templates.hpp:464
Point< dim > local_refinement_2_top_right
Upper-right point of the second local refinement box.
Definition laser_melting_simonds.hpp:265
TableHandler output_table
Table used to collect conservation-variable output.
Definition laser_melting_simonds.hpp:280
void set_boundary_conditions() override
Assign boundary identifiers and attach boundary conditions.
Definition laser_melting_simonds.templates.hpp:248
std::vector< unsigned int > cell_repetitions
Number of initial cell repetitions in each coordinate direction.
Definition laser_melting_simonds.hpp:250
Point< dim > local_refinement_1_bottom_left
Lower-left point of the first local refinement box.
Definition laser_melting_simonds.hpp:256
Definition laser_melting_simonds.cpp:7
static double inflow_temperature
Prescribed inflow temperature.
Definition laser_melting_simonds.hpp:75
static double height_substrate
Height of the substrate region.
Definition laser_melting_simonds.hpp:48
static double height_gas
Height of the gas region.
Definition laser_melting_simonds.hpp:56
static double eps_prefactor
Prefactor used to compute the diffuse-interface thickness.
Definition laser_melting_simonds.hpp:83
static double outlet_pressure
Prescribed outlet pressure.
Definition laser_melting_simonds.hpp:72
static double inflow_velocity
Prescribed inflow velocity for the gas phase.
Definition laser_melting_simonds.hpp:69
static double width
Width of the computational domain.
Definition laser_melting_simonds.hpp:40
static double T_initial_bottom
Initial temperature at the bottom boundary.
Definition laser_melting_simonds.hpp:66
static double T_initial_top
Initial temperature at the top boundary.
Definition laser_melting_simonds.hpp:63
static double delta_h
Definition laser_melting_simonds.hpp:60
Definition dealii_tensor.hpp:10