67class SpatialOperatorBase :
public dealii::Subscriptor
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 interpolate_functions(VectorType & velocity,
246 std::shared_ptr<dealii::Function<dim>>
const & f_velocity,
247 VectorType & pressure,
248 std::shared_ptr<dealii::Function<dim>>
const & f_pressure,
249 double const time)
const;
255 interpolate_analytical_solution(VectorType & velocity,
256 VectorType & pressure,
257 double const time)
const;
262 interpolate_stress_bc(VectorType & stress,
263 VectorType
const & velocity,
264 VectorType
const & pressure)
const;
274 calculate_time_step_max_efficiency(
unsigned int const order_time_integrator)
const;
278 calculate_time_step_cfl_global()
const;
282 calculate_time_step_cfl(VectorType
const & velocity)
const;
286 calculate_cfl_from_time_step(VectorType & cfl,
287 VectorType
const & velocity,
288 double const time_step_size)
const;
294 get_characteristic_element_length()
const;
305 is_pressure_level_undefined()
const;
310 adjust_pressure_level_if_undefined(VectorType & pressure,
double const & time)
const;
316 set_temperature(VectorType
const & temperature);
325 compute_vorticity(VectorType & dst, VectorType
const & src)
const;
329 compute_divergence(VectorType & dst, VectorType
const & src)
const;
333 compute_shear_rate(VectorType & dst, VectorType
const & src)
const;
337 compute_velocity_magnitude(VectorType & dst, VectorType
const & src)
const;
341 compute_vorticity_magnitude(VectorType & dst, VectorType
const & src)
const;
345 compute_streamfunction(VectorType & dst, VectorType
const & src)
const;
349 compute_q_criterion(VectorType & dst, VectorType
const & src)
const;
357 apply_mass_operator(VectorType & dst, VectorType
const & src)
const;
360 apply_mass_operator_add(VectorType & dst, VectorType
const & src)
const;
364 evaluate_add_body_force_term(VectorType & dst,
double const time)
const;
368 evaluate_convective_term(VectorType & dst, VectorType
const & src, Number
const time)
const;
372 evaluate_pressure_gradient_term(VectorType & dst,
373 VectorType
const & src,
374 double const time)
const;
378 evaluate_velocity_divergence_term(VectorType & dst,
379 VectorType
const & src,
380 double const time)
const;
384 apply_inverse_mass_operator(VectorType & dst, VectorType
const & src)
const;
390 update_viscosity(VectorType
const & velocity)
const;
396 update_projection_operator(VectorType
const & velocity,
double const time_step_size)
const;
399 rhs_add_projection_operator(VectorType & dst,
double const time)
const;
402 solve_projection(VectorType & dst,
403 VectorType
const & src,
404 bool const & update_preconditioner)
const;
410 calculate_dissipation_convective_term(VectorType
const & velocity,
double const time)
const;
413 calculate_dissipation_viscous_term(VectorType
const & velocity)
const;
416 calculate_dissipation_divergence_term(VectorType
const & velocity)
const;
419 calculate_dissipation_continuity_term(VectorType
const & velocity)
const;
425 update_after_grid_motion(
bool const update_matrix_free);
431 set_grid_velocity(VectorType
const & velocity);
437 distribute_constraint_u(VectorType & velocity)
const;
444 setup_projection_solver();
447 unsteady_problem_has_to_be_solved()
const;
452 std::shared_ptr<Grid<dim>
const> grid;
458 std::shared_ptr<dealii::Mapping<dim>
const> mapping;
460 std::shared_ptr<MultigridMappings<dim, Number>>
const multigrid_mappings;
465 std::shared_ptr<BoundaryDescriptor<dim>
const> boundary_descriptor;
466 std::shared_ptr<FieldFunctions<dim>
const> field_functions;
476 std::string
const field;
492 std::shared_ptr<Poisson::BoundaryDescriptor<0, dim>> boundary_descriptor_laplace;
497 dealii::Point<dim> first_point;
498 dealii::types::global_dof_index dof_index_first_point;
504 mutable double evaluation_time;
510 std::shared_ptr<dealii::FiniteElement<dim>> fe_u;
511 std::shared_ptr<dealii::FiniteElement<dim>> fe_p;
512 std::shared_ptr<dealii::FiniteElement<dim>> fe_u_scalar;
514 dealii::DoFHandler<dim> dof_handler_u;
515 dealii::DoFHandler<dim> dof_handler_p;
516 dealii::DoFHandler<dim> dof_handler_u_scalar;
518 dealii::AffineConstraints<Number> constraint_u, constraint_p, constraint_u_scalar;
520 std::string
const dof_index_u =
"velocity";
521 std::string
const dof_index_p =
"pressure";
522 std::string
const dof_index_u_scalar =
"velocity_scalar";
524 std::string
const quad_index_u =
"velocity";
525 std::string
const quad_index_p =
"pressure";
526 std::string
const quad_index_u_overintegration =
"velocity_overintegration";
527 std::string
const quad_index_u_nodal_points =
"velocity_nodal_points";
528 std::string
const quad_index_p_nodal_points =
"pressure_nodal_points";
530 std::shared_ptr<MatrixFreeData<dim, Number>
const> matrix_free_data;
531 std::shared_ptr<dealii::MatrixFree<dim, Number>
const> matrix_free;
536 std::shared_ptr<dealii::MatrixFree<dim, Number>> matrix_free_own_storage;
538 bool pressure_level_is_undefined;
543 std::shared_ptr<ContainerInterfaceData<1, dim, double>> interface_data_dirichlet_cached;
552 std::shared_ptr<Operators::ConvectiveKernel<dim, Number>> convective_kernel;
553 std::shared_ptr<Operators::ViscousKernel<dim, Number>> viscous_kernel;
555 std::shared_ptr<Operators::DivergencePenaltyKernel<dim, Number>> div_penalty_kernel;
556 std::shared_ptr<Operators::ContinuityPenaltyKernel<dim, Number>> conti_penalty_kernel;
579 InverseMassOperator<dim, dim, Number> inverse_mass_velocity;
580 InverseMassOperator<dim, 1, Number> inverse_mass_velocity_scalar;
591 std::shared_ptr<ProjOperator> projection_operator;
600 std::shared_ptr<ELEMENTWISE_PROJ_OPERATOR> elementwise_projection_operator;
603 ELEMENTWISE_PRECONDITIONER;
604 std::shared_ptr<ELEMENTWISE_PRECONDITIONER> elementwise_preconditioner_projection;
607 std::shared_ptr<Krylov::SolverBase<VectorType>> projection_solver;
608 std::shared_ptr<PreconditionerBase<Number>> preconditioner_projection;
619 MPI_Comm
const mpi_comm;
621 dealii::ConditionalOStream pcout;
626 calculate_minimum_element_length()
const;
632 initialize_boundary_descriptor_laplace();
635 initialize_dof_handler_and_constraints();
638 initialize_dirichlet_cached_bc();
641 initialize_operators(std::string
const & dof_index_temperature);
644 initialize_calculators_for_derived_quantities();
647 initialization_pure_dirichlet_bc();
650 cell_loop_empty(dealii::MatrixFree<dim, Number>
const &,
658 face_loop_empty(dealii::MatrixFree<dim, Number>
const &,
666 local_interpolate_stress_bc_boundary_face(dealii::MatrixFree<dim, Number>
const & matrix_free,
668 VectorType
const & src,
669 Range
const & face_range)
const;
674 mutable VectorType
const * velocity_ptr;
675 mutable VectorType
const * pressure_ptr;