4#ifndef lethe_tracer_scratch_data_h
5#define lethe_tracer_scratch_data_h
13#include <deal.II/fe/fe_interface_values.h>
14#include <deal.II/fe/fe_system.h>
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,
73 update_values | update_quadrature_points |
74 update_JxW_values | update_gradients |
75 (
uses_dg ? update_default : update_hessians))
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)
107 update_values | update_quadrature_points |
108 update_JxW_values | update_gradients |
109 (sd.
uses_dg ? update_default : update_hessians))
113 update_values | update_gradients |
114 update_quadrature_points |
115 update_JxW_values | update_normal_vectors)
119 update_values | update_gradients)
152 template <
typename VectorType>
154 reinit(
const typename DoFHandler<dim>::active_cell_iterator &cell,
156 const std::vector<VectorType> &previous_solutions,
157 const Function<dim> *source_function)
167 double cell_measure =
189 for (
unsigned int p = 0; p < previous_solutions.size(); ++p)
199 for (
unsigned int k = 0; k <
n_dofs; ++k)
207 for (
unsigned int k = 0; k <
n_dofs; ++k)
226 const typename DoFHandler<dim>::active_cell_iterator &cell,
227 const std::shared_ptr<
Shape<dim>> &immersed_solid_shape)
236 immersed_solid_shape !=
nullptr,
238 "Shape is required for tracer assembly, but the shape is a nullptr"));
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)
267 immersed_solid_shape !=
nullptr,
269 "Shape is required for tracer assembly, but the shape is a nullptr"));
272 for (
unsigned int q = 0; q < n_face_q_points; q++)
273 sdf_values[q] = immersed_solid_shape->value_with_cell_guess(
293 template <
typename VectorType>
296 const typename DoFHandler<dim>::active_cell_iterator &cell,
299 const std::shared_ptr<Functions::ParsedFunction<dim>> &drift_velocity)
311 Tensor<1, dim> drift_velocity_tensor;
312 Vector<double> drift_velocity_vector(dim);
317 drift_velocity_vector);
318 for (
int d = 0; d < dim; ++d)
319 drift_velocity_tensor[d] = drift_velocity_vector[d];
329 Tensor<1, dim> velocity_ale;
330 std::shared_ptr<Functions::ParsedFunction<dim>> velocity_ale_function =
332 Vector<double> velocity_ale_vector(dim);
337 velocity_ale_vector);
338 for (
int d = 0; d < dim; ++d)
339 velocity_ale[d] = velocity_ale_vector[d];
364 template <
typename VectorType>
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,
376 cell, face_no, sub_face_no, neigh_cell, neigh_face_no, neigh_sub_face_no);
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();
398 const std::vector<Tensor<1, dim>> &normals =
433 template <
typename VectorType>
436 const typename DoFHandler<dim>::active_cell_iterator &cell,
437 const unsigned int &face_no,
442 const FEFaceValuesBase<dim> &fe_face =
446 fe_face.get_function_values(current_solution,
values_here);
451 const double extent_here = cell->measure() / cell->face(face_no)->measure();
467 template <
typename VectorType>
470 const typename DoFHandler<dim>::active_cell_iterator &velocity_cell,
471 const unsigned int &face_no,
474 const std::shared_ptr<Functions::ParsedFunction<dim>> &drift_velocity)
484 Tensor<1, dim> drift_velocity_tensor;
485 Vector<double> drift_velocity_vector(dim);
490 drift_velocity_vector);
491 for (
int d = 0; d < dim; ++d)
492 drift_velocity_tensor[d] = drift_velocity_vector[d];
503 Tensor<1, dim> velocity_ale;
504 std::shared_ptr<Functions::ParsedFunction<dim>> velocity_ale_function =
506 Vector<double> velocity_ale_vector(dim);
511 velocity_ale_vector);
512 for (
int d = 0; d < dim; ++d)
513 velocity_ale[d] = velocity_ale_vector[d];
537 const double rotor_angular_velocity =
543 if (cell->material_id() == 1)
544 omega = rotor_angular_velocity;
550 cell->material_id() < 2,
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."));
556 std::vector<Tensor<1, dim>>(this->
n_q_points);
602 std::map<field, std::vector<double>>
fields;
An interface for all the common parameters required to consider a moving frame of reference in a simp...
bool enabled() const
Return if the ALE module is enabled.
std::shared_ptr< Functions::ParsedFunction< dim > > velocity
ALE velocity function.
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 ...
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.
unsigned int boundary_index
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 ¤t_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 ¤t_solution)
Reinitializes the content of the scratch for the boundary faces. This is only used for the DG assembl...
std::vector< double > tracer_diffusivity
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
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 ¤t_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...
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)...
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....
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