16#ifndef dealii_solver_fire_h
17#define dealii_solver_fire_h
90template <
typename VectorType = Vector<
double>>
147 template <
typename PreconditionerType = DiagonalMatrix<VectorType>>
149 solve(
const std::function<
double(VectorType &,
const VectorType &)> &compute,
158 template <
typename MatrixType,
typename PreconditionerType>
162 const VectorType & b,
163 const PreconditionerType &preconditioner);
176 const VectorType &
g)
const;
190template <
typename VectorType>
192 const double initial_timestep,
193 const double maximum_timestep,
194 const double maximum_linfty_norm)
195 : initial_timestep(initial_timestep)
196 , maximum_timestep(maximum_timestep)
197 , maximum_linfty_norm(maximum_linfty_norm)
199 AssertThrow(initial_timestep > 0. && maximum_timestep > 0. &&
200 maximum_linfty_norm > 0.,
201 ExcMessage(
"Expected positive values for initial_timestep, "
202 "maximum_timestep and maximum_linfty_norm but one "
203 "or more of the these values are not positive."));
208template <
typename VectorType>
211 const AdditionalData & data)
212 :
SolverBase<VectorType>(solver_control, vector_memory)
213 , additional_data(data)
218template <
typename VectorType>
220 const AdditionalData &data)
222 , additional_data(data)
227template <
typename VectorType>
228template <
typename PreconditionerType>
231 const std::function<
double(VectorType &,
const VectorType &)> &compute,
244 using real_type =
typename VectorType::real_type;
259 compute(gradients,
x);
261 unsigned int iter = 0;
264 conv = this->iteration_status(iter, gradients * gradients,
x);
269 const auto &maximum_timestep = additional_data.maximum_timestep;
270 double timestep = additional_data.initial_timestep;
286 compute(gradients,
x);
304 const real_type
beta =
332 additional_data.maximum_linfty_norm /
vmax;
349template <
typename VectorType>
350template <
typename MatrixType,
typename PreconditionerType>
354 const VectorType & b,
355 const PreconditionerType &preconditioner)
357 std::function<double(VectorType &,
const VectorType &)>
compute_func =
358 [&](VectorType &
g,
const VectorType &
x) ->
double {
367 return 0.5 * A.matrix_norm_square(
x) -
x *
b;
375template <
typename VectorType>
380 const VectorType &)
const
void reinit(value_type *starting_element, const std::size_t n_elements)
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
SolverFIRE(SolverControl &solver_control, VectorMemory< VectorType > &vector_memory, const AdditionalData &data=AdditionalData())
const AdditionalData additional_data
virtual void print_vectors(const unsigned int, const VectorType &x, const VectorType &v, const VectorType &g) const
SolverFIRE(SolverControl &solver_control, const AdditionalData &data=AdditionalData())
void solve(const std::function< double(VectorType &, const VectorType &)> &compute, VectorType &x, const PreconditionerType &inverse_mass_matrix)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
const double maximum_timestep
const double initial_timestep
const double maximum_linfty_norm
AdditionalData(const double initial_timestep=0.1, const double maximum_timestep=1, const double maximum_linfty_norm=1)