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 
30 #include <deal.II/base/timer.h>
34 #include <deal.II/fe/fe.h>
35 #include <deal.II/fe/mapping_q.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 PrescribedDilation
62  {
63  template <int dim> class Manager;
64  }
65 
66  namespace MaterialModel
67  {
68  template <int dim> class Interface;
69  }
70 
71  namespace InitialTemperature
72  {
73  template <int dim> class Manager;
74  template <int dim> class Interface;
75  }
76 
77  namespace BoundaryTemperature
78  {
79  template <int dim> class Manager;
80  template <int dim> class Interface;
81  }
82 
83  namespace BoundaryHeatFlux
84  {
85  template <int dim> class Interface;
86  }
87 
88  namespace BoundaryConvectiveHeating
89  {
90  template <int dim> class Manager;
91  template <int dim> class Interface;
92  }
93 
94  namespace BoundaryComposition
95  {
96  template <int dim> class Manager;
97  template <int dim> class Interface;
98  }
99 
100  namespace BoundaryTraction
101  {
102  template <int dim> class Manager;
103  template <int dim> class Interface;
104  }
105 
106  namespace BoundaryVelocity
107  {
108  template <int dim> class Manager;
109  template <int dim> class Interface;
110  }
111 
112  namespace InitialComposition
113  {
114  template <int dim> class Manager;
115  template <int dim> class Interface;
116  }
117 
118  namespace InitialTopographyModel
119  {
120  template <int dim> class Interface;
121  }
122 
123  namespace MeshRefinement
124  {
125  template <int dim> class Manager;
126  }
127 
128  namespace AdiabaticConditions
129  {
130  template <int dim> class Interface;
131  }
132 
133  namespace Postprocess
134  {
135  template <int dim> class Manager;
136  }
137 
138  template <int dim> class MeltHandler;
139  template <int dim> class VolumeOfFluidHandler;
140 
141  namespace MeshDeformation
142  {
143  template <int dim> class MeshDeformationHandler;
144  }
145 
146  template <int dim> class NewtonHandler;
147 
148  template <int dim> class StokesMatrixFreeHandler;
149 
150  namespace Particle
151  {
152  template <int dim> class Manager;
153  }
154 
155  namespace StokesSolver
156  {
157  template <int dim> class Interface;
158  }
159 
160  namespace TimeStepping
161  {
162  template <int dim> class Manager;
163  }
164 
165  namespace PrescribedSolution
166  {
167  template <int dim> class Manager;
168  }
169 
219  template <int dim>
220  class SimulatorAccess
221  {
222  public:
229  SimulatorAccess ();
230 
235  SimulatorAccess (const Simulator<dim> &simulator_object);
236 
241  virtual ~SimulatorAccess ();
242 
252  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
253 
264  const Introspection<dim> &
265  introspection () const;
266 
274  const Simulator<dim> &
275  get_simulator () const;
276 
281  const Parameters<dim> &
282  get_parameters () const;
283 
288  get_signals() const;
289 
293  MPI_Comm
294  get_mpi_communicator () const;
295 
302  TimerOutput &
303  get_computing_timer () const;
304 
310  const ConditionalOStream &
311  get_pcout () const;
312 
316  double get_time () const;
317 
321  double
322  get_timestep () const;
323 
327  double
328  get_old_timestep () const;
329 
333  unsigned int
334  get_timestep_number () const;
335 
342  get_timestepping_manager() const;
343 
347  unsigned int
348  get_nonlinear_iteration () const;
349 
355  get_triangulation () const;
356 
360  double
361  get_volume () const;
362 
367  const Mapping<dim> &
368  get_mapping () const;
369 
375  std::string
376  get_output_directory () const;
377 
384  unsigned int
385  get_checkpoint_id () const;
386 
390  bool
391  include_adiabatic_heating () const;
392 
396  bool
397  include_latent_heat () const;
398 
402  bool
403  include_melt_transport () const;
404 
408  int
409  get_stokes_velocity_degree () const;
410 
414  double
415  get_adiabatic_surface_temperature () const;
416 
420  double
421  get_surface_pressure () const;
422 
428  bool
429  convert_output_to_years () const;
430 
440  unsigned int
441  get_pre_refinement_step () const;
442 
447  unsigned int
448  n_compositional_fields () const;
449 
453  double
454  get_end_time () const;
455 
462  void
463  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
464 
475  void
476  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
477  const bool skip_interior_cells = false) const;
478 
483  void
484  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
485  const unsigned int compositional_variable) const;
504  get_current_linearization_point () const;
505 
517  get_solution () const;
518 
528  get_old_solution () const;
529 
539  get_old_old_solution () const;
540 
549  get_reaction_vector () const;
550 
559  get_mesh_velocity () const;
560 
565  const DoFHandler<dim> &
566  get_dof_handler () const;
567 
576  const FiniteElement<dim> &
577  get_fe () const;
578 
583  get_system_matrix () const;
584 
589  get_system_preconditioner_matrix () const;
590 
602  get_material_model () const;
603 
608  get_gravity_model () const;
609 
614  get_initial_topography_model () const;
615 
621  const std::shared_ptr<const InitialTopographyModel::Interface<dim>>
622  get_initial_topography_model_pointer () const;
623 
628  get_geometry_model () const;
629 
630 
636  get_adiabatic_conditions () const;
637 
646  bool has_boundary_temperature () const;
647 
655  get_boundary_temperature_manager () const;
656 
664  get_boundary_convective_heating_manager () const;
665 
671  get_boundary_heat_flux () const;
672 
680  bool has_boundary_composition () const;
681 
689  get_boundary_composition_manager () const;
690 
698  get_boundary_traction_manager () const;
699 
726  std::shared_ptr<const InitialTemperature::Manager<dim>>
727  get_initial_temperature_manager_pointer () const;
728 
744  get_initial_temperature_manager () const;
745 
771  std::shared_ptr<const InitialComposition::Manager<dim>>
772  get_initial_composition_manager_pointer () const;
773 
789  get_initial_composition_manager () const;
790 
795  const std::set<types::boundary_id> &
796  get_fixed_temperature_boundary_indicators () const;
797 
802  const std::set<types::boundary_id> &
803  get_fixed_heat_flux_boundary_indicators () const;
804 
809  const std::set<types::boundary_id> &
810  get_fixed_convective_heating_boundary_indicators () const;
811 
816  const std::set<types::boundary_id> &
817  get_fixed_composition_boundary_indicators () const;
818 
825  const std::set<types::boundary_id> &
826  get_mesh_deformation_boundary_indicators () const;
827 
835  get_boundary_velocity_manager () const;
836 
843  get_heating_model_manager () const;
844 
851  get_prescribed_dilation_manager () const;
852 
860  get_mesh_refinement_manager () const;
861 
865  const MeltHandler<dim> &
866  get_melt_handler () const;
867 
872  get_volume_of_fluid_handler () const;
873 
878  const NewtonHandler<dim> &
879  get_newton_handler () const;
880 
881 #ifdef ASPECT_WITH_WORLD_BUILDER
882 
898  const WorldBuilder::World &
899  get_world_builder () const;
900 
910  std::shared_ptr<const WorldBuilder::World>
911  get_world_builder_pointer () const;
912 #endif
913 
918  get_mesh_deformation_handler () const;
919 
925  const LateralAveraging<dim> &
926  get_lateral_averaging () const;
927 
933  get_current_constraints () const;
934 
967  bool simulator_is_past_initialization () const;
968 
973  double
974  get_pressure_scaling () const;
975 
982  bool
983  pressure_rhs_needs_compatibility_modification() const;
984 
988  bool
989  model_has_prescribed_stokes_solution () const;
990 
996  static
997  void
998  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
999  const unsigned int q,
1000  std::vector<double> &composition_values_at_q_point);
1001 
1013  TableHandler &get_statistics_object() const;
1014 
1019  get_postprocess_manager () const;
1020 
1024  unsigned int
1025  n_particle_managers() const;
1026 
1031  const Particle::Manager<dim> &
1032  get_particle_manager(const unsigned int particle_manager_index) const;
1033 
1041  get_particle_manager(const unsigned int particle_manager_index);
1042 
1046  bool is_stokes_matrix_free() const;
1047 
1053  get_stokes_matrix_free () const;
1054 
1059  get_stokes_solver () const;
1060 
1066  get_prescribed_solution () const;
1067 
1080  compute_net_angular_momentum(const bool use_constant_density,
1081  const LinearAlgebra::BlockVector &solution,
1082  const bool limit_to_top_faces = false) const;
1083 
1093  void remove_nullspace(LinearAlgebra::BlockVector &solution,
1094  LinearAlgebra::BlockVector &distributed_stokes_solution) const;
1095 
1108  double normalize_pressure(LinearAlgebra::BlockVector &vector) const;
1109 
1120  void denormalize_pressure(const double pressure_adjustment,
1121  LinearAlgebra::BlockVector &vector) const;
1122 
1125  private:
1130  };
1131 }
1132 
1133 
1134 #endif
Manager< dim > World
Definition: world.h:39
ObserverPointer< const Simulator< dim >, SimulatorAccess< dim > > simulator