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 
70  template <int dim>
71  class CpoBinghamAverage : public Interface<dim>, public ::aspect::SimulatorAccess<dim>
72  {
73  public:
77  CpoBinghamAverage() = default;
78 
83  void
84  initialize () override;
85 
97  void
98  initialize_one_particle_property (const Point<dim> &position,
99  std::vector<double> &particle_properties) const override;
100 
127  void
128  update_particle_property (const unsigned int data_position,
129  const Vector<double> &solution,
130  const std::vector<Tensor<1,dim>> &gradients,
131  typename ParticleHandler<dim>::particle_iterator &particle) const override;
132 
138  need_update () const override;
139 
144  UpdateFlags
145  get_needed_update_flags () const override;
146 
154  std::vector<std::pair<std::string, unsigned int>>
155  get_property_information() const override;
156 
165  std::array<std::array<double,6>,3>
166  compute_bingham_average(std::vector<Tensor<2,3>> matrices) const;
167 
171  static
172  void
173  declare_parameters (ParameterHandler &prm);
174 
178  void
179  parse_parameters (ParameterHandler &prm) override;
180 
181  private:
185  unsigned int cpo_data_position;
186 
191  std::unique_ptr<const Particle::Property::CrystalPreferredOrientation<dim>> cpo_particle_property;
192 
197  mutable std::mt19937 random_number_generator;
198 
202  unsigned int random_number_seed;
203 
207  unsigned int n_grains;
208 
212  unsigned int n_minerals;
213 
217  unsigned int n_samples;
218 
219  };
220  }
221  }
222 }
223 
224 #endif
static void declare_parameters(ParameterHandler &prm)
std::unique_ptr< const Particle::Property::CrystalPreferredOrientation< dim > > cpo_particle_property
std::array< std::array< double, 6 >, 3 > compute_bingham_average(std::vector< Tensor< 2, 3 >> matrices) const
void update_particle_property(const unsigned int data_position, const Vector< double > &solution, const std::vector< Tensor< 1, dim >> &gradients, typename ParticleHandler< dim >::particle_iterator &particle) const override
UpdateFlags get_needed_update_flags() const override
Definition: compat.h:59
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