ASPECT
cpo_bingham_average.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 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 #ifndef _aspect_particle_property_cpo_bingham_average_h
22 #define _aspect_particle_property_cpo_bingham_average_h
23 
27 
28 #include <array>
29 #include <random>
30 
31 namespace aspect
32 {
33  namespace Particle
34  {
35  namespace Property
36  {
37 
58  template <int dim>
59  class CpoBinghamAverage : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
60  {
61  public:
66 
71  void
72  initialize () override;
73 
85  void
86  initialize_one_particle_property (const Point<dim> &position,
87  std::vector<double> &particle_properties) const override;
88 
110  void
111  update_one_particle_property (const unsigned int data_position,
112  const Point<dim> &position,
113  const Vector<double> &solution,
114  const std::vector<Tensor<1,dim>> &gradients,
115  const ArrayView<double> &particle_properties) const override;
116 
122  need_update () const override;
123 
128  UpdateFlags
129  get_needed_update_flags () const override;
130 
138  std::vector<std::pair<std::string, unsigned int>>
139  get_property_information() const override;
140 
149  std::array<std::array<double,3>,3>
150  compute_bingham_average(std::vector<Tensor<2,3>> matrices) const;
151 
155  static
156  void
157  declare_parameters (ParameterHandler &prm);
158 
162  void
163  parse_parameters (ParameterHandler &prm) override;
164 
165  private:
169  unsigned int cpo_data_position;
170 
175  std::unique_ptr<const Particle::Property::CrystalPreferredOrientation<dim>> cpo_particle_property;
176 
181  mutable std::mt19937 random_number_generator;
182 
186  unsigned int random_number_seed;
187 
191  unsigned int n_grains;
192 
196  unsigned int n_minerals;
197 
201  unsigned int n_samples;
202 
203  };
204  }
205  }
206 }
207 
208 #endif
static void declare_parameters(ParameterHandler &prm)
std::unique_ptr< const Particle::Property::CrystalPreferredOrientation< dim > > cpo_particle_property
std::array< std::array< double, 3 >, 3 > compute_bingham_average(std::vector< Tensor< 2, 3 >> matrices) const
UpdateFlags get_needed_update_flags() const override
void update_one_particle_property(const unsigned int data_position, const Point< dim > &position, const Vector< double > &solution, const std::vector< Tensor< 1, dim >> &gradients, const ArrayView< double > &particle_properties) const override
void parse_parameters(ParameterHandler &prm) override
UpdateTimeFlags need_update() const override
std::vector< std::pair< std::string, unsigned int > > get_property_information() const override
void initialize_one_particle_property(const Point< dim > &position, std::vector< double > &particle_properties) const override