ASPECT
simulator_access.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2020 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>
36 
37 #if !DEAL_II_VERSION_GTE(9,1,0)
39 #else
41 #endif
42 
43 namespace WorldBuilder
44 {
45  class World;
46 }
47 
48 namespace aspect
49 {
50  using namespace dealii;
51 
52  // forward declarations:
53  template <int dim> class Simulator;
54  template <int dim> struct SimulatorSignals;
55  template <int dim> class LateralAveraging;
56 
57  namespace GravityModel
58  {
59  template <int dim> class Interface;
60  }
61 
62  namespace HeatingModel
63  {
64  template <int dim> class Manager;
65  }
66 
67  namespace MaterialModel
68  {
69  template <int dim> class Interface;
70  }
71 
72  namespace InitialTemperature
73  {
74  template <int dim> class Manager;
75  template <int dim> class Interface;
76  }
77 
78  namespace BoundaryTemperature
79  {
80  template <int dim> class Manager;
81  template <int dim> class Interface;
82  }
83 
84  namespace BoundaryHeatFlux
85  {
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 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 World;
147  }
148 
170  template <int dim>
171  class SimulatorAccess
172  {
173  public:
180  SimulatorAccess ();
181 
186  SimulatorAccess (const Simulator<dim> &simulator_object);
187 
192  virtual
193  ~SimulatorAccess ();
194 
204  virtual void initialize_simulator (const Simulator<dim> &simulator_object);
205 
216  const Introspection<dim> &
217  introspection () const;
218 
226  const Simulator<dim> &
227  get_simulator () const;
228 
233  const Parameters<dim> &
234  get_parameters () const;
235 
240  get_signals() const;
241 
245  MPI_Comm
246  get_mpi_communicator () const;
247 
254  TimerOutput &
255  get_computing_timer () const;
256 
262  const ConditionalOStream &
263  get_pcout () const;
264 
268  double get_time () const;
269 
273  double
274  get_timestep () const;
275 
279  double
280  get_old_timestep () const;
281 
285  unsigned int
286  get_timestep_number () const;
287 
291  unsigned int
292  get_nonlinear_iteration () const;
293 
299  get_triangulation () const;
300 
304  double
305  get_volume () const;
306 
311  const Mapping<dim> &
312  get_mapping () const;
313 
319  std::string
320  get_output_directory () const;
321 
325  bool
326  include_adiabatic_heating () const;
327 
331  bool
332  include_latent_heat () const;
333 
337  bool
338  include_melt_transport () const;
339 
343  int
344  get_stokes_velocity_degree () const;
345 
349  double
350  get_adiabatic_surface_temperature () const;
351 
355  double
356  get_surface_pressure () const;
357 
363  bool
364  convert_output_to_years () const;
365 
375  unsigned int
376  get_pre_refinement_step () const;
377 
382  unsigned int
383  n_compositional_fields () const;
384 
391  void
392  get_refinement_criteria(Vector<float> &estimated_error_per_cell) const;
393 
404  void
405  get_artificial_viscosity(Vector<float> &viscosity_per_cell,
406  const bool skip_interior_cells = false) const;
407 
412  void
413  get_artificial_viscosity_composition(Vector<float> &viscosity_per_cell,
414  const unsigned int compositional_variable) const;
433  get_current_linearization_point () const;
434 
446  get_solution () const;
447 
457  get_old_solution () const;
458 
468  get_old_old_solution () const;
469 
478  get_reaction_vector () const;
479 
488  get_mesh_velocity () const;
489 
494  const DoFHandler<dim> &
495  get_dof_handler () const;
496 
505  const FiniteElement<dim> &
506  get_fe () const;
507 
512  get_system_matrix () const;
513 
518  get_system_preconditioner_matrix () const;
519 
531  get_material_model () const;
532 
537  void
538  compute_material_model_input_values (const LinearAlgebra::BlockVector &input_solution,
539  const FEValuesBase<dim,dim> &input_finite_element_values,
540  const typename DoFHandler<dim>::active_cell_iterator &cell,
541  const bool compute_strainrate,
542  MaterialModel::MaterialModelInputs<dim> &material_model_inputs) const;
543 
548  get_gravity_model () const;
549 
554  get_initial_topography_model () const;
555 
560  get_geometry_model () const;
561 
562 
568  get_adiabatic_conditions () const;
569 
578  bool has_boundary_temperature () const;
579 
588  get_boundary_temperature () const;
589 
597  get_boundary_temperature_manager () const;
598 
604  get_boundary_heat_flux () const;
605 
613  bool has_boundary_composition () const;
614 
623  get_boundary_composition () const;
624 
632  get_boundary_composition_manager () const;
633 
638  const std::map<types::boundary_id,std::unique_ptr<BoundaryTraction::Interface<dim> > > &
639  get_boundary_traction () const;
640 
649  get_initial_temperature () const;
650 
658  get_initial_temperature_manager () const;
659 
666  get_initial_composition () const;
667 
674  get_initial_composition_manager () const;
675 
680  const std::set<types::boundary_id> &
681  get_fixed_temperature_boundary_indicators () const;
682 
687  const std::set<types::boundary_id> &
688  get_fixed_heat_flux_boundary_indicators () const;
689 
694  const std::set<types::boundary_id> &
695  get_fixed_composition_boundary_indicators () const;
696 
703  const std::set<types::boundary_id> &
704  get_mesh_deformation_boundary_indicators () const;
705 
713  get_boundary_velocity_manager () const;
714 
721  get_heating_model_manager () const;
722 
730  get_mesh_refinement_manager () const;
731 
735  const MeltHandler<dim> &
736  get_melt_handler () const;
737 
742  get_volume_of_fluid_handler () const;
743 
748  const NewtonHandler<dim> &
749  get_newton_handler () const;
750 #ifdef ASPECT_WITH_WORLD_BUILDER
751 
758  const WorldBuilder::World &
759  get_world_builder () const;
760 #endif
761 
766  get_mesh_deformation_handler () const;
767 
773  const LateralAveraging<dim> &
774  get_lateral_averaging () const;
775 
781  get_current_constraints () const;
782 
815  bool simulator_is_past_initialization () const;
816 
821  double
822  get_pressure_scaling () const;
823 
830  bool
831  pressure_rhs_needs_compatibility_modification() const;
832 
836  bool
837  model_has_prescribed_stokes_solution () const;
838 
844  static
845  void
846  get_composition_values_at_q_point (const std::vector<std::vector<double> > &composition_values,
847  const unsigned int q,
848  std::vector<double> &composition_values_at_q_point);
849 
861  TableHandler &get_statistics_object() const;
862 
863 
877  template <typename PostprocessorType>
879  PostprocessorType *
880  find_postprocessor () const;
881 
886  get_postprocess_manager () const;
887 
892  const Particle::World<dim> &
893  get_particle_world() const;
894 
902  get_particle_world();
903 
907  bool is_stokes_matrix_free();
908 
914  get_stokes_matrix_free () const;
915 
918  private:
923  };
924 
925  template <int dim>
926  template <typename PostprocessorType>
927  inline
928  PostprocessorType *
930  {
931  if (get_postprocess_manager().template has_matching_postprocessor<PostprocessorType>())
932  return &get_postprocess_manager().template get_matching_postprocessor<PostprocessorType>();
933 
934  return nullptr;
935  }
936 }
937 
938 
939 #endif
const Simulator< dim > * simulator
std::string get_time()
#define DEAL_II_DEPRECATED