ASPECT
gplates.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2022 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_boundary_velocity_gplates_h
23 #define _aspect_boundary_velocity_gplates_h
24 
27 
28 #include <array>
29 #include <deal.II/base/function_lib.h>
30 
31 
32 namespace aspect
33 {
34  namespace BoundaryVelocity
35  {
36  using namespace dealii;
37 
38  namespace internal
39  {
44  template <int dim>
46  {
47  public:
48 
53  GPlatesLookup(const Tensor<1,2> &surface_point_one,
54  const Tensor<1,2> &surface_point_two);
55 
59  std::string
60  screen_output(const Tensor<1,2> &surface_point_one,
61  const Tensor<1,2> &surface_point_two) const;
62 
67  void load_file(const std::string &filename,
68  const MPI_Comm comm);
69 
77  Tensor<1,dim> surface_velocity(const Point<dim> &position) const;
78 
79  private:
83  std::array<std::unique_ptr<Functions::InterpolatedUniformGridData<2>>, 2> velocities;
84 
88  double delta_phi, delta_theta;
89 
96  Tensor<2,3> rotation_matrix;
97 
105  std::array<double,3>
106  angles_from_matrix (const Tensor<2,3> &rotation_matrix) const;
107 
112  double
113  rotation_axis_from_matrix (Tensor<1,3> &rotation_axis,
114  const Tensor<2,3> &rotation_matrix) const;
115 
121  template <int in, int out>
122  Tensor<1,out> convert_tensor (const Tensor<1,in> &old_tensor) const;
123 
129  Tensor<1,3>
130  cartesian_surface_coordinates(const Tensor<1,3> &sposition) const;
131 
136  Tensor<1,dim>
137  cartesian_velocity_at_surface_point(const std::array<double,3> &spherical_point) const;
138 
148  Tensor<1,3> sphere_to_cart_velocity(const Tensor<1,2> &s_velocities,
149  const std::array<double,3> &s_position) const;
150 
156  bool
157  gplates_1_4_or_higher(const boost::property_tree::ptree &pt) const;
158  };
159  }
160 
168  template <int dim>
169  class GPlates : public Interface<dim>, public SimulatorAccess<dim>
170  {
171  public:
175  GPlates ();
176 
181  Tensor<1,dim>
182  boundary_velocity (const types::boundary_id boundary_indicator,
183  const Point<dim> &position) const override;
184 
185  // avoid -Woverloaded-virtual warning until the deprecated function
186  // is removed from the interface:
188 
193  void
194  initialize () override;
195 
202  void
203  update () override;
204 
208  static
209  void
210  declare_parameters (ParameterHandler &prm);
211 
215  void
216  parse_parameters (ParameterHandler &prm) override;
217 
218  private:
224 
233 
239 
247 
253 
258  double time_weight;
259 
266 
270  std::string data_directory;
271 
277  std::string velocity_file_name;
278 
283 
291  std::string point1;
292  std::string point2;
293 
297  Tensor<1,2> pointone;
298  Tensor<1,2> pointtwo;
299 
308 
313  std::unique_ptr<internal::GPlatesLookup<dim>> lookup;
314 
319  std::unique_ptr<internal::GPlatesLookup<dim>> old_lookup;
320 
327  void
328  update_data (const bool load_both_files);
329 
334  void
335  end_time_dependence ();
336 
340  std::string
341  create_filename (const int timestep) const;
342  };
343  }
344 }
345 
346 
347 #endif
std::array< std::unique_ptr< Functions::InterpolatedUniformGridData< 2 > >, 2 > velocities
Definition: gplates.h:83
void declare_parameters(ParameterHandler &prm)
std::unique_ptr< internal::GPlatesLookup< dim > > old_lookup
Definition: gplates.h:319
std::unique_ptr< internal::GPlatesLookup< dim > > lookup
Definition: gplates.h:313
Definition: compat.h:42