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  using namespace dealii;
46 
47  // forward declarations:
48  template <int dim> class Simulator;
49  template <int dim> struct SimulatorSignals;
50  template <int dim> class LateralAveraging;
51  template <int dim> struct RotationProperties;
52 
53  namespace GravityModel
54  {
55  template <int dim> class Interface;
56  }
57 
58  namespace HeatingModel
59  {
60  template <int dim> class Manager;
61  }
62 
63  namespace MaterialModel
64  {
65  template <int dim> class Interface;
66  }
67 
68  namespace InitialTemperature
69  {
70  template <int dim> class Manager;
71  template <int dim> class Interface;
72  }
73 
74  namespace BoundaryTemperature
75  {
76  template <int dim> class Manager;
77  template <int dim> class Interface;
78  }
79 
80  namespace BoundaryHeatFlux
81  {
82  template <int dim> class Interface;
83  }
84 
85  namespace BoundaryComposition
86  {
87  template <int dim> class Manager;
88  template <int dim> class Interface;
89  }
90 
91  namespace BoundaryTraction
92  {
93  template <int dim> class Manager;
94  template <int dim> class Interface;
95  }
96 
97  namespace BoundaryVelocity
98  {
99  template <int dim> class Manager;
100  template <int dim> class Interface;
101  }
102 
103  namespace InitialComposition
104  {
105  template <int dim> class Manager;
106  template <int dim> class Interface;
107  }
108 
109  namespace InitialTopographyModel
110  {
111  template <int dim> class Interface;
112  }
113 
114  namespace MeshRefinement
115  {
116  template <int dim> class Manager;
117  }
118 
119  namespace AdiabaticConditions
120  {
121  template <int dim> class Interface;
122  }
123 
124  namespace Postprocess
125  {
126  template <int dim> class Manager;
127  }
128 
129  template <int dim> class MeltHandler;
130  template <int dim> class VolumeOfFluidHandler;
131 
132  namespace MeshDeformation
133  {
134  template <int dim> class MeshDeformationHandler;
135  }
136 
137  template <int dim> class NewtonHandler;
138 
139  template <int dim> class StokesMatrixFreeHandler;
140 
141  namespace Particle
142  {
143  template <int dim> class Manager;
144  }
145 
146  namespace TimeStepping
147  {
148  template <int dim> class Manager;
149  }
150 
172  template <int dim>
173  class SimulatorAccess
174  {
175  public:
182  SimulatorAccess ();
183 
188  SimulatorAccess (const Simulator<dim> &simulator_object);
189 
194  virtual ~SimulatorAccess () = default;
195 
205  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
206 
217  const Introspection<dim> &
218  introspection () const;
219 
227  const Simulator<dim> &
228  get_simulator () const;
229 
234  const Parameters<dim> &
235  get_parameters () const;
236 
241  get_signals() const;
242 
246  MPI_Comm
247  get_mpi_communicator () const;
248 
255  TimerOutput &
256  get_computing_timer () const;
257 
263  const ConditionalOStream &
264  get_pcout () const;
265 
269  double get_time () const;
270 
274  double
275  get_timestep () const;
276 
280  double
281  get_old_timestep () const;
282 
286  unsigned int
287  get_timestep_number () const;
288 
295  get_timestepping_manager() const;
296 
300  unsigned int
301  get_nonlinear_iteration () const;
302 
307  const parallel::distributed::Triangulation<dim> &
308  get_triangulation () const;
309 
313  double
314  get_volume () const;
315 
320  const Mapping<dim> &
321  get_mapping () const;
322 
328  std::string
329  get_output_directory () const;
330 
334  bool
335  include_adiabatic_heating () const;
336 
340  bool
341  include_latent_heat () const;
342 
346  bool
347  include_melt_transport () const;
348 
352  int
353  get_stokes_velocity_degree () const;
354 
358  double
359  get_adiabatic_surface_temperature () const;
360 
364  double
365  get_surface_pressure () const;
366 
372  bool
373  convert_output_to_years () const;
374 
384  unsigned int
385  get_pre_refinement_step () const;
386 
391  unsigned int
392  n_compositional_fields () const;
393 
397  double
398  get_end_time () const;
399 
406  void
407  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
408 
419  void
420  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
421  const bool skip_interior_cells = false) const;
422 
427  void
428  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
429  const unsigned int compositional_variable) const;
448  get_current_linearization_point () const;
449 
461  get_solution () const;
462 
472  get_old_solution () const;
473 
483  get_old_old_solution () const;
484 
493  get_reaction_vector () const;
494 
503  get_mesh_velocity () const;
504 
509  const DoFHandler<dim> &
510  get_dof_handler () const;
511 
520  const FiniteElement<dim> &
521  get_fe () const;
522 
527  get_system_matrix () const;
528 
533  get_system_preconditioner_matrix () const;
534 
546  get_material_model () const;
547 
552  get_gravity_model () const;
553 
558  get_initial_topography_model () const;
559 
564  get_geometry_model () const;
565 
566 
572  get_adiabatic_conditions () const;
573 
582  bool has_boundary_temperature () const;
583 
591  get_boundary_temperature_manager () const;
592 
598  get_boundary_heat_flux () const;
599 
607  bool has_boundary_composition () const;
608 
616  get_boundary_composition_manager () const;
617 
625  get_boundary_traction_manager () const;
626 
653  std::shared_ptr<const InitialTemperature::Manager<dim>>
654  get_initial_temperature_manager_pointer () const;
655 
671  get_initial_temperature_manager () const;
672 
698  std::shared_ptr<const InitialComposition::Manager<dim>>
699  get_initial_composition_manager_pointer () const;
700 
716  get_initial_composition_manager () const;
717 
722  const std::set<types::boundary_id> &
723  get_fixed_temperature_boundary_indicators () const;
724 
729  const std::set<types::boundary_id> &
730  get_fixed_heat_flux_boundary_indicators () const;
731 
736  const std::set<types::boundary_id> &
737  get_fixed_composition_boundary_indicators () const;
738 
745  const std::set<types::boundary_id> &
746  get_mesh_deformation_boundary_indicators () const;
747 
755  get_boundary_velocity_manager () const;
756 
763  get_heating_model_manager () const;
764 
772  get_mesh_refinement_manager () const;
773 
777  const MeltHandler<dim> &
778  get_melt_handler () const;
779 
784  get_volume_of_fluid_handler () const;
785 
790  const NewtonHandler<dim> &
791  get_newton_handler () const;
792 
793 #ifdef ASPECT_WITH_WORLD_BUILDER
794 
810  const WorldBuilder::World &
811  get_world_builder () const;
812 
822  std::shared_ptr<const WorldBuilder::World>
823  get_world_builder_pointer () const;
824 #endif
825 
830  get_mesh_deformation_handler () const;
831 
837  const LateralAveraging<dim> &
838  get_lateral_averaging () const;
839 
844  const AffineConstraints<double> &
845  get_current_constraints () const;
846 
879  bool simulator_is_past_initialization () const;
880 
885  double
886  get_pressure_scaling () const;
887 
894  bool
895  pressure_rhs_needs_compatibility_modification() const;
896 
900  bool
901  model_has_prescribed_stokes_solution () const;
902 
908  static
909  void
910  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
911  const unsigned int q,
912  std::vector<double> &composition_values_at_q_point);
913 
925  TableHandler &get_statistics_object() const;
926 
931  get_postprocess_manager () const;
932 
936  unsigned int
937  n_particle_managers() const;
938 
943  const Particle::Manager<dim> &
944  get_particle_manager(const unsigned int particle_manager_index) const;
945 
953  get_particle_manager(const unsigned int particle_manager_index);
954 
958  bool is_stokes_matrix_free();
959 
965  get_stokes_matrix_free () const;
966 
979  compute_net_angular_momentum(const bool use_constant_density,
980  const LinearAlgebra::BlockVector &solution,
981  const bool limit_to_top_faces = false) const;
982 
985  private:
990  };
991 }
992 
993 
994 #endif
const Simulator< dim > * simulator
::TrilinosWrappers::MPI::BlockVector BlockVector
Definition: global.h:262
::TrilinosWrappers::BlockSparseMatrix BlockSparseMatrix
Definition: global.h:273
Manager< dim > World
Definition: world.h:39
Definition: compat.h:59
Definition: compat.h:42