ASPECT
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
176  template <int dim>
177  class SimulatorAccess
178  {
179  public:
186  SimulatorAccess ();
187 
192  SimulatorAccess (const Simulator<dim> &simulator_object);
193 
198  virtual ~SimulatorAccess () = default;
199 
209  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
210 
221  const Introspection<dim> &
222  introspection () const;
223 
231  const Simulator<dim> &
232  get_simulator () const;
233 
238  const Parameters<dim> &
239  get_parameters () const;
240 
245  get_signals() const;
246 
250  MPI_Comm
251  get_mpi_communicator () const;
252 
259  TimerOutput &
260  get_computing_timer () const;
261 
267  const ConditionalOStream &
268  get_pcout () const;
269 
273  double get_time () const;
274 
278  double
279  get_timestep () const;
280 
284  double
285  get_old_timestep () const;
286 
290  unsigned int
291  get_timestep_number () const;
292 
299  get_timestepping_manager() const;
300 
304  unsigned int
305  get_nonlinear_iteration () const;
306 
311  const parallel::distributed::Triangulation<dim> &
312  get_triangulation () const;
313 
317  double
318  get_volume () const;
319 
324  const Mapping<dim> &
325  get_mapping () const;
326 
332  std::string
333  get_output_directory () const;
334 
338  bool
339  include_adiabatic_heating () const;
340 
344  bool
345  include_latent_heat () const;
346 
350  bool
351  include_melt_transport () const;
352 
356  int
357  get_stokes_velocity_degree () const;
358 
362  double
363  get_adiabatic_surface_temperature () const;
364 
368  double
369  get_surface_pressure () const;
370 
376  bool
377  convert_output_to_years () const;
378 
388  unsigned int
389  get_pre_refinement_step () const;
390 
395  unsigned int
396  n_compositional_fields () const;
397 
401  double
402  get_end_time () const;
403 
410  void
411  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
412 
423  void
424  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
425  const bool skip_interior_cells = false) const;
426 
431  void
432  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
433  const unsigned int compositional_variable) const;
452  get_current_linearization_point () const;
453 
465  get_solution () const;
466 
476  get_old_solution () const;
477 
487  get_old_old_solution () const;
488 
497  get_reaction_vector () const;
498 
507  get_mesh_velocity () const;
508 
513  const DoFHandler<dim> &
514  get_dof_handler () const;
515 
524  const FiniteElement<dim> &
525  get_fe () const;
526 
531  get_system_matrix () const;
532 
537  get_system_preconditioner_matrix () const;
538 
550  get_material_model () const;
551 
556  get_gravity_model () const;
557 
562  get_initial_topography_model () const;
563 
569  const std::shared_ptr<const InitialTopographyModel::Interface<dim>>
570  get_initial_topography_model_pointer () const;
571 
576  get_geometry_model () const;
577 
578 
584  get_adiabatic_conditions () const;
585 
594  bool has_boundary_temperature () const;
595 
603  get_boundary_temperature_manager () const;
604 
612  get_boundary_convective_heating_manager () const;
613 
619  get_boundary_heat_flux () const;
620 
628  bool has_boundary_composition () const;
629 
637  get_boundary_composition_manager () const;
638 
646  get_boundary_traction_manager () const;
647 
674  std::shared_ptr<const InitialTemperature::Manager<dim>>
675  get_initial_temperature_manager_pointer () const;
676 
692  get_initial_temperature_manager () const;
693 
719  std::shared_ptr<const InitialComposition::Manager<dim>>
720  get_initial_composition_manager_pointer () const;
721 
737  get_initial_composition_manager () const;
738 
743  const std::set<types::boundary_id> &
744  get_fixed_temperature_boundary_indicators () const;
745 
750  const std::set<types::boundary_id> &
751  get_fixed_heat_flux_boundary_indicators () const;
752 
757  const std::set<types::boundary_id> &
758  get_fixed_convective_heating_boundary_indicators () const;
759 
764  const std::set<types::boundary_id> &
765  get_fixed_composition_boundary_indicators () const;
766 
773  const std::set<types::boundary_id> &
774  get_mesh_deformation_boundary_indicators () const;
775 
783  get_boundary_velocity_manager () const;
784 
791  get_heating_model_manager () const;
792 
800  get_mesh_refinement_manager () const;
801 
805  const MeltHandler<dim> &
806  get_melt_handler () const;
807 
812  get_volume_of_fluid_handler () const;
813 
818  const NewtonHandler<dim> &
819  get_newton_handler () const;
820 
821 #ifdef ASPECT_WITH_WORLD_BUILDER
822 
838  const WorldBuilder::World &
839  get_world_builder () const;
840 
850  std::shared_ptr<const WorldBuilder::World>
851  get_world_builder_pointer () const;
852 #endif
853 
858  get_mesh_deformation_handler () const;
859 
865  const LateralAveraging<dim> &
866  get_lateral_averaging () const;
867 
872  const AffineConstraints<double> &
873  get_current_constraints () const;
874 
907  bool simulator_is_past_initialization () const;
908 
913  double
914  get_pressure_scaling () const;
915 
922  bool
923  pressure_rhs_needs_compatibility_modification() const;
924 
928  bool
929  model_has_prescribed_stokes_solution () const;
930 
936  static
937  void
938  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
939  const unsigned int q,
940  std::vector<double> &composition_values_at_q_point);
941 
953  TableHandler &get_statistics_object() const;
954 
959  get_postprocess_manager () const;
960 
964  unsigned int
965  n_particle_managers() const;
966 
971  const Particle::Manager<dim> &
972  get_particle_manager(const unsigned int particle_manager_index) const;
973 
981  get_particle_manager(const unsigned int particle_manager_index);
982 
986  bool is_stokes_matrix_free();
987 
993  get_stokes_matrix_free () const;
994 
1007  compute_net_angular_momentum(const bool use_constant_density,
1008  const LinearAlgebra::BlockVector &solution,
1009  const bool limit_to_top_faces = false) const;
1010 
1020  void remove_nullspace(LinearAlgebra::BlockVector &solution,
1021  LinearAlgebra::BlockVector &distributed_stokes_solution) const;
1022 
1035  double normalize_pressure(LinearAlgebra::BlockVector &vector) const;
1036 
1047  void denormalize_pressure(const double pressure_adjustment,
1048  LinearAlgebra::BlockVector &vector) const;
1049 
1052  private:
1057  };
1058 }
1059 
1060 
1061 #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