Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
navier_stokes_scratch_data.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2021-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_navier_stokes_scratch_data_h
5#define lethe_navier_stokes_scratch_data_h
6
8#include <core/ale.h>
9#include <core/bdf.h>
10#include <core/dem_properties.h>
12#include <core/parameters.h>
16
18#include <solvers/cls_filter.h>
21
22#include <deal.II/base/quadrature.h>
23
24#include <deal.II/fe/fe_system.h>
25
26#include <deal.II/matrix_free/fe_point_evaluation.h>
27
28#include <deal.II/particles/particle_handler.h>
29
30using namespace dealii;
31
32/**
33 * @brief Class that stores the information required by the assembly procedure
34 * for a Navier-Stokes equation. Consequently, this class calculates
35 * the velocity (values, gradients, laplacians) and the shape function
36 * (values, gradients, laplacians) at all the gauss points for all degrees
37 * of freedom and stores it into arrays. Additionally, the use can request
38 * that this class gathers additional fields for physics which are coupled
39 * to the Navier-Stokes equation, such as the CLS. This class
40 * serves as a separation between the evaluation at the gauss point of the
41 * variables of interest and their use in the assembly, which is carried out
42 * by the assembler functions. For more information on this design, the reader
43 * can consult deal.II step-9
44 * "https://www.dealii.org/current/doxygen/deal.II/step_9.html". In this latter
45 * example, the scratch is a struct instead of a templated class because of the
46 * simplicity of step-9.
47 *
48 * @tparam dim An integer that denotes the dimension of the space in which
49 * the flow is solved
50 *
51 * @ingroup solvers
52 **/
53
54template <int dim>
56{
57public:
58 // Store the curl using deal.II's own view-dependent result type. This keeps
59 // the scratch data compatible with the deal.II versions used in CI, where
60 // the 2D curl may be exposed either as a scalar or as Tensor<1,1>.
62 typename FEValuesViews::Vector<2>::template solution_curl_type<double>;
64 typename FEValuesViews::Vector<3>::template solution_curl_type<double>;
65
66 /**
67 * @brief Constructor. The constructor creates the fe_values that will be used
68 * to fill the member variables of the scratch. It also allocated the
69 * necessary memory for all member variables. However, it does not do any
70 * evaluation, since this needs to be done at the cell level.
71 *
72 * @param simulation_control The SimulationControl object that holds
73 * information related to the control of the steady-state or transient
74 * simulation. This is used to extrapolate auxiliary physics solutions in time
75 * for transient simulation.
76 *
77 * @param properties_manager The PhysicalPropertiesManager object that stores
78 * physical property models.
79 *
80 * @param fe The FESystem used to solve the Navier-Stokes equations
81 *
82 * @param quadrature The quadrature to use for the assembly
83 *
84 * @param mapping The mapping of the domain in which the Navier-Stokes
85 * equations are solved
86 */
88 const std::shared_ptr<SimulationControl> &simulation_control,
90 const FESystem<dim> &fe,
91 const Quadrature<dim> &quadrature,
92 const Mapping<dim> &mapping,
93 const Quadrature<dim - 1> &face_quadrature)
96 , fe_values(mapping,
97 fe,
98 quadrature,
99 update_values | update_quadrature_points | update_JxW_values |
100 update_gradients | update_hessians)
101 , fe_face_values(mapping,
102 fe,
103 face_quadrature,
104 update_values | update_quadrature_points |
105 update_JxW_values | update_gradients | update_hessians |
106 update_normal_vectors)
107 , sdirk_table(
108 time_stepping_is_sdirk(simulation_control->get_assembly_method()) ?
109 ::sdirk_table(simulation_control->get_assembly_method()) :
110 SDIRKTable())
111 {
112 allocate();
113
114 // By default, the assembly of variables belonging to auxiliary physics is
115 // disabled.
116 gather_cls = false;
118 gather_curvature = false;
119 gather_void_fraction = false;
121 gather_temperature = false;
122 gather_cahn_hilliard = false;
123 gather_ale = false;
124 gather_mortar = false;
126 gather_hessian = properties_manager.is_non_newtonian();
127 }
128
129 /**
130 * @brief Copy Constructor. Same as the main constructor.
131 * This constructor only uses the other scratch to build the FeValues, it
132 * does not copy the content of the other scratch into itself since, by
133 * definition of the WorkStream mechanism it is assumed that the content of
134 * the scratch will be reset on a cell basis.
135 *
136 * @param sd The scratch data to be copied
137 */
141 , fe_values(sd.fe_values.get_mapping(),
142 sd.fe_values.get_fe(),
143 sd.fe_values.get_quadrature(),
144 update_values | update_quadrature_points | update_JxW_values |
145 update_gradients | update_hessians)
146 , fe_face_values(sd.fe_face_values.get_mapping(),
147 sd.fe_face_values.get_fe(),
148 sd.fe_face_values.get_quadrature(),
149 update_values | update_quadrature_points |
150 update_JxW_values | update_gradients | update_hessians |
151 update_normal_vectors)
153 {
154 allocate();
155
156 // By default, the assembly of variables belonging to auxiliary physics is
157 // disabled.
158 gather_cls = false;
160 gather_curvature = false;
161 gather_void_fraction = false;
163 gather_temperature = false;
164 gather_cahn_hilliard = false;
165 gather_ale = false;
166 gather_mortar = false;
168 gather_hessian = properties_manager.is_non_newtonian();
169
170 if (sd.gather_cls)
171 enable_cls(sd.fe_values_cls->get_fe(),
172 sd.fe_values_cls->get_quadrature(),
173 sd.fe_values_cls->get_mapping(),
174 sd.filter);
180 if (sd.gather_curvature)
182 sd.fe_values_curvature->get_quadrature(),
183 sd.fe_values_curvature->get_mapping());
184
187 sd.fe_values_void_fraction->get_quadrature(),
188 sd.fe_values_void_fraction->get_mapping());
192 if (sd.gather_temperature)
194 sd.fe_values_temperature->get_quadrature(),
195 sd.fe_values_temperature->get_mapping());
198 sd.fe_values_cahn_hilliard->get_quadrature(),
199 sd.fe_values_cahn_hilliard->get_mapping(),
201 if (sd.gather_ale)
202 enable_ale();
203 if (sd.gather_mortar)
205
208 sd.fe_values.get_quadrature(),
209 sd.fe_values.get_mapping(),
210 sd.fe_values_particle_drag->get_fe(),
212 sd.fe_values_particle_velocity->get_fe(),
214
216 }
217
218 /**
219 * @brief Allocates the memory for the scratch
220 *
221 * This function allocates the necessary memory for all members of the scratch
222 */
223 void
224 allocate() override;
225
226 /**
227 * @brief Reinitializes the content of the scratch.
228 *
229 * Using the FeValues and the content of the solutions and previous solutions,
230 * fills all of the class member of the scratch.
231 *
232 * @param[in] cell The cell over which the assembly is being carried.
233 * This cell must be compatible with the FE which is used to fill the
234 * FeValues.
235 *
236 * @param[in] current_solution The present value of the solution for [u,p].
237 *
238 * @param[in] previous_solutions The solutions at the previous time steps.
239 *
240 * @param[in] forcing_function The function describing the momentum/mass
241 * source term.
242 *
243 * @param[in] beta_force The additional force for flow control.
244 * TODO : Deprecate this argument and pass it to the constructor of the
245 * assembler
246 */
247
248 template <typename VectorType>
249 void
250 reinit(const typename DoFHandler<dim>::active_cell_iterator &cell,
251 const VectorType &current_solution,
252 const std::vector<VectorType> &previous_solutions,
253 const VectorType &sum_over_previous_stages,
254 const std::shared_ptr<Function<dim>> &forcing_function,
255 const Tensor<1, dim> &beta_force,
256 const double pressure_scaling_factor)
257 {
258 this->fe_values.reinit(cell);
259
260 quadrature_points = this->fe_values.get_quadrature_points();
261 auto &fe = this->fe_values.get_fe();
262
263 forcing_function->vector_value_list(quadrature_points, this->rhs_force);
264
265 // Establish the force vector
266 for (unsigned int q = 0; q < n_q_points; ++q)
267 {
268 for (int d = 0; d < dim; ++d)
269 {
270 const unsigned int component_i =
271 fe.system_to_component_index(d).first;
272 this->force[q][d] = this->rhs_force[q](component_i);
273 }
274
275 const unsigned int component_mass =
276 fe.system_to_component_index(dim).first;
277 this->mass_source[q] = this->rhs_force[q](component_mass);
278
279 // Correct force to include the dynamic forcing term for flow
280 // control
281 force[q] = force[q] + beta_force;
282 }
283
284 for (const unsigned int k : fe_values.dof_indices())
285 {
286 components[k] = fe.system_to_component_index(k).first;
287 }
288
289 // Compute cell diameter
290 double cell_measure =
291 compute_cell_measure_with_JxW(this->fe_values.get_JxW_values());
292 this->cell_size = compute_cell_diameter<dim>(cell_measure, fe.degree);
293
294 // For the SDIRK methods, \sum_{j=1}^{i-1} a_{ij} k_j is needed for the
295 // assembler
296 if (this->simulation_control->is_sdirk())
297 {
298 this->fe_values[velocities].get_function_values(
299 sum_over_previous_stages, this->sdirk_stage_sum);
300 }
301
302 // Gather velocity (values, gradient and laplacian)
303 this->fe_values[velocities].get_function_values(current_solution,
304 this->velocity_values);
305 this->fe_values[velocities].get_function_gradients(
306 current_solution, this->velocity_gradients);
307 this->fe_values[velocities].get_function_laplacians(
308 current_solution, this->velocity_laplacians);
309 if (gather_hessian)
310 this->fe_values[velocities].get_function_hessians(
311 current_solution, this->velocity_hessians);
312
313 // Gather convective velocity (same as velocity_values unless ALE is
314 // enabled. The ALE correction is made within the correponding reinit
315 // function)
317
318 for (unsigned int q = 0; q < this->n_q_points; ++q)
319 {
320 this->velocity_divergences[q] = trace(this->velocity_gradients[q]);
321 // In the VANS momentum equations, the viscous stress tensor includes
322 // the gradient of the divergence of the velocity, ∇(∇·u) = ∂i(∂juj). We
323 // therefore compute this quantity here when assembling VANS-specific
324 // contributions (gated by gather_void_fraction).
326 {
327 // Compute term ∂j(∂iuj) = ∂i(∂juj) for use in the strong residual
328 // of the VANS momentum equations.
329 this->velocity_gradient_divergence[q] = 0;
330 for (int d1 = 0; d1 < dim; ++d1)
331 {
332 for (int d2 = 0; d2 < dim; ++d2)
333 {
334 this->velocity_gradient_divergence[q][d1] +=
335 (this->velocity_hessians[q][d2][d1][d2]);
336 }
337 }
338 }
339 }
340
341 // Gather pressure (values, gradient)
342 fe_values[pressure].get_function_values(current_solution,
343 this->pressure_values);
344 fe_values[pressure].get_function_gradients(current_solution,
345 this->pressure_gradients);
346 this->pressure_scaling_factor = pressure_scaling_factor;
347
348 for (unsigned int p = 0; p < previous_solutions.size(); ++p)
349 {
350 this->fe_values[velocities].get_function_values(
351 previous_solutions[p], previous_velocity_values[p]);
352 }
353
354 // Only gather the pressure when a pressure history is necessary
355 // (compressible Navier-Stokes)
356 if (!this->properties_manager.density_is_constant())
357 for (unsigned int p = 0; p < previous_solutions.size(); ++p)
358 {
359 this->fe_values[pressure].get_function_values(
360 previous_solutions[p], previous_pressure_values[p]);
361 }
362
363 for (unsigned int q = 0; q < n_q_points; ++q)
364 {
365 this->JxW[q] = this->fe_values.JxW(q);
366 for (unsigned int k = 0; k < n_dofs; ++k)
367 {
368 // Velocity
369 this->phi_u[q][k] = this->fe_values[velocities].value(k, q);
370 this->div_phi_u[q][k] =
371 this->fe_values[velocities].divergence(k, q);
372 this->grad_phi_u[q][k] = this->fe_values[velocities].gradient(k, q);
373 this->hess_phi_u[q][k] = this->fe_values[velocities].hessian(k, q);
374 for (int d = 0; d < dim; ++d)
375 this->laplacian_phi_u[q][k][d] = trace(this->hess_phi_u[q][k][d]);
376
377 // In the VANS momentum equations, the viscous stress tensor
378 // includes the gradient of the divergence of the velocity, ∇(∇·u) =
379 // ∂i(∂juj). This results in a term ∂i(∂jδuj), which we compute here
380 // when assembling VANS-specific contributions (gated by
381 // gather_void_fraction).
383 {
384 this->gradient_divergence_phi_u[q][k] = 0;
385 // Compute term ∂j(∂iδuj) = ∂i(∂jδuj) to be used in the strong
386 // Jacobian of the VANS momentum equations
387
388 for (int d1 = 0; d1 < dim; ++d1)
389 {
390 for (int d2 = 0; d2 < dim; ++d2)
391 {
392 this->gradient_divergence_phi_u[q][k][d1] +=
393 (this->hess_phi_u[q][k][d2][d1][d2]);
394 }
395 }
396 }
397 // Pressure
398 this->phi_p[q][k] = this->fe_values[pressure].value(k, q);
399 this->grad_phi_p[q][k] = this->fe_values[pressure].gradient(k, q);
400 }
401 }
402
403 is_boundary_cell = cell->at_boundary();
405 {
406 n_faces = cell->n_faces();
407 is_boundary_face = std::vector<bool>(n_faces, false);
408 n_faces_q_points = fe_face_values.get_quadrature().size();
409 boundary_face_id = std::vector<unsigned int>(n_faces);
410
412
413 // Velocity and pressure values
414 // First vector is face number, second quadrature point
415 this->face_velocity_values = std::vector<std::vector<Tensor<1, dim>>>(
416 n_faces, std::vector<Tensor<1, dim>>(n_faces_q_points));
417
418 this->face_velocity_divergences = std::vector<std::vector<double>>(
419 n_faces, std::vector<double>(n_faces_q_points));
420
422 std::vector<std::vector<Tensor<2, dim>>>(
423 n_faces, std::vector<Tensor<2, dim>>(n_faces_q_points));
424
426 std::vector<std::vector<Tensor<1, dim>>>(
427 n_faces, std::vector<Tensor<1, dim>>(n_faces_q_points));
428
429 this->face_pressure_values = std::vector<std::vector<double>>(
430 n_faces, std::vector<double>(n_faces_q_points));
431
433 std::vector<std::vector<Tensor<1, dim>>>(
434 n_faces, std::vector<Tensor<1, dim>>(n_faces_q_points));
435
436 this->face_normal.reinit(n_faces, n_faces_q_points);
437
438 this->face_quadrature_points = std::vector<std::vector<Point<dim>>>(
439 n_faces, std::vector<Point<dim>>(n_faces_q_points));
440
442
445
447
451
452 for (const auto face : cell->face_indices())
453 {
454 is_boundary_face[face] = cell->face(face)->at_boundary();
455 if (is_boundary_face[face])
456 {
457 fe_face_values.reinit(cell, face);
458 n_dofs = fe_face_values.get_fe().n_dofs_per_cell();
459 boundary_face_id[face] = cell->face(face)->boundary_id();
460 // Shape functions
461 // First vector is face number, second quadrature point, third
462 // DOF
463
464 // Gather velocity (values, gradient and laplacian)
465 this->fe_face_values[velocities].get_function_values(
466 current_solution, this->face_velocity_values[face]);
467 this->fe_face_values[velocities].get_function_gradients(
468 current_solution, this->face_velocity_gradients[face]);
469 this->fe_face_values[velocities].get_function_laplacians(
470 current_solution, this->face_velocity_laplacians[face]);
471
472 // Gather pressure (values, gradient)
473 this->fe_face_values[pressure].get_function_values(
474 current_solution, this->face_pressure_values[face]);
475 this->fe_face_values[pressure].get_function_gradients(
476 current_solution, this->face_pressure_gradients[face]);
477
478 for (unsigned int q = 0; q < n_faces_q_points; ++q)
479 {
480 this->face_JxW[face][q] = this->fe_face_values.JxW(q);
481 this->face_normal[face][q] =
482 this->fe_face_values.normal_vector(q);
483 this->face_quadrature_points[face][q] =
484 this->fe_face_values.quadrature_point(q);
485 for (const unsigned int k : fe_face_values.dof_indices())
486 {
487 // Velocity
488 this->face_phi_u[face][q][k] =
489 this->fe_face_values[velocities].value(k, q);
490 this->face_div_phi_u[face][q][k] =
491 this->fe_face_values[velocities].divergence(k, q);
492 this->face_grad_phi_u[face][q][k] =
493 this->fe_face_values[velocities].gradient(k, q);
494 this->face_hess_phi_u[face][q][k] =
495 this->fe_face_values[velocities].hessian(k, q);
496 for (int d = 0; d < dim; ++d)
497 this->face_laplacian_phi_u[face][q][k][d] =
498 trace(this->face_hess_phi_u[face][q][k][d]);
499 // Pressure
500 this->face_phi_p[face][q][k] =
501 this->fe_face_values[pressure].value(k, q);
502 this->face_grad_phi_p[face][q][k] =
503 this->fe_face_values[pressure].gradient(k, q);
504 }
505 }
506 }
507 }
508 }
509 }
510
511 /**
512 * @brief enable_cls Enables the collection of the CLS data by the scratch
513 *
514 * @param fe FiniteElement associated with the CLS.
515 *
516 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
517 *
518 * @param mapping Mapping used for the Navier-Stokes problem assembly
519 *
520 * @param phase_filter_parameters Parameters for phase indicator filtering
521 */
522
523 void
524 enable_cls(const FiniteElement<dim> &fe,
525 const Quadrature<dim> &quadrature,
526 const Mapping<dim> &mapping,
527 const Parameters::CLS_PhaseFilter &phase_filter_parameters);
528
529 /**
530 * @brief enable_cls Enables the collection of the CLS data by the scratch - function overload used in the copy constructor of NavierStokesScratchData
531 *
532 * @param fe FiniteElement associated with the CLS.
533 *
534 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
535 *
536 * @param mapping Mapping used for the Navier-Stokes problem assembly
537 *
538 * @param filter Filter that is applied on the phase indicator
539 */
540
541 void
542 enable_cls(const FiniteElement<dim> &fe,
543 const Quadrature<dim> &quadrature,
544 const Mapping<dim> &mapping,
545 const std::shared_ptr<ConservativeLevelSetFilterBase> &filter);
546
547 void
549 const FiniteElement<dim> &fe_projected_phase_indicator_gradient,
550 const Quadrature<dim> &quadrature,
551 const Mapping<dim> &mapping);
552
553 void
554 enable_curvature(const FiniteElement<dim> &fe_curvature,
555 const Quadrature<dim> &quadrature,
556 const Mapping<dim> &mapping);
557
558 /**
559 * @brief Reinitialize the content of the scratch for the cls
560 *
561 * @param cell The cell over which the assembly is being carried.
562 * This cell must be compatible with the CLS FE and not the
563 * Navier-Stokes FE
564 *
565 * @param current_solution The present value of the solution for [alpha]
566 *
567 * @param current_filtered_solution The present value of the solution for [alpha]_filtered
568 *
569 * @param previous_solutions The solutions at the previous time steps for [alpha]
570 */
571
572 template <typename VectorType>
573 void
574 reinit_cls(const typename DoFHandler<dim>::active_cell_iterator &cell,
575 const VectorType &current_solution,
576 const VectorType &current_filtered_solution,
577 const std::vector<VectorType> &previous_solutions)
578 {
579 Assert(
581 ExcMessage(
582 "You are trying to reinit the CLS model in a cell, but you did not enable CLS for the scratch data (gather_cls=false)."));
583
584 this->fe_values_cls->reinit(cell);
585 // Gather phase indicator (values, gradient)
586 this->fe_values_cls->get_function_values(current_solution,
587 this->phase_values);
588 this->fe_values_cls->get_function_values(current_filtered_solution,
590 this->fe_values_cls->get_function_gradients(
591 current_filtered_solution, this->filtered_phase_gradient_values);
592 this->fe_values_cls->get_function_gradients(current_solution,
594
595 // Gather previous phase indicator values
596 for (unsigned int p = 0; p < previous_solutions.size(); ++p)
597 {
598 this->fe_values_cls->get_function_values(previous_solutions[p],
600 }
601 }
602
603 template <typename VectorType>
604 void
606 const typename DoFHandler<dim>::active_cell_iterator
607 &projected_phase_indicator_gradient_cell,
608 const VectorType &current_projected_phase_indicator_gradient_solution)
609 {
611 projected_phase_indicator_gradient_cell);
612
613 FEValuesExtractors::Vector pig(0);
614 // Gather phase indicator gradient
615 (*fe_values_projected_phase_indicator_gradient)[pig].get_function_values(
616 current_projected_phase_indicator_gradient_solution,
618 }
619
620 template <typename VectorType>
621 void
623 const typename DoFHandler<dim>::active_cell_iterator &curvature_cell,
624 const VectorType &current_curvature_solution)
625 {
626 Assert(
628 ExcMessage(
629 "You are trying to reinit the curvature in a cell, but you did not enable curvature for the scratch data (gather_curvature=false)."));
630
631 this->fe_values_curvature->reinit(curvature_cell);
632
633 // Gather phase indicator gradient
634 this->fe_values_curvature->get_function_values(current_curvature_solution,
635 this->curvature_values);
636 }
637
638 /**
639 * @brief enable_void_fraction Enables the collection of the void fraction
640 * data by the scratch
641 *
642 * @param fe FiniteElement associated with the void fraction
643 *
644 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
645 *
646 * @param mapping Mapping used for the Navier-Stokes problem assembly
647 */
648
649 void
650 enable_void_fraction(const FiniteElement<dim> &fe,
651 const Quadrature<dim> &quadrature,
652 const Mapping<dim> &mapping);
653
654 /**
655 * @brief enable_particle_field_projection Enables the collection of the particle
656 * fields projection data by the scratch
657 *
658 * @param[in] quadrature Quadrature rule of the Navier-Stokes problem assembly
659 *
660 * @param[in] mapping Mapping used for the Navier-Stokes problem assembly
661 *
662 * @param[in] fe_particle_drag_proj FiniteElement associated with the
663 * projected particle drag force
664 *
665 * @param[in] fe_particle_two_way_coupling_force_proj FiniteElement associated
666 * with the projected particle two-way coupling force
667 *
668 * @param[in] fe_particle_velocity_proj FiniteElement associated with the
669 * projected particle velocity
670 *
671 * @param[in] fe_particle_momentum_transfer_coefficient FiniteElement
672 * associated with the projected particle momentum transfer coefficient
673 */
674 void
676 const Quadrature<dim> &quadrature,
677 const Mapping<dim> &mapping,
678 const FiniteElement<dim> &fe_particle_drag_proj,
679 const FiniteElement<dim> &fe_particle_two_way_coupling_force_proj,
680 const FiniteElement<dim> &fe_particle_velocity_proj,
681 const FiniteElement<dim> &fe_particle_momentum_transfer_coefficient);
682
683 /**
684 * @brief Reinitialize the content of the scratch for the void fraction
685 *
686 * @param cell The cell over which the assembly is being carried.
687 * This cell must be compatible with the void fraction FE and not the
688 * Navier-Stokes FE
689 *
690 * @param current_solution The present value of the solution for [epsilon]
691 *
692 * @param previous_solutions The solutions at the previous time steps for [epsilon]
693 */
694
695 template <typename VectorType>
696 void
698 const typename DoFHandler<dim>::active_cell_iterator &cell,
699 const VectorType &current_solution,
700 const std::vector<VectorType> &previous_solutions)
701 {
702 Assert(
704 ExcMessage(
705 "You are trying to reinit the void fraction in a cell, but you did not enable void fraction for the scratch data (gather_void_fraction=false)."));
706
707 this->fe_values_void_fraction->reinit(cell);
708
709 // Gather void fraction (values, gradient)
710 this->fe_values_void_fraction->get_function_values(
711 current_solution, this->void_fraction_values);
712 this->fe_values_void_fraction->get_function_gradients(
713 current_solution, this->void_fraction_gradient_values);
714
715 // Gather previous void fraction fraction values
716 for (unsigned int p = 0; p < previous_solutions.size(); ++p)
717 {
718 this->fe_values_void_fraction->get_function_values(
719 previous_solutions[p], previous_void_fraction_values[p]);
720 }
721 }
722
723 /**
724 * @brief enable_particle_fluid_interactions Enables the calculation of the fluid information at the particle location for the scratch.
725 *
726 * @param fe FiniteElement associated with the void fraction
727 *
728 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
729 *
730 * @param mapping Mapping used for the Navier-Stokes problem assembly
731 */
732
733 void
735 const unsigned int n_global_max_particles_per_cell,
736 const bool enable_void_fraction_interpolation);
737
738 /**
739 * @brief Reinitializes the fluid forces and torques on the particles in the cell to zero
740 *
741 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
742 */
743 template <typename PropertiesIndex>
744 void
746
747 /**
748 * @brief Extracts the velocity of the particles and calculates their total volume
749 * in the cell. Both outcomes are stored as members of the scratch data class.
750 *
751 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
752 */
753 template <typename PropertiesIndex>
754 void
756
757 /**
758 * @brief Computes the cell void fraction
759 *
760 * @param[in] total_particle_volume The total volume of the particles in the
761 * cell
762 */
763
764 void
766
767 /**
768 * @brief Creates an object of type Quadrature<dim> that contains the
769 * particle reference location. This object can be used to interpolate any
770 * function known at the dofs at the location of the particles.
771 *
772 * @return Quadrature type object that contains the location of the particles
773 * relative to the cell's frame of reference.
774 */
775
776 Quadrature<dim>
778
779
780 /**
781 * @brief Interpolates the velocity and pressure of the fluid, as well as the
782 * pressure gradient, and the laplacian, curl and gradient of the velocity,
783 * at the locations of the particles.
784 *
785 * @param[in] q_particles_location Quadrature type object that contains the
786 * location of the particles relative to the cell's frame of reference.
787 *
788 * @param[in] velocity_cell The active cell associated with the velocity and
789 * pressure DoFHandler
790 *
791 * @param[in] present_velocity_pressure_solution The solution (velocity and
792 * pressure) at the current time step. This solution is used in the implicit
793 * coupling to establish the particle-fluid force.
794 *
795 * @param[in] previous_velocity_pressure_solution The solution (velocity and
796 * pressure) at the previous time step. This solution is used in the explicit
797 * and semi-implicit coupling to calculate the particle-fluid force.
798 *
799 * @param[in] drag_coupling Indicator for the type of coupling that is used.
800 * This parameter essentially decides which velocity_pressure solution is
801 * interpolated at the location of the particles.
802 */
803
804 template <typename VectorType>
805 void
807 const Quadrature<dim> &q_particles_location,
808 const typename DoFHandler<dim>::active_cell_iterator &velocity_cell,
809 const VectorType &present_velocity_pressure_solution,
810 const VectorType &previous_velocity_pressure_solution,
811 const Parameters::DragCoupling &drag_coupling)
812 {
813 FEValues<dim> fe_values_local_particles(this->fe_values.get_fe(),
814 q_particles_location,
815 update_gradients | update_values |
816 update_hessians);
817
818 // Reallocate memory for the fields to be interpolated at the particle
819 // location This has to be done for every cell because deal.II expects the
820 // size of the vector to be strictly equal to the number of points in the
821 // quadrature
827
828 // Take velocity_pressure_solution according to the type of coupling used.
829 const auto &velocity_pressure_solution =
831 present_velocity_pressure_solution :
832 previous_velocity_pressure_solution;
833
834 fe_values_local_particles.reinit(velocity_cell);
835
836 // Calculate all fluid properties at the particle location
837 fe_values_local_particles[velocities].get_function_values(
838 velocity_pressure_solution, fluid_velocity_at_particle_location);
839
840 fe_values_local_particles[velocities].get_function_laplacians(
841 velocity_pressure_solution,
843
844 if constexpr (dim == 2)
845 {
846 fe_values_local_particles[velocities].get_function_curls(
847 velocity_pressure_solution,
849 }
850 else if constexpr (dim == 3)
851 {
852 fe_values_local_particles[velocities].get_function_curls(
853 velocity_pressure_solution,
855 }
856
857 fe_values_local_particles[pressure].get_function_gradients(
858 velocity_pressure_solution,
860 }
861
862 /**
863 * @brief Interpolates the void fraction at the locations of the particles.
864 *
865 * @param[in] q_particles_location Quadrature type object that contains the
866 * location of the particles relative to the cell's frame of reference.
867 *
868 * @param[in] void_fraction_cell The active cell associated with the void
869 * fraction DoFHandler
870 *
871 * @param[in] void_fraction_solution The void fraction calculated with one of
872 * the methods of the VoidFractionBase class.
873 */
874
875 template <typename VectorType>
876 void
878 const Quadrature<dim> &q_particles_location,
879 const typename DoFHandler<dim>::active_cell_iterator &void_fraction_cell,
880 const VectorType &void_fraction_solution)
881 {
882 Assert(
884 ExcMessage(
885 "gather_void_fraction has been set to false, yet you are trying to gather the void fraction at the location of the particles. The scratch data is currently unaware of the finite element interpolation for the void fraction and the simulation will abort."));
886
887 Assert(
888 cell_void_fraction.size() == q_particles_location.size(),
889 ExcMessage(
890 "The vector for the void fraction at the particle location does not have the same size as the quadrature used to evaluate it."));
891
892 Vector<double> local_void_fraction_dof_values(
893 void_fraction_cell->get_fe().n_dofs_per_cell());
894 void_fraction_cell->get_dof_values(void_fraction_solution,
895 local_void_fraction_dof_values);
896
898 void_fraction_cell, make_array_view(q_particles_location.get_points()));
900 make_array_view(local_void_fraction_dof_values), EvaluationFlags::values);
901
902 for (unsigned int i_particle = 0; i_particle < q_particles_location.size();
903 ++i_particle)
904 cell_void_fraction[i_particle] =
905 point_evaluator_void_fraction->get_value(i_particle);
906 }
907
908 /**
909 * @brief Calculates the properties of the fluid at the locations of the particles.
910 * At the moment, only constant properties within the same fluid are
911 * supported. When two fluids are present and CLS is used, the properties are
912 * calculated based on the filtered CLS solution interpolated at the
913 * location of the particles. These properties are used in the forces
914 * calculations in the VANS equations.
915 */
916
917 void
919 {
920 AssertThrow(
921 properties_manager.density_is_constant(),
922 ExcMessage(
923 "The lethe-fluid-particles solver only supports constant densities"));
924 AssertThrow(
925 !properties_manager.get_rheology()
926 ->is_non_newtonian_rheological_model() &&
927 !properties_manager.get_rheology()
928 ->is_non_newtonian_rheological_model(),
929 ExcMessage(
930 "The lethe-fluid-particles solver only supports constant rheology model"));
931
932 if (gather_cls)
933 {
934 for (unsigned int i_particle = 0; i_particle < number_of_particles;
935 ++i_particle)
936 {
939 this->density_ref_0,
940 this->density_ref_1);
941 double dynamic_viscosity_at_particle_location =
946
948 dynamic_viscosity_at_particle_location /
950 }
951
952 // Properties have been calculated, return
953 return;
954 }
955
956 // Regular case without CLS
957 for (unsigned int i_particle = 0; i_particle < number_of_particles;
958 ++i_particle)
959 {
960 // Gather the kinematic viscosity and density at the particle
961 // location assuming a constant kinematic viscosity and density in a
962 // single fluid
966 }
967 }
968
969 /**
970 * @brief Calculates the velocity of the fluid relative to that of the particle and
971 * the particle Reynolds number at the location of the particles. These will
972 * be used in forces calculations in the vans equations.
973 *
974 * @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
975 */
976
977 template <typename PropertiesIndex>
978 void
980 {
981 // Tolerance for the calculation of the particle Reynolds number.
982 // TODO -> Revisit if that is not a too high value.
983 const double Re_particle_tolerance = 1e-3;
984 unsigned int i_particle = 0;
986
987 for (auto &particle : pic)
988 {
989 auto particle_properties = particle.get_properties();
990
993 particle_velocity[i_particle];
996
997 Re_particle[i_particle] =
998 Re_particle_tolerance +
999 cell_void_fraction[i_particle] *
1001 .norm() *
1002 particle_properties[PropertiesIndex::dp] /
1003 (kinematic_viscosity_at_particle_location[i_particle] + DBL_MIN);
1004 i_particle++;
1005 }
1006
1009 }
1010
1011 /**
1012 * @brief Interpolates the filtered CLS solution at the location of the particles.
1013 * The latter values are used in calculating the density and viscosity of the
1014 * fluid at the particles' locations when CLS is used.
1015 *
1016 * @param[in] q_particles_location Quadrature type object that contains the
1017 * location of the particles relative to the cell's frame of reference.
1018 *
1019 * @param[in] phase_cell The active cell associated with the CLS DoFHandler
1020 *
1021 * @param[in] current_filtered_solution The present value of the filtered CLS
1022 * solution
1023 */
1024
1025 template <typename VectorType>
1026 void
1028 const Quadrature<dim> &q_particles_location,
1029 const typename DoFHandler<dim>::active_cell_iterator &phase_cell,
1030 const VectorType &current_filtered_solution)
1031 {
1032 Assert(
1033 gather_cls,
1034 ExcMessage(
1035 "gather_cls has been set to false, yet you are trying to gather the CLS at the location of the particles. The scratch data is currently unaware of the finite element interpolation for CLS and the simulation will abort."));
1036
1038
1039 Vector<double> local_filtered_phase_dof_values(
1040 phase_cell->get_fe().n_dofs_per_cell());
1041 phase_cell->get_dof_values(current_filtered_solution,
1042 local_filtered_phase_dof_values);
1043
1044 point_evaluator_cls->reinit(
1045 phase_cell, make_array_view(q_particles_location.get_points()));
1046 point_evaluator_cls->evaluate(make_array_view(
1047 local_filtered_phase_dof_values),
1048 EvaluationFlags::values);
1049
1050 for (unsigned int i_particle = 0; i_particle < number_of_particles;
1051 ++i_particle)
1053 point_evaluator_cls->get_value(i_particle);
1054 }
1055
1056 /**
1057 * @brief Calculates the variables needed to compute the particle fluid interactions
1058 * in the VANS equations.
1059 *
1060 * @param[in] velocity_cell The active cell associated with the velocity and
1061 * pressure DoFHandler
1062 *
1063 * @param[in] void_fraction_cell The active cell associated with the void
1064 * fraction DoFHandler
1065 *
1066 * @param[in] present_velocity_pressure_solution The solution (velocity and
1067 * pressure) at the current time step. This solution is used in the implicit
1068 * coupling to establish the particle-fluid force.
1069 *
1070 * @param[in] previous_velocity_pressure_solution The solution (velocity and
1071 * pressure) at the previous time step. This solution is used in the explicit
1072 * and semi-implicit coupling to calculate the particle-fluid force.
1073 *
1074 * @param[in] void_fraction_solution The void fraction value calculated with
1075 * one of the methods of the VoidFractionBase class.
1076 *
1077 * @param[in] particle_handler The particle handler object that stores and
1078 * manages the particles in the simulations
1079 *
1080 * @param[in] drag_coupling Indicator for the type of coupling that is used.
1081 * This parameter essentially decides which velocity_pressure solution is
1082 * interpolated at the location of the particles.
1083 */
1084
1085 template <typename PropertiesIndex, typename VectorType>
1086 void
1088 const typename DoFHandler<dim>::active_cell_iterator &velocity_cell,
1089 const typename DoFHandler<dim>::active_cell_iterator &void_fraction_cell,
1090 const VectorType &present_velocity_pressure_solution,
1091 const VectorType &previous_velocity_pressure_solution,
1092 const VectorType &void_fraction_solution,
1093 const Particles::ParticleHandler<dim> &particle_handler,
1094 const Parameters::DragCoupling &drag_coupling)
1095 {
1096 Assert(
1098 ExcMessage(
1099 "You are trying to reinit the fluid information at the particle location within a cell,"
1100 " but you did not enable the gathering of the information at the particle location for the scratch data (gather_particles_information=false)."));
1101
1102 pic = particle_handler.particles_in_cell(velocity_cell);
1103
1106
1108
1109 if (number_of_particles == 0)
1110 return;
1111
1112 Quadrature<dim> q_particles_location =
1114
1116 q_particles_location,
1117 velocity_cell,
1118 present_velocity_pressure_solution,
1119 previous_velocity_pressure_solution,
1120 drag_coupling);
1121
1123 {
1125 void_fraction_cell,
1126 void_fraction_solution);
1127 }
1130 }
1131
1132 /**
1133 * @brief Calculates the variables needed to compute the particle fluid interactions
1134 * in the VANS equations.This version of the function is used when CLS is used
1135 * with CFD-DEM.
1136 *
1137 * @param[in] velocity_cell The active cell associated with the velocity and
1138 * pressure DoFHandler.
1139 *
1140 * @param[in] void_fraction_cell The active cell associated with the void
1141 * fraction DoFHandler.
1142 *
1143 * @param[in] phase_cell The active cell associated with the CLS DoFHandler.
1144 *
1145 * @param[in] present_velocity_pressure_solution The solution (velocity and
1146 * pressure) at the current time step. This solution is used in the implicit
1147 * coupling to establish the particle-fluid force.
1148 *
1149 * @param[in] previous_velocity_pressure_solution The solution (velocity and
1150 * pressure) at the previous time step. This solution is used in the explicit
1151 * and semi-implicit coupling to calculate the particle-fluid force.
1152 *
1153 * @param[in] void_fraction_solution The void fraction value calculated with
1154 * one of the methods of the VoidFractionBase class.
1155 *
1156 * @param[in] particle_handler The particle handler object that stores and
1157 * manages the particles in the simulations.
1158 *
1159 * @param[in] current_filtered_CLS_solution The present value of the CLS
1160 * solution.
1161 *
1162 * @param[in] drag_coupling Indicator for the type of coupling that is
1163 * used. This parameter essentially decides which velocity_pressure solution
1164 * is interpolated at the location of the particles.
1165 */
1166 template <typename PropertiesIndex, typename VectorType>
1167 void
1169 const typename DoFHandler<dim>::active_cell_iterator &velocity_cell,
1170 const typename DoFHandler<dim>::active_cell_iterator &void_fraction_cell,
1171 const typename DoFHandler<dim>::active_cell_iterator &phase_cell,
1172 const VectorType &present_velocity_pressure_solution,
1173 const VectorType &previous_velocity_pressure_solution,
1174 const VectorType &void_fraction_solution,
1175 const Particles::ParticleHandler<dim> &particle_handler,
1176 const Parameters::DragCoupling &drag_coupling,
1177 const VectorType &current_filtered_CLS_solution)
1178 {
1179 pic = particle_handler.particles_in_cell(velocity_cell);
1180
1184
1185 if (number_of_particles == 0)
1186 return;
1187
1188 Quadrature<dim> q_particles_location =
1191 q_particles_location,
1192 velocity_cell,
1193 present_velocity_pressure_solution,
1194 previous_velocity_pressure_solution,
1195 drag_coupling);
1196
1198 {
1200 void_fraction_cell,
1201 void_fraction_solution);
1202 }
1203 calculate_cls_at_particle_location(q_particles_location,
1204 phase_cell,
1205 current_filtered_CLS_solution);
1208 }
1209
1210 /**
1211 * @brief enable_heat_transfer Enables the collection of the heat transfer
1212 * data (Temperature field) by the scratch
1213 *
1214 * @param fe FiniteElement associated with the heat transfer.
1215 *
1216 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
1217 *
1218 * @param mapping Mapping used for the Navier-Stokes problem assembly
1219 */
1220
1221 void
1222 enable_heat_transfer(const FiniteElement<dim> &fe,
1223 const Quadrature<dim> &quadrature,
1224 const Mapping<dim> &mapping);
1225
1226 /**
1227 * @brief Reinitialize the content of the scratch for the heat transfer
1228 * auxiliary physic
1229 *
1230 * @param cell The cell over which the assembly is being carried.
1231 * This cell must be compatible with the heat transfer FE and not the
1232 * Navier-Stokes FE
1233 *
1234 * @param current_solution The present value of the solution for temperature
1235 *
1236 * @param previous_solutions Vector of \f$n\f$ @p VectorType containers of
1237 * previous temperature solutions. \f$n\f$ depends on the BDF scheme selected
1238 * for time-stepping.
1239 */
1240
1241 template <typename VectorType>
1242 void
1244 const typename DoFHandler<dim>::active_cell_iterator &cell,
1245 const VectorType &current_solution,
1246 const std::vector<VectorType> &previous_solutions)
1247 {
1248 this->fe_values_temperature->reinit(cell);
1249
1250 // Gather temperature
1251 this->fe_values_temperature->get_function_values(current_solution,
1252 this->temperature_values);
1253
1254 // Gather temperature gradient
1255 this->fe_values_temperature->get_function_gradients(
1256 current_solution, this->temperature_gradients);
1257
1258 // Extrapolate temperature and temperature gradient to t+dt using the BDF
1259 // if the simulation is transient
1260 const auto method = this->simulation_control->get_assembly_method();
1261 if (time_stepping_is_bdf(method))
1262 {
1263 // Gather previous temperature and temperature gradient values
1264 for (unsigned int p = 0; p < previous_solutions.size(); ++p)
1265 {
1266 fe_values_temperature->get_function_values(
1267 previous_solutions[p], this->previous_temperature_values[p]);
1268 fe_values_temperature->get_function_gradients(
1269 previous_solutions[p], this->previous_temperature_gradients[p]);
1270 }
1271 // Extrapolate temperature and temperature gradient
1272 std::vector<double> time_vector =
1273 this->simulation_control->get_simulation_times();
1274 bdf_extrapolate(time_vector,
1278 bdf_extrapolate(time_vector,
1282 }
1283 }
1284
1285 /**
1286 * @brief enable_cahn_hilliard Enables the collection of the CahnHilliard data
1287 * by the scratch
1288 *
1289 * @param fe FiniteElement associated with the CahnHilliard physics
1290 *
1291 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
1292 *
1293 * @param mapping Mapping used for the Navier-Stokes problem assembly
1294 */
1295 void
1297 const FiniteElement<dim> &fe,
1298 const Quadrature<dim> &quadrature,
1299 const Mapping<dim> &mapping,
1300 const Parameters::CahnHilliard &cahn_hilliard_parameters);
1301
1302 /**
1303 * @brief Enables the collection of the CahnHilliard data by the scratch
1304 *
1305 * @param fe FiniteElement associated with the CahnHilliard physics
1306 *
1307 * @param quadrature Quadrature rule of the Navier-Stokes problem assembly
1308 *
1309 * @param mapping Mapping used for the Navier-Stokes problem assembly
1310 */
1311 void
1313 const FiniteElement<dim> &fe,
1314 const Quadrature<dim> &quadrature,
1315 const Mapping<dim> &mapping,
1316 const std::shared_ptr<CahnHilliardFilterBase> &cahn_hilliard_filter);
1317
1318 /**
1319 * @brief Reinitialize the content of the scratch for CH
1320 *
1321 * @param cell The cell over which the assembly is being carried.
1322 * This cell must be compatible with the CH FE and not the
1323 * Navier-Stokes FE
1324 *
1325 * @param current_solution The present value of the solution for [phi]
1326 */
1327 template <typename VectorType>
1328 void
1330 const typename DoFHandler<dim>::active_cell_iterator &cell,
1331 const VectorType &current_solution,
1332 const VectorType &current_filtered_solution)
1333 {
1334 this->fe_values_cahn_hilliard->reinit(cell);
1335 this->phase_order.component = 0;
1336 this->chemical_potential.component = 1;
1337
1338 // Gather phase indicator (values, gradients)
1339 this->fe_values_cahn_hilliard->operator[](phase_order)
1340 .get_function_values(current_solution,
1343 .get_function_values(current_solution,
1345 this->fe_values_cahn_hilliard->operator[](phase_order)
1346 .get_function_gradients(current_solution,
1348
1349 // Gather filtered CLS solution (values, gradients)
1350 this->fe_values_cahn_hilliard->operator[](phase_order)
1351 .get_function_values(current_filtered_solution,
1353 }
1354
1355 /**
1356 * @brief enable_ale Enables the calculation of the ALE velocity
1357 */
1358 void
1359 enable_ale();
1360
1361 /**
1362 * @brief Renitialize the content of the scratch data for ALE
1363 *
1364 * @param[in] ale ALE parameters
1365 */
1366 void
1367 reinit_ale(const Parameters::ALE<dim> &ale);
1368
1369 /**
1370 * @brief enable_mortar Enables the calculation of ALE velocity within the mortar feature
1371 */
1372 void
1373 enable_mortar();
1374
1375
1376 /**
1377 * @brief Renitialize the content of the scratch data for mortar
1378 *
1379 * @param[in] cell The cell over which the assembly is being carried.
1380 * This cell must be compatible with the FE which is used to fill the
1381 * FeValues.
1382 *
1383 * @param[in] mortar_parameters Parameters for the mortar method
1384 */
1385 void
1386 reinit_mortar(const typename DoFHandler<dim>::active_cell_iterator &cell,
1387 const Parameters::Mortar<dim> &mortar_parameters);
1388
1389 /**
1390 * @brief Calculates the physical properties. This function calculates the
1391 * physical properties that may be required by the fluid dynamics problem.
1392 * Namely the kinematic viscosity and, when required, the density.
1393 */
1394 void
1396
1397 /**
1398 * @brief Calculates the particle forces and velocities that were projected on
1399 * the fluid dofs at the quadrature points of the velocity and pressure FE.
1400 * The values are stored in the corresponding variables in scratch data.
1401 *
1402 * @param[in] particle_drag_cell Iterator pointing to the current active cell
1403 * using the particle drag force DoFHandler
1404 *
1405 * @param[in] particle_two_way_coupling_force_cell Iterator pointing to the
1406 * current active cell using the particle two-way coupling force DoFHandler
1407 *
1408 * @param[in] particle_velocity_cell Iterator pointing to the current active
1409 * cell using the particle velocity DoFHandler
1410 *
1411 * @param[in] particle_momentum_transfer_coefficient_cell Iterator pointing to
1412 * the current active cell using the particle momentum transfer coefficient
1413 * DoFHandler
1414 *
1415 * @param[in] particle_fluid_drag Object containing the projection of the drag
1416 * calculated for the particles onto the fluid dofs
1417 *
1418 * @param[in] particle_fluid_force_two_way_coupling Object containing the
1419 * projection of the two-way coupling force calculated for the particles onto
1420 * the fluid dofs
1421 *
1422 * @param[in] particle_velocity Object containing the projection of the
1423 * particle velocities onto the fluid dofs
1424 *
1425 * @param[in] particle_momentum_transfer_coefficient Object containing the
1426 * projection of the momentum transfer coefficient calculated for the
1427 * particles onto the fluid dofs
1428 *
1429 * @param[in] drag_coupling Enumeration specifying the numerical coupling
1430 * strategy used for the computation of the drag force between the fluid and
1431 * the particles.
1432 */
1433 template <typename VectorType>
1434 void
1436 const typename DoFHandler<dim>::active_cell_iterator &particle_drag_cell,
1437 const typename DoFHandler<dim>::active_cell_iterator
1438 &particle_two_way_coupling_force_cell,
1439 const typename DoFHandler<dim>::active_cell_iterator
1440 &particle_velocity_cell,
1441 const typename DoFHandler<dim>::active_cell_iterator
1442 &particle_momentum_transfer_coefficient_cell,
1443 const VectorType &particle_fluid_drag,
1444 const VectorType &particle_fluid_force_two_way_coupling,
1446 const VectorType &particle_momentum_transfer_coefficient,
1447 const Parameters::DragCoupling &drag_coupling)
1448 {
1449 constexpr FEValuesExtractors::Vector vector_index(0);
1450
1452 particle_two_way_coupling_force_cell);
1453 (*this->fe_values_particle_two_way_coupling_force)[vector_index]
1454 .get_function_values(particle_fluid_force_two_way_coupling,
1456
1457 // particle_drag_values will remain zero in the implicit and semi-implicit
1458 // coupling, since the momentum transfer coefficient is used instead, while
1459 // particle_momentum_transfer_coefficient_values and
1460 // particle_velocity_values will remain zero in the fully explicit coupling
1461 if (drag_coupling == Parameters::DragCoupling::fully_explicit)
1462 {
1463 this->fe_values_particle_drag->reinit(particle_drag_cell);
1464 (*this->fe_values_particle_drag)[vector_index].get_function_values(
1465 particle_fluid_drag, this->particle_drag_values);
1466 }
1467 else
1468 {
1469 this->fe_values_particle_velocity->reinit(particle_velocity_cell);
1470 (*this->fe_values_particle_velocity)[vector_index].get_function_values(
1472
1474 particle_momentum_transfer_coefficient_cell);
1476 .get_function_values(
1477 particle_momentum_transfer_coefficient,
1479 }
1480 }
1481
1482 // For auxiliary physics solution extrapolation
1483 const std::shared_ptr<SimulationControl> simulation_control;
1484
1485 // Physical properties
1487 std::map<field, std::vector<double>> fields;
1488 std::vector<double> density;
1491 std::vector<double> dynamic_viscosity;
1492 std::vector<double> kinematic_viscosity;
1494 /// Values of the kinematic viscosity used in the SUPG and PSPG
1495 /// stabilizations.
1497 /// Values of the dynamic viscosity used in the SUPG and PSPG stabilizations.
1499 std::vector<double> thermal_expansion;
1500 std::vector<double> density_thermal_expansion;
1502 std::vector<std::vector<double>> previous_density;
1503
1504 // Pressure scaling factor to facilitate different scales between velocity and
1505 // pressure
1507
1508 // For CLS and CH simulations. Present properties for fluid 0 and 1.
1509 std::vector<double> density_0;
1510 std::vector<double> density_1;
1516 // The density at the particles locations is used to calculate the forces
1517 // between the fluid and the particles.
1518 std::vector<double> density_at_particle_location;
1519 std::vector<double> compressibility_multiplier;
1520 std::vector<double> dynamic_viscosity_0;
1521 std::vector<double> dynamic_viscosity_1;
1522 std::vector<double> kinematic_viscosity_0;
1523 std::vector<double> kinematic_viscosity_1;
1524 /// Scale of the kinematic viscosity for fluid 0.
1526 /// Scale of the kinematic viscosity for fluid 1.
1528 /// Kinematic viscosity at the particles locations. This is used to calculate
1529 /// the Reynolds number and the forces between the fluid and the particles.
1531 /// Values of the dynamic viscosity used in the SUPG and PSPG stabilizations
1532 /// for fluid 0.
1534 /// Values of the dynamic viscosity used in the SUPG and PSPG stabilizations
1535 /// for fluid 1.
1537 std::vector<double> thermal_expansion_0;
1538 std::vector<double> thermal_expansion_1;
1539 std::vector<double> surface_tension;
1540 std::vector<double> surface_tension_gradient;
1541
1542 // FEValues for the Navier-Stokes problem
1543 FEValues<dim> fe_values;
1544 unsigned int n_dofs;
1545 unsigned int n_q_points;
1547 FEValuesExtractors::Vector velocities;
1548 FEValuesExtractors::Scalar pressure;
1549
1550 std::vector<Vector<double>> rhs_force;
1551 Tensor<1, dim> beta_force;
1552 std::vector<Tensor<1, dim>> force;
1553 std::vector<double> mass_source;
1554
1555 // Quadrature
1556 Table<1, double> JxW;
1557 std::vector<Point<dim>> quadrature_points;
1558
1559 // Components index
1560 std::vector<unsigned int> components;
1561
1562 // Velocity and pressure values
1563 std::vector<Tensor<1, dim>> velocity_values;
1564 std::vector<double> velocity_divergences;
1565 std::vector<Tensor<2, dim>> velocity_gradients;
1566 std::vector<Tensor<1, dim>> velocity_laplacians;
1567 std::vector<Tensor<3, dim>> velocity_hessians;
1568 std::vector<Tensor<1, dim>> velocity_gradient_divergence;
1569 // The gradient of the velocity divergence
1570 std::vector<Tensor<1, dim>> advective_velocity;
1571 std::vector<double> shear_rate;
1572 std::vector<double> pressure_values;
1573 std::vector<Tensor<1, dim>> pressure_gradients;
1574 std::vector<std::vector<double>> previous_pressure_values;
1575 std::vector<std::vector<Tensor<1, dim>>> previous_velocity_values;
1576 std::vector<Tensor<1, dim>> sdirk_stage_sum;
1577
1578 // Shape functions
1579 Table<2, double> div_phi_u;
1580 Table<2, Tensor<1, dim>> phi_u;
1581 Table<2, Tensor<3, dim>> hess_phi_u;
1582 Table<2, Tensor<1, dim>> laplacian_phi_u;
1583 Table<2, Tensor<1, dim>> gradient_divergence_phi_u;
1584 Table<2, Tensor<2, dim>> grad_phi_u;
1585 Table<2, double> phi_p;
1586 Table<2, Tensor<1, dim>> grad_phi_p;
1587
1588 /**
1589 * Scratch component for the CLS auxiliary physics
1590 */
1592 unsigned int n_dofs_cls;
1593 std::vector<double> phase_values;
1594 std::vector<double> filtered_phase_values;
1596 std::vector<std::vector<double>> previous_phase_values;
1597 std::vector<Tensor<1, dim>> filtered_phase_gradient_values;
1598 std::vector<Tensor<1, dim>> phase_gradient_values;
1599 // This is stored as a shared_ptr because it is only instantiated when needed
1600 std::shared_ptr<FEValues<dim>> fe_values_cls;
1601 // Used to evaluate the filtered CLS solution at particle locations
1602 // (arbitrary points within the cell); stored as a shared_ptr because it is
1603 // only instantiated when needed
1604 std::shared_ptr<FEPointEvaluation<1, dim>> point_evaluator_cls;
1605 std::shared_ptr<ConservativeLevelSetFilterBase>
1606 filter; // Phase indicator filter
1607
1610 std::shared_ptr<FEValues<dim>> fe_values_projected_phase_indicator_gradient;
1611 std::shared_ptr<FEValues<dim>> fe_values_curvature;
1613 std::vector<double> curvature_values;
1614
1615 /**
1616 * Scratch component for the void fraction auxiliary physics
1617 */
1620 std::vector<double> void_fraction_values;
1621 std::vector<std::vector<double>> previous_void_fraction_values;
1622 std::vector<Tensor<1, dim>> void_fraction_gradient_values;
1623 // This is stored as a shared_ptr because it is only instantiated when needed
1624 std::shared_ptr<FEValues<dim>> fe_values_void_fraction;
1625 // Used to evaluate the void fraction at particle locations (arbitrary
1626 // points within the cell); stored as a shared_ptr because it is only
1627 // instantiated when needed
1628 std::shared_ptr<FEPointEvaluation<1, dim>> point_evaluator_void_fraction;
1629
1630 /**
1631 * Scratch component for the particle fluid interaction auxiliary physics
1632 */
1635
1636 std::shared_ptr<FEValues<dim>> fe_values_particle_drag;
1637 std::shared_ptr<FEValues<dim>> fe_values_particle_two_way_coupling_force;
1638 std::shared_ptr<FEValues<dim>> fe_values_particle_velocity;
1639 std::shared_ptr<FEValues<dim>>
1641
1643 std::vector<Tensor<1, dim>> particle_velocity;
1644 std::vector<Tensor<1, dim>> particle_velocity_values;
1645 std::vector<Tensor<1, dim>> particle_drag_values;
1646 std::vector<Tensor<1, dim>> particle_two_way_coupling_force_values;
1649 std::vector<Tensor<1, dim>> fluid_velocity_at_particle_location;
1650 std::vector<Tensor<1, dim>>
1655 // Store the particle-location curls with the aliases above so the call to
1656 // FEValuesViews::Vector::get_function_curls() receives the exact curl type
1657 // expected by the installed deal.II version.
1658 std::vector<velocity_curl_type_2d>
1660 std::vector<velocity_curl_type_3d>
1662 std::vector<Point<dim>> particle_reference_location;
1663 std::vector<double> particle_weights;
1664 std::vector<double> cell_void_fraction;
1665 std::vector<double> Re_particle;
1668 typename Particles::ParticleHandler<dim>::particle_iterator_range pic;
1673
1674
1675 /**
1676 * Scratch component for the heat transfer
1677 */
1680 std::vector<double> temperature_values;
1681 std::vector<std::vector<double>> previous_temperature_values;
1682 std::vector<Tensor<1, dim>> temperature_gradients;
1683 std::vector<std::vector<Tensor<1, dim>>> previous_temperature_gradients;
1684 // This is stored as a shared_ptr because it is only instantiated when needed
1685 std::shared_ptr<FEValues<dim>> fe_values_temperature;
1686
1687 /**
1688 * Scratch component for the CahnHilliard auxiliary physics
1689 */
1694 std::vector<Tensor<1, dim>> phase_order_cahn_hilliard_gradients;
1696
1697 std::shared_ptr<CahnHilliardFilterBase>
1698 cahn_hilliard_filter; // Phase order fraction filter
1699
1700 // This is stored as a shared_ptr because it is only instantiated when needed
1701 std::shared_ptr<FEValues<dim>> fe_values_cahn_hilliard;
1702 FEValuesExtractors::Scalar phase_order;
1703 FEValuesExtractors::Scalar chemical_potential;
1704
1705 /**
1706 * Scratch component for the ALE method
1707 */
1709
1710 /**
1711 * Scratch components for the mortar method
1712 */
1714 std::vector<Tensor<1, dim>> rotor_linear_velocity_values;
1715
1716 /**
1717 * Is boundary cell indicator
1718 */
1720
1721 // If a rheological model is being used for a non-Newtonian flow
1723
1724 FEFaceValues<dim> fe_face_values;
1725
1726 unsigned int n_faces;
1727 unsigned int n_faces_q_points;
1728 unsigned int face_n_dofs;
1729
1730 // If boundary cell indicator
1731 std::vector<bool> is_boundary_face;
1732 std::vector<unsigned int> boundary_face_id;
1733
1734 // Quadrature
1735 Table<2, double> face_JxW;
1736 std::vector<std::vector<Point<dim>>> face_quadrature_points;
1737 Table<2, Tensor<1, dim>> face_normal;
1738
1739 // Velocity and pressure values
1740 // First vector is face number, second quadrature point
1741 std::vector<std::vector<Tensor<1, dim>>> face_velocity_values;
1742 std::vector<std::vector<double>> face_velocity_divergences;
1743 std::vector<std::vector<Tensor<2, dim>>> face_velocity_gradients;
1744 std::vector<std::vector<Tensor<1, dim>>> face_velocity_laplacians;
1745 std::vector<std::vector<double>> face_pressure_values;
1746 std::vector<std::vector<Tensor<1, dim>>> face_pressure_gradients;
1747
1748 // Shape functions
1749 // First vector is face number, second quadrature point, third DOF
1750 Table<3, double> face_div_phi_u;
1751 Table<3, Tensor<1, dim>> face_phi_u;
1752 Table<3, Tensor<3, dim>> face_hess_phi_u;
1753 Table<3, Tensor<1, dim>> face_laplacian_phi_u;
1754 Table<3, Tensor<2, dim>> face_grad_phi_u;
1755 Table<3, double> face_phi_p;
1756 Table<3, Tensor<1, dim>> face_grad_phi_p;
1757
1758 /// SDIRK Butcher table with coefficients for the SDIRK time-stepping method
1760};
1761
1762#endif
void bdf_extrapolate(const std::vector< double > &time_vector, const std::vector< std::vector< DataType > > &solution_vector, const unsigned int number_of_previous_solutions, std::vector< DataType > &extrapolated_solution)
Extrapolate vector of solution to time_vector[0] using previous solution times and previous solutions...
Definition bdf.h:133
unsigned int number_of_previous_solutions(const Parameters::SimulationControl::TimeSteppingMethod method)
Get the number of previous time steps for a specific BDF scheme.
Definition bdf.h:97
void enable_projected_phase_indicator_gradient(const FiniteElement< dim > &fe_projected_phase_indicator_gradient, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping)
typename FEValuesViews::Vector< 2 >::template solution_curl_type< double > velocity_curl_type_2d
NavierStokesScratchData(const NavierStokesScratchData< dim > &sd)
Copy Constructor. Same as the main constructor. This constructor only uses the other scratch to build...
std::vector< std::vector< double > > previous_phase_values
void reinit_particle_fluid_interactions(const typename DoFHandler< dim >::active_cell_iterator &velocity_cell, const typename DoFHandler< dim >::active_cell_iterator &void_fraction_cell, const VectorType &present_velocity_pressure_solution, const VectorType &previous_velocity_pressure_solution, const VectorType &void_fraction_solution, const Particles::ParticleHandler< dim > &particle_handler, const Parameters::DragCoupling &drag_coupling)
Calculates the variables needed to compute the particle fluid interactions in the VANS equations.
Table< 2, Tensor< 1, dim > > face_normal
std::vector< Tensor< 1, dim > > sdirk_stage_sum
void enable_cahn_hilliard(const FiniteElement< dim > &fe, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping, const Parameters::CahnHilliard &cahn_hilliard_parameters)
enable_cahn_hilliard Enables the collection of the CahnHilliard data by the scratch
std::vector< double > thermal_expansion_1
std::vector< Tensor< 1, dim > > force
void extract_particle_properties()
Extracts the velocity of the particles and calculates their total volume in the cell....
NavierStokesScratchData(const std::shared_ptr< SimulationControl > &simulation_control, const PhysicalPropertiesManager &properties_manager, const FESystem< dim > &fe, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping, const Quadrature< dim - 1 > &face_quadrature)
Constructor. The constructor creates the fe_values that will be used to fill the member variables of ...
std::shared_ptr< FEValues< dim > > fe_values_particle_momentum_transfer_coefficient
void reinit_mortar(const typename DoFHandler< dim >::active_cell_iterator &cell, const Parameters::Mortar< dim > &mortar_parameters)
Renitialize the content of the scratch data for mortar.
std::vector< Tensor< 1, dim > > projected_phase_indicator_gradient_values
void calculate_fluid_fields_at_particle_location(const Quadrature< dim > &q_particles_location, const typename DoFHandler< dim >::active_cell_iterator &velocity_cell, const VectorType &present_velocity_pressure_solution, const VectorType &previous_velocity_pressure_solution, const Parameters::DragCoupling &drag_coupling)
Interpolates the velocity and pressure of the fluid, as well as the pressure gradient,...
double kinematic_viscosity_scale_0
Scale of the kinematic viscosity for fluid 0.
std::vector< double > density_thermal_expansion
std::vector< velocity_curl_type_2d > fluid_velocity_curls_at_particle_location_2d
FEValuesExtractors::Vector velocities
SDIRKTable sdirk_table
SDIRK Butcher table with coefficients for the SDIRK time-stepping method.
std::shared_ptr< FEValues< dim > > fe_values_cls
Table< 3, Tensor< 2, dim > > face_grad_phi_u
std::vector< Tensor< 3, dim > > velocity_hessians
void enable_void_fraction(const FiniteElement< dim > &fe, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping)
enable_void_fraction Enables the collection of the void fraction data by the scratch
void calculate_force_parameters_at_particle_location()
Calculates the velocity of the fluid relative to that of the particle and the particle Reynolds numbe...
void reinit_projected_phase_indicator_gradient(const typename DoFHandler< dim >::active_cell_iterator &projected_phase_indicator_gradient_cell, const VectorType &current_projected_phase_indicator_gradient_solution)
std::vector< Tensor< 1, dim > > void_fraction_gradient_values
void calculate_physical_properties()
Calculates the physical properties. This function calculates the physical properties that may be requ...
std::vector< std::vector< Tensor< 1, dim > > > face_velocity_laplacians
std::shared_ptr< FEValues< dim > > fe_values_cahn_hilliard
std::vector< double > kinematic_viscosity_1
std::vector< std::vector< Tensor< 1, dim > > > previous_velocity_values
std::vector< double > kinematic_viscosity_0
void reinit(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions, const VectorType &sum_over_previous_stages, const std::shared_ptr< Function< dim > > &forcing_function, const Tensor< 1, dim > &beta_force, const double pressure_scaling_factor)
Reinitializes the content of the scratch.
std::vector< Tensor< 1, dim > > phase_order_cahn_hilliard_gradients
void enable_ale()
enable_ale Enables the calculation of the ALE velocity
void reinit_heat_transfer(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions)
Reinitialize the content of the scratch for the heat transfer auxiliary physic.
std::shared_ptr< FEValues< dim > > fe_values_particle_velocity
std::vector< Tensor< 1, dim > > temperature_gradients
std::shared_ptr< FEPointEvaluation< 1, dim > > point_evaluator_cls
std::vector< Tensor< 1, dim > > phase_gradient_values
std::vector< std::vector< double > > previous_pressure_values
FEValuesExtractors::Scalar phase_order
std::vector< std::vector< Tensor< 1, dim > > > previous_temperature_gradients
void reinit_particle_fluid_interactions(const typename DoFHandler< dim >::active_cell_iterator &velocity_cell, const typename DoFHandler< dim >::active_cell_iterator &void_fraction_cell, const typename DoFHandler< dim >::active_cell_iterator &phase_cell, const VectorType &present_velocity_pressure_solution, const VectorType &previous_velocity_pressure_solution, const VectorType &void_fraction_solution, const Particles::ParticleHandler< dim > &particle_handler, const Parameters::DragCoupling &drag_coupling, const VectorType &current_filtered_CLS_solution)
Calculates the variables needed to compute the particle fluid interactions in the VANS equations....
Tensor< 1, dim > average_fluid_particle_relative_velocity
std::shared_ptr< FEValues< dim > > fe_values_void_fraction
std::vector< std::vector< double > > previous_temperature_values
std::vector< unsigned int > components
void enable_mortar()
enable_mortar Enables the calculation of ALE velocity within the mortar feature
std::shared_ptr< FEValues< dim > > fe_values_particle_drag
std::vector< double > cell_void_fraction
std::vector< double > compressibility_multiplier
std::vector< Tensor< 2, dim > > velocity_gradients
std::vector< double > surface_tension_gradient
void enable_heat_transfer(const FiniteElement< dim > &fe, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping)
enable_heat_transfer Enables the collection of the heat transfer data (Temperature field) by the scra...
void reinit_void_fraction(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions)
Reinitialize the content of the scratch for the void fraction.
std::vector< std::vector< double > > previous_density
void reinit_ale(const Parameters::ALE< dim > &ale)
Renitialize the content of the scratch data for ALE.
FEValuesExtractors::Scalar pressure
std::vector< Point< dim > > particle_reference_location
void enable_particle_fluid_interactions(const unsigned int n_global_max_particles_per_cell, const bool enable_void_fraction_interpolation)
enable_particle_fluid_interactions Enables the calculation of the fluid information at the particle l...
std::vector< Tensor< 1, dim > > particle_two_way_coupling_force_values
std::vector< Point< dim > > quadrature_points
std::vector< Tensor< 1, dim > > fluid_particle_relative_velocity_at_particle_location
Table< 3, Tensor< 3, dim > > face_hess_phi_u
std::vector< double > particle_momentum_transfer_coefficient_values
Table< 2, Tensor< 1, dim > > phi_u
std::vector< Tensor< 1, dim > > advective_velocity
std::vector< double > void_fraction_values
void calculate_fluid_properties_at_particle_location()
Calculates the properties of the fluid at the locations of the particles. At the moment,...
std::vector< double > dynamic_viscosity_for_stabilization_1
std::map< field, std::vector< double > > fields
typename FEValuesViews::Vector< 3 >::template solution_curl_type< double > velocity_curl_type_3d
std::vector< Tensor< 1, dim > > particle_velocity_values
std::shared_ptr< ConservativeLevelSetFilterBase > filter
std::vector< double > dynamic_viscosity_0
std::vector< double > kinematic_viscosity
std::vector< double > thermal_expansion_0
void calculate_void_fraction_at_particle_location(const Quadrature< dim > &q_particles_location, const typename DoFHandler< dim >::active_cell_iterator &void_fraction_cell, const VectorType &void_fraction_solution)
Interpolates the void fraction at the locations of the particles.
void reinit_cahn_hilliard(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const VectorType &current_filtered_solution)
Reinitialize the content of the scratch for CH.
std::vector< Tensor< 1, dim > > velocity_values
std::shared_ptr< FEValues< dim > > fe_values_temperature
void enable_cls(const FiniteElement< dim > &fe, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping, const Parameters::CLS_PhaseFilter &phase_filter_parameters)
enable_cls Enables the collection of the CLS data by the scratch
Table< 2, Tensor< 2, dim > > grad_phi_u
std::vector< double > filtered_phase_values_at_particle_location
Table< 2, Tensor< 3, dim > > hess_phi_u
std::vector< velocity_curl_type_3d > fluid_velocity_curls_at_particle_location_3d
std::shared_ptr< CahnHilliardFilterBase > cahn_hilliard_filter
Particles::ParticleHandler< dim >::particle_iterator_range pic
void enable_curvature(const FiniteElement< dim > &fe_curvature, const Quadrature< dim > &quadrature, const Mapping< dim > &mapping)
Table< 2, Tensor< 1, dim > > laplacian_phi_u
std::vector< std::vector< Tensor< 1, dim > > > face_velocity_values
Quadrature< dim > gather_particles_reference_location()
Creates an object of type Quadrature<dim> that contains the particle reference location....
std::vector< std::vector< double > > previous_void_fraction_values
void calculate_cls_at_particle_location(const Quadrature< dim > &q_particles_location, const typename DoFHandler< dim >::active_cell_iterator &phase_cell, const VectorType &current_filtered_solution)
Interpolates the filtered CLS solution at the location of the particles. The latter values are used i...
std::vector< double > phase_order_cahn_hilliard_values
std::vector< Tensor< 1, dim > > particle_velocity
FEValuesExtractors::Scalar chemical_potential
std::vector< Tensor< 1, dim > > filtered_phase_gradient_values
std::vector< std::vector< Tensor< 1, dim > > > face_pressure_gradients
std::shared_ptr< FEPointEvaluation< 1, dim > > point_evaluator_void_fraction
std::shared_ptr< FEValues< dim > > fe_values_projected_phase_indicator_gradient
void reinit_particle_fluid_forces()
Reinitializes the fluid forces and torques on the particles in the cell to zero.
Table< 3, Tensor< 1, dim > > face_phi_u
std::vector< double > dynamic_viscosity_1
std::vector< double > temperature_values
std::vector< Tensor< 1, dim > > fluid_velocity_at_particle_location
std::vector< unsigned int > boundary_face_id
std::vector< Tensor< 1, dim > > velocity_gradient_divergence
const std::shared_ptr< SimulationControl > simulation_control
std::vector< double > kinematic_viscosity_for_stabilization
std::vector< Vector< double > > rhs_force
std::vector< double > filtered_phase_values
std::vector< Tensor< 1, dim > > particle_drag_values
void allocate() override
Allocates the memory for the scratch.
void reinit_cls(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const VectorType &current_filtered_solution, const std::vector< VectorType > &previous_solutions)
Reinitialize the content of the scratch for the cls.
void reinit_curvature(const typename DoFHandler< dim >::active_cell_iterator &curvature_cell, const VectorType &current_curvature_solution)
std::vector< Tensor< 1, dim > > fluid_velocity_laplacian_at_particle_location
Table< 3, Tensor< 1, dim > > face_grad_phi_p
std::vector< double > velocity_divergences
std::vector< Tensor< 1, dim > > rotor_linear_velocity_values
std::vector< double > dynamic_viscosity_for_stabilization
Values of the dynamic viscosity used in the SUPG and PSPG stabilizations.
std::vector< double > density_at_particle_location
std::vector< std::vector< double > > face_velocity_divergences
std::vector< double > kinematic_viscosity_at_particle_location
std::vector< std::vector< Tensor< 2, dim > > > face_velocity_gradients
Table< 3, Tensor< 1, dim > > face_laplacian_phi_u
void enable_particle_field_projection(const Quadrature< dim > &quadrature, const Mapping< dim > &mapping, const FiniteElement< dim > &fe_particle_drag_proj, const FiniteElement< dim > &fe_particle_two_way_coupling_force_proj, const FiniteElement< dim > &fe_particle_velocity_proj, const FiniteElement< dim > &fe_particle_momentum_transfer_coefficient)
enable_particle_field_projection Enables the collection of the particle fields projection data by the...
Table< 2, Tensor< 1, dim > > grad_phi_p
std::vector< double > dynamic_viscosity
std::vector< double > grad_kinematic_viscosity_shear_rate
std::shared_ptr< FEValues< dim > > fe_values_curvature
std::vector< std::vector< double > > face_pressure_values
std::vector< std::vector< Point< dim > > > face_quadrature_points
std::vector< double > filtered_phase_order_cahn_hilliard_values
std::vector< Tensor< 1, dim > > pressure_gradients
Tensor< 1, dim > explicit_particle_volumetric_acceleration_on_fluid
std::vector< Tensor< 1, dim > > fluid_pressure_gradients_at_particle_location
Table< 2, Tensor< 1, dim > > gradient_divergence_phi_u
std::vector< double > thermal_expansion
void calculate_cell_void_fraction(const double &total_particle_volume)
Computes the cell void fraction.
std::vector< Tensor< 1, dim > > velocity_laplacians
const PhysicalPropertiesManager properties_manager
void calculate_particle_fields_values(const typename DoFHandler< dim >::active_cell_iterator &particle_drag_cell, const typename DoFHandler< dim >::active_cell_iterator &particle_two_way_coupling_force_cell, const typename DoFHandler< dim >::active_cell_iterator &particle_velocity_cell, const typename DoFHandler< dim >::active_cell_iterator &particle_momentum_transfer_coefficient_cell, const VectorType &particle_fluid_drag, const VectorType &particle_fluid_force_two_way_coupling, const VectorType &particle_velocity, const VectorType &particle_momentum_transfer_coefficient, const Parameters::DragCoupling &drag_coupling)
Calculates the particle forces and velocities that were projected on the fluid dofs at the quadrature...
std::vector< double > dynamic_viscosity_for_stabilization_0
std::shared_ptr< FEValues< dim > > fe_values_particle_two_way_coupling_force
std::vector< double > chemical_potential_cahn_hilliard_values
double kinematic_viscosity_scale_1
Scale of the kinematic viscosity for fluid 1.
An interface for all the common parameters required to consider a moving frame of reference in a simp...
Definition ale.h:25
Class that manages the physical properties model which are required to calculate the various physical...
Base class for scratch data objects of physics and subequations.
double compute_cell_measure_with_JxW(const std::vector< double > &JxW_values)
Computes the area (2D) or volume (3D) of the cell by integrating 1 over the cell, by summing JxW valu...
Definition utilities.h:1017
double calculate_point_property(const double phase, const double property0, const double property1)
Calculate the equivalent properties for a given phase. Method called in quadrature points loops in CL...
Definition utilities.h:307
double compute_cell_diameter(const double cell_measure, const unsigned int fe_degree)
Computes equivalent cell diameter by comparing the area to a disk (2D) or the volume to a sphere (3D)...
Definition utilities.h:989
DEM particle property definitions and output name management.
DragCoupling
Defines the numerical coupling strategy used for drag force computation between fluid and particles.
@ fully_implicit
Fully implicit drag coupling.
@ fully_explicit
Explicit drag coupling.
Parameter structures for CFD-DEM coupled simulations.
Parameters for the phase filtration.
Mortar - Defines parameters used to construct mortar elements.
Structure representing a Butcher tableau for a SDIRK method.
GlobalVectorType VectorType
bool time_stepping_is_bdf(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the bdf family.
bool time_stepping_is_sdirk(const Parameters::SimulationControl::TimeSteppingMethod method)
Determines if the time integration method is within the sdirk family.