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>
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 
95 
103  std::array<double,3>
105 
110  double
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 
129 
135  cartesian_velocity_at_surface_point(const std::array<double,3> &spherical_point) const;
136 
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:
174 
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
205 
209  void
211 
212  private:
218 
229 
236 
245 
252 
257  double time_weight;
258 
265 
270  std::string data_directory;
271 
278  std::string velocity_file_name;
279 
285 
294  std::string point1;
295 
299  std::string point2;
300 
306 
317 
322  std::unique_ptr<internal::GPlatesLookup<dim>> lookup;
323 
328  std::unique_ptr<internal::GPlatesLookup<dim>> old_lookup;
329 
336  void
337  update_data (const bool load_both_files);
338 
343  void
345 
349  std::string
350  create_filename (const unsigned int timestep) const;
351  };
352  }
353 }
354 
355 
356 #endif
std::unique_ptr< internal::GPlatesLookup< dim > > lookup
Definition: gplates.h:322
std::string create_filename(const unsigned int timestep) const
void update_data(const bool load_both_files)
Tensor< 1, dim > boundary_velocity(const types::boundary_id boundary_indicator, const Point< dim > &position) const override
void parse_parameters(ParameterHandler &prm) override
std::unique_ptr< internal::GPlatesLookup< dim > > old_lookup
Definition: gplates.h:328
static void declare_parameters(ParameterHandler &prm)
Tensor< 1, dim > cartesian_velocity_at_surface_point(const std::array< double, 3 > &spherical_point) const
Tensor< 1, 3 > cartesian_surface_coordinates(const Tensor< 1, 3 > &sposition) const
std::array< double, 3 > angles_from_matrix(const Tensor< 2, 3 > &rotation_matrix) const
GPlatesLookup(const Tensor< 1, 2 > &surface_point_one, const Tensor< 1, 2 > &surface_point_two)
Tensor< 1, dim > surface_velocity(const Point< dim > &position) const
double rotation_axis_from_matrix(Tensor< 1, 3 > &rotation_axis, const Tensor< 2, 3 > &rotation_matrix) const
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< std::unique_ptr< Functions::InterpolatedUniformGridData< 2 > >, 2 > velocities
Definition: gplates.h:81
std::string screen_output(const Tensor< 1, 2 > &surface_point_one, const Tensor< 1, 2 > &surface_point_two) const
void load_file(const std::string &filename, const MPI_Comm comm)
Tensor< 1, 3 > sphere_to_cart_velocity(const Tensor< 1, 2 > &s_velocities, const std::array< double, 3 > &s_position) const
unsigned int boundary_id