include/meltpooldg/compressible_flow/multiphase_level_set_advection.hpp Source File

Developer Documentation: include/meltpooldg/compressible_flow/multiphase_level_set_advection.hpp Source File
Developer Documentation
multiphase_level_set_advection.hpp
Go to the documentation of this file.
1
7// TODO: remove/restructure, when level-set advection and reinitialization (and velocity field
8// extrapolation) are incorporated
9
10#pragma once
11
12#include <deal.II/base/function.h>
13#include <deal.II/base/point.h>
14
15#include <deal.II/numerics/vector_tools_interpolate.h>
16
18{
24 template <int dim, typename number>
25 class LevelSetOscillatingWaterColumn : public dealii::Function<dim, number>
26 {
27 public:
32 : dealii::Function<dim, number>(1)
33 {}
34
45 void
46 update_interface_positions(const number &time_step,
47 const std::vector<number> &interface_velocity)
48 {
49 for (unsigned int i = 0; i < 2; ++i)
50 interface_coordinates[i] += time_step * interface_velocity[i];
51 }
52
58 number
59 value(const dealii::Point<dim, number> &p, const unsigned int /*component*/) const final
60 {
61 return std::min(p[0] - interface_coordinates[0], -(p[0] - interface_coordinates[1]));
62 }
63
64 private:
66 // Note that the initial interface coordinates are aligned to the data in the case file
67 // "oscillating_water_column.hpp".
68 std::vector<number> interface_coordinates = {0.100156487, 0.800156487};
69 };
70
76 template <int dim, typename number>
78 {
79 public:
84
87
103 void
104 move_level_set(auto &level_set,
105 const number &time_step,
106 const std::string &case_name,
107 const auto &scratch_data,
108 const int level_set_dof_idx)
109 {
110 if (case_name == "oscillating_water_column")
111 {
112 // two phase boundaries
113 level_set_oscillating_water_column.update_interface_positions(time_step,
115 level_set.zero_out_ghost_values();
116 dealii::VectorTools::interpolate(scratch_data->get_mapping(),
117 scratch_data->get_dof_handler(level_set_dof_idx),
119 level_set);
120 level_set.update_ghost_values();
121 }
122 else if (case_name == "two_phase")
123 {
124 // one phase boundary
125 for (unsigned int i = 0; i < level_set.size(); i++)
126 level_set[i] += time_step * interface_velocity[0];
127 }
128 else
129 AssertThrow(false,
130 dealii::ExcMessage(
131 "Analytical function for level-set advection is "
132 "only supported for the cases 'oscillating_water_column' and 'two_phase'."));
133 }
134
140 void
141 set_interface_velocity(const number &interface_velocity_in)
142 {
143 interface_velocity.push_back(interface_velocity_in);
144 }
145
149 void
154
155 private:
158 static std::vector<number> interface_velocity;
159 };
160
161 template <int dim, typename number>
163
164 template <int dim, typename number>
166
167 template <int dim, typename number>
170} // namespace MeltPoolDG::Multiphase
Class for the analytical advection of a 1D test case.
Definition multiphase_level_set_advection.hpp:78
static LevelSetOscillatingWaterColumn< dim, number > level_set_oscillating_water_column
Object for the oscillating water column test case.
Definition multiphase_level_set_advection.hpp:86
void clear_interface_velocity()
Clear current interface velocity field.
Definition multiphase_level_set_advection.hpp:150
void move_level_set(auto &level_set, const number &time_step, const std::string &case_name, const auto &scratch_data, const int level_set_dof_idx)
Function for analytical advection of a level-set field according to computed interface velocities for...
Definition multiphase_level_set_advection.hpp:104
void set_interface_velocity(const number &interface_velocity_in)
Setter function for the computed interface velocity.
Definition multiphase_level_set_advection.hpp:141
static std::vector< number > interface_velocity
Definition multiphase_level_set_advection.hpp:158
Class for the analytical advection of a 1D test case with two phase interfaces.
Definition multiphase_level_set_advection.hpp:26
std::vector< number > interface_coordinates
Vector of interface coordinates.
Definition multiphase_level_set_advection.hpp:68
void update_interface_positions(const number &time_step, const std::vector< number > &interface_velocity)
Function to update the two interface coordinates for the case that two phase interfaces exist.
Definition multiphase_level_set_advection.hpp:46
number value(const dealii::Point< dim, number > &p, const unsigned int) const final
Analytical function for the level-set field for the "oscillating_water_column" case.
Definition multiphase_level_set_advection.hpp:59
LevelSetOscillatingWaterColumn()
Constructor.
Definition multiphase_level_set_advection.hpp:31
A collection of functions for the computation of the interface terms for compressible two-phase flows...
Definition multiphase_interface_kernels.hpp:31
Definition dealii_tensor.hpp:10