ASPECT
simulator_access.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2023 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 World;
144  }
145 
167  template <int dim>
168  class SimulatorAccess
169  {
170  public:
177  SimulatorAccess ();
178 
183  SimulatorAccess (const Simulator<dim> &simulator_object);
184 
189  virtual ~SimulatorAccess () = default;
190 
200  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
201 
212  const Introspection<dim> &
213  introspection () const;
214 
222  const Simulator<dim> &
223  get_simulator () const;
224 
229  const Parameters<dim> &
230  get_parameters () const;
231 
236  get_signals() const;
237 
241  MPI_Comm
242  get_mpi_communicator () const;
243 
250  TimerOutput &
251  get_computing_timer () const;
252 
258  const ConditionalOStream &
259  get_pcout () const;
260 
264  double get_time () const;
265 
269  double
270  get_timestep () const;
271 
275  double
276  get_old_timestep () const;
277 
281  unsigned int
282  get_timestep_number () const;
283 
287  unsigned int
288  get_nonlinear_iteration () const;
289 
294  const parallel::distributed::Triangulation<dim> &
295  get_triangulation () const;
296 
300  double
301  get_volume () const;
302 
307  const Mapping<dim> &
308  get_mapping () const;
309 
315  std::string
316  get_output_directory () const;
317 
321  bool
322  include_adiabatic_heating () const;
323 
327  bool
328  include_latent_heat () const;
329 
333  bool
334  include_melt_transport () const;
335 
339  int
340  get_stokes_velocity_degree () const;
341 
345  double
346  get_adiabatic_surface_temperature () const;
347 
351  double
352  get_surface_pressure () const;
353 
359  bool
360  convert_output_to_years () const;
361 
371  unsigned int
372  get_pre_refinement_step () const;
373 
378  unsigned int
379  n_compositional_fields () const;
380 
387  void
388  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
389 
400  void
401  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
402  const bool skip_interior_cells = false) const;
403 
408  void
409  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
410  const unsigned int compositional_variable) const;
429  get_current_linearization_point () const;
430 
442  get_solution () const;
443 
453  get_old_solution () const;
454 
464  get_old_old_solution () const;
465 
474  get_reaction_vector () const;
475 
484  get_mesh_velocity () const;
485 
490  const DoFHandler<dim> &
491  get_dof_handler () const;
492 
501  const FiniteElement<dim> &
502  get_fe () const;
503 
508  get_system_matrix () const;
509 
514  get_system_preconditioner_matrix () const;
515 
527  get_material_model () const;
528 
533  get_gravity_model () const;
534 
539  get_initial_topography_model () const;
540 
545  get_geometry_model () const;
546 
547 
553  get_adiabatic_conditions () const;
554 
563  bool has_boundary_temperature () const;
564 
572  get_boundary_temperature_manager () const;
573 
579  get_boundary_heat_flux () const;
580 
588  bool has_boundary_composition () const;
589 
597  get_boundary_composition_manager () const;
598 
606  get_boundary_traction_manager () const;
607 
634  std::shared_ptr<const InitialTemperature::Manager<dim>>
635  get_initial_temperature_manager_pointer () const;
636 
652  get_initial_temperature_manager () const;
653 
679  std::shared_ptr<const InitialComposition::Manager<dim>>
680  get_initial_composition_manager_pointer () const;
681 
697  get_initial_composition_manager () const;
698 
703  const std::set<types::boundary_id> &
704  get_fixed_temperature_boundary_indicators () const;
705 
710  const std::set<types::boundary_id> &
711  get_fixed_heat_flux_boundary_indicators () const;
712 
717  const std::set<types::boundary_id> &
718  get_fixed_composition_boundary_indicators () const;
719 
726  const std::set<types::boundary_id> &
727  get_mesh_deformation_boundary_indicators () const;
728 
736  get_boundary_velocity_manager () const;
737 
744  get_heating_model_manager () const;
745 
753  get_mesh_refinement_manager () const;
754 
758  const MeltHandler<dim> &
759  get_melt_handler () const;
760 
765  get_volume_of_fluid_handler () const;
766 
771  const NewtonHandler<dim> &
772  get_newton_handler () const;
773 
774 #ifdef ASPECT_WITH_WORLD_BUILDER
775 
791  const WorldBuilder::World &
792  get_world_builder () const;
793 
803  std::shared_ptr<const WorldBuilder::World>
804  get_world_builder_pointer () const;
805 #endif
806 
811  get_mesh_deformation_handler () const;
812 
818  const LateralAveraging<dim> &
819  get_lateral_averaging () const;
820 
825  const AffineConstraints<double> &
826  get_current_constraints () const;
827 
860  bool simulator_is_past_initialization () const;
861 
866  double
867  get_pressure_scaling () const;
868 
875  bool
876  pressure_rhs_needs_compatibility_modification() const;
877 
881  bool
882  model_has_prescribed_stokes_solution () const;
883 
889  static
890  void
891  get_composition_values_at_q_point (const std::vector<std::vector<double>> &composition_values,
892  const unsigned int q,
893  std::vector<double> &composition_values_at_q_point);
894 
906  TableHandler &get_statistics_object() const;
907 
912  get_postprocess_manager () const;
913 
918  const Particle::World<dim> &
919  get_particle_world() const;
920 
928  get_particle_world();
929 
933  bool is_stokes_matrix_free();
934 
940  get_stokes_matrix_free () const;
941 
954  compute_net_angular_momentum(const bool use_constant_density,
955  const LinearAlgebra::BlockVector &solution,
956  const bool limit_to_top_faces = false) const;
957 
960  private:
965  };
966 }
967 
968 
969 #endif
const Simulator< dim > * simulator
::TrilinosWrappers::MPI::BlockVector BlockVector
Definition: global.h:239
::TrilinosWrappers::BlockSparseMatrix BlockSparseMatrix
Definition: global.h:250
Definition: compat.h:42