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  namespace internal
37  {
42  template <int dim>
44  {
45  public:
46 
51  GPlatesLookup(const Tensor<1,2> &surface_point_one,
52  const Tensor<1,2> &surface_point_two);
53 
57  std::string
58  screen_output(const Tensor<1,2> &surface_point_one,
59  const Tensor<1,2> &surface_point_two) const;
60 
65  void load_file(const std::string &filename,
66  const MPI_Comm comm);
67 
75  Tensor<1,dim> surface_velocity(const Point<dim> &position) const;
76 
77  private:
81  std::array<std::unique_ptr<Functions::InterpolatedUniformGridData<2>>, 2> velocities;
82 
87 
94  Tensor<2,3> rotation_matrix;
95 
103  std::array<double,3>
104  angles_from_matrix (const Tensor<2,3> &rotation_matrix) const;
105 
110  double
111  rotation_axis_from_matrix (Tensor<1,3> &rotation_axis,
112  const Tensor<2,3> &rotation_matrix) const;
113 
119  template <int in, int out>
120  Tensor<1,out> convert_tensor (const Tensor<1,in> &old_tensor) const;
121 
127  Tensor<1,3>
128  cartesian_surface_coordinates(const Tensor<1,3> &sposition) const;
129 
134  Tensor<1,dim>
135  cartesian_velocity_at_surface_point(const std::array<double,3> &spherical_point) const;
136 
146  Tensor<1,3> sphere_to_cart_velocity(const Tensor<1,2> &s_velocities,
147  const std::array<double,3> &s_position) const;
148 
154  bool
155  gplates_1_4_or_higher(const boost::property_tree::ptree &pt) const;
156  };
157  }
158 
166  template <int dim>
167  class GPlates : public Interface<dim>, public SimulatorAccess<dim>
168  {
169  public:
173  GPlates ();
174 
179  Tensor<1,dim>
180  boundary_velocity (const types::boundary_id boundary_indicator,
181  const Point<dim> &position) const override;
182 
187  void
188  initialize () override;
189 
196  void
197  update () override;
198 
202  static
203  void
204  declare_parameters (ParameterHandler &prm);
205 
209  void
210  parse_parameters (ParameterHandler &prm) override;
211 
212  private:
218 
227 
233 
241 
247 
252  double time_weight;
253 
260 
264  std::string data_directory;
265 
271  std::string velocity_file_name;
272 
277 
285  std::string point1;
286  std::string point2;
287 
291  Tensor<1,2> pointone;
292  Tensor<1,2> pointtwo;
293 
302 
307  std::unique_ptr<internal::GPlatesLookup<dim>> lookup;
308 
313  std::unique_ptr<internal::GPlatesLookup<dim>> old_lookup;
314 
321  void
322  update_data (const bool load_both_files);
323 
328  void
329  end_time_dependence ();
330 
334  std::string
335  create_filename (const int timestep) const;
336  };
337  }
338 }
339 
340 
341 #endif
Tensor< 1, out > convert_tensor(const Tensor< 1, in > &old_tensor) const
bool gplates_1_4_or_higher(const boost::property_tree::ptree &pt) const
std::array< double, 3 > angles_from_matrix(const Tensor< 2, 3 > &rotation_matrix) const
Tensor< 1, dim > cartesian_velocity_at_surface_point(const std::array< double, 3 > &spherical_point) const
Tensor< 1, dim > surface_velocity(const Point< dim > &position) const
void load_file(const std::string &filename, const MPI_Comm comm)
std::array< std::unique_ptr< Functions::InterpolatedUniformGridData< 2 > >, 2 > velocities
Definition: gplates.h:81
Tensor< 1, 3 > sphere_to_cart_velocity(const Tensor< 1, 2 > &s_velocities, const std::array< double, 3 > &s_position) const
GPlatesLookup(const Tensor< 1, 2 > &surface_point_one, const Tensor< 1, 2 > &surface_point_two)
void declare_parameters(ParameterHandler &prm)
Definition: compat.h:59
Tensor< 1, 3 > cartesian_surface_coordinates(const Tensor< 1, 3 > &sposition) const
std::unique_ptr< internal::GPlatesLookup< dim > > old_lookup
Definition: gplates.h:313
std::string screen_output(const Tensor< 1, 2 > &surface_point_one, const Tensor< 1, 2 > &surface_point_two) const
std::unique_ptr< internal::GPlatesLookup< dim > > lookup
Definition: gplates.h:307
double rotation_axis_from_matrix(Tensor< 1, 3 > &rotation_axis, const Tensor< 2, 3 > &rotation_matrix) const