ASPECT
gplates.h
Go to the documentation of this file.
1 // ------------------------------------------------------
2 //
3 // SPDX-License-Identifier: GPL-2.0-or-later
4 //
5 // SPDX-FileCopyrightText: Copyright (C) 2011-2026 by the ASPECT authors.
6 //
7 // This file is part of ASPECT.
8 //
9 // Detailed license information governing the source code and
10 // contributions can be found in the folder LICENSES and in
11 // LICENSE and CONTRIBUTING.md at the top level directory.
12 //
13 // ------------------------------------------------------
14 
15 
16 #ifndef _aspect_boundary_velocity_gplates_h
17 #define _aspect_boundary_velocity_gplates_h
18 
21 
22 #include <array>
24 
25 
26 namespace aspect
27 {
28  namespace BoundaryVelocity
29  {
30  namespace internal
31  {
36  template <int dim>
38  {
39  public:
40 
45  GPlatesLookup(const Tensor<1,2> &surface_point_one,
46  const Tensor<1,2> &surface_point_two);
47 
51  std::string
52  screen_output(const Tensor<1,2> &surface_point_one,
53  const Tensor<1,2> &surface_point_two) const;
54 
59  void load_file(const std::string &filename,
60  const MPI_Comm comm);
61 
69  Tensor<1,dim> surface_velocity(const Point<dim> &position) const;
70 
71  private:
75  std::array<std::unique_ptr<Functions::InterpolatedUniformGridData<2>>, 2> velocities;
76 
81 
89 
97  std::array<double,3>
98  angles_from_matrix (const Tensor<2,3> &rotation_matrix) const;
99 
104  double
105  rotation_axis_from_matrix (Tensor<1,3> &rotation_axis,
106  const Tensor<2,3> &rotation_matrix) const;
107 
113  template <int in, int out>
114  Tensor<1,out> convert_tensor (const Tensor<1,in> &old_tensor) const;
115 
122  cartesian_surface_coordinates(const Tensor<1,3> &sposition) const;
123 
129  cartesian_velocity_at_surface_point(const std::array<double,3> &spherical_point) const;
130 
140  Tensor<1,3> sphere_to_cart_velocity(const Tensor<1,2> &s_velocities,
141  const std::array<double,3> &s_position) const;
142 
148  bool
149  gplates_1_4_or_higher(const boost::property_tree::ptree &pt) const;
150  };
151  }
152 
160  template <int dim>
161  class GPlates : public Interface<dim>, public SimulatorAccess<dim>
162  {
163  public:
167  GPlates ();
168 
174  boundary_velocity (const types::boundary_id boundary_indicator,
175  const Point<dim> &position) const override;
176 
181  void
182  initialize () override;
183 
190  void
191  update () override;
192 
196  static
197  void
199 
203  void
204  parse_parameters (ParameterHandler &prm) override;
205 
206  private:
212 
223 
230 
239 
246 
251  double time_weight;
252 
259 
264  std::string data_directory;
265 
272  std::string velocity_file_name;
273 
279 
288  std::string point1;
289 
293  std::string point2;
294 
300 
311 
316  std::unique_ptr<internal::GPlatesLookup<dim>> lookup;
317 
322  std::unique_ptr<internal::GPlatesLookup<dim>> old_lookup;
323 
330  void
331  update_data (const bool load_both_files);
332 
337  void
338  end_time_dependence ();
339 
343  std::string
344  create_filename (const unsigned int timestep) const;
345  };
346  }
347 }
348 
349 
350 #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:75
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)
*braid_SplitCommworld & comm
Tensor< 1, 3 > cartesian_surface_coordinates(const Tensor< 1, 3 > &sposition) const
std::unique_ptr< internal::GPlatesLookup< dim > > old_lookup
Definition: gplates.h:322
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:316
double rotation_axis_from_matrix(Tensor< 1, 3 > &rotation_axis, const Tensor< 2, 3 > &rotation_matrix) const