4#ifndef lethe_gls_sharp_h
5#define lethe_gls_sharp_h
20#include <deal.II/particles/particle_handler.h>
22#include <unordered_set>
88 const typename DoFHandler<dim>::active_cell_iterator &cell,
107 const typename DoFHandler<dim>::active_cell_iterator &cell,
170 ->explicit_position_integration_calculation ==
false)
271 const double dt)
const;
301 Particles::ParticleHandler<dim, dim> &particle_handler,
304 std::unordered_set<unsigned int> &local_particle_ids)
const;
323 const std::unordered_set<unsigned int> &local_particle_ids,
325 &local_adjacent_particles,
327 &ghost_adjacent_particles)
const;
337 std::vector<double> &properties)
const;
350 std::pair<double, double>
368 virtual std::vector<OutputStruct<dim, GlobalVectorType>>
419 std::pair<bool, bool>
421 const typename DoFHandler<dim>::cell_iterator &cell,
422 const unsigned int p_id);
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);
457 const typename DoFHandler<dim>::active_cell_iterator &cell,
458 std::map<types::global_dof_index, Point<dim>> &support_points,
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);
559 ->particle_nonlinear_tolerance;
610 virtual const std::vector<DataOutBase::Patch<0, dim>> &
616 virtual std::vector<std::string>
620 std::tuple<
unsigned int,
623 DataComponentInterpretation::DataComponentInterpretation>>
632 std::vector<DataOutBase::Patch<0, dim>>
patches;
644 std::tuple<
unsigned int,
647 DataComponentInterpretation::DataComponentInterpretation>>
672 std::map<
unsigned int,
673 std::set<typename DoFHandler<dim>::active_cell_iterator>>
682 std::map<typename DoFHandler<dim>::active_cell_iterator,
683 std::tuple<bool, unsigned int, std::vector<unsigned int>>>
693 std::map<typename DoFHandler<dim>::active_cell_iterator,
694 std::tuple<bool, unsigned int, double>>
706 std::map<typename DoFHandler<dim>::active_cell_iterator,
707 std::tuple<bool, unsigned int>>
713 std::map<
unsigned int,
714 std::pair<bool, typename DoFHandler<dim>::active_cell_iterator>>
718 std::vector<std::shared_ptr<NavierStokesAssemblerBase<dim>>>
741 std::shared_ptr<LevelsetGradientPostprocessor<dim>>
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 > ©_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 > ©_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 > ©_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
bool some_particles_are_coupled
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...
PVDHandler ib_particles_pvdhandler
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...
void load_particles_from_file()
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 > ©_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.
A solver class for the DEM used in conjunction with IB particles and fluid_dynamics_sharp....
GlobalVectorType system_rhs
SimulationParameters< dim > simulation_parameters
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....
unsigned int get_current_newton_iteration() const
Class responsible for storing the information calculated using the assembly of stabilized Tensor<1,...
@ 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::string > dataset_names
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