ASPECT
newton.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) 2016-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_newton_h
17 #define _aspect_newton_h
18 
21 #include <aspect/global.h>
23 
25 
26 namespace aspect
27 {
28  namespace MaterialModel
29  {
33  template <int dim>
35  {
36  public:
41  MaterialModelDerivatives (const unsigned int n_points);
42 
46  std::vector<double> viscosity_derivative_wrt_pressure;
47 
51  std::vector<SymmetricTensor<2,dim>> viscosity_derivative_wrt_strain_rate;
52 
58 
65  std::vector<double> dilation_derivative_wrt_pressure;
66 
70  std::vector<SymmetricTensor<2,dim>> dilation_derivative_wrt_strain_rate;
71  };
72  }
73 
74 
75  namespace Newton
76  {
77  struct Parameters
78  {
79 
89  {
90  none = 0,
91  symmetric = 1,
92  PD = 2,
93  SPD = symmetric | PD
94  };
95 
96 
102  friend
105  const Stabilization b)
106  {
107  return static_cast<Stabilization>(
108  static_cast<int>(a) | static_cast<int>(b));
109  }
110 
111 
117  friend
120  const Stabilization b)
121  {
122  return static_cast<Stabilization>(
123  static_cast<int>(a) & static_cast<int>(b));
124  }
125 
126 
131  static void declare_parameters (ParameterHandler &prm);
132 
137  void parse_parameters (ParameterHandler &prm);
138 
155 
158 
165 
172 
179  };
180 
181 
186  std::string
187  to_string(const Newton::Parameters::Stabilization preconditioner_stabilization);
188  }
189 
190 
191 
195  template <int dim>
196  class NewtonHandler : public SimulatorAccess<dim>
197  {
198  public:
204  void set_assemblers (Assemblers::Manager<dim> &assemblers) const;
205 
211  static void create_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &output);
212 
218  };
219 
220 
221  namespace Assemblers
222  {
227  template <int dim>
229  public SimulatorAccess<dim>
230  {
231  public:
237  void
238  create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const override;
239  };
240 
244  template <int dim>
246  {
247  public:
248  void
249  execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch_base,
250  internal::Assembly::CopyData::CopyDataBase<dim> &data_base) const override;
251 
256  void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const override;
257  };
258 
262  template <int dim>
264  {
265  public:
266  void
267  execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch_base,
268  internal::Assembly::CopyData::CopyDataBase<dim> &data_base) const override;
269  };
270 
275  template <int dim>
277  {
278  public:
279  void
280  execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch_base,
281  internal::Assembly::CopyData::CopyDataBase<dim> &data_base) const override;
282 
288  void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &outputs) const override;
289  };
290 
295  template <int dim>
297  public SimulatorAccess<dim>
298  {
299  public:
300  void
301  execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch_base,
302  internal::Assembly::CopyData::CopyDataBase<dim> &data_base) const override;
303  };
304  }
305 }
306 
307 #endif
unsigned int max_pre_newton_nonlinear_iterations
Definition: newton.h:174
bool use_newton_residual_scaling_method
Definition: newton.h:176
double maximum_linear_stokes_solver_tolerance
Definition: newton.h:177
double nonlinear_switch_tolerance
Definition: newton.h:171
IteratorRange< FilteredIterator< BaseIterator > > operator|(IteratorRange< BaseIterator > i, const Predicate &p)
std::string to_string(const Newton::Parameters::Stabilization preconditioner_stabilization)
bool use_Eisenstat_Walker_method_for_Picard_iterations
Definition: newton.h:173
void declare_parameters(ParameterHandler &prm)
UpdateFlags operator &(const UpdateFlags f1, const UpdateFlags f2)
Stabilization preconditioner_stabilization
Definition: newton.h:156
std::vector< SymmetricTensor< 2, dim > > viscosity_derivative_wrt_strain_rate
Definition: newton.h:51
std::vector< double > dilation_derivative_wrt_pressure
Definition: newton.h:65
Stabilization velocity_block_stabilization
Definition: newton.h:157
std::vector< SymmetricTensor< 2, dim > > dilation_derivative_wrt_strain_rate
Definition: newton.h:70
double newton_derivative_scaling_factor
Definition: newton.h:154
Newton::Parameters parameters
Definition: newton.h:217
MaterialModelDerivatives(const unsigned int n_points)
std::vector< double > viscosity_derivative_averaging_weights
Definition: newton.h:57
unsigned int max_newton_line_search_iterations
Definition: newton.h:175
std::vector< double > viscosity_derivative_wrt_pressure
Definition: newton.h:46