ASPECT
simulator_access.h
Go to the documentation of this file.
1 // ------------------------------------------------------
2 //
3 // SPDX-License-Identifier: GPL-2.0-or-later
4 //
5 // SPDX-FileCopyrightText: Copyright (C) 2011-2026 by the ASPECT authors.
6 //
7 // This file is part of ASPECT.
8 //
9 // Detailed license information governing the source code and
10 // contributions can be found in the folder LICENSES and in
11 // LICENSE and CONTRIBUTING.md at the top level directory.
12 //
13 // ------------------------------------------------------
14 
15 
16 #ifndef _aspect_simulator_access_h
17 #define _aspect_simulator_access_h
18 
19 #include <aspect/global.h>
20 #include <aspect/parameters.h>
21 #include <aspect/introspection.h>
22 
24 #include <deal.II/base/timer.h>
28 #include <deal.II/fe/fe.h>
29 #include <deal.II/fe/mapping_q.h>
31 
32 namespace WorldBuilder
33 {
34  class World;
35 }
36 
37 namespace aspect
38 {
39  // forward declarations:
40  template <int dim> class Simulator;
41  template <int dim> struct SimulatorSignals;
42  template <int dim> class LateralAveraging;
43  template <int dim> struct RotationProperties;
44 
45  namespace GravityModel
46  {
47  template <int dim> class Interface;
48  }
49 
50  namespace HeatingModel
51  {
52  template <int dim> class Manager;
53  }
54 
55  namespace PrescribedDilation
56  {
57  template <int dim> class Manager;
58  }
59 
60  namespace MaterialModel
61  {
62  template <int dim> class Interface;
63  }
64 
65  namespace InitialTemperature
66  {
67  template <int dim> class Manager;
68  template <int dim> class Interface;
69  }
70 
71  namespace BoundaryTemperature
72  {
73  template <int dim> class Manager;
74  template <int dim> class Interface;
75  }
76 
77  namespace BoundaryHeatFlux
78  {
79  template <int dim> class Interface;
80  }
81 
82  namespace BoundaryConvectiveHeating
83  {
84  template <int dim> class Manager;
85  template <int dim> class Interface;
86  }
87 
88  namespace BoundaryComposition
89  {
90  template <int dim> class Manager;
91  template <int dim> class Interface;
92  }
93 
94  namespace BoundaryTraction
95  {
96  template <int dim> class Manager;
97  template <int dim> class Interface;
98  }
99 
100  namespace BoundaryVelocity
101  {
102  template <int dim> class Manager;
103  template <int dim> class Interface;
104  }
105 
106  namespace InitialComposition
107  {
108  template <int dim> class Manager;
109  template <int dim> class Interface;
110  }
111 
112  namespace InitialTopographyModel
113  {
114  template <int dim> class Interface;
115  }
116 
117  namespace MeshRefinement
118  {
119  template <int dim> class Manager;
120  }
121 
122  namespace AdiabaticConditions
123  {
124  template <int dim> class Interface;
125  }
126 
127  namespace Postprocess
128  {
129  template <int dim> class Manager;
130  }
131 
132  template <int dim> class MeltHandler;
133  template <int dim> class VolumeOfFluidHandler;
134 
135  namespace MeshDeformation
136  {
137  template <int dim> class MeshDeformationHandler;
138  }
139 
140  template <int dim> class NewtonHandler;
141 
142  template <int dim> class StokesMatrixFreeHandler;
143 
144  namespace Particle
145  {
146  template <int dim> class Manager;
147  }
148 
149  namespace StokesSolver
150  {
151  template <int dim> class Interface;
152  }
153 
154  namespace TimeStepping
155  {
156  template <int dim> class Manager;
157  }
158 
159  namespace PrescribedSolution
160  {
161  template <int dim> class Manager;
162  }
163 
213  template <int dim>
214  class SimulatorAccess
215  {
216  public:
223  SimulatorAccess ();
224 
229  SimulatorAccess (const Simulator<dim> &simulator_object);
230 
235  virtual ~SimulatorAccess ();
236 
246  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
247 
258  const Introspection<dim> &
259  introspection () const;
260 
268  const Simulator<dim> &
269  get_simulator () const;
270 
275  const Parameters<dim> &
276  get_parameters () const;
277 
282  get_signals() const;
283 
287  MPI_Comm
288  get_mpi_communicator () const;
289 
296  TimerOutput &
297  get_computing_timer () const;
298 
304  const ConditionalOStream &
305  get_pcout () const;
306 
310  double get_time () const;
311 
315  double
316  get_timestep () const;
317 
321  double
322  get_old_timestep () const;
323 
327  unsigned int
328  get_timestep_number () const;
329 
336  get_timestepping_manager() const;
337 
341  unsigned int
342  get_nonlinear_iteration () const;
343 
349  get_triangulation () const;
350 
354  double
355  get_volume () const;
356 
361  const Mapping<dim> &
362  get_mapping () const;
363 
369  std::string
370  get_output_directory () const;
371 
378  unsigned int
379  get_checkpoint_id () const;
380 
384  bool
385  include_adiabatic_heating () const;
386 
390  bool
391  include_latent_heat () const;
392 
396  bool
397  include_melt_transport () const;
398 
402  int
403  get_stokes_velocity_degree () const;
404 
408  double
409  get_adiabatic_surface_temperature () const;
410 
414  double
415  get_surface_pressure () const;
416 
422  bool
423  convert_output_to_years () const;
424 
434  unsigned int
435  get_pre_refinement_step () const;
436 
441  unsigned int
442  n_compositional_fields () const;
443 
447  double
448  get_end_time () const;
449 
456  void
457  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
458 
469  void
470  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
471  const bool skip_interior_cells = false) const;
472 
477  void
478  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
479  const unsigned int compositional_variable) const;
498  get_current_linearization_point () const;
499 
511  get_solution () const;
512 
522  get_old_solution () const;
523 
533  get_old_old_solution () const;
534 
543  get_reaction_vector () const;
544 
553  get_mesh_velocity () const;
554 
559  const DoFHandler<dim> &
560  get_dof_handler () const;
561 
570  const FiniteElement<dim> &
571  get_fe () const;
572 
577  get_system_matrix () const;
578 
583  get_system_preconditioner_matrix () const;
584 
596  get_material_model () const;
597 
602  get_gravity_model () const;
603 
608  get_initial_topography_model () const;
609 
615  const std::shared_ptr<const InitialTopographyModel::Interface<dim>>
616  get_initial_topography_model_pointer () const;
617 
622  get_geometry_model () const;
623 
624 
630  get_adiabatic_conditions () const;
631 
640  bool has_boundary_temperature () const;
641 
649  get_boundary_temperature_manager () const;
650 
658  get_boundary_convective_heating_manager () const;
659 
665  get_boundary_heat_flux () const;
666 
674  bool has_boundary_composition () const;
675 
683  get_boundary_composition_manager () const;
684 
692  get_boundary_traction_manager () const;
693 
720  std::shared_ptr<const InitialTemperature::Manager<dim>>
721  get_initial_temperature_manager_pointer () const;
722 
738  get_initial_temperature_manager () const;
739 
765  std::shared_ptr<const InitialComposition::Manager<dim>>
766  get_initial_composition_manager_pointer () const;
767 
783  get_initial_composition_manager () const;
784 
789  const std::set<types::boundary_id> &
790  get_fixed_temperature_boundary_indicators () const;
791 
796  const std::set<types::boundary_id> &
797  get_fixed_heat_flux_boundary_indicators () const;
798 
803  const std::set<types::boundary_id> &
804  get_fixed_convective_heating_boundary_indicators () const;
805 
810  const std::set<types::boundary_id> &
811  get_fixed_composition_boundary_indicators () const;
812 
819  const std::set<types::boundary_id> &
820  get_mesh_deformation_boundary_indicators () const;
821 
829  get_boundary_velocity_manager () const;
830 
837  get_heating_model_manager () const;
838 
845  get_prescribed_dilation_manager () const;
846 
854  get_mesh_refinement_manager () const;
855 
859  const MeltHandler<dim> &
860  get_melt_handler () const;
861 
866  get_volume_of_fluid_handler () const;
867 
872  const NewtonHandler<dim> &
873  get_newton_handler () const;
874 
875 #ifdef ASPECT_WITH_WORLD_BUILDER
876 
892  const WorldBuilder::World &
893  get_world_builder () const;
894 
904  std::shared_ptr<const WorldBuilder::World>
905  get_world_builder_pointer () const;
906 #endif
907 
912  get_mesh_deformation_handler () const;
913 
919  const LateralAveraging<dim> &
920  get_lateral_averaging () const;
921 
927  get_current_constraints () const;
928 
961  bool simulator_is_past_initialization () const;
962 
967  double
968  get_pressure_scaling () const;
969 
976  bool
977  pressure_rhs_needs_compatibility_modification() const;
978 
986  bool
987  stokes_A_block_is_symmetric() const;
988 
992  bool
993  model_has_prescribed_stokes_solution () const;
994 
1000  static
1001  void
1002  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
1003  const unsigned int q,
1004  std::vector<double> &composition_values_at_q_point);
1005 
1017  TableHandler &get_statistics_object() const;
1018 
1023  get_postprocess_manager () const;
1024 
1028  unsigned int
1029  n_particle_managers() const;
1030 
1035  const Particle::Manager<dim> &
1036  get_particle_manager(const unsigned int particle_manager_index) const;
1037 
1045  get_particle_manager(const unsigned int particle_manager_index);
1046 
1050  bool is_stokes_matrix_free() const;
1051 
1057  get_stokes_matrix_free () const;
1058 
1063  get_stokes_solver () const;
1064 
1070  get_prescribed_solution () const;
1071 
1084  compute_net_angular_momentum(const bool use_constant_density,
1085  const LinearAlgebra::BlockVector &solution,
1086  const bool limit_to_top_faces = false) const;
1087 
1097  void remove_nullspace(LinearAlgebra::BlockVector &solution,
1098  LinearAlgebra::BlockVector &distributed_stokes_solution) const;
1099 
1112  double normalize_pressure(LinearAlgebra::BlockVector &vector) const;
1113 
1124  void denormalize_pressure(const double pressure_adjustment,
1125  LinearAlgebra::BlockVector &vector) const;
1126 
1129  private:
1134  };
1135 }
1136 
1137 
1138 #endif
Manager< dim > World
Definition: world.h:33
ObserverPointer< const Simulator< dim >, SimulatorAccess< dim > > simulator