ASPECT
simulator_access.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2024 by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef _aspect_simulator_access_h
23 #define _aspect_simulator_access_h
24 
25 #include <aspect/global.h>
26 #include <aspect/parameters.h>
27 #include <aspect/introspection.h>
28 
29 #include <deal.II/base/table_handler.h>
30 #include <deal.II/base/timer.h>
31 #include <deal.II/base/conditional_ostream.h>
32 #include <deal.II/distributed/tria.h>
33 #include <deal.II/dofs/dof_handler.h>
34 #include <deal.II/fe/fe.h>
35 #include <deal.II/fe/mapping_q.h>
36 #include <deal.II/lac/affine_constraints.h>
37 
38 namespace WorldBuilder
39 {
40  class World;
41 }
42 
43 namespace aspect
44 {
45  // forward declarations:
46  template <int dim> class Simulator;
47  template <int dim> struct SimulatorSignals;
48  template <int dim> class LateralAveraging;
49  template <int dim> struct RotationProperties;
50 
51  namespace GravityModel
52  {
53  template <int dim> class Interface;
54  }
55 
56  namespace HeatingModel
57  {
58  template <int dim> class Manager;
59  }
60 
61  namespace MaterialModel
62  {
63  template <int dim> class Interface;
64  }
65 
66  namespace InitialTemperature
67  {
68  template <int dim> class Manager;
69  template <int dim> class Interface;
70  }
71 
72  namespace BoundaryTemperature
73  {
74  template <int dim> class Manager;
75  template <int dim> class Interface;
76  }
77 
78  namespace BoundaryHeatFlux
79  {
80  template <int dim> class Interface;
81  }
82 
83  namespace BoundaryComposition
84  {
85  template <int dim> class Manager;
86  template <int dim> class Interface;
87  }
88 
89  namespace BoundaryTraction
90  {
91  template <int dim> class Manager;
92  template <int dim> class Interface;
93  }
94 
95  namespace BoundaryVelocity
96  {
97  template <int dim> class Manager;
98  template <int dim> class Interface;
99  }
100 
101  namespace InitialComposition
102  {
103  template <int dim> class Manager;
104  template <int dim> class Interface;
105  }
106 
107  namespace InitialTopographyModel
108  {
109  template <int dim> class Interface;
110  }
111 
112  namespace MeshRefinement
113  {
114  template <int dim> class Manager;
115  }
116 
117  namespace AdiabaticConditions
118  {
119  template <int dim> class Interface;
120  }
121 
122  namespace Postprocess
123  {
124  template <int dim> class Manager;
125  }
126 
127  template <int dim> class MeltHandler;
128  template <int dim> class VolumeOfFluidHandler;
129 
130  namespace MeshDeformation
131  {
132  template <int dim> class MeshDeformationHandler;
133  }
134 
135  template <int dim> class NewtonHandler;
136 
137  template <int dim> class StokesMatrixFreeHandler;
138 
139  namespace Particle
140  {
141  template <int dim> class Manager;
142  }
143 
144  namespace TimeStepping
145  {
146  template <int dim> class Manager;
147  }
148 
170  template <int dim>
171  class SimulatorAccess
172  {
173  public:
180  SimulatorAccess ();
181 
186  SimulatorAccess (const Simulator<dim> &simulator_object);
187 
192  virtual ~SimulatorAccess () = default;
193 
203  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
204 
215  const Introspection<dim> &
216  introspection () const;
217 
225  const Simulator<dim> &
226  get_simulator () const;
227 
232  const Parameters<dim> &
233  get_parameters () const;
234 
239  get_signals() const;
240 
244  MPI_Comm
245  get_mpi_communicator () const;
246 
253  TimerOutput &
254  get_computing_timer () const;
255 
261  const ConditionalOStream &
262  get_pcout () const;
263 
267  double get_time () const;
268 
272  double
273  get_timestep () const;
274 
278  double
279  get_old_timestep () const;
280 
284  unsigned int
285  get_timestep_number () const;
286 
293  get_timestepping_manager() const;
294 
298  unsigned int
299  get_nonlinear_iteration () const;
300 
305  const parallel::distributed::Triangulation<dim> &
306  get_triangulation () const;
307 
311  double
312  get_volume () const;
313 
318  const Mapping<dim> &
319  get_mapping () const;
320 
326  std::string
327  get_output_directory () const;
328 
332  bool
333  include_adiabatic_heating () const;
334 
338  bool
339  include_latent_heat () const;
340 
344  bool
345  include_melt_transport () const;
346 
350  int
351  get_stokes_velocity_degree () const;
352 
356  double
357  get_adiabatic_surface_temperature () const;
358 
362  double
363  get_surface_pressure () const;
364 
370  bool
371  convert_output_to_years () const;
372 
382  unsigned int
383  get_pre_refinement_step () const;
384 
389  unsigned int
390  n_compositional_fields () const;
391 
395  double
396  get_end_time () const;
397 
404  void
405  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
406 
417  void
418  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
419  const bool skip_interior_cells = false) const;
420 
425  void
426  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
427  const unsigned int compositional_variable) const;
446  get_current_linearization_point () const;
447 
459  get_solution () const;
460 
470  get_old_solution () const;
471 
481  get_old_old_solution () const;
482 
491  get_reaction_vector () const;
492 
501  get_mesh_velocity () const;
502 
507  const DoFHandler<dim> &
508  get_dof_handler () const;
509 
518  const FiniteElement<dim> &
519  get_fe () const;
520 
525  get_system_matrix () const;
526 
531  get_system_preconditioner_matrix () const;
532 
544  get_material_model () const;
545 
550  get_gravity_model () const;
551 
556  get_initial_topography_model () const;
557 
562  get_geometry_model () const;
563 
564 
570  get_adiabatic_conditions () const;
571 
580  bool has_boundary_temperature () const;
581 
589  get_boundary_temperature_manager () const;
590 
596  get_boundary_heat_flux () const;
597 
605  bool has_boundary_composition () const;
606 
614  get_boundary_composition_manager () const;
615 
623  get_boundary_traction_manager () const;
624 
651  std::shared_ptr<const InitialTemperature::Manager<dim>>
652  get_initial_temperature_manager_pointer () const;
653 
669  get_initial_temperature_manager () const;
670 
696  std::shared_ptr<const InitialComposition::Manager<dim>>
697  get_initial_composition_manager_pointer () const;
698 
714  get_initial_composition_manager () const;
715 
720  const std::set<types::boundary_id> &
721  get_fixed_temperature_boundary_indicators () const;
722 
727  const std::set<types::boundary_id> &
728  get_fixed_heat_flux_boundary_indicators () const;
729 
734  const std::set<types::boundary_id> &
735  get_fixed_composition_boundary_indicators () const;
736 
743  const std::set<types::boundary_id> &
744  get_mesh_deformation_boundary_indicators () const;
745 
753  get_boundary_velocity_manager () const;
754 
761  get_heating_model_manager () const;
762 
770  get_mesh_refinement_manager () const;
771 
775  const MeltHandler<dim> &
776  get_melt_handler () const;
777 
782  get_volume_of_fluid_handler () const;
783 
788  const NewtonHandler<dim> &
789  get_newton_handler () const;
790 
791 #ifdef ASPECT_WITH_WORLD_BUILDER
792 
808  const WorldBuilder::World &
809  get_world_builder () const;
810 
820  std::shared_ptr<const WorldBuilder::World>
821  get_world_builder_pointer () const;
822 #endif
823 
828  get_mesh_deformation_handler () const;
829 
835  const LateralAveraging<dim> &
836  get_lateral_averaging () const;
837 
842  const AffineConstraints<double> &
843  get_current_constraints () const;
844 
877  bool simulator_is_past_initialization () const;
878 
883  double
884  get_pressure_scaling () const;
885 
892  bool
893  pressure_rhs_needs_compatibility_modification() const;
894 
898  bool
899  model_has_prescribed_stokes_solution () const;
900 
906  static
907  void
908  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
909  const unsigned int q,
910  std::vector<double> &composition_values_at_q_point);
911 
923  TableHandler &get_statistics_object() const;
924 
929  get_postprocess_manager () const;
930 
934  unsigned int
935  n_particle_managers() const;
936 
941  const Particle::Manager<dim> &
942  get_particle_manager(const unsigned int particle_manager_index) const;
943 
951  get_particle_manager(const unsigned int particle_manager_index);
952 
956  bool is_stokes_matrix_free();
957 
963  get_stokes_matrix_free () const;
964 
977  compute_net_angular_momentum(const bool use_constant_density,
978  const LinearAlgebra::BlockVector &solution,
979  const bool limit_to_top_faces = false) const;
980 
983  private:
988  };
989 }
990 
991 
992 #endif
const Simulator< dim > * simulator
::TrilinosWrappers::MPI::BlockVector BlockVector
Definition: global.h:268
::TrilinosWrappers::BlockSparseMatrix BlockSparseMatrix
Definition: global.h:279
Manager< dim > World
Definition: world.h:39
Definition: compat.h:59