include/meltpooldg/compressible_flow/multiphase_operator.hpp Source File

Developer Documentation: include/meltpooldg/compressible_flow/multiphase_operator.hpp Source File
Developer Documentation
multiphase_operator.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <deal.II/fe/fe_system.h>
4
12#include <meltpooldg/utilities/better_enum.hpp>
15
17{
19 BETTER_ENUM(Phase, int, liquid, gas);
20
29 template <int dim, typename number, bool is_viscous_gas = true, bool is_viscous_liquid = true>
31 {
32 public:
33 using VectorType = dealii::LinearAlgebra::distributed::Vector<number>;
36
40
43
44 using ConvectiveKernel = CompressibleFlow::
45 ConvectiveFlux<dim, number, ConservedVariablesType, ConservedVariablesGradType>;
46 using DiffusiveKernel = CompressibleFlow::
47 DiffusiveFlux<dim, number, ConservedVariablesType, ConservedVariablesGradType, FlowFluxType>;
48
51
53
62 number,
65
66 template <int n_components = CompressibleFlow::n_conserved_variables<dim>>
68
69 template <int n_components = CompressibleFlow::n_conserved_variables<dim>>
71
72 template <int n_components = CompressibleFlow::n_conserved_variables<dim>>
74 dealii::FEPointEvaluation<n_components, dim, dim, dealii::VectorizedArray<number>>;
75
76 template <int n_components = CompressibleFlow::n_conserved_variables<dim>>
78 dealii::FEFacePointEvaluation<n_components, dim, dim, dealii::VectorizedArray<number>>;
79
99 const MappingInfoType &mapping_info_interface_in,
100 const MappingInfoVectorType &mapping_info_cells_in,
101 const MappingInfoVectorType &mapping_info_faces_in);
102
111 void
112 local_apply_cell_rhs(const dealii::MatrixFree<dim, number> &matrix_free,
113 VectorType &dst,
114 const VectorType &src,
115 const std::pair<unsigned int, unsigned int> &cell_range) const;
116
125 void
126 local_apply_face_rhs(const dealii::MatrixFree<dim, number> &matrix_free,
127 VectorType &dst,
128 const VectorType &src,
129 const std::pair<unsigned int, unsigned int> &face_range) const;
130
139 void
140 local_apply_boundary_face_rhs(const dealii::MatrixFree<dim, number> &matrix_free,
141 VectorType &dst,
142 const VectorType &src,
143 const std::pair<unsigned int, unsigned int> &face_range) const;
144
153 void
154 local_apply_cell_lhs(const dealii::MatrixFree<dim, number> &matrix_free,
155 VectorType &dst,
156 const VectorType &src,
157 const std::pair<unsigned int, unsigned int> &cell_range) const;
158
167 void
168 local_apply_face_lhs(const dealii::MatrixFree<dim, number> &matrix_free,
169 VectorType &dst,
170 const VectorType &src,
171 const std::pair<unsigned int, unsigned int> &face_range) const;
172
182 void
183 local_apply_boundary_face_lhs(const dealii::MatrixFree<dim, number> &matrix_free,
184 VectorType &dst,
185 const VectorType &src,
186 const std::pair<unsigned int, unsigned int> &face_range) const;
187
196 void
197 create_rhs(const number &time,
198 const number &time_step_in,
199 VectorType &dst,
200 const VectorType &src) const;
201
208 void
209 vmult(VectorType &dst, const VectorType &src) const;
210
216 void
217 set_current_time(const number &current_time_in)
218 {
219 current_time = current_time_in;
220 };
221
227 void
229 std::shared_ptr<CompressibleFlow::ExternalFlowForce<dim, number>> external_force);
230
246 template <typename EvaluatorType>
247 inline void
248 ghost_penalty_face_integral(EvaluatorType &eval_m,
249 EvaluatorType &eval_p,
250 const unsigned int q,
251 const number cell_side_length,
252 const number cell_side_length_pow_3,
253 const number cell_side_length_pow_5) const;
254
261 void
263
270 void
272 dealii::TrilinosWrappers::SparseMatrix &system_matrix) const;
273
274 private:
277
280
283
286
288 dealii::FESystem<dim> fe_point_temp;
289
291 const unsigned int n_dofs_per_cell;
292
296
299 std::vector<std::shared_ptr<CompressibleFlow::ExternalFlowForce<dim, number>>> external_forces;
300
302 mutable number time_step = 0.;
303
305 mutable number inv_time_step = 0.;
306
308 mutable number current_time = 0.;
309
312
314 std::unique_ptr<Evaporation::EvaporationModelKnight<number>> evaporation_model_knight;
315
318
321 static constexpr std::array<unsigned int, 2> first_component = {{
322 0 /*liquid phase*/,
323 CompressibleFlow::n_conserved_variables<dim> /*gas phase*/
324 }};
325
336 const unsigned int offset = 0) const
337 {
339 multiphase_scratch_data.scratch_data.get_matrix_free(),
342 offset,
343 category);
344 }
345
359 create_face_integrator(const bool is_inner_face,
360 const CutUtil::CellCategory category,
361 const unsigned int offset = 0) const
362 {
364 multiphase_scratch_data.scratch_data.get_matrix_free(),
365 is_inner_face,
368 offset,
369 category);
370 };
371
385 std::pair<FEFaceIntegrator<dim, dim + 2, number>, FEFaceIntegrator<dim, dim + 2, number>>
387 const unsigned int offset = 0) const
388 {
389 return {create_face_integrator(true, category, offset),
390 create_face_integrator(false, category, offset)};
391 };
392
411 void
413 VectorType &diagonal,
414 dealii::TrilinosWrappers::SparseMatrix &system_matrix,
415 const bool do_diagonal) const;
416 };
417} // namespace MeltPoolDG::Multiphase
This class computes the Darcy damping coefficient given by the Kozeny-Carman equation:
Definition darcy_damping_model.hpp:28
Operator for the matrix-free of a compressible multiphase flow cutDG formulation.
Definition multiphase_operator.hpp:31
FECellIntegrator< dim, dim+2, number > create_cell_integrator(const CutUtil::CellCategory category, const unsigned int offset=0) const
Wrapper for the generation of a FECellIntegrator object.
Definition multiphase_operator.hpp:335
dealii::FEFacePointEvaluation< n_components, dim, dim, dealii::VectorizedArray< number > > FacePointEval
Definition multiphase_operator.hpp:78
void local_apply_cell_lhs(const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &cell_range) const
Local applier for the cell integrals in the left-hand side matrix-vector product evaluation.
Definition multiphase_operator.cpp:1166
CompressibleFlow::SourceType< dim, number > FlowSourceType
Definition multiphase_operator.hpp:42
CutUtil::MappingInfoType< dim, number > MappingInfoType
Definition multiphase_operator.hpp:34
CompressibleFlow::DofValueAndGradientStateView< dim, number, const ConservedVariablesType, const ConservedVariablesGradType > DofValueAndGradientStateView
Definition multiphase_operator.hpp:64
void vmult(VectorType &dst, const VectorType &src) const
Function for the matrix-free matrix-vector product evaluation.
Definition multiphase_operator.cpp:69
std::pair< FEFaceIntegrator< dim, dim+2, number >, FEFaceIntegrator< dim, dim+2, number > > create_face_integrators(const CutUtil::CellCategory category, const unsigned int offset=0) const
Wrapper for the generation of a pair of FEFaceIntegrator objects for the "interior" face and the "ext...
Definition multiphase_operator.hpp:386
void local_apply_face_rhs(const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &face_range) const
Local applier for the face integrals in the right-hand side evaluation.
Definition multiphase_operator.cpp:685
void compute_system_matrix_from_matrixfree(dealii::TrilinosWrappers::SparseMatrix &system_matrix) const
Assemble the system matrix explicitly from the matrix-free operator. Used by matrix-based preconditio...
Definition multiphase_operator.cpp:1380
static constexpr std::array< unsigned int, 2 > first_component
Definition multiphase_operator.hpp:321
dealii::FESystem< dim > fe_point_temp
FESystem object, required by FEPointEvaluation.
Definition multiphase_operator.hpp:288
void local_apply_boundary_face_rhs(const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &face_range) const
Local applier for the boundary face integral in the right-hand side evaluation.
Definition multiphase_operator.cpp:958
number visc_ave_weight_phase_gas
Definition multiphase_operator.hpp:295
CompressibleFlow::ConservedVariablesType< dim, number > ConservedVariablesType
Definition multiphase_operator.hpp:37
void internal_compute_diagonal_or_system_matrix(VectorType &diagonal, dealii::TrilinosWrappers::SparseMatrix &system_matrix, const bool do_diagonal) const
Shared implementation of the matrix-free diagonal and system matrix assembly.
Definition multiphase_operator.cpp:1395
void compute_inverse_diagonal_from_matrixfree(VectorType &diagonal) const
Compute the inverse diagonal of the system matrix. Used by the diagonal preconditioner.
Definition multiphase_operator.cpp:1360
void local_apply_face_lhs(const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &face_range) const
Local applier for the face integrals in the left-hand side matrix-vector product evaluation.
Definition multiphase_operator.cpp:1258
std::vector< std::shared_ptr< CompressibleFlow::ExternalFlowForce< dim, number > > > external_forces
Definition multiphase_operator.hpp:299
CompressibleFlow::ConvectiveFlux< dim, number, ConservedVariablesType, ConservedVariablesGradType > ConvectiveKernel
Definition multiphase_operator.hpp:45
CompressibleFlow::ConservedVariablesGradientType< dim, number > ConservedVariablesGradType
Definition multiphase_operator.hpp:39
CutUtil::MappingInfoVectorType< dim, number > MappingInfoVectorType
Definition multiphase_operator.hpp:35
void local_apply_boundary_face_lhs(const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &face_range) const
Local applier for the boundary face integrals in the left-hand side matrix-vector product evaluation.
Definition multiphase_operator.cpp:1349
void add_external_force(std::shared_ptr< CompressibleFlow::ExternalFlowForce< dim, number > > external_force)
Add external fluid forces (e.g. gravity, ...).
Definition multiphase_operator.cpp:99
CompressibleFlow::DofStateView< dim, number, const ConservedVariablesType > DofStateView
Definition multiphase_operator.hpp:59
CompressibleFlow::DofValueView< dim, ConservedVariablesType > DofValueView
Definition multiphase_operator.hpp:54
CompressibleFlow::DofPrimitiveStateView< dim, number, const ConservedVariablesType > DofPrimitiveStateView
Definition multiphase_operator.hpp:58
const MappingInfoVectorType & mapping_info_cells
Mapping information for integration over cut cells.
Definition multiphase_operator.hpp:282
const MappingInfoType & mapping_info_interface
Mapping information for integration over the phase interface.
Definition multiphase_operator.hpp:279
const MappingInfoVectorType & mapping_info_faces
Mapping information for integration over cut faces.
Definition multiphase_operator.hpp:285
number current_time
Current time.
Definition multiphase_operator.hpp:308
LevelSetAdvection< dim, number > level_set_advection_operator
Object for the analytical advection of the level set field for 1D simulations.
Definition multiphase_operator.hpp:311
number visc_ave_weight_phase_liquid
Weighting factors for Nitsche-type viscous interface flux.
Definition multiphase_operator.hpp:294
dealii::LinearAlgebra::distributed::Vector< number > VectorType
Definition multiphase_operator.hpp:33
Flow::DarcyDampingModel< number > darcy_damping_model
Darcy damping model for the computation of the damping coefficient.
Definition multiphase_operator.hpp:317
void create_rhs(const number &time, const number &time_step_in, VectorType &dst, const VectorType &src) const
Function for the matrix-free right-hand side vector evaluation.
Definition multiphase_operator.cpp:154
void ghost_penalty_face_integral(EvaluatorType &eval_m, EvaluatorType &eval_p, const unsigned int q, const number cell_side_length, const number cell_side_length_pow_3, const number cell_side_length_pow_5) const
Evaluates the face-based ghost penalty stabilization at quadrature point q.
Definition multiphase_operator.cpp:110
CompressibleFlow::DofPrimitiveValueView< dim, ConservedVariablesType > DofPrimitiveValueView
Definition multiphase_operator.hpp:56
dealii::FEPointEvaluation< n_components, dim, dim, dealii::VectorizedArray< number > > DomainPointEval
Definition multiphase_operator.hpp:74
FEFaceIntegrator< dim, n_components, number > FaceEval
Definition multiphase_operator.hpp:70
CompressibleFlow::DiffusiveFlux< dim, number, ConservedVariablesType, ConservedVariablesGradType, FlowFluxType > DiffusiveKernel
Definition multiphase_operator.hpp:47
number time_step
Current time step size.
Definition multiphase_operator.hpp:302
void set_current_time(const number &current_time_in)
Set the current time.
Definition multiphase_operator.hpp:217
CompressibleFlow::FluxType< dim, number > FlowFluxType
Definition multiphase_operator.hpp:41
FEFaceIntegrator< dim, dim+2, number > create_face_integrator(const bool is_inner_face, const CutUtil::CellCategory category, const unsigned int offset=0) const
Wrapper for the generation of a FEFaceIntegrator object.
Definition multiphase_operator.hpp:359
const unsigned int n_dofs_per_cell
Number of DoFs per cell.
Definition multiphase_operator.hpp:291
std::unique_ptr< Evaporation::EvaporationModelKnight< number > > evaporation_model_knight
Pointer to the object for the evaluation of the Knight evaporation model.
Definition multiphase_operator.hpp:314
CompressibleFlow::MultiphaseOperationScratchData< dim, number > & multiphase_scratch_data
Scratch data for multiphase case.
Definition multiphase_operator.hpp:276
FECellIntegrator< dim, n_components, number > DomainEval
Definition multiphase_operator.hpp:67
number inv_time_step
Inverse time step size.
Definition multiphase_operator.hpp:305
void local_apply_cell_rhs(const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &cell_range) const
Local applier for the cell integrals in the right-hand side evaluation.
Definition multiphase_operator.cpp:196
Class for the analytical advection of a 1D test case.
Definition multiphase_level_set_advection.hpp:82
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, dealii::VectorizedArray< number > > SourceType
Definition data_types.hpp:80
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, dealii::Tensor< 1, dim, dealii::VectorizedArray< number > > > FluxType
Definition data_types.hpp:61
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, dealii::Tensor< 1, dim, VectorizedArrayType > > ConservedVariablesGradientType
Definition data_types.hpp:54
dealii::Tensor< 1, n_conserved_variables< dim, n_species >, VectorizedArrayType > ConservedVariablesType
Definition data_types.hpp:45
CellCategory
Definition of the cell category numbering (active FE index).
Definition util.hpp:62
std::vector< std::shared_ptr< MappingInfoType< dim, number > > > MappingInfoVectorType
Definition util.hpp:56
dealii::NonMatching::MappingInfo< dim, dim, dealii::VectorizedArray< number > > MappingInfoType
Definition util.hpp:53
A collection of functions for the computation of the interface terms for compressible two-phase flows...
Definition multiphase_interface_kernels.hpp:32
BETTER_ENUM(Phase, int, liquid, gas)
Helper enum to distinguish between the liquid and gas phase in the multiphase operator.
dealii::FEFaceEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType > FEFaceIntegrator
Definition fe_integrator.hpp:22
dealii::FEEvaluation< dim, -1, 0, n_components, number, VectorizedArrayType > FECellIntegrator
Definition fe_integrator.hpp:14
Definition state_views.hpp:186
Definition state_views.hpp:79
An abstract interface for defining external forces acting on the fluid that must be evaluated and inc...
Definition utils.hpp:187
Scratch data structure for compressible multiphase flow solvers.
Definition operation_scratch_data.hpp:152
Definition dg_generic_convection_diffusion_worker.hpp:232
Definition dg_generic_convection_diffusion_worker.hpp:67