newton(3rheolef)

πŸ“¦
version 7.2 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’– newton β€” the nonlinear solver glow-up (rheolef-7.2) πŸ’–

okay bestie, we're in section 3rheolef of the rheolef manual and this one is literally the main character of nonlinear solving. sit down, grab a boba, let's go πŸ§‹βœ¨


🌸 SYNOPSIS 🌸

template <class Problem, class Field>
int newton (const Problem& P, Field& uh, Float& tol, size_t& max_iter, odiststream *p_derr = 0)

that's the whole vibe right there. five things in, an int out, and yes there's a default arg at the end being all sneaky = 0 🫢


✨ DESCRIPTION ✨

this function implements a generic Newton method for solving the problem:

F(u) = 0

like. that's it. that's the problem. we're finding the u that makes F vanish, no cap πŸ’…

a simple call to the algorithm writes:

my_problem P;
field uh (Xh);
newton (P, uh, tol, max_iter);

look how clean that is. obsessed. 😭

your my_problem class should contain some methods for the evaluation of F, i.e. the residue of the problem, and its derivative. the minimal requirements are:

class my_problem {
public:
  typedef value_type;
  value_type residue           (const value_type& uh)  const;
  void update_derivative       (const value_type& uh)  const;
  value_type  derivative_solve (const value_type& mrh) const;
  Float dual_space_norm        (const value_type& mrh) const;
};

that's the whole checklist bestie, don't skip a single one πŸŽ€

the value_type could be a field(2). and plot twist: the Newton method could also be applied when value_type is a simple Float scalar. conversely β€” yes, conversely, we love a transition word β€” it supports multi-field extensions. versatile icon behavior fr fr πŸ‘‘

the update_derivative and derivative_solver members are called at each step of the Newton algorithm. every. single. step. πŸ’€

the dual_space_norm member function returns a scalar from the weighted residual field term mrh returned by the residue function: this scalar is used as the stopping criterion of the algorithm. so like, that's the vibe check that tells us when to stop πŸ›‘


🌈 EXAMPLE 🌈

see the p_laplacian_newton.cc example and the usersguide for more. go look, it's giving tutorial energy πŸ“šβœ¨


🧚 IMPLEMENTATION 🧚

this documentation has been generated from file main/lib/newton.h

like, it was born there. that's its origin story 🌱


πŸ’œ AUTHOR πŸ’œ

Pierre Saramito <Pierre.Saramito@imag.fr>


Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr>

GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. (yes that's dramatic and yes it means it. no take-backsies πŸ’€)

and that's the whole page bestie!! this was rheolef Version 7.2, newton(3rheolef), and honestly? iconic. go solve something nonlinear, you absolute legend πŸ¦‹πŸ’–

πŸ“¦ where this page comes from