ASPECT
|
Classes | |
struct | ParticleLoadBalancing |
Public Member Functions | |
Manager () | |
~Manager () override | |
Manager (Manager &&) noexcept | |
void | initialize () |
void | update () |
const Property::Manager< dim > & | get_property_manager () const |
const Particles::ParticleHandler< dim > & | get_particle_handler () const |
Particles::ParticleHandler< dim > & | get_particle_handler () |
void | copy_particle_handler (const Particles::ParticleHandler< dim > &from_particle_handler, Particles::ParticleHandler< dim > &to_particle_handler) const |
void | backup_particles () |
Stores a copy of the particle handler in particle_handler_backup. This copy can be used to restore the position and properties of the particles for example after advection solver iterations of the iterated advection scheme or when a timestep has to be repeated. More... | |
void | restore_particles () |
Restores the particle handler particle_handler based on the copy in particle_handler_backup. This restores the position and properties of the particles to those in the copy and can be used for example after advection solver iterations of the iterated advection scheme or when a timestep has to be repeated. More... | |
void | setup_initial_state () |
const Interpolator::Interface< dim > & | get_interpolator () const |
void | generate_particles () |
void | initialize_particles () |
void | advance_timestep () |
types::particle_index | n_global_particles () const |
void | connect_to_signals (aspect::SimulatorSignals< dim > &signals) |
unsigned int | cell_weight (const typename parallel::distributed::Triangulation< dim >::cell_iterator &cell, const typename parallel::distributed::Triangulation< dim >::CellStatus status) |
void | update_particles () |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
virtual void | save (std::ostringstream &os) const |
virtual void | load (std::istringstream &is) |
virtual void | parse_parameters (ParameterHandler &prm, const unsigned int particle_manager) |
Public Member Functions inherited from aspect::SimulatorAccess< dim > | |
SimulatorAccess () | |
SimulatorAccess (const Simulator< dim > &simulator_object) | |
virtual | ~SimulatorAccess ()=default |
virtual void | initialize_simulator (const Simulator< dim > &simulator_object) |
const Introspection< dim > & | introspection () const |
const Simulator< dim > & | get_simulator () const |
const Parameters< dim > & | get_parameters () const |
SimulatorSignals< dim > & | get_signals () const |
MPI_Comm | get_mpi_communicator () const |
TimerOutput & | get_computing_timer () const |
const ConditionalOStream & | get_pcout () const |
double | get_time () const |
double | get_timestep () const |
double | get_old_timestep () const |
unsigned int | get_timestep_number () const |
const TimeStepping::Manager< dim > & | get_timestepping_manager () const |
unsigned int | get_nonlinear_iteration () const |
const parallel::distributed::Triangulation< dim > & | get_triangulation () const |
double | get_volume () const |
const Mapping< dim > & | get_mapping () const |
std::string | get_output_directory () const |
bool | include_adiabatic_heating () const |
bool | include_latent_heat () const |
bool | include_melt_transport () const |
int | get_stokes_velocity_degree () const |
double | get_adiabatic_surface_temperature () const |
double | get_surface_pressure () const |
bool | convert_output_to_years () const |
unsigned int | get_pre_refinement_step () const |
unsigned int | n_compositional_fields () const |
double | get_end_time () const |
void | get_refinement_criteria (Vector< float > &estimated_error_per_cell) const |
void | get_artificial_viscosity (Vector< float > &viscosity_per_cell, const bool skip_interior_cells=false) const |
void | get_artificial_viscosity_composition (Vector< float > &viscosity_per_cell, const unsigned int compositional_variable) const |
const LinearAlgebra::BlockVector & | get_current_linearization_point () const |
const LinearAlgebra::BlockVector & | get_solution () const |
const LinearAlgebra::BlockVector & | get_old_solution () const |
const LinearAlgebra::BlockVector & | get_old_old_solution () const |
const LinearAlgebra::BlockVector & | get_reaction_vector () const |
const LinearAlgebra::BlockVector & | get_mesh_velocity () const |
const DoFHandler< dim > & | get_dof_handler () const |
const FiniteElement< dim > & | get_fe () const |
const LinearAlgebra::BlockSparseMatrix & | get_system_matrix () const |
const LinearAlgebra::BlockSparseMatrix & | get_system_preconditioner_matrix () const |
const MaterialModel::Interface< dim > & | get_material_model () const |
const GravityModel::Interface< dim > & | get_gravity_model () const |
const InitialTopographyModel::Interface< dim > & | get_initial_topography_model () const |
const GeometryModel::Interface< dim > & | get_geometry_model () const |
const AdiabaticConditions::Interface< dim > & | get_adiabatic_conditions () const |
bool | has_boundary_temperature () const |
const BoundaryTemperature::Manager< dim > & | get_boundary_temperature_manager () const |
const BoundaryHeatFlux::Interface< dim > & | get_boundary_heat_flux () const |
bool | has_boundary_composition () const |
const BoundaryComposition::Manager< dim > & | get_boundary_composition_manager () const |
const BoundaryTraction::Manager< dim > & | get_boundary_traction_manager () const |
std::shared_ptr< const InitialTemperature::Manager< dim > > | get_initial_temperature_manager_pointer () const |
const InitialTemperature::Manager< dim > & | get_initial_temperature_manager () const |
std::shared_ptr< const InitialComposition::Manager< dim > > | get_initial_composition_manager_pointer () const |
const InitialComposition::Manager< dim > & | get_initial_composition_manager () const |
const std::set< types::boundary_id > & | get_fixed_temperature_boundary_indicators () const |
const std::set< types::boundary_id > & | get_fixed_heat_flux_boundary_indicators () const |
const std::set< types::boundary_id > & | get_fixed_composition_boundary_indicators () const |
const std::set< types::boundary_id > & | get_mesh_deformation_boundary_indicators () const |
const BoundaryVelocity::Manager< dim > & | get_boundary_velocity_manager () const |
const HeatingModel::Manager< dim > & | get_heating_model_manager () const |
const MeshRefinement::Manager< dim > & | get_mesh_refinement_manager () const |
const MeltHandler< dim > & | get_melt_handler () const |
const VolumeOfFluidHandler< dim > & | get_volume_of_fluid_handler () const |
const NewtonHandler< dim > & | get_newton_handler () const |
const MeshDeformation::MeshDeformationHandler< dim > & | get_mesh_deformation_handler () const |
const LateralAveraging< dim > & | get_lateral_averaging () const |
const AffineConstraints< double > & | get_current_constraints () const |
bool | simulator_is_past_initialization () const |
double | get_pressure_scaling () const |
bool | pressure_rhs_needs_compatibility_modification () const |
bool | model_has_prescribed_stokes_solution () const |
TableHandler & | get_statistics_object () const |
const Postprocess::Manager< dim > & | get_postprocess_manager () const |
unsigned int | n_particle_managers () const |
const Particle::Manager< dim > & | get_particle_manager (const unsigned int particle_manager_index) const |
Particle::Manager< dim > & | get_particle_manager (const unsigned int particle_manager_index) |
bool | is_stokes_matrix_free () |
const StokesMatrixFreeHandler< dim > & | get_stokes_matrix_free () const |
RotationProperties< dim > | compute_net_angular_momentum (const bool use_constant_density, const LinearAlgebra::BlockVector &solution, const bool limit_to_top_faces=false) const |
Static Public Member Functions | |
static void | declare_parameters (ParameterHandler &prm) |
Static Public Member Functions inherited from aspect::SimulatorAccess< dim > | |
static void | get_composition_values_at_q_point (const std::vector< std::vector< double >> &composition_values, const unsigned int q, std::vector< double > &composition_values_at_q_point) |
Private Member Functions | |
std::map< types::subdomain_id, unsigned int > | get_subdomain_id_to_neighbor_map () const |
void | apply_particle_per_cell_bounds () |
void | advect_particles () |
void | local_initialize_particles (const typename ParticleHandler< dim >::particle_iterator &begin_particle, const typename ParticleHandler< dim >::particle_iterator &end_particle) |
void | local_update_particles (Property::ParticleUpdateInputs< dim > &inputs, small_vector< Point< dim >> &positions, const std::vector< EvaluationFlags::EvaluationFlags > &evaluation_flags, SolutionEvaluator< dim > &evaluator) |
void | local_advect_particles (const typename DoFHandler< dim >::active_cell_iterator &cell, const typename ParticleHandler< dim >::particle_iterator &begin_particle, const typename ParticleHandler< dim >::particle_iterator &end_particle, SolutionEvaluator< dim > &evaluators) |
void | connect_particle_handler_signals (aspect::SimulatorSignals< dim > &signals, ParticleHandler< dim > &particle_handler, const bool connect_to_checkpoint_signals=true) const |
Private Attributes | |
std::unique_ptr< Generator::Interface< dim > > | generator |
std::unique_ptr< Integrator::Interface< dim > > | integrator |
std::unique_ptr< Interpolator::Interface< dim > > | interpolator |
std::unique_ptr< Particles::ParticleHandler< dim > > | particle_handler |
Particles::ParticleHandler< dim > | particle_handler_backup |
std::unique_ptr< Property::Manager< dim > > | property_manager |
ParticleLoadBalancing::Kind | particle_load_balancing |
unsigned int | min_particles_per_cell |
unsigned int | max_particles_per_cell |
unsigned int | particle_weight |
This class manages the storage and handling of particles. It provides interfaces to generate and store particles, functions to initialize, update and advect them, and ways to retrieve information about the particles. The implementation of most of these methods is outsourced to different plugin systems, this class is mostly concerned with managing the interactions of the different systems with the code outside the particle manager.
Definition at line 143 of file simulator_access.h.
aspect::Particle::Manager< dim >::Manager | ( | ) |
Default constructor.
|
override |
Default destructor.
|
noexcept |
Move constructor. This is required to be able to put instances of this class into a std::vector.
void aspect::Particle::Manager< dim >::initialize | ( | ) |
Initialize the particle manager.
void aspect::Particle::Manager< dim >::update | ( | ) |
Update the particle manager.
const Property::Manager<dim>& aspect::Particle::Manager< dim >::get_property_manager | ( | ) | const |
Get the particle property manager for this particle manager.
const Particles::ParticleHandler<dim>& aspect::Particle::Manager< dim >::get_particle_handler | ( | ) | const |
Get the const particle handler for this particle manager.
Particles::ParticleHandler<dim>& aspect::Particle::Manager< dim >::get_particle_handler | ( | ) |
Get the particle handler for this particle manager. There is no get_particles() function in the deal.II ParticleHandler, so we get and set the positions of the particles. These getter/setter functions are not const, and neither are the calling functions, but the existing get_particle_handler is. Therefore this non-const function is added.
void aspect::Particle::Manager< dim >::copy_particle_handler | ( | const Particles::ParticleHandler< dim > & | from_particle_handler, |
Particles::ParticleHandler< dim > & | to_particle_handler | ||
) | const |
Copy the state of particle handler from_particle_handler
into the particle handler to_particle_handler
. This will copy all particles and properties and leave to_particle_handler
as an identical copy of from_particle_handler
, assuming it was set up by this particle manager class. This means we assume from_particle_handler
uses the same triangulation and particle properties as are used in this model. Existing particles in to_particle_handler
are deleted.
This function is expensive as it has to duplicate all data in from_particle_handler
, and insert it into to_particle_handler
, which may be a significant amount of data. However, it can be useful to save the state of a particle collection at a certain point in time and reset this state later under certain conditions, for example if a timestep has to be undone and repeated.
void aspect::Particle::Manager< dim >::backup_particles | ( | ) |
Stores a copy of the particle handler in particle_handler_backup. This copy can be used to restore the position and properties of the particles for example after advection solver iterations of the iterated advection scheme or when a timestep has to be repeated.
void aspect::Particle::Manager< dim >::restore_particles | ( | ) |
Restores the particle handler particle_handler based on the copy in particle_handler_backup. This restores the position and properties of the particles to those in the copy and can be used for example after advection solver iterations of the iterated advection scheme or when a timestep has to be repeated.
void aspect::Particle::Manager< dim >::setup_initial_state | ( | ) |
Do initial logic for handling pre-refinement steps
const Interpolator::Interface<dim>& aspect::Particle::Manager< dim >::get_interpolator | ( | ) | const |
Get the particle interpolator for this particle manager.
void aspect::Particle::Manager< dim >::generate_particles | ( | ) |
Initialize the particle properties.
void aspect::Particle::Manager< dim >::initialize_particles | ( | ) |
Initialize the particle properties.
void aspect::Particle::Manager< dim >::advance_timestep | ( | ) |
Advance particles by the old timestep using the current integration scheme. This accounts for the fact that the particles are actually still at their old positions and the current timestep length is already updated for the next step at the time this function is called.
types::particle_index aspect::Particle::Manager< dim >::n_global_particles | ( | ) | const |
Return the total number of particles in the simulation. This function is useful for monitoring how many particles have been lost by falling out of the domain. Note that this function does not compute the number of particles, because that is an expensive global MPI operation. Instead it returns the number, which is updated internally every time it might change by a call to update_n_global_particles().
void aspect::Particle::Manager< dim >::connect_to_signals | ( | aspect::SimulatorSignals< dim > & | signals | ) |
This callback function is registered within Simulator by the constructor of this class and will be called from Simulator during construction. It allows to attach slot functions to the provided SimulatorSignals. This particle manager will register the register_store_callback_function() and register_load_callback_function() to the pre_refinement_store_user_data signal and the post_refinement_load_user_data signal respectively.
unsigned int aspect::Particle::Manager< dim >::cell_weight | ( | const typename parallel::distributed::Triangulation< dim >::cell_iterator & | cell, |
const typename parallel::distributed::Triangulation< dim >::CellStatus | status | ||
) |
Called by listener functions from Triangulation for every cell before a refinement step. A weight is attached to every cell depending on the number of contained particles.
void aspect::Particle::Manager< dim >::update_particles | ( | ) |
Update the particle properties if necessary.
void aspect::Particle::Manager< dim >::serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
|
virtual |
Save the state of the object.
|
virtual |
Restore the state of the object.
|
static |
Declare the parameters this class takes through input files.
|
virtual |
Read the parameters this class declares from the parameter file.
prm | The ParameterHandler. |
particle_manager | Parse the parameters for the Particle manager with this index. |
|
private |
Get a map between subdomain id and the neighbor index. In other words the returned map answers the question: Given a subdomain id, which neighbor of the current processor's domain (in terms of a contiguous number from 0 to n_neighbors) owns this subdomain?
|
private |
Apply the bounds for the maximum and minimum number of particles per cell, if the appropriate particle_load_balancing
strategy has been selected.
|
private |
Advect the particle positions by one integration step. Needs to be called until integrator->continue() returns false.
|
private |
Initialize the particle properties of one cell.
|
private |
Update the particle properties of one cell.
inputs | The input data required for the particle update. This function will fill this structure with the necessary data. |
positions | The reference positions of the particles in the cell. This function will update these positions for the current cell. |
evaluation_flags | The required evaluation flags for each component. |
evaluator | The solution evaluator that is used to update the particles. |
|
private |
Advect the particles of one cell. Performs only one step for multi-step integrators. Needs to be called until integrator->continue() evaluates to false. Particles that moved out of their old cell during this advection step are removed from the local multimap and stored in particles_out_of_cell
for further treatment (sorting them into the new cell).
|
private |
This function registers the necessary functions to the signals
that the particle_handler
needs to know about.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Lower limit for particle number per cell. This limit is useful for adaptive meshes to prevent fine cells from being empty of particles. It will be checked and enforced after mesh refinement and after particle movement. If there are n_number_of_particles < min_particles_per_cell particles in one cell then min_particles_per_cell - n_number_of_particles particles are generated and randomly placed in this cell. If the particles carry properties the individual property plugins control how the properties of the new particles are initialized.
|
private |
Upper limit for particle number per cell. This limit is useful for adaptive meshes to prevent coarse cells from slowing down the whole model. It will be checked and enforced after mesh refinement, after MPI transfer of particles and after particle movement. If there are n_number_of_particles > max_particles_per_cell particles in one cell then n_number_of_particles - max_particles_per_cell particles in this cell are randomly chosen and destroyed.
|
private |
The computational cost of a single particle. This is an input parameter that is set during initialization and is only used if the particle load balancing strategy 'repartition' is used. This value determines how costly the computation of a single particle is compared to the computation of a whole cell, which is arbitrarily defined to represent a cost of 1000.