67class SpatialOperatorBase :
public dealii::EnableObserverPointer
70 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
71 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
73 typedef SpatialOperatorBase<dim, Number> This;
75 typedef dealii::VectorizedArray<Number> scalar;
76 typedef dealii::Tensor<1, dim, dealii::VectorizedArray<Number>> vector;
77 typedef dealii::Tensor<2, dim, dealii::VectorizedArray<Number>> tensor;
79 typedef std::pair<unsigned int, unsigned int> Range;
81 typedef FaceIntegrator<dim, dim, Number> FaceIntegratorU;
82 typedef FaceIntegrator<dim, 1, Number> FaceIntegratorP;
90 SpatialOperatorBase(std::shared_ptr<
Grid<dim> const> grid,
91 std::shared_ptr<dealii::Mapping<dim>
const> mapping,
96 std::string
const & field,
97 MPI_Comm
const & mpi_comm);
102 virtual ~SpatialOperatorBase(){};
120 setup(std::shared_ptr<dealii::MatrixFree<dim, Number>
const> matrix_free,
122 std::string
const & dof_index_temperature =
"");
131 setup_preconditioners_and_solvers()
146 dealii::MatrixFree<dim, Number>
const &
147 get_matrix_free()
const;
150 get_dof_name_velocity()
const;
153 get_dof_index_velocity()
const;
156 get_dof_index_pressure()
const;
159 get_quad_index_velocity_standard()
const;
162 get_quad_index_pressure()
const;
166 get_dof_index_velocity_scalar()
const;
169 get_quad_index_velocity_overintegration()
const;
172 get_quad_index_velocity_nodal_points()
const;
175 get_quad_index_pressure_nodal_points()
const;
178 get_quad_index_velocity_linearized()
const;
181 std::shared_ptr<dealii::Mapping<dim>
const>
184 dealii::FiniteElement<dim>
const &
187 dealii::FiniteElement<dim>
const &
190 dealii::DoFHandler<dim>
const &
191 get_dof_handler_u()
const;
193 dealii::DoFHandler<dim>
const &
194 get_dof_handler_u_scalar()
const;
196 dealii::DoFHandler<dim>
const &
197 get_dof_handler_p()
const;
199 dealii::AffineConstraints<Number>
const &
200 get_constraint_p()
const;
202 dealii::AffineConstraints<Number>
const &
203 get_constraint_u()
const;
205 dealii::types::global_dof_index
206 get_number_of_dofs()
const;
208 dealii::VectorizedArray<Number>
209 get_viscosity_boundary_face(
unsigned int const face,
unsigned int const q)
const;
212 std::shared_ptr<ContainerInterfaceData<1, dim, double>>
213 get_container_interface_data();
216 set_velocity_ptr(VectorType
const & velocity)
const;
222 initialize_vector_velocity(VectorType & src)
const;
225 initialize_vector_velocity_scalar(VectorType & src)
const;
228 initialize_vector_pressure(VectorType & src)
const;
231 initialize_block_vector_velocity_pressure(BlockVectorType & src)
const;
237 prescribe_initial_conditions(VectorType & velocity,
238 VectorType & pressure,
239 double const time)
const;
245 serialize_vectors(std::vector<VectorType const *> & vectors_velocity,
246 std::vector<VectorType const *> & vectors_pressure)
const;
249 deserialize_vectors(std::vector<VectorType *> & vectors_velocity,
250 std::vector<VectorType *> & vectors_pressure);
256 interpolate_functions(VectorType & velocity,
257 std::shared_ptr<dealii::Function<dim>>
const & f_velocity,
258 VectorType & pressure,
259 std::shared_ptr<dealii::Function<dim>>
const & f_pressure,
260 double const time)
const;
266 interpolate_analytical_solution(VectorType & velocity,
267 VectorType & pressure,
268 double const time)
const;
273 interpolate_stress_bc(VectorType & stress,
274 VectorType
const & velocity,
275 VectorType
const & pressure)
const;
285 calculate_time_step_max_efficiency(
unsigned int const order_time_integrator)
const;
289 calculate_time_step_cfl_global()
const;
293 calculate_time_step_cfl(VectorType
const & velocity)
const;
297 calculate_cfl_from_time_step(VectorType & cfl,
298 VectorType
const & velocity,
299 double const time_step_size)
const;
305 get_characteristic_element_length()
const;
316 is_pressure_level_undefined()
const;
321 adjust_pressure_level_if_undefined(VectorType & pressure,
double const & time)
const;
327 set_temperature(VectorType
const & temperature);
336 compute_vorticity(VectorType & dst, VectorType
const & src)
const;
340 compute_divergence(VectorType & dst, VectorType
const & src)
const;
344 compute_shear_rate(VectorType & dst, VectorType
const & src)
const;
348 compute_velocity_magnitude(VectorType & dst, VectorType
const & src)
const;
352 compute_vorticity_magnitude(VectorType & dst, VectorType
const & src)
const;
356 compute_streamfunction(VectorType & dst, VectorType
const & src)
const;
360 compute_q_criterion(VectorType & dst, VectorType
const & src)
const;
364 access_viscosity(VectorType & dst)
const;
372 apply_mass_operator(VectorType & dst, VectorType
const & src)
const;
375 apply_mass_operator_add(VectorType & dst, VectorType
const & src)
const;
379 evaluate_add_body_force_term(VectorType & dst,
double const time)
const;
383 evaluate_convective_term(VectorType & dst, VectorType
const & src, Number
const time)
const;
387 evaluate_pressure_gradient_term(VectorType & dst,
388 VectorType
const & src,
389 double const time)
const;
393 evaluate_velocity_divergence_term(VectorType & dst,
394 VectorType
const & src,
395 double const time)
const;
399 apply_inverse_mass_operator(VectorType & dst, VectorType
const & src)
const;
405 update_viscosity(VectorType
const & velocity)
const;
411 update_projection_operator(VectorType
const & velocity,
double const time_step_size)
const;
414 rhs_add_projection_operator(VectorType & dst,
double const time)
const;
417 solve_projection(VectorType & dst,
418 VectorType
const & src,
419 bool const & update_preconditioner)
const;
425 calculate_dissipation_convective_term(VectorType
const & velocity,
double const time)
const;
428 calculate_dissipation_viscous_term(VectorType
const & velocity)
const;
431 calculate_dissipation_divergence_term(VectorType
const & velocity)
const;
434 calculate_dissipation_continuity_term(VectorType
const & velocity)
const;
440 update_after_grid_motion(
bool const update_matrix_free);
446 set_grid_velocity(VectorType
const & velocity);
452 distribute_constraint_u(VectorType & velocity)
const;
459 setup_projection_solver();
462 unsteady_problem_has_to_be_solved()
const;
467 std::shared_ptr<Grid<dim>
const> grid;
473 std::shared_ptr<dealii::Mapping<dim>
const> mapping;
475 std::shared_ptr<MultigridMappings<dim, Number>>
const multigrid_mappings;
480 std::shared_ptr<BoundaryDescriptor<dim>
const> boundary_descriptor;
481 std::shared_ptr<FieldFunctions<dim>
const> field_functions;
491 std::string
const field;
507 std::shared_ptr<Poisson::BoundaryDescriptor<0, dim>> boundary_descriptor_laplace;
512 dealii::Point<dim> first_point;
513 dealii::types::global_dof_index dof_index_first_point;
519 mutable double evaluation_time;
525 std::shared_ptr<dealii::FiniteElement<dim>> fe_u;
526 std::shared_ptr<dealii::FiniteElement<dim>> fe_p;
527 std::shared_ptr<dealii::FiniteElement<dim>> fe_u_scalar;
528 std::shared_ptr<dealii::FiniteElement<dim>> fe_mapping;
530 dealii::DoFHandler<dim> dof_handler_u;
531 dealii::DoFHandler<dim> dof_handler_p;
532 dealii::DoFHandler<dim> dof_handler_u_scalar;
533 std::shared_ptr<dealii::DoFHandler<dim>> dof_handler_mapping;
535 dealii::AffineConstraints<Number> constraint_u, constraint_p, constraint_u_scalar;
537 std::string
const dof_index_u =
"velocity";
538 std::string
const dof_index_p =
"pressure";
539 std::string
const dof_index_u_scalar =
"velocity_scalar";
541 std::string
const quad_index_u =
"velocity";
542 std::string
const quad_index_p =
"pressure";
543 std::string
const quad_index_u_overintegration =
"velocity_overintegration";
544 std::string
const quad_index_u_nodal_points =
"velocity_nodal_points";
545 std::string
const quad_index_p_nodal_points =
"pressure_nodal_points";
547 std::shared_ptr<MatrixFreeData<dim, Number>
const> matrix_free_data;
548 std::shared_ptr<dealii::MatrixFree<dim, Number>
const> matrix_free;
553 std::shared_ptr<dealii::MatrixFree<dim, Number>> matrix_free_own_storage;
555 bool pressure_level_is_undefined;
560 std::shared_ptr<ContainerInterfaceData<1, dim, double>> interface_data_dirichlet_cached;
569 std::shared_ptr<Operators::ConvectiveKernel<dim, Number>> convective_kernel;
570 std::shared_ptr<Operators::ViscousKernel<dim, Number>> viscous_kernel;
572 std::shared_ptr<Operators::DivergencePenaltyKernel<dim, Number>> div_penalty_kernel;
573 std::shared_ptr<Operators::ContinuityPenaltyKernel<dim, Number>> conti_penalty_kernel;
596 InverseMassOperator<dim, dim, Number> inverse_mass_velocity;
597 InverseMassOperator<dim, 1, Number> inverse_mass_velocity_scalar;
603 std::shared_ptr<ProjOperator> projection_operator;
612 std::shared_ptr<ELEMENTWISE_PROJ_OPERATOR> elementwise_projection_operator;
615 ELEMENTWISE_PRECONDITIONER;
616 std::shared_ptr<ELEMENTWISE_PRECONDITIONER> elementwise_preconditioner_projection;
619 std::shared_ptr<Krylov::SolverBase<VectorType>> projection_solver;
620 std::shared_ptr<PreconditionerBase<Number>> preconditioner_projection;
632 MPI_Comm
const mpi_comm;
634 dealii::ConditionalOStream pcout;
637 std::shared_ptr<dealii::FiniteElement<dim>>
638 setup_fe_u(SpatialDiscretization
const spatial_discretization,
639 ElementType
const element_type,
640 unsigned int const degree)
const;
644 calculate_minimum_element_length()
const;
650 initialize_boundary_descriptor_laplace();
653 initialize_dof_handler_and_constraints();
656 initialize_dirichlet_cached_bc();
659 initialize_operators(std::string
const & dof_index_temperature);
662 initialize_calculators_for_derived_quantities();
665 initialization_pure_dirichlet_bc();
668 cell_loop_empty(dealii::MatrixFree<dim, Number>
const &,
676 face_loop_empty(dealii::MatrixFree<dim, Number>
const &,
684 local_interpolate_stress_bc_boundary_face(dealii::MatrixFree<dim, Number>
const & matrix_free,
686 VectorType
const & src,
687 Range
const & face_range)
const;
692 mutable VectorType
const * velocity_ptr;
693 mutable VectorType
const * pressure_ptr;