ASPECT
gplates.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_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 
189  void
190  initialize () override;
191 
198  void
199  update () override;
200 
204  static
205  void
206  declare_parameters (ParameterHandler &prm);
207 
211  void
212  parse_parameters (ParameterHandler &prm) override;
213 
214  private:
220 
229 
235 
243 
249 
254  double time_weight;
255 
262 
266  std::string data_directory;
267 
273  std::string velocity_file_name;
274 
279 
287  std::string point1;
288  std::string point2;
289 
293  Tensor<1,2> pointone;
294  Tensor<1,2> pointtwo;
295 
304 
309  std::unique_ptr<internal::GPlatesLookup<dim>> lookup;
310 
315  std::unique_ptr<internal::GPlatesLookup<dim>> old_lookup;
316 
323  void
324  update_data (const bool load_both_files);
325 
330  void
331  end_time_dependence ();
332 
336  std::string
337  create_filename (const int timestep) const;
338  };
339  }
340 }
341 
342 
343 #endif
std::array< std::unique_ptr< Functions::InterpolatedUniformGridData< 2 > >, 2 > velocities
Definition: gplates.h:83
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:59
std::unique_ptr< internal::GPlatesLookup< dim > > old_lookup
Definition: gplates.h:315
std::unique_ptr< internal::GPlatesLookup< dim > > lookup
Definition: gplates.h:309
Definition: compat.h:42