Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
tracer_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_tracer_scratch_data_h
5#define lethe_tracer_scratch_data_h
6
7#include <core/ale.h>
9
12
13#include <deal.II/fe/fe_interface_values.h>
14#include <deal.II/fe/fe_system.h>
15
16using namespace dealii;
17
18/**
19 * @brief Class that stores the information required by the assembly procedure
20 * for a Tracer advection-diffusion equation. Consequently, this class
21 *calculates the tracer (values, gradients, laplacians) and the shape function
22 * (values, gradients, laplacians) at all the gauss points for all degrees
23 * of freedom and stores it into arrays. Additionnaly, the use can request
24 * that this class gathers additional fields for physics which are coupled
25 * to the Tracer equation, such as the velocity which is required. This class
26 * serves as a seperation between the evaluation at the gauss point of the
27 * variables of interest and their use in the assembly, which is carried out
28 * by the assembler functions. For more information on this design, the reader
29 * can consult deal.II step-9
30 * "https://www.dealii.org/current/doxygen/deal.II/step_9.html". In this latter
31 * example, the scratch is a struct instead of a templated class because of the
32 * simplicity of step-9.
33 *
34 * @tparam dim An integer that denotes the dimension of the space in which
35 * the flow is solved
36 * @ingroup solvers
37 **/
38
39template <int dim>
41{
42public:
43 /**
44 * @brief Constructor. The constructor creates the fe_values that will be used
45 * to fill the member variables of the scratch. It also allocated the
46 * necessary memory for all member variables. However, it does not do any
47 * evalution, since this needs to be done at the cell level.
48 *
49 * @param fe The FESystem used to solve the Navier-Stokes equations
50 *
51 * @param quadrature The quadrature to use for the assembly
52 *
53 * @param mapping The mapping of the domain in which the Navier-Stokes equations are solved
54 *
55 * @param uses_dg If true, the scratch is used for the discontinuous Galerkin
56 * formulation. The hessians, laplacians and previous gradients, which are
57 * only required by the stabilization of the continuous formulation, are then
58 * not computed.
59 *
60 */
62 const FiniteElement<dim> &fe_tracer,
63 const Quadrature<dim> &quadrature,
64 const Quadrature<dim - 1> &face_quadrature,
65 const Mapping<dim> &mapping,
66 const FiniteElement<dim> &fe_fd,
67 const bool uses_dg)
70 , fe_values_tracer(mapping,
71 fe_tracer,
72 quadrature,
73 update_values | update_quadrature_points |
74 update_JxW_values | update_gradients |
75 (uses_dg ? update_default : update_hessians))
77 fe_tracer,
78 face_quadrature,
79 update_values | update_gradients |
80 update_quadrature_points |
81 update_JxW_values | update_normal_vectors)
82 , fe_values_fd(mapping, fe_fd, quadrature, update_values | update_gradients)
83 , fe_face_values_fd(mapping, fe_fd, face_quadrature, update_values)
84 {
85 allocate();
86 }
87
88 /**
89 * @brief Copy Constructor. Same as the main constructor.
90 * This constructor only uses the other scratch to build the FeValues, it
91 * does not copy the content of the other scratch into itself since, by
92 * definition of the WorkStream mechanism it is assumed that the content of
93 * the scratch will be reset on a cell basis.
94 *
95 * @param fe The FESystem used to solve the Navier-Stokes equations
96 *
97 * @param quadrature The quadrature to use for the assembly
98 *
99 * @param mapping The mapping of the domain in which the Navier-Stokes equations are solved
100 */
102 : uses_dg(sd.uses_dg)
104 , fe_values_tracer(sd.fe_values_tracer.get_mapping(),
105 sd.fe_values_tracer.get_fe(),
106 sd.fe_values_tracer.get_quadrature(),
107 update_values | update_quadrature_points |
108 update_JxW_values | update_gradients |
109 (sd.uses_dg ? update_default : update_hessians))
111 sd.fe_interface_values_tracer.get_fe(),
112 sd.fe_interface_values_tracer.get_quadrature(),
113 update_values | update_gradients |
114 update_quadrature_points |
115 update_JxW_values | update_normal_vectors)
116 , fe_values_fd(sd.fe_values_fd.get_mapping(),
117 sd.fe_values_fd.get_fe(),
118 sd.fe_values_fd.get_quadrature(),
119 update_values | update_gradients)
120 , fe_face_values_fd(sd.fe_face_values_fd.get_mapping(),
121 sd.fe_face_values_fd.get_fe(),
122 sd.fe_face_values_fd.get_quadrature(),
123 update_values)
124 {
125 allocate();
126 }
127
128
129 /** @brief Allocates the memory for the scratch
130 *
131 * This function allocates the necessary memory for all members of the scratch
132 *
133 */
134 void
135 allocate() override;
136
137 /** @brief Reinitializes the content of the scratch.
138 *
139 * Using the FeValues and the content of the solutions and previous solutions,
140 * fills all of the class member of the scratch.
141 *
142 * @param[in] cell The cell over which the assembly is being carried.
143 * This cell must be compatible with the fe which is used to fill the
144 * FeValues.
145 *
146 * @param[in] current_solution The present value of the solution.
147 *
148 * @param[in] previous_solutions The solutions at the previous time steps.
149 *
150 * @param[in] source_function The function describing the tracer source term.
151 */
152 template <typename VectorType>
153 void
154 reinit(const typename DoFHandler<dim>::active_cell_iterator &cell,
155 const VectorType &current_solution,
156 const std::vector<VectorType> &previous_solutions,
157 const Function<dim> *source_function)
158 {
159 this->fe_values_tracer.reinit(cell);
160
161 quadrature_points = this->fe_values_tracer.get_quadrature_points();
162 auto &fe_tracer = this->fe_values_tracer.get_fe();
163
164 source_function->value_list(quadrature_points, source);
165
166 // Compute cell diameter
167 double cell_measure =
168 compute_cell_measure_with_JxW(this->fe_values_tracer.get_JxW_values());
169 this->cell_size =
170 compute_cell_diameter<dim>(cell_measure, fe_tracer.degree);
171
172 // Gather tracer (values, gradient and laplacian)
173 this->fe_values_tracer.get_function_values(current_solution,
174 this->tracer_values);
175 this->fe_values_tracer.get_function_gradients(current_solution,
176 this->tracer_gradients);
177
178 // The laplacian and the previous gradient are only used by the
179 // stabilization of the continuous formulation
180 if (!uses_dg)
181 {
182 this->fe_values_tracer.get_function_laplacians(current_solution,
183 this->tracer_laplacians);
184 this->fe_values_tracer.get_function_gradients(
185 previous_solutions[0], this->previous_tracer_gradients);
186 }
187
188 // Gather previous tracer values
189 for (unsigned int p = 0; p < previous_solutions.size(); ++p)
190 {
191 this->fe_values_tracer.get_function_values(previous_solutions[p],
193 }
194
195 for (unsigned int q = 0; q < n_q_points; ++q)
196 {
197 this->JxW[q] = this->fe_values_tracer.JxW(q);
198
199 for (unsigned int k = 0; k < n_dofs; ++k)
200 {
201 // Shape function
202 this->phi[q][k] = this->fe_values_tracer.shape_value(k, q);
203 this->grad_phi[q][k] = this->fe_values_tracer.shape_grad(k, q);
204 }
205
206 if (!uses_dg)
207 for (unsigned int k = 0; k < n_dofs; ++k)
208 {
209 this->hess_phi[q][k] = this->fe_values_tracer.shape_hessian(k, q);
210 this->laplacian_phi[q][k] = trace(this->hess_phi[q][k]);
211 }
212 }
213
214 boundary_index = 0;
215 }
216
217 /**
218 * @brief Reinitializes the signed distance vector of the scratch.
219 *
220 * @param[in] cell The cell over which the assembly is being carried.
221 * @param[in] immersed_solid_shape Shared pointer to the shape describing the
222 * particles (if there are any).
223 */
224 void
226 const typename DoFHandler<dim>::active_cell_iterator &cell,
227 const std::shared_ptr<Shape<dim>> &immersed_solid_shape)
228 {
229 if (properties_manager.field_is_required(field::levelset))
230 {
231 this->fe_values_tracer.reinit(cell);
232
233 quadrature_points = this->fe_values_tracer.get_quadrature_points();
234
235 Assert(
236 immersed_solid_shape != nullptr,
237 ExcMessage(
238 "Shape is required for tracer assembly, but the shape is a nullptr"));
239
240 for (unsigned int q = 0; q < n_q_points; q++)
241 sdf_values[q] =
242 immersed_solid_shape->value_with_cell_guess(quadrature_points[q],
243 cell);
244 }
245 }
246
247 /** @brief Reinitializes the signed distance vector of the scratch for a given face.
248 *
249 * @param[in] cell The cell over which the assembly is being carried.
250 * @param[in] face_no The face index associated with the cell
251 * @param[in] immersed_solid_shape Shared pointer to the shape describing the
252 * particles (if there are any).
253 */
254 void
256 const typename DoFHandler<dim>::active_cell_iterator &cell,
257 const unsigned int &face_no,
258 const std::shared_ptr<Shape<dim>> &immersed_solid_shape)
259 {
260 if (properties_manager.field_is_required(field::levelset))
261 {
262 fe_interface_values_tracer.reinit(cell, face_no);
264 fe_interface_values_tracer.get_quadrature_points();
265
266 Assert(
267 immersed_solid_shape != nullptr,
268 ExcMessage(
269 "Shape is required for tracer assembly, but the shape is a nullptr"));
270
271 unsigned int n_face_q_points = face_quadrature_points.size();
272 for (unsigned int q = 0; q < n_face_q_points; q++)
273 sdf_values[q] = immersed_solid_shape->value_with_cell_guess(
274 face_quadrature_points[q], cell);
275 }
276 }
277
278
279 /** @brief Reinitialize the velocity, calculated by the fluid dynamics while also taking into account ALE
280 *
281 * @tparam VectorType The Vector type used for the solvers
282 *
283 * @param cell The cell for which the velocity is reinitialized
284 * This cell must be compatible with the Fluid Dynamics FE
285 *
286 * @param current_solution The present value of the solution for [u,p]
287 *
288 * @param ale The ALE parameters which include the ALE function
289 *
290 * @param drift_velocity Function to calculate the drift velocity
291 *
292 */
293 template <typename VectorType>
294 void
296 const typename DoFHandler<dim>::active_cell_iterator &cell,
297 const VectorType &velocity_solution,
298 const Parameters::ALE<dim> &ale,
299 const std::shared_ptr<Functions::ParsedFunction<dim>> &drift_velocity)
300 {
301 this->fe_values_fd.reinit(cell);
302
303 this->fe_values_fd[velocities].get_function_values(velocity_solution,
305
306 this->fe_values_fd[velocities].get_function_divergences(
307 velocity_solution, velocity_divergences);
308
309 // Add the drift velocity to the velocity to account for tracer drift flux
310 // modeling
311 Tensor<1, dim> drift_velocity_tensor;
312 Vector<double> drift_velocity_vector(dim);
313
314 for (unsigned int q = 0; q < n_q_points; ++q)
315 {
316 drift_velocity->vector_value(quadrature_points[q],
317 drift_velocity_vector);
318 for (int d = 0; d < dim; ++d)
319 drift_velocity_tensor[d] = drift_velocity_vector[d];
320
321 velocity_values[q] += drift_velocity_tensor;
322 }
323
324 if (!ale.enabled())
325 return;
326
327 // ALE enabled, so extract the ALE velocity and subtract it from the
328 // velocity obtained from the fluid dynamics
329 Tensor<1, dim> velocity_ale;
330 std::shared_ptr<Functions::ParsedFunction<dim>> velocity_ale_function =
331 ale.velocity;
332 Vector<double> velocity_ale_vector(dim);
333
334 for (unsigned int q = 0; q < n_q_points; ++q)
335 {
336 velocity_ale_function->vector_value(quadrature_points[q],
337 velocity_ale_vector);
338 for (int d = 0; d < dim; ++d)
339 velocity_ale[d] = velocity_ale_vector[d];
340
341 velocity_values[q] -= velocity_ale;
342 }
343 }
344
345
346 /** @brief Reinitializes the content of the scratch for the internal faces. This is only used for the DG assemblers.
347 *
348 * @param[in] cell The cell over which the assembly is being carried.
349 *
350 * @param[in] face_no The face index associated with the cell
351 *
352 * @param[in] sub_face_no The subface index associated with the face
353 *
354 * @param[in] neigh_cell The neighboring cell
355 *
356 * @param[in] neigh_face_no The face index associated with the neighboring
357 * cell
358 *
359 * @param[in] neigh_sub_face_no The subface index associated with the
360 * neighboring cell
361 *
362 * @param[in] current_solution The present value of the solution.
363 */
364 template <typename VectorType>
365 void
367 const typename DoFHandler<dim>::active_cell_iterator &cell,
368 const unsigned int &face_no,
369 const unsigned int &sub_face_no,
370 const typename DoFHandler<dim>::active_cell_iterator &neigh_cell,
371 const unsigned int &neigh_face_no,
372 const unsigned int &neigh_sub_face_no,
373 const VectorType &current_solution)
374 {
376 cell, face_no, sub_face_no, neigh_cell, neigh_face_no, neigh_sub_face_no);
377 face_quadrature_points = fe_interface_values_tracer.get_quadrature_points();
378
379 n_interface_dofs = fe_interface_values_tracer.n_current_interface_dofs();
380
381 const double extent_here = cell->measure() / cell->face(face_no)->measure();
382 const double extent_there =
383 neigh_cell->measure() / neigh_cell->face(neigh_face_no)->measure();
384
386 extent_here,
387 extent_there);
388
389
390 fe_interface_values_tracer.get_fe_face_values(0).get_function_values(
391 current_solution, values_here);
392 fe_interface_values_tracer.get_fe_face_values(1).get_function_values(
393 current_solution, values_there);
394
395 fe_interface_values_tracer.get_average_of_function_gradients(
396 current_solution, tracer_average_gradient);
397
398 const std::vector<Tensor<1, dim>> &normals =
399 fe_interface_values_tracer.get_normal_vectors();
400
401 for (unsigned int q = 0; q < face_quadrature_points.size(); ++q)
402 {
403 // The jump is defined as the value on cell 0 minus the value on cell 1
405
406 // Gather the shape function quantities once per quadrature point
407 // since the FEInterfaceValues accessors map the interface dof to the
408 // cell dofs at every call.
409 for (unsigned int i = 0; i < n_interface_dofs; ++i)
410 {
411 face_phi_here[q][i] =
412 fe_interface_values_tracer.shape_value(true, i, q);
413 face_phi_there[q][i] =
414 fe_interface_values_tracer.shape_value(false, i, q);
415 face_jump_phi[q][i] = face_phi_here[q][i] - face_phi_there[q][i];
417 fe_interface_values_tracer.average_of_shape_gradients(i, q) *
418 normals[q];
419 }
420 }
421 }
422
423
424 /** @brief Reinitializes the content of the scratch for the boundary faces. This is only used for the DG assemblers.
425 *
426 * @param[in] cell The cell over which the assembly is being carried.
427 *
428 * @param[in] face The face index associated with the cell
429 *
430 * @param[in] current_solution The present value of the solution.
431 * there are any).
432 */
433 template <typename VectorType>
434 void
436 const typename DoFHandler<dim>::active_cell_iterator &cell,
437 const unsigned int &face_no,
438 const unsigned int &boundary_index,
439 const VectorType &current_solution)
440 {
441 fe_interface_values_tracer.reinit(cell, face_no);
442 const FEFaceValuesBase<dim> &fe_face =
443 fe_interface_values_tracer.get_fe_face_values(0);
444 face_quadrature_points = fe_interface_values_tracer.get_quadrature_points();
445
446 fe_face.get_function_values(current_solution, values_here);
447 fe_face.get_function_gradients(current_solution, gradients_here);
448
449 this->boundary_index = boundary_index;
450
451 const double extent_here = cell->measure() / cell->face(face_no)->measure();
452 this->penalty_factor = get_penalty_factor(fe_values_tracer.get_fe().degree,
453 extent_here,
454 extent_here);
455 }
456
457 /** @brief Reinitializes the content of the scratch regarding the velocity for internal/boundary faces.
458 * The velocity is inherently assumed to have been solved using a CG scheme.
459 *
460 * @param[in] cell The cell over which the assembly is being carried.
461 *
462 * @param[in] face The face index associated with the cell
463 *
464 * @param[in] velocity_solution The present value of the solution.
465 * there are any).
466 */
467 template <typename VectorType>
468 void
470 const typename DoFHandler<dim>::active_cell_iterator &velocity_cell,
471 const unsigned int &face_no,
472 const VectorType &velocity_solution,
473 const Parameters::ALE<dim> &ale,
474 const std::shared_ptr<Functions::ParsedFunction<dim>> &drift_velocity)
475 {
476 fe_face_values_fd.reinit(velocity_cell, face_no);
477
478 fe_face_values_fd[velocities].get_function_values(velocity_solution,
480
481
482 // Add the drift velocity to the velocity to account for tracer drift flux
483 // modeling
484 Tensor<1, dim> drift_velocity_tensor;
485 Vector<double> drift_velocity_vector(dim);
486
487 for (unsigned int q = 0; q < face_quadrature_points.size(); ++q)
488 {
489 drift_velocity->vector_value(face_quadrature_points[q],
490 drift_velocity_vector);
491 for (int d = 0; d < dim; ++d)
492 drift_velocity_tensor[d] = drift_velocity_vector[d];
493
494 face_velocity_values[q] += drift_velocity_tensor;
495 }
496
497
498 if (!ale.enabled())
499 return;
500
501 // ALE enabled, so extract the ALE velocity and subtract it from the
502 // velocity obtained from the fluid dynamics
503 Tensor<1, dim> velocity_ale;
504 std::shared_ptr<Functions::ParsedFunction<dim>> velocity_ale_function =
505 ale.velocity;
506 Vector<double> velocity_ale_vector(dim);
507
508 for (unsigned int q = 0; q < face_quadrature_points.size(); ++q)
509 {
510 velocity_ale_function->vector_value(face_quadrature_points[q],
511 velocity_ale_vector);
512 for (int d = 0; d < dim; ++d)
513 velocity_ale[d] = velocity_ale_vector[d];
514
515 face_velocity_values[q] -= velocity_ale;
516 }
517 }
518
519 /**
520 * @brief Renitialize the content of the scratch data for mortar
521 *
522 * @param[in] cell The cell over which the assembly is being carried.
523 * This cell must be compatible with the FE which is used to fill the
524 * FeValues.
525 *
526 * @param[in] mortar_parameters Parameters for the mortar method
527 *
528 * @param[in] time Current simulation time
529 */
530 void
531 reinit_mortar(const typename DoFHandler<dim>::active_cell_iterator &cell,
532 const Parameters::Mortar<dim> &mortar_parameters,
533 const double &time)
534 {
535 // Get updated rotor angular velocity
536 mortar_parameters.rotor_angular_velocity->set_time(time);
537 const double rotor_angular_velocity =
538 mortar_parameters.rotor_angular_velocity->value(Point<dim>());
539
540 // Apply prescribed rotor angular velocity only at rotor cells
541 // (material_id = 1)
542 double omega = 0.0;
543 if (cell->material_id() == 1)
544 omega = rotor_angular_velocity;
545
546 // The mortar implementation is not defined for more than two
547 // materials. Throw when running debug mode as a security measure to prevent
548 // this case
549 Assert(
550 cell->material_id() < 2,
551 ExcMessage(
552 "The material id in a cell was identified as equal or greater than 2, however the mortar implementation is not defined for more than two materials."));
553
554 // Compute rotor linear velocity at quadrature points
556 std::vector<Tensor<1, dim>>(this->n_q_points);
557 for (unsigned int q = 0; q < n_q_points; ++q)
558 {
559 // Shift quadrature point by the center of rotation
560 const auto p = fe_values_tracer.quadrature_point(q) -
561 mortar_parameters.center_of_rotation;
562
563 // Compute terms of u_ale
566 omega, p, mortar_parameters.rotation_axis_direction);
567
568 // Subtract u_ale from the advective velocity
570 }
571 }
572
573 /** @brief Calculates the physical properties at a face
574 */
575 void
577 {
578 const auto diffusivity_model = properties_manager.get_tracer_diffusivity();
579
580 // If the tracer diffusivity depends on the level set, take this into
581 // account
582 if (properties_manager.field_is_required(field::levelset))
584
585
586 diffusivity_model->vector_value(fields, tracer_diffusivity_face);
587 }
588
589
590 /** @brief Calculates the physical properties. This function calculates the physical properties
591 * that may be required by the tracer. Namely the diffusivity.
592 *
593 */
594 void
596
597 // True if the scratch is used for the discontinuous Galerkin formulation
598 const bool uses_dg;
599
600 // Physical properties
602 std::map<field, std::vector<double>> fields;
603 std::vector<double> tracer_diffusivity;
604 std::vector<double> tracer_diffusivity_face;
605 std::vector<double> tracer_diffusivity_0;
606 std::vector<double> tracer_diffusivity_1;
607 std::vector<double> tracer_reaction_prefactor;
608
609 // Gradient of the tracer reaction prefactor with respect to the concentration
610 // This is calculated by deriving the prefactor by the concentration
611 // (dk/dC)
613
614 // FEValues for the Tracer problem
615 FEValues<dim> fe_values_tracer;
616 FEInterfaceValues<dim> fe_interface_values_tracer;
617
618 unsigned int n_dofs;
619 unsigned int n_interface_dofs;
620 unsigned int n_q_points;
621 double cell_size;
622
623 // Quadrature
624 Table<1, double> JxW;
625 std::vector<Point<dim>> quadrature_points;
626 std::vector<Point<dim>> face_quadrature_points;
627
628 // Tracer values
629 std::vector<double> tracer_values;
630 std::vector<Tensor<1, dim>> tracer_gradients;
631 std::vector<double> tracer_laplacians;
632 std::vector<std::vector<double>> previous_tracer_values;
633 std::vector<Tensor<1, dim>> previous_tracer_gradients;
634
635 // Tracer values at the faces
636 std::vector<double> values_here;
637 std::vector<double> values_there;
638 std::vector<double> tracer_value_jump;
639 std::vector<Tensor<1, dim>> gradients_here;
640 std::vector<Tensor<1, dim>> tracer_average_gradient;
641
642 // Shape function quantities at the internal faces, indexed by quadrature
643 // point and interface dof
644 Table<2, double> face_phi_here;
645 Table<2, double> face_phi_there;
646 Table<2, double> face_jump_phi;
648
649 // SIPG (interior faces) or Nitsche (boundary) penalization factor
650 // The penalty factor is calculated using a measure of the element size. It is
651 // multiplied by the diffusion coefficient to apply the SIPG method
653
654 // Bool that defines if the selected face is a dirichlet/outlet boundary
655 unsigned int boundary_index;
656
657 // Immersed solid shape (signed distance function)
658 std::vector<double> sdf_values;
659
660 // Source term
661 std::vector<double> source;
662
663 // Shape functions
664 Table<2, double> phi;
665 Table<2, Tensor<2, dim>> hess_phi;
666 Table<2, double> laplacian_phi;
667 Table<2, Tensor<1, dim>> grad_phi;
668
669 /**
670 * Scratch components for the mortar method
671 */
673 std::vector<Tensor<1, dim>> rotor_linear_velocity_values;
674
675 /**
676 * Scratch component for the Navier-Stokes component
677 */
678 FEValuesExtractors::Vector velocities;
679 // This FEValues must mandatorily be instantiated for the velocity
680 FEValues<dim> fe_values_fd;
681 FEFaceValues<dim> fe_face_values_fd;
682 std::vector<Tensor<1, dim>> velocity_values;
683 std::vector<double> velocity_divergences;
684 std::vector<Tensor<1, dim>> face_velocity_values;
685};
686
687#endif
An interface for all the common parameters required to consider a moving frame of reference in a simp...
Definition ale.h:25
bool enabled() const
Return if the ALE module is enabled.
Definition ale.h:64
std::shared_ptr< Functions::ParsedFunction< dim > > velocity
ALE velocity function.
Definition ale.h:56
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.
A base class used to represent geometrical entities. Its main uses are to return signed distance and ...
Definition shape.h:53
std::vector< Tensor< 1, dim > > face_velocity_values
TracerScratchData(const TracerScratchData< dim > &sd)
Copy Constructor. Same as the main constructor. This constructor only uses the other scratch to build...
std::vector< double > tracer_values
std::vector< Tensor< 1, dim > > previous_tracer_gradients
FEValuesExtractors::Vector velocities
void reinit_signed_distance(const typename DoFHandler< dim >::active_cell_iterator &cell, const std::shared_ptr< Shape< dim > > &immersed_solid_shape)
Reinitializes the signed distance vector of the scratch.
std::vector< double > tracer_diffusivity_0
std::vector< double > tracer_diffusivity_1
Table< 2, double > face_average_grad_phi_dot_n
std::vector< double > values_there
std::vector< Point< dim > > face_quadrature_points
void reinit_face_velocity(const typename DoFHandler< dim >::active_cell_iterator &velocity_cell, const unsigned int &face_no, const VectorType &velocity_solution, const Parameters::ALE< dim > &ale, const std::shared_ptr< Functions::ParsedFunction< dim > > &drift_velocity)
Reinitializes the content of the scratch regarding the velocity for internal/boundary faces....
std::vector< Tensor< 1, dim > > velocity_values
void reinit_internal_face(const typename DoFHandler< dim >::active_cell_iterator &cell, const unsigned int &face_no, const unsigned int &sub_face_no, const typename DoFHandler< dim >::active_cell_iterator &neigh_cell, const unsigned int &neigh_face_no, const unsigned int &neigh_sub_face_no, const VectorType &current_solution)
Reinitializes the content of the scratch for the internal faces. This is only used for the DG assembl...
std::vector< double > grad_tracer_reaction_prefactor
void calculate_face_physical_properties()
Calculates the physical properties at a face.
std::vector< double > velocity_divergences
void allocate() override
Allocates the memory for the scratch.
std::vector< std::vector< double > > previous_tracer_values
void reinit_boundary_face(const typename DoFHandler< dim >::active_cell_iterator &cell, const unsigned int &face_no, const unsigned int &boundary_index, const VectorType &current_solution)
Reinitializes the content of the scratch for the boundary faces. This is only used for the DG assembl...
std::vector< double > tracer_diffusivity
Table< 1, double > JxW
FEInterfaceValues< dim > fe_interface_values_tracer
std::vector< Tensor< 1, dim > > tracer_average_gradient
std::vector< double > tracer_reaction_prefactor
std::vector< double > sdf_values
Table< 2, double > laplacian_phi
std::map< field, std::vector< double > > fields
void calculate_physical_properties()
Calculates the physical properties. This function calculates the physical properties that may be requ...
std::vector< Tensor< 1, dim > > tracer_gradients
Table< 2, Tensor< 2, dim > > hess_phi
FEFaceValues< dim > fe_face_values_fd
TracerScratchData(const PhysicalPropertiesManager &properties_manager, const FiniteElement< dim > &fe_tracer, const Quadrature< dim > &quadrature, const Quadrature< dim - 1 > &face_quadrature, const Mapping< dim > &mapping, const FiniteElement< dim > &fe_fd, const bool uses_dg)
Constructor. The constructor creates the fe_values that will be used to fill the member variables of ...
std::vector< double > source
std::vector< double > tracer_value_jump
std::vector< double > values_here
void reinit_mortar(const typename DoFHandler< dim >::active_cell_iterator &cell, const Parameters::Mortar< dim > &mortar_parameters, const double &time)
Renitialize the content of the scratch data for mortar.
Table< 2, double > face_jump_phi
Table< 2, double > face_phi_there
PhysicalPropertiesManager properties_manager
std::vector< Tensor< 1, dim > > rotor_linear_velocity_values
Table< 2, double > face_phi_here
std::vector< double > tracer_laplacians
unsigned int n_interface_dofs
Table< 2, Tensor< 1, dim > > grad_phi
void reinit_signed_distance_at_face(const typename DoFHandler< dim >::active_cell_iterator &cell, const unsigned int &face_no, const std::shared_ptr< Shape< dim > > &immersed_solid_shape)
Reinitializes the signed distance vector of the scratch for a given face.
std::vector< Point< dim > > quadrature_points
Table< 2, double > phi
std::vector< double > tracer_diffusivity_face
std::vector< Tensor< 1, dim > > gradients_here
FEValues< dim > fe_values_tracer
FEValues< dim > fe_values_fd
void reinit_velocity(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &velocity_solution, const Parameters::ALE< dim > &ale, const std::shared_ptr< Functions::ParsedFunction< dim > > &drift_velocity)
Reinitialize the velocity, calculated by the fluid dynamics while also taking into account ALE.
void reinit(const typename DoFHandler< dim >::active_cell_iterator &cell, const VectorType &current_solution, const std::vector< VectorType > &previous_solutions, const Function< dim > *source_function)
Reinitializes the content of the scratch.
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 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
double get_penalty_factor(const unsigned int fe_degree, const double cell_extent_here, const double cell_extent_there)
Calculate the penalty factor for the SIPG method for the case when two cells are of different sizes....
Definition utilities.h:1099
Tensor< 1, dim > angular_to_linear_velocity(const double omega, const Tensor< 1, dim > &point, const unsigned int rotation_axis_direction=2)
Transform angular velocity into linear velocity considering that the angular velocity omega is consta...
void set_field_vector(const field &id, const std::vector< double > &data, std::map< field, std::vector< double > > &fields)
Mortar - Defines parameters used to construct mortar elements.
Point< dim > center_of_rotation
Center of rotation of the rotor domain.
std::shared_ptr< Functions::ParsedFunction< dim > > rotor_angular_velocity
Angular velocity of the rotor domain.
unsigned int rotation_axis_direction
Rotation axis direction.
GlobalVectorType VectorType