Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
fluid_dynamics_sharp.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2020-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_gls_sharp_h
5#define lethe_gls_sharp_h
6
7#include <core/ib_particle.h>
8#include <core/ib_stencil.h>
9#include <core/shape.h>
10#include <core/vector.h>
11
13
14#include <dem/data_containers.h>
16#include <dem/visualization.h>
19
20#include <deal.II/particles/particle_handler.h>
21
22#include <unordered_set>
23
24using namespace dealii;
25
26/**
27 * A solver class for the Navier-Stokes equation using GLS stabilization and
28 * Sharp-Edge immersed boundaries
29 *
30 * @tparam dim An integer that denotes the dimension of the space in which
31 * the flow is solved
32 *
33 * @ingroup solvers
34 */
35
36template <int dim>
38{
39public:
41
43
44 void
45 solve() override;
46
47 /**
48 * @brief Call for the assembly of the matrix
49 */
50 void
55
56 /**
57 * @brief Call for the assembly of the right-hand side
58 */
59 void
61 {
63 sharp_edge();
64 }
65
66
67private:
68 /**
69 * @brief Assemble the local matrix for a given cell.
70 *
71 * This function is used by the WorkStream class to assemble
72 * the system matrix. It is a thread safe function.
73 *
74 * @param cell The cell for which the local matrix is assembled.
75 *
76 * @param scratch_data The scratch data which is used to store
77 * the calculated finite element information at the gauss point.
78 * See the documentation for NavierStokesScratchData for more
79 * information
80 *
81 * @param copy_data The copy data which is used to store
82 * the results of the assembly over a cell
83 * This function is modified compared to the GLS function to take into account
84 * the cells that are cut or inside a particle
85 */
86 void
88 const typename DoFHandler<dim>::active_cell_iterator &cell,
89 NavierStokesScratchData<dim> &scratch_data,
90 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
91
92 /**
93 * @brief Assemble the local rhs for a given cell
94 *
95 * @param cell The cell for which the local matrix is assembled.
96 *
97 * @param scratch_data The scratch data which is used to store
98 * the calculated finite element information at the gauss point.
99 * See the documentation for NavierStokesScratchData for more
100 * information
101 *
102 * @param copy_data The copy data which is used to store
103 * the results of the assembly over a cell
104 */
105 void
107 const typename DoFHandler<dim>::active_cell_iterator &cell,
108 NavierStokesScratchData<dim> &scratch_data,
109 StabilizedMethodsTensorCopyData<dim> &copy_data) override;
110
111 /**
112 * @brief sets up the vector of assembler functions
113 * This function is modified compared to the GLS function to take into account
114 * the cells that are cut or inside a particle. Refer to 2 different assembler
115 * depending on what type of equations is assembled inside the particles.
116 */
117 void
118 setup_assemblers() override;
119
120
121 /**
122 * @brief Copy local cell information to global matrix
123 * This function is modified compared to the GLS function to take into account
124 * the cells that are cut or inside a particle
125 */
126
127 void
129 const StabilizedMethodsTensorCopyData<dim> &copy_data) override;
130
131 /**
132 * @brief Copy local cell rhs information to global rhs
133 * This function is modified compared to the GLS function to take into account
134 * the cells that are cut or inside a particle
135 */
136
137 void
139 const StabilizedMethodsTensorCopyData<dim> &copy_data) override;
140
141 /**
142 * @brief Call for the assembly of the matrix and the right hand side
143 *
144 * @deprecated This function is to be deprecated when the non-linear solvers
145 * have been refactored to call for rhs and matrix assembly seperately.
146 */
147
148 /*
149 Modified version of assemble_matrix_and_rhs to include the presence of
150 extra steps. For more detail see the same function in the
151 fluid_dynamics_matrix_based.h solver.
152 */
153
154 virtual void
156 {
158 {
159 if (this->get_current_newton_iteration() != 0)
160 {
161 force_on_ib();
162 }
165 }
166 // Do the cut cell mapping only if it is the first Newton iteration or
167 // if the explicit position integration is false.
168 if (this->get_current_newton_iteration() == 0 ||
169 this->simulation_parameters.particlesParameters
170 ->explicit_position_integration_calculation == false)
171 {
172 if (all_spheres)
174 else
176 }
178
179 sharp_edge();
180 }
181
182
183 /**
184 * @brief Call for the assembly of the right hand side
185 *
186 * @deprecated This function is to be deprecated when the non-linear solvers
187 * have been refactored to call for rhs and matrix assembly seperately.
188 *
189 * Modified version of assemble_matrix_and_rhs to include the presence of
190 * extra steps. For more detail see the same function in the
191 * fluid_dynamics_matrix_based.h solver.
192 */
193 virtual void
198
199 /**
200 * @brief
201 * Map the vertex index to the cell that includes that vertex.
202 * This map is used to find all the cell close to a specific vertex.
203 */
204 void
206
207 /**
208 * @brief
209 * Defines the particle structure and value based on the parameter file.
210 * This structure gives access to the position, velocity, force and other
211 * proprieties of each IB particle. All the variables defined for each of the
212 * particle are described in the class: IBparticle. see:
213 * \include\core\ib_particle.h
214 */
215 void
217
218 /**
219 * @brief
220 * Evaluate the forces applied on each of the IB particle.
221 */
222 void
223 force_on_ib();
224
225
226 /**
227 * @brief
228 * Modify the system matrix to impose IB condition using the sharp_edge
229 * approach. The detail of this approach are presented in : L. Barbeau, S.
230 * Étienne, C. Béguin & B. Blais, «Development of a high-order continuous
231 * Galerkin sharp-interface immersed boundary method and its application to
232 * incompressible flow problems,» Computers & Fluids, 2020, in press, ref.
233 * CAF-D-20-00773
234 */
235 void
236 sharp_edge();
237
238 /**
239 * @brief
240 * Write in a specifique file for each of the paticles its forces, velocity,
241 * position at each time step.
242 */
243 void
245
246 /**
247 * @brief
248 * Integrate the particle velocity and position based on the forces and
249 * torques and applies the next value to the particle.
250 */
251 void
253
254 /**
255 * @brief Apply the prescribed motion of a particle whose dynamics is not
256 * integrated, at the end of the current time step. The motion is given by
257 * the functions of the particle subsection or, if the particles are loaded
258 * from a file, by the constant velocity and angular velocity of the
259 * particle.
260 *
261 * @param[in,out] particle Particle whose position, orientation, velocity and
262 * angular velocity are updated.
263 *
264 * @param[in] time Time at the end of the current time step.
265 *
266 * @param[in] dt Current time step.
267 */
268 void
270 const double time,
271 const double dt) const;
272
273 /**
274 * @brief
275 * Store the solution of the particles dynamics parameters for integration.
276 * Defines the table to store the history of each of the particles.
277 */
278 void
280
281 /**
282 * @brief Mirror DEM-style particle output and post-processing for
283 * Sharp-IB particles.
284 */
285 void
287
288 /**
289 * @brief Build a temporary DEM particle handler from the current Sharp-IB
290 * particles.
291 *
292 * @param particle_handler Particle handler that stores the locally owned and
293 * ghosted Sharp-IB particles.
294 * @param particle_container Map from particle ids to particle iterators in
295 * the temporary particle handler.
296 * @param local_particle_ids Set of locally owned particle ids on the current
297 * MPI rank.
298 */
299 void
301 Particles::ParticleHandler<dim, dim> &particle_handler,
303 &particle_container,
304 std::unordered_set<unsigned int> &local_particle_ids) const;
305
306 /**
307 * @brief Build the DEM-style particle-particle contact containers of the
308 * Sharp-IB particles, used for the force-chain output.
309 *
310 * @param particle_container Map from particle ids to particle iterators in
311 * the temporary particle handler.
312 * @param local_particle_ids Set of locally owned particle ids on the current
313 * MPI rank.
314 * @param local_adjacent_particles Particle-particle contacts where both
315 * particles are locally owned.
316 * @param ghost_adjacent_particles Particle-particle contacts involving a
317 * ghost particle.
318 */
319 void
322 &particle_container,
323 const std::unordered_set<unsigned int> &local_particle_ids,
325 &local_adjacent_particles,
327 &ghost_adjacent_particles) const;
328
329 /**
330 * @brief Fill DEM particle properties from a Sharp-IB particle state.
331 *
332 * @param particle Sharp-IB particle whose properties are exported.
333 * @param properties DEM property vector to populate.
334 */
335 void
337 std::vector<double> &properties) const;
338
339 /**
340 * @brief
341 * Evaluate the L2 error on the computational domain if an analytical solution
342 * is given. This function is slightly different from its standard GLS
343 * counterpart as the cells that are cut by an immersed boundary should not be
344 * taken into account in the error evaluation. See "computation domain"
345 * definition in: L. Barbeau, S. Étienne, C. Béguin & B. Blais, «Development
346 * of a high-order continuous Galerkin sharp-interface immersed boundary
347 * method and its application to incompressible flow problems,» Computers &
348 * Fluids, 2020, in press, ref. CAF-D-20-0077
349 */
350 std::pair<double, double>
352
353
354 /**
355 * @brief
356 * Same function as its standard GLS counterpart but it used the error
357 * evaluation that takes into account the particle’s position.
358 */
359 virtual void
360 postprocess_fd(bool firstIter) override;
361
362
363 /**
364 * @brief Adds levelset to output files.
365 *
366 * @return Vector of OutputStructs that will be used to write the output results as VTU files.
367 */
368 virtual std::vector<OutputStruct<dim, GlobalVectorType>>
369 gather_output_hook() override;
370
371 /**
372 * @brief
373 * Adapt the mesh around each immersed-boundary particle.
374 * The refinement zone is defined by a ring in 2D and a shell in 3D. The
375 * outside and inside radius of this ring\shell are defined relative to the
376 * particle radius by the immersed-boundary parameters
377 * "refine mesh inside radius factor" and
378 * "refine mesh outside radius factor". When enabled, distance-based
379 * coarsening is also applied outside the corresponding coarsening threshold.
380 * @param initial_refinement A bool that indicates if this is the initial
381 * refinement cycle.
382 */
383 void
384 mesh_adapt_ib(const bool initial_refinement);
385
386
387 /**
388 * @brief
389 *This function checks if all particles are spheres. If one of them is not,
390 *the code will use the regular generate_cut_cells function. If all particles
391 *are spheres, it uses the optimized_generate_cut_cells.
392 */
393 void
395 /**
396 * @brief
397 *This function creates a map (cut_cells_map) that indicates if a cell is
398 *cut, and the particle id of the particle that cut it.
399 */
400 void
402
403 /**
404 * @brief
405 * This function is only applied if all particles are spheres.
406 * It creates two maps (cut_cells_map and cells_inside_map) to access the
407 * cells cut by particles and inside the particles, respectively. The map keys
408 * are the particle's IDs. The algorithm was optimized to reduce the cost of
409 * this step.
410 */
411 void
413
414 /**
415 * @brief
416 *This function abstracts the generation of cell candidates that possibly are
417 *cut
418 */
419 std::pair<bool, bool>
421 const typename DoFHandler<dim>::cell_iterator &cell,
422 const unsigned int p_id);
423
424 /**
425 * @brief
426 * Return a bool to define if a cell is cut by an IB particle and the local
427 * DOFs of the cell for later us. If the cell is cut, the function will return
428 * the id of the particle that cut it, else it returns 0.
429 *
430 * @param cell , the cell that we verify whether it is cut or not.
431 *
432 * @param local_dof_indices, a container for the local dof indices used during the function call.
433 *
434 * @param support_points, a mapping of support points for the DOFs.
435 *
436 */
437 std::tuple<bool, unsigned int, std::vector<types::global_dof_index>>
438 cell_cut(const typename DoFHandler<dim>::active_cell_iterator &cell,
439 std::vector<types::global_dof_index> &local_dof_indices,
440 std::map<types::global_dof_index, Point<dim>> &support_points);
441
442 /**
443 * @brief
444 * Return a bool to define if a cell is cut by an IB.
445 * This function is built to handle special cases where the level set is
446 * always positive.
447 *
448 * @param cell, the cell that we verify whether it is cut or not.
449 *
450 * @param support_points, a mapping of support points for the DOFs.
451 *
452 * @param p, the particle index of the particle used in the check
453 *
454 */
455 bool
457 const typename DoFHandler<dim>::active_cell_iterator &cell,
458 std::map<types::global_dof_index, Point<dim>> &support_points,
459 unsigned int p);
460
461 /**
462 * @brief
463 * Return a bool to define if a cell is contains inside an IB particle and the
464 * local DOFs of the cell for later us. If the cell is cut, the function will
465 * return the id of the particle, else it returns 0.
466 *
467 * @param cell , the cell that we verify whether it is cut or not.
468 *
469 * @param local_dof_indices, a container for the local dof indices used during the function call.
470 *
471 * @param support_points, a mapping of support points for the DOFs.
472 *
473 */
474 std::tuple<bool, unsigned int, std::vector<types::global_dof_index>>
475 cell_inside(const typename DoFHandler<dim>::active_cell_iterator &cell,
476 std::vector<types::global_dof_index> &local_dof_indices,
477 std::map<types::global_dof_index, Point<dim>> &support_points);
478
479
480
481 /**
482 * @brief Write a gls_sharp simulation checkpointing to allow for gls_sharp simulation restart
483 * This function stores all the previous' particles states in one file. Each
484 * row corresponds to one particle state. The file is structured as follows:
485 *
486 *
487 * P0 state at time t
488 *
489 * P0 state at time t-dt
490 *
491 * P0 state at time t-2dt
492 *
493 * P1 state at time t
494 *
495 * P1 state at time t-dt
496 *
497 * P1 state at time t-2dt
498 *
499 * etc
500 *
501 */
502
503 virtual void
504 write_checkpoint() override;
505 /*
506 * @brief Read a gls_sharp simulation checkpoint and initiate simulation restart.
507 * See the description of the function write_checkpoint for more details about
508 * the file structure.
509 * */
510 virtual void
511 read_checkpoint() override;
512
513
514 /*
515 * @brief Read file to load particles. The file must contain the following information for each particle (the header must be defined accordingly):
516 * type shape_argument_0 shape_argument_1 shape_argument_2 p_x p_y p_z v_x v_y
517 * v_z omega_x omega_y omega_z orientation_x orientation_y orientation_z
518 * density inertia pressure_x pressure_y pressure_z youngs_modulus
519 * restitution_coefficient friction_coefficient poisson_ratio
520 * rolling_friction_coefficient
521 * */
522 void
524
525 /**
526 * @brief Regroup and organize the refinement process around the IB particle.
527 *
528 * @param initial_refinement, A bool that indicate if this is the initial refinement.
529 */
530 void
531 refinement_control(const bool initial_refinement);
532
533
534 /**
535* @brief
536Return a bool that describes if a cell contains a specific point
537*
538* @param cell , The initial cell for which we want to check if the point is inside.
539*
540* @param point, The point that we wish to check
541*/
542 bool
543 point_inside_cell(const typename DoFHandler<dim>::active_cell_iterator &cell,
544 Point<dim> point);
545
546 /**
547 * @brief A override of the get_current_residual to take into account the particles
548 * coupling residual.
549 *
550 * @return The maximum between the fluid residual and the particle residual time the scaling.
551 */
552 double
554 {
555 double scaling = this->simulation_parameters.physics_solving_strategy
557 .tolerance /
558 this->simulation_parameters.particlesParameters
559 ->particle_nonlinear_tolerance;
560 return std::max(this->system_rhs.l2_norm(), particle_residual * scaling);
561 }
562
563 /**
564 * @brief Sharp may keep the outer nonlinear iteration active because of the
565 * particle-coupling residual even when the assembled fluid residual is
566 * already below tolerance.
567 *
568 * In that situation, the inner fluid linear solve is unnecessary and may be
569 * skipped while the outer coupled iteration continues.
570 *
571 * @return `true` because Sharp allows skipping the inner fluid linear solve
572 * once the assembled fluid residual is already below the nonlinear
573 * tolerance.
574 */
575 bool
577 {
578 return true;
579 }
580
581 /**
582 * @brief
583 *This function updates the precalculations for every immersed particle
584 */
585 void
587
588 /**
589 * @brief Defines a struct with methods that allow the generation of a visualisation of the IB_particles. This is equivalent to the corresponding class in the DEM solver.
590 */
591 struct Visualization_IB : public dealii::DataOutInterface<0, dim>
592 {
593 public:
594 /**
595 * Carries out building the patches of properties of particles for
596 * visualization
597 *
598 * @param particles The vector fo IB_particles
599 */
600 void
602
603
605
606 private:
607 /**
608 * Implementation of the corresponding function of the base class.
609 */
610 virtual const std::vector<DataOutBase::Patch<0, dim>> &
611 get_patches() const override;
612
613 /**
614 * Implementation of the corresponding function of the base class.
615 */
616 virtual std::vector<std::string>
617 get_dataset_names() const override;
618
619 virtual std::vector<
620 std::tuple<unsigned int,
621 unsigned int,
622 std::string,
623 DataComponentInterpretation::DataComponentInterpretation>>
624 get_nonscalar_data_ranges() const override;
625
626
627
628 /**
629 * Output information that is filled by build_patches() and
630 * written by the write function of the base class.
631 */
632 std::vector<DataOutBase::Patch<0, dim>> patches;
633
634 /**
635 * A list of field names for all data components stored in patches.
636 */
637 std::vector<std::string> dataset_names;
638
639 /**
640 * Store which of the data fields are vectors.
641 */
642
643 std::vector<
644 std::tuple<unsigned int,
645 unsigned int,
646 std::string,
647 DataComponentInterpretation::DataComponentInterpretation>>
649
650
651 /**
652 * Particle properties that are written in output files
653 */
654 std::vector<std::pair<std::string, int>> properties_to_write;
655 };
656
657
658
659 /**
660 * Members
661 */
662
663private:
664 // Parameters
666
668
669 // Bool that check if some particle are coupled.
671
672 std::map<unsigned int,
673 std::set<typename DoFHandler<dim>::active_cell_iterator>>
675 /*
676 * This map uses the cell as the key, and stores the following information:
677 * if that cell is cut (bool), what particle cut this cell (unsigned int), and
678 * the number of particles that cut this cell(unsigned int). The id of the
679 * particle that cut the cell is the id of the particle with the lowest
680 * particle index.
681 */
682 std::map<typename DoFHandler<dim>::active_cell_iterator,
683 std::tuple<bool, unsigned int, std::vector<unsigned int>>>
685
686 /*
687 * This map uses the cell as the key, and stores the following information:
688 * if the cell is overconstrained (bool), what particle overconstrains this
689 * cell (unsigned int), and the distance to the closest surface (double).
690 * The id of the particle that overconstrains the cell
691 * is the id of the particle closest to the cell barycenter.
692 */
693 std::map<typename DoFHandler<dim>::active_cell_iterator,
694 std::tuple<bool, unsigned int, double>>
696
697 /*
698 * These vectors and map are used to keep track of the DOFs that are
699 * overconstrained
700 */
703 std::map<unsigned int, bool> dof_with_more_then_one_particle;
704
705
706 std::map<typename DoFHandler<dim>::active_cell_iterator,
707 std::tuple<bool, unsigned int>>
709 /*
710 * This map is used to keep in memory which DOFs already have an IB equation
711 * imposed on them in order to avoid writing multiple time the same equation.
712 */
713 std::map<unsigned int,
714 std::pair<bool, typename DoFHandler<dim>::active_cell_iterator>>
716
717 // Special assembler of the cells inside an IB particle
718 std::vector<std::shared_ptr<NavierStokesAssemblerBase<dim>>>
720
722 // DEM-style post-processing handlers rebuilt from Sharp-IB particles.
724
725 std::vector<IBParticle<dim>> particles;
727
728 std::vector<TableHandler> table_p;
729 TableHandler table_all_p;
730
731 // Object used to sub-time step the particle dynamics to allow contact between
732 // particles.
734
735 // Function that describes all solids signed distance functions together
736 std::shared_ptr<Shape<dim>> combined_shapes;
737
738 // Postprocessors to output the signed distance function of the immersed
739 // solids
740 std::shared_ptr<LevelsetPostprocessor<dim>> levelset_postprocessor;
741 std::shared_ptr<LevelsetGradientPostprocessor<dim>>
743};
744
745
746#endif
virtual void assemble_system_matrix() override
Assembles the matrix associated with the solver.
virtual void assemble_system_rhs() override
Assemble the rhs associated with the solver.
FluidDynamicsMatrixBased(SimulationParameters< dim > &nsparam, const FluidDynamicsFormulation fluid_dynamics_formulation=FluidDynamicsFormulation::standard)
Construct the matrix-based Navier-Stokes solver.
GlobalVectorType dof_overconstrained
void generate_cut_cells_map()
This function creates a map (cut_cells_map) that indicates if a cell is cut, and the particle id of t...
virtual void read_checkpoint() override
Restart a previous simulation from a checkpoint file.
std::pair< bool, bool > generate_cut_cell_candidates(const typename DoFHandler< dim >::cell_iterator &cell, const unsigned int p_id)
This function abstracts the generation of cell candidates that possibly are cut.
void copy_local_matrix_to_global_matrix(const StabilizedMethodsTensorCopyData< dim > &copy_data) override
Copy local cell information to global matrix This function is modified compared to the GLS function t...
FluidDynamicsSharp(CFDDEMSimulationParameters< dim > &nsparam)
void assemble_system_rhs() override
Call for the assembly of the right-hand side.
virtual void write_checkpoint() override
Write a gls_sharp simulation checkpointing to allow for gls_sharp simulation restart This function st...
void apply_prescribed_particle_motion(IBParticle< dim > &particle, const double time, const double dt) const
Apply the prescribed motion of a particle whose dynamics is not integrated, at the end of the current...
std::map< unsigned int, bool > dof_with_more_then_one_particle
void assemble_system_matrix() override
Call for the assembly of the matrix.
std::map< unsigned int, std::set< typename DoFHandler< dim >::active_cell_iterator > > vertices_to_cell
void build_ib_particle_handler(Particles::ParticleHandler< dim, dim > &particle_handler, typename DEM::dem_data_structures< dim >::particle_index_iterator_map &particle_container, std::unordered_set< unsigned int > &local_particle_ids) const
Build a temporary DEM particle handler from the current Sharp-IB particles.
void optimized_generate_cut_cells_map()
This function is only applied if all particles are spheres. It creates two maps (cut_cells_map and ce...
CFDDEMSimulationParameters< dim > cfd_dem_parameters
void force_on_ib()
Evaluate the forces applied on each of the IB particle.
std::shared_ptr< Shape< dim > > combined_shapes
void mesh_adapt_ib(const bool initial_refinement)
Adapt the mesh around each immersed-boundary particle. The refinement zone is defined by a ring in 2D...
bool cell_cut_by_p_absolute_distance(const typename DoFHandler< dim >::active_cell_iterator &cell, std::map< types::global_dof_index, Point< dim > > &support_points, unsigned int p)
Return a bool to define if a cell is cut by an IB. This function is built to handle special cases whe...
virtual std::vector< OutputStruct< dim, GlobalVectorType > > gather_output_hook() override
Adds levelset to output files.
std::map< typename DoFHandler< dim >::active_cell_iterator, std::tuple< bool, unsigned int, double > > overconstrained_fluid_cell_map
PVDHandler ib_particles_pvdhandler_force_chains
void integrate_particles()
Integrate the particle velocity and position based on the forces and torques and applies the next val...
void assemble_local_system_matrix(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
Assemble the local matrix for a given cell.
std::map< typename DoFHandler< dim >::active_cell_iterator, std::tuple< bool, unsigned int > > cells_inside_map
void fill_particle_properties(const IBParticle< dim > &particle, std::vector< double > &properties) const
Fill DEM particle properties from a Sharp-IB particle state.
void copy_local_rhs_to_global_rhs(const StabilizedMethodsTensorCopyData< dim > &copy_data) override
Copy local cell rhs information to global rhs This function is modified compared to the GLS function ...
std::shared_ptr< LevelsetGradientPostprocessor< dim > > levelset_gradient_postprocessor
virtual void assemble_matrix_and_rhs()
Call for the assembly of the matrix and the right hand side.
std::map< typename DoFHandler< dim >::active_cell_iterator, std::tuple< bool, unsigned int, std::vector< unsigned int > > > cut_cells_map
std::vector< TableHandler > table_p
std::tuple< bool, unsigned int, std::vector< types::global_dof_index > > cell_inside(const typename DoFHandler< dim >::active_cell_iterator &cell, std::vector< types::global_dof_index > &local_dof_indices, std::map< types::global_dof_index, Point< dim > > &support_points)
Return a bool to define if a cell is contains inside an IB particle and the local DOFs of the cell fo...
std::shared_ptr< LevelsetPostprocessor< dim > > levelset_postprocessor
double get_current_residual() override
A override of the get_current_residual to take into account the particles coupling residual.
virtual void assemble_rhs()
Call for the assembly of the right hand side.
void refinement_control(const bool initial_refinement)
Regroup and organize the refinement process around the IB particle.
void finish_time_step_particles()
Store the solution of the particles dynamics parameters for integration. Defines the table to store t...
void update_precalculations_for_ib()
This function updates the precalculations for every immersed particle.
void write_force_ib()
Write in a specifique file for each of the paticles its forces, velocity, position at each time step.
void sharp_edge()
Modify the system matrix to impose IB condition using the sharp_edge approach. The detail of this app...
void vertices_cell_mapping()
Map the vertex index to the cell that includes that vertex. This map is used to find all the cell clo...
GlobalVectorType local_dof_overconstrained
void build_contact_containers(const typename DEM::dem_data_structures< dim >::particle_index_iterator_map &particle_container, const std::unordered_set< unsigned int > &local_particle_ids, typename DEM::dem_data_structures< dim >::adjacent_particle_pairs &local_adjacent_particles, typename DEM::dem_data_structures< dim >::adjacent_particle_pairs &ghost_adjacent_particles) const
Build the DEM-style particle-particle contact containers of the Sharp-IB particles,...
std::map< unsigned int, std::pair< bool, typename DoFHandler< dim >::active_cell_iterator > > ib_done
void setup_assemblers() override
sets up the vector of assembler functions This function is modified compared to the GLS function to t...
std::tuple< bool, unsigned int, std::vector< types::global_dof_index > > cell_cut(const typename DoFHandler< dim >::active_cell_iterator &cell, std::vector< types::global_dof_index > &local_dof_indices, std::map< types::global_dof_index, Point< dim > > &support_points)
Return a bool to define if a cell is cut by an IB particle and the local DOFs of the cell for later u...
void check_whether_all_particles_are_sphere()
This function checks if all particles are spheres. If one of them is not, the code will use the regul...
std::pair< double, double > calculate_L2_error_particles()
Evaluate the L2 error on the computational domain if an analytical solution is given....
IBParticlesDEM< dim > ib_dem
void solve() override
solve Solves the Navier-Stokes problem
std::vector< IBParticle< dim > > particles
bool allow_skip_linear_solve_when_residual_is_below_tolerance() const override
Sharp may keep the outer nonlinear iteration active because of the particle-coupling residual even wh...
virtual void postprocess_fd(bool firstIter) override
Same function as its standard GLS counterpart but it used the error evaluation that takes into accoun...
void define_particles()
Defines the particle structure and value based on the parameter file. This structure gives access to ...
std::vector< std::shared_ptr< NavierStokesAssemblerBase< dim > > > assemblers_inside_ib
void assemble_local_system_rhs(const typename DoFHandler< dim >::active_cell_iterator &cell, NavierStokesScratchData< dim > &scratch_data, StabilizedMethodsTensorCopyData< dim > &copy_data) override
Assemble the local rhs for a given cell.
void handle_dem_particle_output_and_postprocessing()
Mirror DEM-style particle output and post-processing for Sharp-IB particles.
bool point_inside_cell(const typename DoFHandler< dim >::active_cell_iterator &cell, Point< dim > point)
Return a bool that describes if a cell contains a specific point.
Define the behavior of a specific particle for the sharp interface IB solver.
Definition ib_particle.h:26
A solver class for the DEM used in conjunction with IB particles and fluid_dynamics_sharp....
Class that stores the information required by the assembly procedure for a Navier-Stokes equation....
The PVDHandler class manages the storage of the information required to write pvd file....
Definition pvd_handler.h:17
unsigned int get_current_newton_iteration() const
Class responsible for storing the information calculated using the assembly of stabilized Tensor<1,...
Definition copy_data.h:166
@ fluid_dynamics
Fluid Dynamics (Velocity,Pressure).
ankerl::unordered_dense::map< types::particle_index, Particles::ParticleIterator< dim > > particle_index_iterator_map
ankerl::unordered_dense::map< types::particle_index, adjacent_particle_pairs_value > adjacent_particle_pairs
Defines a struct with methods that allow the generation of a visualisation of the IB_particles....
virtual const std::vector< DataOutBase::Patch< 0, dim > > & get_patches() const override
virtual std::vector< std::string > get_dataset_names() const override
std::vector< DataOutBase::Patch< 0, dim > > patches
void build_patches(std::vector< IBParticle< dim > > particles)
std::vector< std::pair< std::string, int > > properties_to_write
std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > vector_datasets
virtual std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation > > get_nonscalar_data_ranges() const override
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType
Definition vector.h:17