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 BoundaryConvectiveHeating
84  {
85  template <int dim> class Manager;
86  template <int dim> class Interface;
87  }
88 
89  namespace BoundaryComposition
90  {
91  template <int dim> class Manager;
92  template <int dim> class Interface;
93  }
94 
95  namespace BoundaryTraction
96  {
97  template <int dim> class Manager;
98  template <int dim> class Interface;
99  }
100 
101  namespace BoundaryVelocity
102  {
103  template <int dim> class Manager;
104  template <int dim> class Interface;
105  }
106 
107  namespace InitialComposition
108  {
109  template <int dim> class Manager;
110  template <int dim> class Interface;
111  }
112 
113  namespace InitialTopographyModel
114  {
115  template <int dim> class Interface;
116  }
117 
118  namespace MeshRefinement
119  {
120  template <int dim> class Manager;
121  }
122 
123  namespace AdiabaticConditions
124  {
125  template <int dim> class Interface;
126  }
127 
128  namespace Postprocess
129  {
130  template <int dim> class Manager;
131  }
132 
133  template <int dim> class MeltHandler;
134  template <int dim> class VolumeOfFluidHandler;
135 
136  namespace MeshDeformation
137  {
138  template <int dim> class MeshDeformationHandler;
139  }
140 
141  template <int dim> class NewtonHandler;
142 
143  template <int dim> class StokesMatrixFreeHandler;
144 
145  namespace Particle
146  {
147  template <int dim> class Manager;
148  }
149 
150  namespace TimeStepping
151  {
152  template <int dim> class Manager;
153  }
154 
204  template <int dim>
205  class SimulatorAccess
206  {
207  public:
214  SimulatorAccess ();
215 
220  SimulatorAccess (const Simulator<dim> &simulator_object);
221 
226  virtual ~SimulatorAccess () = default;
227 
237  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
238 
249  const Introspection<dim> &
250  introspection () const;
251 
259  const Simulator<dim> &
260  get_simulator () const;
261 
266  const Parameters<dim> &
267  get_parameters () const;
268 
273  get_signals() const;
274 
278  MPI_Comm
279  get_mpi_communicator () const;
280 
287  TimerOutput &
288  get_computing_timer () const;
289 
295  const ConditionalOStream &
296  get_pcout () const;
297 
301  double get_time () const;
302 
306  double
307  get_timestep () const;
308 
312  double
313  get_old_timestep () const;
314 
318  unsigned int
319  get_timestep_number () const;
320 
327  get_timestepping_manager() const;
328 
332  unsigned int
333  get_nonlinear_iteration () const;
334 
339  const parallel::distributed::Triangulation<dim> &
340  get_triangulation () const;
341 
345  double
346  get_volume () const;
347 
352  const Mapping<dim> &
353  get_mapping () const;
354 
360  std::string
361  get_output_directory () const;
362 
366  bool
367  include_adiabatic_heating () const;
368 
372  bool
373  include_latent_heat () const;
374 
378  bool
379  include_melt_transport () const;
380 
384  int
385  get_stokes_velocity_degree () const;
386 
390  double
391  get_adiabatic_surface_temperature () const;
392 
396  double
397  get_surface_pressure () const;
398 
404  bool
405  convert_output_to_years () const;
406 
416  unsigned int
417  get_pre_refinement_step () const;
418 
423  unsigned int
424  n_compositional_fields () const;
425 
429  double
430  get_end_time () const;
431 
438  void
439  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
440 
451  void
452  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
453  const bool skip_interior_cells = false) const;
454 
459  void
460  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
461  const unsigned int compositional_variable) const;
480  get_current_linearization_point () const;
481 
493  get_solution () const;
494 
504  get_old_solution () const;
505 
515  get_old_old_solution () const;
516 
525  get_reaction_vector () const;
526 
535  get_mesh_velocity () const;
536 
541  const DoFHandler<dim> &
542  get_dof_handler () const;
543 
552  const FiniteElement<dim> &
553  get_fe () const;
554 
559  get_system_matrix () const;
560 
565  get_system_preconditioner_matrix () const;
566 
578  get_material_model () const;
579 
584  get_gravity_model () const;
585 
590  get_initial_topography_model () const;
591 
597  const std::shared_ptr<const InitialTopographyModel::Interface<dim>>
598  get_initial_topography_model_pointer () const;
599 
604  get_geometry_model () const;
605 
606 
612  get_adiabatic_conditions () const;
613 
622  bool has_boundary_temperature () const;
623 
631  get_boundary_temperature_manager () const;
632 
640  get_boundary_convective_heating_manager () const;
641 
647  get_boundary_heat_flux () const;
648 
656  bool has_boundary_composition () const;
657 
665  get_boundary_composition_manager () const;
666 
674  get_boundary_traction_manager () const;
675 
702  std::shared_ptr<const InitialTemperature::Manager<dim>>
703  get_initial_temperature_manager_pointer () const;
704 
720  get_initial_temperature_manager () const;
721 
747  std::shared_ptr<const InitialComposition::Manager<dim>>
748  get_initial_composition_manager_pointer () const;
749 
765  get_initial_composition_manager () const;
766 
771  const std::set<types::boundary_id> &
772  get_fixed_temperature_boundary_indicators () const;
773 
778  const std::set<types::boundary_id> &
779  get_fixed_heat_flux_boundary_indicators () const;
780 
785  const std::set<types::boundary_id> &
786  get_fixed_convective_heating_boundary_indicators () const;
787 
792  const std::set<types::boundary_id> &
793  get_fixed_composition_boundary_indicators () const;
794 
801  const std::set<types::boundary_id> &
802  get_mesh_deformation_boundary_indicators () const;
803 
811  get_boundary_velocity_manager () const;
812 
819  get_heating_model_manager () const;
820 
828  get_mesh_refinement_manager () const;
829 
833  const MeltHandler<dim> &
834  get_melt_handler () const;
835 
840  get_volume_of_fluid_handler () const;
841 
846  const NewtonHandler<dim> &
847  get_newton_handler () const;
848 
849 #ifdef ASPECT_WITH_WORLD_BUILDER
850 
866  const WorldBuilder::World &
867  get_world_builder () const;
868 
878  std::shared_ptr<const WorldBuilder::World>
879  get_world_builder_pointer () const;
880 #endif
881 
886  get_mesh_deformation_handler () const;
887 
893  const LateralAveraging<dim> &
894  get_lateral_averaging () const;
895 
900  const AffineConstraints<double> &
901  get_current_constraints () const;
902 
935  bool simulator_is_past_initialization () const;
936 
941  double
942  get_pressure_scaling () const;
943 
950  bool
951  pressure_rhs_needs_compatibility_modification() const;
952 
956  bool
957  model_has_prescribed_stokes_solution () const;
958 
964  static
965  void
966  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
967  const unsigned int q,
968  std::vector<double> &composition_values_at_q_point);
969 
981  TableHandler &get_statistics_object() const;
982 
987  get_postprocess_manager () const;
988 
992  unsigned int
993  n_particle_managers() const;
994 
999  const Particle::Manager<dim> &
1000  get_particle_manager(const unsigned int particle_manager_index) const;
1001 
1009  get_particle_manager(const unsigned int particle_manager_index);
1010 
1014  bool is_stokes_matrix_free();
1015 
1021  get_stokes_matrix_free () const;
1022 
1035  compute_net_angular_momentum(const bool use_constant_density,
1036  const LinearAlgebra::BlockVector &solution,
1037  const bool limit_to_top_faces = false) const;
1038 
1048  void remove_nullspace(LinearAlgebra::BlockVector &solution,
1049  LinearAlgebra::BlockVector &distributed_stokes_solution) const;
1050 
1063  double normalize_pressure(LinearAlgebra::BlockVector &vector) const;
1064 
1075  void denormalize_pressure(const double pressure_adjustment,
1076  LinearAlgebra::BlockVector &vector) const;
1077 
1080  private:
1085  };
1086 }
1087 
1088 
1089 #endif
const Simulator< dim > * simulator
::TrilinosWrappers::MPI::BlockVector BlockVector
Definition: global.h:269
::TrilinosWrappers::BlockSparseMatrix BlockSparseMatrix
Definition: global.h:280
Manager< dim > World
Definition: world.h:39